summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 21:09:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 21:09:45 +0000
commitdd4bee69b7d55620f7dc9db8c36b478bd4959755 (patch)
tree78ba4c486ad8aa2d5effaccf23241ffb6c6dde26 /app/assets/javascripts/ide
parentce8a0b90849ac5d1895e741c023432930f24d724 (diff)
downloadgitlab-ce-dd4bee69b7d55620f7dc9db8c36b478bd4959755.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ide')
-rw-r--r--app/assets/javascripts/ide/components/preview/clientside.vue23
-rw-r--r--app/assets/javascripts/ide/index.js1
-rw-r--r--app/assets/javascripts/ide/stores/state.js1
3 files changed, 16 insertions, 9 deletions
diff --git a/app/assets/javascripts/ide/components/preview/clientside.vue b/app/assets/javascripts/ide/components/preview/clientside.vue
index beb179d0411..aa8d932da6e 100644
--- a/app/assets/javascripts/ide/components/preview/clientside.vue
+++ b/app/assets/javascripts/ide/components/preview/clientside.vue
@@ -21,7 +21,7 @@ export default {
};
},
computed: {
- ...mapState(['entries', 'promotionSvgPath', 'links']),
+ ...mapState(['entries', 'promotionSvgPath', 'links', 'codesandboxBundlerUrl']),
...mapGetters(['packageJson', 'currentProject']),
normalizedEntries() {
return Object.keys(this.entries).reduce((acc, path) => {
@@ -106,12 +106,7 @@ export default {
return this.loadFileContent(this.mainEntry)
.then(() => this.$nextTick())
.then(() => {
- this.initManager('#ide-preview', this.sandboxOpts, {
- fileResolver: {
- isFile: p => Promise.resolve(Boolean(this.entries[createPathWithExt(p)])),
- readFile: p => this.loadFileContent(createPathWithExt(p)).then(content => content),
- },
- });
+ this.initManager();
this.listener = listen(e => {
switch (e.type) {
@@ -139,8 +134,18 @@ export default {
this.manager.updatePreview(this.sandboxOpts);
}, 250);
},
- initManager(el, opts, resolver) {
- this.manager = new Manager(el, opts, resolver);
+ initManager() {
+ const { codesandboxBundlerUrl: bundlerURL } = this;
+
+ const settings = {
+ fileResolver: {
+ isFile: p => Promise.resolve(Boolean(this.entries[createPathWithExt(p)])),
+ readFile: p => this.loadFileContent(createPathWithExt(p)).then(content => content),
+ },
+ ...(bundlerURL ? { bundlerURL } : {}),
+ };
+
+ this.manager = new Manager('#ide-preview', this.sandboxOpts, settings);
},
},
};
diff --git a/app/assets/javascripts/ide/index.js b/app/assets/javascripts/ide/index.js
index a3450522697..9e9d9df8f82 100644
--- a/app/assets/javascripts/ide/index.js
+++ b/app/assets/javascripts/ide/index.js
@@ -53,6 +53,7 @@ export function initIde(el, options = {}) {
clientsidePreviewEnabled: parseBoolean(el.dataset.clientsidePreviewEnabled),
renderWhitespaceInCode: parseBoolean(el.dataset.renderWhitespaceInCode),
editorTheme: window.gon?.user_color_scheme || DEFAULT_THEME,
+ codesandboxBundlerUrl: el.dataset.codesandboxBundlerUrl,
});
},
methods: {
diff --git a/app/assets/javascripts/ide/stores/state.js b/app/assets/javascripts/ide/stores/state.js
index a714562c5b2..0fd6a448283 100644
--- a/app/assets/javascripts/ide/stores/state.js
+++ b/app/assets/javascripts/ide/stores/state.js
@@ -34,4 +34,5 @@ export default () => ({
clientsidePreviewEnabled: false,
renderWhitespaceInCode: false,
editorTheme: DEFAULT_THEME,
+ codesandboxBundlerUrl: null,
});