mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-21 06:09:41 +02:00
Page creation basics (#7)
* Page cration basics * remove unused code * add client-side Header validation * remove static method * rm await duplication
This commit is contained in:
parent
5c0560a2ed
commit
073772c047
17 changed files with 476 additions and 93 deletions
|
@ -1,7 +1,42 @@
|
|||
import CodeXEditor from 'codex.editor';
|
||||
import Header from 'codex.editor.header';
|
||||
|
||||
/**
|
||||
* Class for working with Editor.js
|
||||
*/
|
||||
export default class Editor {
|
||||
/**
|
||||
* Creates Editor instance
|
||||
*/
|
||||
constructor() {
|
||||
this.editor = new CodeXEditor();
|
||||
this.editor = new CodeXEditor({
|
||||
tools: {
|
||||
header: {
|
||||
class: Header,
|
||||
config: {
|
||||
placeholder: 'Enter a title'
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
blocks: [
|
||||
{
|
||||
type: 'header',
|
||||
data: {
|
||||
text: '',
|
||||
level: 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Editor data
|
||||
* @return {Promise.<{}>}
|
||||
*/
|
||||
save() {
|
||||
return this.editor.saver.save();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue