Commit 7a188677 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'patch-29' into 'master'

Notebook rendering: handle metadata.scrolled

See merge request gitlab-org/gitlab!15687
parents 51aa3148 d17a7f0d
...@@ -49,6 +49,7 @@ export default { ...@@ -49,6 +49,7 @@ export default {
v-if="hasOutput" v-if="hasOutput"
:count="cell.execution_count" :count="cell.execution_count"
:outputs="outputs" :outputs="outputs"
:metadata="cell.metadata"
:code-css-class="codeCssClass" :code-css-class="codeCssClass"
/> />
</div> </div>
......
...@@ -26,6 +26,10 @@ export default { ...@@ -26,6 +26,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
metadata: {
type: Object,
default: () => ({}),
},
}, },
computed: { computed: {
code() { code() {
...@@ -36,6 +40,12 @@ export default { ...@@ -36,6 +40,12 @@ export default {
return type.charAt(0).toUpperCase() + type.slice(1); return type.charAt(0).toUpperCase() + type.slice(1);
}, },
cellCssClass() {
return {
[this.codeCssClass]: true,
'jupyter-notebook-scrolled': this.metadata.scrolled,
};
},
}, },
mounted() { mounted() {
Prism.highlightElement(this.$refs.code); Prism.highlightElement(this.$refs.code);
...@@ -46,6 +56,6 @@ export default { ...@@ -46,6 +56,6 @@ export default {
<template> <template>
<div :class="type"> <div :class="type">
<prompt :type="promptType" :count="count" /> <prompt :type="promptType" :count="count" />
<pre ref="code" :class="codeCssClass" class="language-python" v-text="code"></pre> <pre ref="code" :class="cellCssClass" class="language-python" v-text="code"></pre>
</div> </div>
</template> </template>
...@@ -19,6 +19,10 @@ export default { ...@@ -19,6 +19,10 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
metadata: {
type: Object,
default: () => ({}),
},
}, },
methods: { methods: {
outputType(output) { outputType(output) {
...@@ -78,6 +82,7 @@ export default { ...@@ -78,6 +82,7 @@ export default {
:count="count" :count="count"
:index="index" :index="index"
:raw-code="rawCode(output)" :raw-code="rawCode(output)"
:metadata="metadata"
:code-css-class="codeCssClass" :code-css-class="codeCssClass"
/> />
</div> </div>
......
...@@ -479,3 +479,8 @@ span.idiff { ...@@ -479,3 +479,8 @@ span.idiff {
padding: $gl-padding; padding: $gl-padding;
} }
} }
.jupyter-notebook-scrolled {
overflow-y: auto;
max-height: 20rem;
}
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