mirror of
https://github.com/elk-zone/elk.git
synced 2024-12-28 15:38:18 +03:00
320ddc0e28
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: TAKAHASHI Shuuji <shuuji3@gmail.com>
56 lines
1.1 KiB
Vue
56 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import { NodeViewContent, nodeViewProps, NodeViewWrapper } from '@tiptap/vue-3'
|
|
|
|
const props = defineProps(nodeViewProps)
|
|
|
|
const languages = [
|
|
'c',
|
|
'cpp',
|
|
'csharp',
|
|
'css',
|
|
'dart',
|
|
'go',
|
|
'html',
|
|
'java',
|
|
'javascript',
|
|
'jsx',
|
|
'kotlin',
|
|
'python',
|
|
'rust',
|
|
'svelte',
|
|
'swift',
|
|
'tsx',
|
|
'typescript',
|
|
'vue',
|
|
]
|
|
|
|
const selectedLanguage = computed({
|
|
get() {
|
|
return props.node.attrs.language
|
|
},
|
|
set(language) {
|
|
props.updateAttributes({ language })
|
|
},
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<NodeViewWrapper>
|
|
<div relative my2>
|
|
<select
|
|
v-model="selectedLanguage"
|
|
contenteditable="false"
|
|
absolute top-1 right-1 rounded px2 op0 hover:op100 focus:op100 transition
|
|
outline-none border="~ base"
|
|
>
|
|
<option :value="null">
|
|
plain
|
|
</option>
|
|
<option v-for="(language, index) in languages" :key="index" :value="language">
|
|
{{ language }}
|
|
</option>
|
|
</select>
|
|
<pre class="code-block"><code><NodeViewContent /></code></pre>
|
|
</div>
|
|
</NodeViewWrapper>
|
|
</template>
|