|
@@ -1,42 +1,29 @@
|
|
|
<template>
|
|
|
<CommonPage show-footer>
|
|
|
<template #action>
|
|
|
- <NButton type="primary" @click="router.push('article/add')">
|
|
|
- <i class="i-material-symbols:add mr-4 text-18" />
|
|
|
- 创建新文章
|
|
|
+ <NButton type="primary" @click="handleAdd">
|
|
|
+ 保存文章
|
|
|
</NButton>
|
|
|
</template>
|
|
|
|
|
|
<!-- <n-space size="large"> -->
|
|
|
- <div style="min-height: 500px;">
|
|
|
- <div id="markdown-container" />
|
|
|
+ <div class="editor-wrap">
|
|
|
+ <VividEditor v-model:value="data" :dark="true" />
|
|
|
</div>
|
|
|
+
|
|
|
<!-- </n-space> -->
|
|
|
</CommonPage>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { router } from '@/router'
|
|
|
-import Cherry from 'cherry-markdown'
|
|
|
-import { NButton } from 'naive-ui'
|
|
|
-import { onMounted } from 'vue'
|
|
|
-import 'cherry-markdown/dist/cherry-markdown.css'
|
|
|
+import { VividEditor } from '@codecoderun/vivid'
|
|
|
+import { ref } from 'vue'
|
|
|
|
|
|
const articleValue = ref('')
|
|
|
-
|
|
|
+const data = ref('')
|
|
|
onMounted(() => {
|
|
|
- const cherryInstance = new Cherry({
|
|
|
- id: 'markdown-container',
|
|
|
- value: articleValue.value,
|
|
|
- editor: {
|
|
|
- theme: 'default',
|
|
|
- height: '100%',
|
|
|
- defaultModel: '',
|
|
|
- },
|
|
|
- })
|
|
|
-
|
|
|
- console.log('cherryInstance', cherryInstance)
|
|
|
+ console.log('VividEditor', VividEditor)
|
|
|
})
|
|
|
|
|
|
-// function handleAdd() {}
|
|
|
+function handleAdd() { }
|
|
|
</script>
|