From e3c9db3f1fef0995bf979abce056cbe6678126ae Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 8 Jun 2018 00:12:51 -0500 Subject: refactor monaco-editor import and stop storing as class property within model --- app/assets/javascripts/ide/lib/common/model.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/ide/lib/common/model.js b/app/assets/javascripts/ide/lib/common/model.js index a1940321acf..7907827bb43 100644 --- a/app/assets/javascripts/ide/lib/common/model.js +++ b/app/assets/javascripts/ide/lib/common/model.js @@ -1,33 +1,32 @@ -import * as monaco from 'monaco-editor'; +import { editor as monacoEditor, Uri as monacoUri } from 'monaco-editor'; import Disposable from './disposable'; import eventHub from '../../eventhub'; export default class Model { constructor(file, head = null) { - this.monaco = monaco; this.disposable = new Disposable(); this.file = file; this.head = head; this.content = file.content !== '' ? file.content : file.raw; this.disposable.add( - (this.originalModel = this.monaco.editor.createModel( + (this.originalModel = monacoEditor.createModel( head ? head.content : this.file.raw, undefined, - new this.monaco.Uri(false, false, `original/${this.path}`), + new monacoUri(false, false, `original/${this.path}`), )), - (this.model = this.monaco.editor.createModel( + (this.model = monacoEditor.createModel( this.content, undefined, - new this.monaco.Uri(false, false, this.path), + new monacoUri(false, false, this.path), )), ); if (this.file.mrChange) { this.disposable.add( - (this.baseModel = this.monaco.editor.createModel( + (this.baseModel = monacoEditor.createModel( this.file.baseRaw, undefined, - new this.monaco.Uri(false, false, `target/${this.path}`), + new monacoUri(false, false, `target/${this.path}`), )), ); } -- cgit v1.2.1