diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-31 21:10:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-31 21:10:43 +0300 |
commit | 8846ca0ed691f35ceb91dc4c924cb105a611bea4 (patch) | |
tree | 47d7d5f37531c27c5087999fef1335e442ccd95e /app/assets/javascripts/editor | |
parent | 2368893df711f330cd210005e616fc3b6003ff31 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/editor')
-rw-r--r-- | app/assets/javascripts/editor/editor_file_template_ext.js | 7 | ||||
-rw-r--r-- | app/assets/javascripts/editor/editor_lite.js | 47 |
2 files changed, 9 insertions, 45 deletions
diff --git a/app/assets/javascripts/editor/editor_file_template_ext.js b/app/assets/javascripts/editor/editor_file_template_ext.js new file mode 100644 index 00000000000..343908b831d --- /dev/null +++ b/app/assets/javascripts/editor/editor_file_template_ext.js @@ -0,0 +1,7 @@ +import { Position } from 'monaco-editor'; + +export default { + navigateFileStart() { + this.setPosition(new Position(1, 1)); + }, +}; diff --git a/app/assets/javascripts/editor/editor_lite.js b/app/assets/javascripts/editor/editor_lite.js index d275cf3a205..136a232d9d0 100644 --- a/app/assets/javascripts/editor/editor_lite.js +++ b/app/assets/javascripts/editor/editor_lite.js @@ -1,4 +1,4 @@ -import { editor as monacoEditor, languages as monacoLanguages, Position, Uri } from 'monaco-editor'; +import { editor as monacoEditor, languages as monacoLanguages, Uri } from 'monaco-editor'; import { DEFAULT_THEME, themes } from '~/ide/lib/themes'; import languages from '~/ide/lib/languages'; import { defaultEditorOptions } from '~/ide/lib/editor_options'; @@ -73,6 +73,7 @@ export default class Editor { this.instances.splice(index, 1); model.dispose(); }); + instance.updateModelLanguage = path => this.updateModelLanguage(path); // Reference to the model on the editor level will go away in // https://gitlab.com/gitlab-org/gitlab/-/issues/241023 @@ -92,10 +93,6 @@ export default class Editor { delete this.editorEl.dataset.editorLoading; } - onChangeContent(fn) { - return this.model.onDidChangeContent(fn); - } - updateModelLanguage(path) { if (path === this.blobPath) return; this.blobPath = path; @@ -107,46 +104,6 @@ export default class Editor { monacoEditor.setModelLanguage(this.model, id); } - /** - * @deprecated do not use .getValue() directly on the editor. - * This proxy-method will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/241025 - * Rather use it on the exact instance - */ - getValue() { - return this.instances[0].getValue(); - } - - /** - * @deprecated do not use .setValue() directly on the editor. - * This proxy-method will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/241025 - * Rather use it on the exact instance - */ - setValue(val) { - this.instances[0].setValue(val); - } - - /** - * @deprecated do not use .focus() directly on the editor. - * This proxy-method will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/241025 - * Rather use it on the exact instance - */ - focus() { - this.instances[0].focus(); - } - - /** - * @deprecated do not use .updateOptions() directly on the editor. - * This proxy-method will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/241025 - * Rather use it on the exact instance - */ - updateOptions(options = {}) { - this.instances[0].updateOptions(options); - } - - navigateFileStart() { - this.instances[0].setPosition(new Position(1, 1)); - } - use(exts = [], instance = null) { const extensions = Array.isArray(exts) ? exts : [exts]; if (instance) { |