diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-06-07 16:34:50 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-06-07 23:36:37 -0500 |
commit | 2729205b391c22eb3a15408580261456cc030530 (patch) | |
tree | 41781c6f9f5d87df759ff859b630cfac9c4ab84a /app/assets/javascripts/ide/lib | |
parent | fd400b3b4754f5104199834ecd3ae2bf72072635 (diff) | |
download | gitlab-ce-2729205b391c22eb3a15408580261456cc030530.tar.gz |
remove monacoLoader and import monaco directly within Editor class
Diffstat (limited to 'app/assets/javascripts/ide/lib')
-rw-r--r-- | app/assets/javascripts/ide/lib/diff/controller.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/ide/lib/editor.js | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/app/assets/javascripts/ide/lib/diff/controller.js b/app/assets/javascripts/ide/lib/diff/controller.js index f579424cf33..046e562ba2b 100644 --- a/app/assets/javascripts/ide/lib/diff/controller.js +++ b/app/assets/javascripts/ide/lib/diff/controller.js @@ -1,4 +1,4 @@ -/* global monaco */ +import { Range } from 'monaco-editor'; import { throttle } from 'underscore'; import DirtyDiffWorker from './diff_worker'; import Disposable from '../common/disposable'; @@ -16,7 +16,7 @@ export const getDiffChangeType = change => { }; export const getDecorator = change => ({ - range: new monaco.Range(change.lineNumber, 1, change.endLineNumber, 1), + range: new Range(change.lineNumber, 1, change.endLineNumber, 1), options: { isWholeLine: true, linesDecorationsClassName: `dirty-diff dirty-diff-${getDiffChangeType(change)}`, diff --git a/app/assets/javascripts/ide/lib/editor.js b/app/assets/javascripts/ide/lib/editor.js index 9c3bb9cc17d..3d336fe63f6 100644 --- a/app/assets/javascripts/ide/lib/editor.js +++ b/app/assets/javascripts/ide/lib/editor.js @@ -1,4 +1,5 @@ import _ from 'underscore'; +import * as monaco from 'monaco-editor'; import store from '../stores'; import DecorationsController from './decorations/controller'; import DirtyDiffController from './diff/controller'; @@ -17,15 +18,14 @@ export const clearDomElement = el => { }; export default class Editor { - static create(monaco) { - if (this.editorInstance) return this.editorInstance; - - this.editorInstance = new Editor(monaco); - + static create() { + if (!this.editorInstance) { + this.editorInstance = new Editor(); + } return this.editorInstance; } - constructor(monaco) { + constructor() { this.monaco = monaco; this.currentModel = null; this.instance = null; |