File tree Expand file tree Collapse file tree 1 file changed +22
-14
lines changed Expand file tree Collapse file tree 1 file changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -514,6 +514,16 @@ export default {
514514 this .$syncService .startSync ()
515515 return
516516 }
517+ this .createEditor ()
518+ .then (editor => {
519+ this .$editor = editor
520+ this .hasEditor = true
521+ this .listenEditorEvents ()
522+ })
523+ },
524+
525+ async createEditor () {
526+ const session = this .currentSession
517527
518528 const extensions = [
519529 Autofocus .configure ({
@@ -534,21 +544,19 @@ export default {
534544 }),
535545 ]
536546
537- const language = extensionHighlight[this .fileExtension ] || this .fileExtension ;
538-
539- (this .isRichEditor ? Promise .resolve () : loadSyntaxHighlight (language))
540- .then (() => {
541- this .$editor = this .isRichEditor
542- ? createRichEditor ({
543- relativePath: this .relativePath ,
544- session,
545- extensions,
546- isEmbedded: this .isEmbedded ,
547- })
548- : createPlainEditor ({ language, extensions })
549- this .hasEditor = true
550- this .listenEditorEvents ()
547+ const language = extensionHighlight[this .fileExtension ] || this .fileExtension
548+
549+ if (this .isRichEditor ) {
550+ return createRichEditor ({
551+ relativePath: this .relativePath ,
552+ session,
553+ extensions,
554+ isEmbedded: this .isEmbedded ,
551555 })
556+ } else {
557+ await loadSyntaxHighlight (language)
558+ return createPlainEditor ({ language, extensions })
559+ }
552560 },
553561
554562 onLoaded ({ documentSource, documentState }) {
You can’t perform that action at this time.
0 commit comments