Merge branch 'main' of github.com:maxkb-dev/maxkb
# Conflicts: # ui/src/components/markdown-renderer/MdRenderer.vue
This commit is contained in:
commit
f286158f54
@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<base target=_blank>
|
||||||
<title>%VITE_APP_TITLE%</title>
|
<title>%VITE_APP_TITLE%</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
"markdown-it-sup": "^1.0.0",
|
"markdown-it-sup": "^1.0.0",
|
||||||
"markdown-it-task-lists": "^2.1.1",
|
"markdown-it-task-lists": "^2.1.1",
|
||||||
"markdown-it-toc-done-right": "^4.2.0",
|
"markdown-it-toc-done-right": "^4.2.0",
|
||||||
"md-editor-v3": "^4.9.0",
|
"md-editor-v3": "^4.12.1",
|
||||||
"medium-zoom": "^1.1.0",
|
"medium-zoom": "^1.1.0",
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
"npm": "^10.2.4",
|
"npm": "^10.2.4",
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="top-bar-container border-b flex-between">
|
<div class="top-bar-container border-b flex-between">
|
||||||
<div class="flex-center h-full">
|
<div class="flex-center h-full">
|
||||||
<a href="/">
|
<div class="app-title-container flex-center cursor" @click="router.push('/')">
|
||||||
<div class="app-title-container flex-center">
|
|
||||||
<div class="app-title-icon"></div>
|
<div class="app-title-icon"></div>
|
||||||
<div class="app-title-text app-logo-font ml-4">
|
<div class="app-title-text app-logo-font ml-4">
|
||||||
{{ defaultTitle }}
|
{{ defaultTitle }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
|
||||||
<TopMenu></TopMenu>
|
<TopMenu></TopMenu>
|
||||||
</div>
|
</div>
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
@ -19,6 +17,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import TopMenu from './top-menu/index.vue'
|
import TopMenu from './top-menu/index.vue'
|
||||||
import Avatar from './avatar/index.vue'
|
import Avatar from './avatar/index.vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
const router = useRouter()
|
||||||
const defaultTitle = import.meta.env.VITE_APP_TITLE
|
const defaultTitle = import.meta.env.VITE_APP_TITLE
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@ -518,11 +518,3 @@ h4 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// markdown
|
|
||||||
|
|
||||||
.ͼ1 .cm-placeholder {
|
|
||||||
color: var(--app-input-color-placeholder);
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -17,3 +17,13 @@
|
|||||||
.md-editor-preview-wrapper {
|
.md-editor-preview-wrapper {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.md-editor-footer {
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ͼ1 .cm-placeholder {
|
||||||
|
color: var(--app-input-color-placeholder);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|||||||
@ -333,7 +333,7 @@ const {
|
|||||||
const defaultPrompt = `已知信息:
|
const defaultPrompt = `已知信息:
|
||||||
{data}
|
{data}
|
||||||
回答要求:
|
回答要求:
|
||||||
- 请简洁和专业的来回答用户的问题。
|
- 请使用简洁且专业的语言来回答用户的问题。
|
||||||
- 如果你不知道答案,请回答“没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作”。
|
- 如果你不知道答案,请回答“没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作”。
|
||||||
- 避免提及你是从已知信息中获得的知识。
|
- 避免提及你是从已知信息中获得的知识。
|
||||||
- 请保证答案与已知信息中描述的一致。
|
- 请保证答案与已知信息中描述的一致。
|
||||||
|
|||||||
@ -28,15 +28,22 @@
|
|||||||
placeholder="请输入分段内容"
|
placeholder="请输入分段内容"
|
||||||
:maxLength="4096"
|
:maxLength="4096"
|
||||||
:preview="false"
|
:preview="false"
|
||||||
style="height: 300px;"
|
:toolbars="toolbars"
|
||||||
|
style="height: 300px"
|
||||||
|
/>
|
||||||
|
<MdPreview
|
||||||
|
v-else
|
||||||
|
ref="editorRef"
|
||||||
|
editorId="preview-only"
|
||||||
|
:modelValue="form.content"
|
||||||
|
class="maxkb-md"
|
||||||
/>
|
/>
|
||||||
<MdPreview v-else ref="editorRef" editorId="preview-only" :modelValue="form.content" />
|
|
||||||
<!-- <span v-else class="break-all lighter">{{ form.content }}</span> -->
|
<!-- <span v-else class="break-all lighter">{{ form.content }}</span> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onUnmounted, watch } from 'vue'
|
import { ref, reactive, onUnmounted, watch, nextTick } from 'vue'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import { MdEditor, MdPreview } from 'md-editor-v3'
|
import { MdEditor, MdPreview } from 'md-editor-v3'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -47,6 +54,39 @@ const props = defineProps({
|
|||||||
isEdit: Boolean
|
isEdit: Boolean
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const toolbars = [
|
||||||
|
'bold',
|
||||||
|
'underline',
|
||||||
|
'italic',
|
||||||
|
'-',
|
||||||
|
'title',
|
||||||
|
'strikeThrough',
|
||||||
|
'sub',
|
||||||
|
'sup',
|
||||||
|
'quote',
|
||||||
|
'unorderedList',
|
||||||
|
'orderedList',
|
||||||
|
'task',
|
||||||
|
'-',
|
||||||
|
'codeRow',
|
||||||
|
'code',
|
||||||
|
'link',
|
||||||
|
'image',
|
||||||
|
'table',
|
||||||
|
'mermaid',
|
||||||
|
'katex',
|
||||||
|
'-',
|
||||||
|
'revoke',
|
||||||
|
'next',
|
||||||
|
'=',
|
||||||
|
'pageFullscreen',
|
||||||
|
'preview',
|
||||||
|
'htmlPreview',
|
||||||
|
'catalog'
|
||||||
|
] as any[]
|
||||||
|
|
||||||
|
const editorRef = ref()
|
||||||
|
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
title: '',
|
title: '',
|
||||||
content: ''
|
content: ''
|
||||||
@ -95,6 +135,21 @@ function validate() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const onHtmlChanged = () => {
|
||||||
|
// appendTarget()
|
||||||
|
// }
|
||||||
|
// const appendTarget = () => {
|
||||||
|
// nextTick(() => {
|
||||||
|
// var item = document.getElementsByClassName('maxkb-md')
|
||||||
|
// for (var j = 0; j < item.length; j++) {
|
||||||
|
// var aTags = item[j].getElementsByTagName('a')
|
||||||
|
// for (var i = 0; i < aTags.length; i++) {
|
||||||
|
// aTags[i].setAttribute('target', '_blank')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
form.value = {
|
form.value = {
|
||||||
title: '',
|
title: '',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user