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')
-rw-r--r--app/assets/javascripts/ide/components/preview/clientside.vue22
-rw-r--r--app/assets/javascripts/ide/components/preview/navigator.vue6
-rw-r--r--app/assets/javascripts/notebook/cells/output/html.vue9
3 files changed, 22 insertions, 15 deletions
diff --git a/app/assets/javascripts/ide/components/preview/clientside.vue b/app/assets/javascripts/ide/components/preview/clientside.vue
index b1f6f2c87b9..70b881b6ff6 100644
--- a/app/assets/javascripts/ide/components/preview/clientside.vue
+++ b/app/assets/javascripts/ide/components/preview/clientside.vue
@@ -2,7 +2,7 @@
import { GlLoadingIcon } from '@gitlab/ui';
import { listen } from 'codesandbox-api';
import { isEmpty, debounce } from 'lodash';
-import { Manager } from 'smooshpack';
+import { SandpackClient } from '@codesandbox/sandpack-client';
import { mapActions, mapGetters, mapState } from 'vuex';
import {
packageJsonPath,
@@ -21,7 +21,7 @@ export default {
},
data() {
return {
- manager: {},
+ client: {},
loading: false,
sandpackReady: false,
};
@@ -94,11 +94,11 @@ export default {
this.sandpackReady = false;
eventHub.$off('ide.files.change', this.onFilesChangeCallback);
- if (!isEmpty(this.manager)) {
- this.manager.listener();
+ if (!isEmpty(this.client)) {
+ this.client.cleanup();
}
- this.manager = {};
+ this.client = {};
if (this.listener) {
this.listener();
@@ -120,7 +120,7 @@ export default {
return this.loadFileContent(this.mainEntry)
.then(() => this.$nextTick())
.then(() => {
- this.initManager();
+ this.initClient();
this.listener = listen((e) => {
switch (e.type) {
@@ -136,15 +136,15 @@ export default {
update() {
if (!this.sandpackReady) return;
- if (isEmpty(this.manager)) {
+ if (isEmpty(this.client)) {
this.initPreview();
return;
}
- this.manager.updatePreview(this.sandboxOpts);
+ this.client.updatePreview(this.sandboxOpts);
},
- initManager() {
+ initClient() {
const { codesandboxBundlerUrl: bundlerURL } = this;
const settings = {
@@ -155,7 +155,7 @@ export default {
...(bundlerURL ? { bundlerURL } : {}),
};
- this.manager = new Manager('#ide-preview', this.sandboxOpts, settings);
+ this.client = new SandpackClient('#ide-preview', this.sandboxOpts, settings);
},
},
};
@@ -164,7 +164,7 @@ export default {
<template>
<div class="preview h-100 w-100 d-flex flex-column gl-bg-white">
<template v-if="showPreview">
- <navigator :manager="manager" />
+ <navigator :client="client" />
<div id="ide-preview"></div>
</template>
<div
diff --git a/app/assets/javascripts/ide/components/preview/navigator.vue b/app/assets/javascripts/ide/components/preview/navigator.vue
index 96f9a85c23f..852de16d508 100644
--- a/app/assets/javascripts/ide/components/preview/navigator.vue
+++ b/app/assets/javascripts/ide/components/preview/navigator.vue
@@ -8,7 +8,7 @@ export default {
GlLoadingIcon,
},
props: {
- manager: {
+ client: {
type: Object,
required: true,
},
@@ -51,7 +51,7 @@ export default {
onUrlChange(e) {
const lastPath = this.path;
- this.path = e.url.replace(this.manager.bundlerURL, '') || '/';
+ this.path = e.url.replace(this.client.bundlerURL, '') || '/';
if (lastPath !== this.path) {
this.currentBrowsingIndex =
@@ -79,7 +79,7 @@ export default {
},
visitPath(path) {
// eslint-disable-next-line vue/no-mutating-props
- this.manager.iframe.src = `${this.manager.bundlerURL}${path}`;
+ this.client.iframe.src = `${this.client.bundlerURL}${path}`;
},
},
};
diff --git a/app/assets/javascripts/notebook/cells/output/html.vue b/app/assets/javascripts/notebook/cells/output/html.vue
index 2d1d8845e41..fdcea300388 100644
--- a/app/assets/javascripts/notebook/cells/output/html.vue
+++ b/app/assets/javascripts/notebook/cells/output/html.vue
@@ -40,6 +40,13 @@ export default {
<template>
<div class="output">
<prompt type="Out" :count="count" :show-output="showOutput" />
- <div v-safe-html:[$options.safeHtmlConfig]="rawCode" class="gl-overflow-auto"></div>
+ <iframe
+ sandbox
+ :srcdoc="rawCode"
+ frameborder="0"
+ scrolling="no"
+ width="100%"
+ class="gl-overflow-auto"
+ ></iframe>
</div>
</template>