1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-19 05:09:41 +02:00

feat(editor): raw tool added (#105)

This commit is contained in:
Peter Savchenko 2020-10-15 19:55:34 +03:00 committed by GitHub
parent 94a9a963ff
commit 7a98b6cfd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 91 additions and 1209 deletions

View file

@ -13,7 +13,7 @@
"build:dev": "webpack ./src/frontend/js/app.js --o='./public/dist/[name].bundle.js' --output-library=Docs --output-public-path=/dist/ -p --mode=development --watch",
"precommit": "yarn lint && yarn test --exit",
"generatePassword": "node ./generatePassword.js",
"editor-upgrade": "yarn add -D @editorjs/{editorjs,header,code,delimiter,list,link,image,table,inline-code,marker,warning,checklist}@latest"
"editor-upgrade": "yarn add -D @editorjs/{editorjs,header,code,delimiter,list,link,image,table,inline-code,marker,warning,checklist,raw}@latest"
},
"dependencies": {
"bcrypt": "^3.0.3",
@ -45,18 +45,19 @@
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.1.0",
"@codexteam/misprints": "^1.0.0",
"@editorjs/checklist": "^1.1.0",
"@editorjs/code": "^2.5.0",
"@editorjs/delimiter": "^1.1.0",
"@editorjs/editorjs": "^2.18.0",
"@editorjs/header": "^2.5.0",
"@editorjs/image": "^2.4.2",
"@editorjs/checklist": "^1.2.0",
"@editorjs/code": "^2.6.0",
"@editorjs/delimiter": "^1.2.0",
"@editorjs/editorjs": "^2.19.0",
"@editorjs/header": "^2.6.0",
"@editorjs/image": "^2.6.0",
"@editorjs/inline-code": "^1.3.1",
"@editorjs/link": "^2.2.1",
"@editorjs/list": "^1.5.0",
"@editorjs/link": "^2.3.1",
"@editorjs/list": "^1.6.0",
"@editorjs/marker": "^1.2.2",
"@editorjs/table": "^1.2.2",
"@editorjs/warning": "^1.1.1",
"@editorjs/raw": "^2.2.0",
"@editorjs/table": "^1.3.0",
"@editorjs/warning": "^1.2.0",
"autoprefixer": "^9.1.3",
"babel": "^6.23.0",
"babel-eslint": "^10.0.1",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -12,6 +12,7 @@ import Table from '@editorjs/table';
import Warning from '@editorjs/warning';
import Checklist from '@editorjs/checklist';
import LinkTool from '@editorjs/link';
import RawTool from '@editorjs/raw';
/**
* Inline Tools for the Editor
@ -25,6 +26,7 @@ import Marker from '@editorjs/marker';
export default class Editor {
/**
* Creates Editor instance
*
* @param {object} editorConfig - configuration object for Editor.js
* @param {object} data.blocks - data to start with
* @param {object} options
@ -37,8 +39,8 @@ export default class Editor {
class: Header,
inlineToolbar: ['marker', 'inlineCode'],
config: {
placeholder: options.headerPlaceholder || ''
}
placeholder: options.headerPlaceholder || '',
},
},
image: {
@ -48,45 +50,45 @@ export default class Editor {
types: 'image/*, video/mp4',
endpoints: {
byFile: '/api/transport/image',
byUrl: '/api/transport/fetch'
byUrl: '/api/transport/fetch',
},
additionalRequestData: {
map: JSON.stringify({
path: 'file:url',
size: 'file:size',
mimetype: 'file:mime'
})
}
}
mimetype: 'file:mime',
}),
},
},
},
linkTool: {
class: LinkTool,
config: {
endpoint: '/api/fetchUrl',
}
},
},
code: {
class: CodeTool,
shortcut: 'CMD+SHIFT+D'
shortcut: 'CMD+SHIFT+D',
},
list: {
class: List,
inlineToolbar: true
inlineToolbar: true,
},
delimiter: Delimiter,
table: {
class: Table,
inlineToolbar: true
inlineToolbar: true,
},
warning: {
class: Warning,
inlineToolbar: true
inlineToolbar: true,
},
checklist: {
@ -99,13 +101,15 @@ export default class Editor {
*/
inlineCode: {
class: InlineCode,
shortcut: 'CMD+SHIFT+C'
shortcut: 'CMD+SHIFT+C',
},
marker: {
class: Marker,
shortcut: 'CMD+SHIFT+M'
}
shortcut: 'CMD+SHIFT+M',
},
raw: RawTool,
},
data: {
blocks: [
@ -113,11 +117,11 @@ export default class Editor {
type: 'header',
data: {
text: '',
level: 2
}
}
]
}
level: 2,
},
},
],
},
};
this.editor = new EditorJS(Object.assign(defaultConfig, editorConfig));
@ -125,7 +129,8 @@ export default class Editor {
/**
* Return Editor data
* @return {Promise.<{}>}
*
* @returns {Promise.<{}>}
*/
save() {
return this.editor.saver.save();

1201
yarn.lock

File diff suppressed because it is too large Load diff