diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /app/assets/javascripts/notebook | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'app/assets/javascripts/notebook')
-rw-r--r-- | app/assets/javascripts/notebook/cells/output/html.vue | 11 | ||||
-rw-r--r-- | app/assets/javascripts/notebook/cells/output/index.vue | 4 | ||||
-rw-r--r-- | app/assets/javascripts/notebook/lib/highlight.js | 19 |
3 files changed, 11 insertions, 23 deletions
diff --git a/app/assets/javascripts/notebook/cells/output/html.vue b/app/assets/javascripts/notebook/cells/output/html.vue index a3d7ddd5bad..dc5b2b66348 100644 --- a/app/assets/javascripts/notebook/cells/output/html.vue +++ b/app/assets/javascripts/notebook/cells/output/html.vue @@ -1,5 +1,5 @@ <script> -/* eslint-disable vue/no-v-html */ +import { GlSafeHtmlDirective } from '@gitlab/ui'; import { sanitize } from '~/lib/dompurify'; import Prompt from '../prompt.vue'; @@ -7,6 +7,9 @@ export default { components: { Prompt, }, + directives: { + SafeHtml: GlSafeHtmlDirective, + }, props: { count: { type: Number, @@ -23,9 +26,7 @@ export default { }, computed: { sanitizedOutput() { - return sanitize(this.rawCode, { - ALLOWED_ATTR: ['src'], - }); + return sanitize(this.rawCode); }, showOutput() { return this.index === 0; @@ -37,6 +38,6 @@ export default { <template> <div class="output"> <prompt type="Out" :count="count" :show-output="showOutput" /> - <div class="gl-overflow-auto" v-html="sanitizedOutput"></div> + <div v-safe-html="sanitizedOutput" class="gl-overflow-auto"></div> </div> </template> diff --git a/app/assets/javascripts/notebook/cells/output/index.vue b/app/assets/javascripts/notebook/cells/output/index.vue index f2d3796cccf..113d8cfc435 100644 --- a/app/assets/javascripts/notebook/cells/output/index.vue +++ b/app/assets/javascripts/notebook/cells/output/index.vue @@ -31,6 +31,8 @@ export default { return 'text/plain'; } else if (output.data['image/png']) { return 'image/png'; + } else if (output.data['image/jpeg']) { + return 'image/jpeg'; } else if (output.data['text/html']) { return 'text/html'; } else if (output.data['image/svg+xml']) { @@ -53,6 +55,8 @@ export default { return CodeOutput; } else if (output.data['image/png']) { return ImageOutput; + } else if (output.data['image/jpeg']) { + return ImageOutput; } else if (output.data['text/html']) { return HtmlOutput; } else if (output.data['image/svg+xml']) { diff --git a/app/assets/javascripts/notebook/lib/highlight.js b/app/assets/javascripts/notebook/lib/highlight.js index 74ade6d2edf..313aeecbd51 100644 --- a/app/assets/javascripts/notebook/lib/highlight.js +++ b/app/assets/javascripts/notebook/lib/highlight.js @@ -1,22 +1,5 @@ import Prism from 'prismjs'; import 'prismjs/components/prism-python'; -import 'prismjs/plugins/custom-class/prism-custom-class'; - -Prism.plugins.customClass.map({ - comment: 'c', - error: 'err', - operator: 'o', - constant: 'kc', - namespace: 'kn', - keyword: 'k', - string: 's', - number: 'm', - 'attr-name': 'na', - builtin: 'nb', - entity: 'ni', - function: 'nf', - tag: 'nt', - variable: 'nv', -}); +import 'prismjs/themes/prism.css'; export default Prism; |