diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-06-08 00:12:51 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-06-08 00:12:51 -0500 |
commit | e3c9db3f1fef0995bf979abce056cbe6678126ae (patch) | |
tree | 65d646a4c324dd77e2e4de105f0bcff0e2b5a602 | |
parent | 4653820d37f89c2fabe74800ccce2d1f8420a7da (diff) | |
download | gitlab-ce-e3c9db3f1fef0995bf979abce056cbe6678126ae.tar.gz |
refactor monaco-editor import and stop storing as class property within model
-rw-r--r-- | app/assets/javascripts/ide/lib/common/model.js | 15 |
1 files 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}`), )), ); } |