1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-01 19:45:24 +02:00

Save CodeMirror editor instance at end of process

This commit is contained in:
Harvey Kandola 2018-06-07 19:14:09 +01:00
parent b316ba80d8
commit 5fe094a2d7
2 changed files with 7 additions and 7 deletions

View file

@ -83,13 +83,13 @@ export default Component.extend(TooltipMixin, {
Mousetrap.trigger('ctrl+s'); Mousetrap.trigger('ctrl+s');
}; };
this.set('codeEditor', editor);
let syntax = this.get("codeSyntax"); let syntax = this.get("codeSyntax");
if (is.not.undefined(syntax)) { if (is.not.undefined(syntax)) {
CodeMirror.autoLoadMode(editor, syntax.mode); CodeMirror.autoLoadMode(editor, syntax.mode);
editor.setOption("mode", syntax.mode); editor.setOption("mode", syntax.mode);
} }
this.set('codeEditor', editor);
}, },
willDestroyElement() { willDestroyElement() {

View file

@ -17,7 +17,7 @@ export default Component.extend({
didReceiveAttrs() { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);
if (this.get('isDestroyed') || this.get('isDestroying')) { if (this.get('isDestroyed') || this.get('isDestroying')) {
return; return;
} }
@ -43,7 +43,7 @@ export default Component.extend({
didInsertElement() { didInsertElement() {
this._super(...arguments); this._super(...arguments);
if (this.get('isDestroyed') || this.get('isDestroying')) { if (this.get('isDestroyed') || this.get('isDestroying')) {
return; return;
} }
@ -62,14 +62,14 @@ export default Component.extend({
readOnly: true readOnly: true
}); });
this.set('codeEditor', editor);
let syntax = this.get("codeSyntax"); let syntax = this.get("codeSyntax");
if (is.not.undefined(syntax)) { if (is.not.undefined(syntax)) {
CodeMirror.autoLoadMode(editor, syntax.mode); CodeMirror.autoLoadMode(editor, syntax.mode);
editor.setOption("mode", syntax.mode); editor.setOption("mode", syntax.mode);
} }
},
this.set('codeEditor', editor);
},
willDestroyElement() { willDestroyElement() {
this._super(...arguments); this._super(...arguments);