Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/blob_edit/edit_blob.js')
-rw-r--r--app/assets/javascripts/blob_edit/edit_blob.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/assets/javascripts/blob_edit/edit_blob.js b/app/assets/javascripts/blob_edit/edit_blob.js
index e22c9b0d4c4..2a4ab4b8827 100644
--- a/app/assets/javascripts/blob_edit/edit_blob.js
+++ b/app/assets/javascripts/blob_edit/edit_blob.js
@@ -40,9 +40,10 @@ export default class EditBlob {
const MarkdownExtensionPromise = this.options.isMarkdown
? import('~/editor/editor_markdown_ext')
: Promise.resolve(false);
+ const FileTemplateExtensionPromise = import('~/editor/editor_file_template_ext');
- return Promise.all([EditorPromise, MarkdownExtensionPromise])
- .then(([EditorModule, MarkdownExtension]) => {
+ return Promise.all([EditorPromise, MarkdownExtensionPromise, FileTemplateExtensionPromise])
+ .then(([EditorModule, MarkdownExtension, FileTemplateExtension]) => {
const EditorLite = EditorModule.default;
const editorEl = document.getElementById('editor');
const fileNameEl =
@@ -50,18 +51,16 @@ export default class EditBlob {
const fileContentEl = document.getElementById('file-content');
const form = document.querySelector('.js-edit-blob-form');
- this.editor = new EditorLite();
+ const rootEditor = new EditorLite();
- if (MarkdownExtension) {
- this.editor.use(MarkdownExtension.default);
- }
-
- this.editor.createInstance({
+ this.editor = rootEditor.createInstance({
el: editorEl,
blobPath: fileNameEl.value,
blobContent: editorEl.innerText,
});
+ rootEditor.use([MarkdownExtension.default, FileTemplateExtension.default], this.editor);
+
fileNameEl.addEventListener('change', () => {
this.editor.updateModelLanguage(fileNameEl.value);
});