2018-09-19 01:47:32 +03:00
|
|
|
/**
|
|
|
|
* Module for pages create/edit
|
|
|
|
*/
|
2018-10-03 12:26:41 +03:00
|
|
|
export default class Writing {
|
2018-09-19 01:47:32 +03:00
|
|
|
constructor(){
|
2018-10-03 12:26:41 +03:00
|
|
|
this.editorWrapper = null;
|
|
|
|
this.editor = null;
|
2018-09-19 01:47:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by ModuleDispatcher to initialize module from DOM
|
|
|
|
*/
|
|
|
|
init(config, moduleEl) {
|
|
|
|
this.editorWrapper = document.createElement('div');
|
|
|
|
this.editorWrapper.id = 'codex-editor';
|
|
|
|
|
|
|
|
moduleEl.appendChild(this.editorWrapper);
|
|
|
|
|
2018-10-03 12:26:41 +03:00
|
|
|
this.loadEditor().then((editor) => {
|
|
|
|
this.editor = editor;
|
2018-09-19 01:47:32 +03:00
|
|
|
})
|
|
|
|
};
|
|
|
|
|
2018-10-03 12:26:41 +03:00
|
|
|
async loadEditor(){
|
|
|
|
const {default: Editor} = await import(/* webpackChunkName: "editor" */ './../classes/editor');
|
|
|
|
|
|
|
|
return new Editor();
|
2018-09-19 01:47:32 +03:00
|
|
|
}
|
2018-10-03 12:26:41 +03:00
|
|
|
}
|