From 5fe094a2d75fc88724199a2fd3c610251279f511 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Thu, 7 Jun 2018 19:14:09 +0100 Subject: [PATCH] Save CodeMirror editor instance at end of process --- gui/app/components/section/code/type-editor.js | 4 ++-- gui/app/components/section/code/type-renderer.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gui/app/components/section/code/type-editor.js b/gui/app/components/section/code/type-editor.js index 1c415fdc..235cc177 100644 --- a/gui/app/components/section/code/type-editor.js +++ b/gui/app/components/section/code/type-editor.js @@ -83,13 +83,13 @@ export default Component.extend(TooltipMixin, { Mousetrap.trigger('ctrl+s'); }; - this.set('codeEditor', editor); - let syntax = this.get("codeSyntax"); if (is.not.undefined(syntax)) { CodeMirror.autoLoadMode(editor, syntax.mode); editor.setOption("mode", syntax.mode); } + + this.set('codeEditor', editor); }, willDestroyElement() { diff --git a/gui/app/components/section/code/type-renderer.js b/gui/app/components/section/code/type-renderer.js index dc824613..b76df157 100644 --- a/gui/app/components/section/code/type-renderer.js +++ b/gui/app/components/section/code/type-renderer.js @@ -17,7 +17,7 @@ export default Component.extend({ didReceiveAttrs() { this._super(...arguments); - + if (this.get('isDestroyed') || this.get('isDestroying')) { return; } @@ -43,7 +43,7 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); - + if (this.get('isDestroyed') || this.get('isDestroying')) { return; } @@ -62,14 +62,14 @@ export default Component.extend({ readOnly: true }); - this.set('codeEditor', editor); - let syntax = this.get("codeSyntax"); if (is.not.undefined(syntax)) { CodeMirror.autoLoadMode(editor, syntax.mode); editor.setOption("mode", syntax.mode); } - }, + + this.set('codeEditor', editor); + }, willDestroyElement() { this._super(...arguments);