diff options
author | Phil Hughes <me@iamphill.com> | 2017-04-11 20:50:21 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-11 20:50:21 +0300 |
commit | 4755f6066bff2617988704e18c8c141056f1b4bd (patch) | |
tree | 7e1c58dfdc96134f7d2594bf63d2be226a98b4d7 /app/assets/javascripts/notebook/cells/code | |
parent | 3082a1195cc0939e0aa0b48a9f59dd84152ebdad (diff) |
Moved NotebookLab assets into repo
Moved all the notebooklab assets into the GitLab repo
Diffstat (limited to 'app/assets/javascripts/notebook/cells/code')
-rw-r--r-- | app/assets/javascripts/notebook/cells/code/index.vue | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/app/assets/javascripts/notebook/cells/code/index.vue b/app/assets/javascripts/notebook/cells/code/index.vue new file mode 100644 index 00000000000..31b30f601e2 --- /dev/null +++ b/app/assets/javascripts/notebook/cells/code/index.vue @@ -0,0 +1,57 @@ +<template> + <div :class="type"> + <prompt + :type="promptType" + :count="count" /> + <pre + class="language-python" + :class="codeCssClass" + ref="code" + v-text="code"> + </pre> + </div> +</template> + +<script> + import Prism from '../../lib/highlight'; + import Prompt from '../prompt.vue'; + + export default { + components: { + prompt: Prompt, + }, + props: { + count: { + type: Number, + required: false, + default: 0, + }, + codeCssClass: { + type: String, + required: false, + default: '', + }, + type: { + type: String, + required: true, + }, + rawCode: { + type: String, + required: true, + }, + }, + computed: { + code() { + return this.rawCode; + }, + promptType() { + const type = this.type.split('put')[0]; + + return type.charAt(0).toUpperCase() + type.slice(1); + }, + }, + mounted() { + Prism.highlightElement(this.$refs.code); + }, + }; +</script> |