Commit 62303530 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Move repoEditorLoader to index and change repo_editor to vue comp

parent 6f88402f
...@@ -9,10 +9,21 @@ import RepoCommitSection from './repo_commit_section.vue'; ...@@ -9,10 +9,21 @@ import RepoCommitSection from './repo_commit_section.vue';
import RepoTabs from './repo_tabs.vue'; import RepoTabs from './repo_tabs.vue';
import RepoFileButtons from './repo_file_buttons.vue'; import RepoFileButtons from './repo_file_buttons.vue';
import RepoBinaryViewer from './repo_binary_viewer.vue'; import RepoBinaryViewer from './repo_binary_viewer.vue';
import { repoEditorLoader } from './repo_editor'; import RepoEditor from './repo_editor.vue';
import monacoLoader from './monaco_loader';
import RepoMixin from './repo_mixin'; import RepoMixin from './repo_mixin';
import PopupDialog from '../vue_shared/components/popup_dialog.vue' import PopupDialog from '../vue_shared/components/popup_dialog.vue'
function repoEditorLoader() {
return new Promise((resolve) => {
monacoLoader(['vs/editor/editor.main'], () => {
Store.monaco = monaco;
resolve(RepoEditor);
});
});
}
function addEventsForNonVueEls() { function addEventsForNonVueEls() {
$(document).on('change', '.dropdown', () => { $(document).on('change', '.dropdown', () => {
Store.targetBranch = $('.project-refs-target-form input[name="ref"]').val(); Store.targetBranch = $('.project-refs-target-form input[name="ref"]').val();
......
<script>
/* global monaco */ /* global monaco */
import Store from './repo_store'; import Store from './repo_store';
import Helper from './repo_helper'; import Helper from './repo_helper';
import monacoLoader from './monaco_loader';
const RepoEditor = { const RepoEditor = {
data: () => Store, data: () => Store,
template: '<div id="ide"></div>',
mounted() { mounted() {
const monacoInstance = this.monaco.editor.create(this.$el, { const monacoInstance = this.monaco.editor.create(this.$el, {
model: null, model: null,
...@@ -106,17 +104,9 @@ const RepoEditor = { ...@@ -106,17 +104,9 @@ const RepoEditor = {
}, },
}; };
function repoEditorLoader() { export default RepoEditor;
return new Promise((resolve) => { </script>
monacoLoader(['vs/editor/editor.main'], () => {
Store.monaco = monaco;
resolve(RepoEditor);
});
});
}
export { <template>
RepoEditor as default, <div id="ide"></div>
repoEditorLoader, </template>
};
import Vue from 'vue'; import Vue from 'vue';
import repoEditor from '~/repo/repo_editor'; import repoEditor from '~/repo/repo_editor.vue';
import RepoStore from '~/repo/repo_store'; import RepoStore from '~/repo/repo_store';
describe('RepoEditor', () => { describe('RepoEditor', () => {
......
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