diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /app/assets/javascripts/notebook/cells | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'app/assets/javascripts/notebook/cells')
-rw-r--r-- | app/assets/javascripts/notebook/cells/markdown.vue | 7 | ||||
-rw-r--r-- | app/assets/javascripts/notebook/cells/output/index.vue | 9 | ||||
-rw-r--r-- | app/assets/javascripts/notebook/cells/output/markdown.vue | 42 |
3 files changed, 56 insertions, 2 deletions
diff --git a/app/assets/javascripts/notebook/cells/markdown.vue b/app/assets/javascripts/notebook/cells/markdown.vue index 127e046b5a9..9aa6abd9d8c 100644 --- a/app/assets/javascripts/notebook/cells/markdown.vue +++ b/app/assets/javascripts/notebook/cells/markdown.vue @@ -148,6 +148,11 @@ export default { type: Object, required: true, }, + hidePrompt: { + type: Boolean, + required: false, + default: false, + }, }, computed: { markdown() { @@ -163,7 +168,7 @@ export default { <template> <div class="cell text-cell"> - <prompt /> + <prompt v-if="!hidePrompt" /> <div v-safe-html:[$options.markdownConfig]="markdown" class="markdown"></div> </div> </template> diff --git a/app/assets/javascripts/notebook/cells/output/index.vue b/app/assets/javascripts/notebook/cells/output/index.vue index 88d01ffa659..bd01534089e 100644 --- a/app/assets/javascripts/notebook/cells/output/index.vue +++ b/app/assets/javascripts/notebook/cells/output/index.vue @@ -3,6 +3,9 @@ import CodeOutput from '../code/index.vue'; import HtmlOutput from './html.vue'; import ImageOutput from './image.vue'; import LatexOutput from './latex.vue'; +import MarkdownOutput from './markdown.vue'; + +const TEXT_MARKDOWN = 'text/markdown'; export default { props: { @@ -35,6 +38,8 @@ export default { return 'text/latex'; } else if (output.data['image/svg+xml']) { return 'image/svg+xml'; + } else if (output.data[TEXT_MARKDOWN]) { + return TEXT_MARKDOWN; } return 'text/plain'; @@ -42,7 +47,7 @@ export default { dataForType(output, type) { let data = output.data[type]; - if (typeof data === 'object') { + if (typeof data === 'object' && this.outputType(output) !== TEXT_MARKDOWN) { data = data.join(''); } @@ -61,6 +66,8 @@ export default { return LatexOutput; } else if (output.data['image/svg+xml']) { return HtmlOutput; + } else if (output.data[TEXT_MARKDOWN]) { + return MarkdownOutput; } return CodeOutput; diff --git a/app/assets/javascripts/notebook/cells/output/markdown.vue b/app/assets/javascripts/notebook/cells/output/markdown.vue new file mode 100644 index 00000000000..5da057dee72 --- /dev/null +++ b/app/assets/javascripts/notebook/cells/output/markdown.vue @@ -0,0 +1,42 @@ +<script> +import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; +import Prompt from '../prompt.vue'; +import Markdown from '../markdown.vue'; + +export default { + name: 'MarkdownOutput', + components: { + Prompt, + Markdown, + }, + directives: { + SafeHtml, + }, + props: { + count: { + type: Number, + required: true, + }, + rawCode: { + type: Array, + required: true, + }, + index: { + type: Number, + required: true, + }, + }, + computed: { + markdownContent() { + return { source: this.rawCode }; + }, + }, +}; +</script> + +<template> + <div class="output"> + <prompt type="Out" :count="count" :show-output="index === 0" /> + <markdown :cell="markdownContent" :hide-prompt="true" /> + </div> +</template> |