Added caching of loaded editor instance
This commit is contained in:
@@ -41,6 +41,7 @@ import Revision from 'models/Revision';
|
||||
|
||||
import schema from './schema';
|
||||
|
||||
let EditorImport;
|
||||
const AUTOSAVE_DELAY = 3000;
|
||||
const IS_DIRTY_DELAY = 500;
|
||||
const MARK_AS_VIEWED_AFTER = 3000;
|
||||
@@ -69,7 +70,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
viewTimeout: TimeoutID;
|
||||
getEditorText: () => string;
|
||||
|
||||
@observable editorComponent;
|
||||
@observable editorComponent = EditorImport;
|
||||
@observable document: ?Document;
|
||||
@observable revision: ?Revision;
|
||||
@observable newDocument: ?Document;
|
||||
@@ -184,8 +185,11 @@ class DocumentScene extends React.Component<Props> {
|
||||
};
|
||||
|
||||
loadEditor = async () => {
|
||||
const EditorImport = await import('./components/Editor');
|
||||
this.editorComponent = EditorImport.default;
|
||||
if (this.editorComponent) return;
|
||||
|
||||
const Imported = await import('./components/Editor');
|
||||
EditorImport = Imported.default;
|
||||
this.editorComponent = EditorImport;
|
||||
};
|
||||
|
||||
get isEditing() {
|
||||
|
||||
Reference in New Issue
Block a user