Commit c7cef92d authored by Denys Mishunov's avatar Denys Mishunov Committed by Natalia Tepluhina

Refactored Editor Lite extensions

Moved those into the dedicated folder
parent 3b662c77
...@@ -5,7 +5,7 @@ import { BLOB_EDITOR_ERROR, BLOB_PREVIEW_ERROR } from './constants'; ...@@ -5,7 +5,7 @@ import { BLOB_EDITOR_ERROR, BLOB_PREVIEW_ERROR } from './constants';
import TemplateSelectorMediator from '../blob/file_template_mediator'; import TemplateSelectorMediator from '../blob/file_template_mediator';
import { addEditorMarkdownListeners } from '~/lib/utils/text_markdown'; import { addEditorMarkdownListeners } from '~/lib/utils/text_markdown';
import EditorLite from '~/editor/editor_lite'; import EditorLite from '~/editor/editor_lite';
import { FileTemplateExtension } from '~/editor/editor_file_template_ext'; import { FileTemplateExtension } from '~/editor/extensions/editor_file_template_ext';
import { insertFinalNewline } from '~/lib/utils/text_utility'; import { insertFinalNewline } from '~/lib/utils/text_utility';
export default class EditBlob { export default class EditBlob {
...@@ -16,7 +16,7 @@ export default class EditBlob { ...@@ -16,7 +16,7 @@ export default class EditBlob {
this.configureMonacoEditor(); this.configureMonacoEditor();
if (this.options.isMarkdown) { if (this.options.isMarkdown) {
import('~/editor/editor_markdown_ext') import('~/editor/extensions/editor_markdown_ext')
.then(({ EditorMarkdownExtension: MarkdownExtension } = {}) => { .then(({ EditorMarkdownExtension: MarkdownExtension } = {}) => {
this.editor.use(new MarkdownExtension()); this.editor.use(new MarkdownExtension());
addEditorMarkdownListeners(this.editor); addEditorMarkdownListeners(this.editor);
......
import Api from '~/api'; import Api from '~/api';
import { registerSchema } from '~/ide/utils'; import { registerSchema } from '~/ide/utils';
import { EditorLiteExtension } from './editor_lite_extension_base'; import { EditorLiteExtension } from './editor_lite_extension_base';
import { EXTENSION_CI_SCHEMA_FILE_NAME_MATCH } from './constants'; import { EXTENSION_CI_SCHEMA_FILE_NAME_MATCH } from '../constants';
export class CiSchemaExtension extends EditorLiteExtension { export class CiSchemaExtension extends EditorLiteExtension {
/** /**
......
import { ERROR_INSTANCE_REQUIRED_FOR_EXTENSION } from './constants'; import { ERROR_INSTANCE_REQUIRED_FOR_EXTENSION } from '../constants';
export class EditorLiteExtension { export class EditorLiteExtension {
constructor({ instance, ...options } = {}) { constructor({ instance, ...options } = {}) {
......
<script> <script>
import EditorLite from '~/vue_shared/components/editor_lite.vue'; import EditorLite from '~/vue_shared/components/editor_lite.vue';
import { CiSchemaExtension } from '~/editor/editor_ci_schema_ext'; import { CiSchemaExtension } from '~/editor/extensions/editor_ci_schema_ext';
export default { export default {
components: { components: {
......
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import EditBlob from '~/blob_edit/edit_blob'; import EditBlob from '~/blob_edit/edit_blob';
import EditorLite from '~/editor/editor_lite'; import EditorLite from '~/editor/editor_lite';
import { EditorMarkdownExtension } from '~/editor/editor_markdown_ext'; import { EditorMarkdownExtension } from '~/editor/extensions/editor_markdown_ext';
import { FileTemplateExtension } from '~/editor/editor_file_template_ext'; import { FileTemplateExtension } from '~/editor/extensions/editor_file_template_ext';
jest.mock('~/editor/editor_lite'); jest.mock('~/editor/editor_lite');
jest.mock('~/editor/editor_markdown_ext'); jest.mock('~/editor/extensions/editor_markdown_ext');
jest.mock('~/editor/editor_file_template_ext'); jest.mock('~/editor/extensions/editor_file_template_ext');
describe('Blob Editing', () => { describe('Blob Editing', () => {
const useMock = jest.fn(); const useMock = jest.fn();
......
import { languages } from 'monaco-editor'; import { languages } from 'monaco-editor';
import EditorLite from '~/editor/editor_lite'; import EditorLite from '~/editor/editor_lite';
import { CiSchemaExtension } from '~/editor/editor_ci_schema_ext'; import { CiSchemaExtension } from '~/editor/extensions/editor_ci_schema_ext';
import { EXTENSION_CI_SCHEMA_FILE_NAME_MATCH } from '~/editor/constants'; import { EXTENSION_CI_SCHEMA_FILE_NAME_MATCH } from '~/editor/constants';
describe('~/editor/editor_ci_config_ext', () => { describe('~/editor/editor_ci_config_ext', () => {
......
import { ERROR_INSTANCE_REQUIRED_FOR_EXTENSION } from '~/editor/constants'; import { ERROR_INSTANCE_REQUIRED_FOR_EXTENSION } from '~/editor/constants';
import { EditorLiteExtension } from '~/editor/editor_lite_extension_base'; import { EditorLiteExtension } from '~/editor/extensions/editor_lite_extension_base';
describe('The basis for an Editor Lite extension', () => { describe('The basis for an Editor Lite extension', () => {
let ext; let ext;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { editor as monacoEditor, languages as monacoLanguages, Uri } from 'monaco-editor'; import { editor as monacoEditor, languages as monacoLanguages, Uri } from 'monaco-editor';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import Editor from '~/editor/editor_lite'; import Editor from '~/editor/editor_lite';
import { EditorLiteExtension } from '~/editor/editor_lite_extension_base'; import { EditorLiteExtension } from '~/editor/extensions/editor_lite_extension_base';
import { DEFAULT_THEME, themes } from '~/ide/lib/themes'; import { DEFAULT_THEME, themes } from '~/ide/lib/themes';
import { EDITOR_LITE_INSTANCE_ERROR_NO_EL, URI_PREFIX } from '~/editor/constants'; import { EDITOR_LITE_INSTANCE_ERROR_NO_EL, URI_PREFIX } from '~/editor/constants';
......
import { Range, Position } from 'monaco-editor'; import { Range, Position } from 'monaco-editor';
import EditorLite from '~/editor/editor_lite'; import EditorLite from '~/editor/editor_lite';
import { EditorMarkdownExtension } from '~/editor/editor_markdown_ext'; import { EditorMarkdownExtension } from '~/editor/extensions/editor_markdown_ext';
describe('Markdown Extension for Editor Lite', () => { describe('Markdown Extension for Editor Lite', () => {
let editor; let editor;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment