diff options
Diffstat (limited to 'app/assets/javascripts/ide/components/repo_editor.vue')
-rw-r--r-- | app/assets/javascripts/ide/components/repo_editor.vue | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue index bf2af9ffd49..5c711313ff6 100644 --- a/app/assets/javascripts/ide/components/repo_editor.vue +++ b/app/assets/javascripts/ide/components/repo_editor.vue @@ -6,9 +6,9 @@ import { EDITOR_CODE_INSTANCE_FN, EDITOR_DIFF_INSTANCE_FN, } from '~/editor/constants'; -import EditorLite from '~/editor/editor_lite'; -import { EditorWebIdeExtension } from '~/editor/extensions/editor_lite_webide_ext'; -import { deprecatedCreateFlash as flash } from '~/flash'; +import { EditorWebIdeExtension } from '~/editor/extensions/source_editor_webide_ext'; +import SourceEditor from '~/editor/source_editor'; +import createFlash from '~/flash'; import ModelManager from '~/ide/lib/common/model_manager'; import { defaultDiffEditorOptions, defaultEditorOptions } from '~/ide/lib/editor_options'; import { __ } from '~/locale'; @@ -216,7 +216,7 @@ export default { }, mounted() { if (!this.globalEditor) { - this.globalEditor = new EditorLite(); + this.globalEditor = new SourceEditor(); } this.initEditor(); @@ -250,14 +250,11 @@ export default { this.createEditorInstance(); }) .catch((err) => { - flash( - __('Error setting up editor. Please try again.'), - 'alert', - document, - null, - false, - true, - ); + createFlash({ + message: __('Error setting up editor. Please try again.'), + fadeTransition: false, + addBodyClass: true, + }); throw err; }); }, @@ -418,7 +415,11 @@ export default { const parentPath = getPathParent(this.file.path); const path = `${parentPath ? `${parentPath}/` : ''}${file.name}`; - return this.addTempImage({ name: path, rawPath: content }).then(({ name: fileName }) => { + return this.addTempImage({ + name: path, + rawPath: URL.createObjectURL(file), + content: atob(content.split('base64,')[1]), + }).then(({ name: fileName }) => { this.editor.replaceSelectedText(`![${fileName}](./${fileName})`); }); }); |