From 31ee6a4ae80f66faab5ed4f002b2b453234df32b Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 14 Mar 2024 17:07:23 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0markdown=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paragraph/component/ParagraphForm.vue | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ui/src/views/paragraph/component/ParagraphForm.vue b/ui/src/views/paragraph/component/ParagraphForm.vue index 3876fb365..6ca7a8e89 100644 --- a/ui/src/views/paragraph/component/ParagraphForm.vue +++ b/ui/src/views/paragraph/component/ParagraphForm.vue @@ -28,7 +28,8 @@ placeholder="请输入分段内容" :maxLength="4096" :preview="false" - style="height: 300px;" + :toolbars="toolbars" + style="height: 300px" /> @@ -47,6 +48,37 @@ const props = defineProps({ 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', +] + const form = ref({ title: '', content: '' From 2e016372f68548f64ccb5c6ce399ec6fb0e40fa6 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 14 Mar 2024 17:28:47 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20markdown=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/application/CreateAndSetting.vue | 2 +- .../paragraph/component/ParagraphForm.vue | 31 ++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ui/src/views/application/CreateAndSetting.vue b/ui/src/views/application/CreateAndSetting.vue index c23fd3d85..0c2a7152d 100644 --- a/ui/src/views/application/CreateAndSetting.vue +++ b/ui/src/views/application/CreateAndSetting.vue @@ -333,7 +333,7 @@ const { const defaultPrompt = `已知信息: {data} 回答要求: -- 请简洁和专业的来回答用户的问题。 +- 请使用简洁且专业的语言来回答用户的问题。 - 如果你不知道答案,请回答“没有在知识库中查找到相关信息,建议咨询相关技术支持或参考官方文档进行操作”。 - 避免提及你是从已知信息中获得的知识。 - 请保证答案与已知信息中描述的一致。 diff --git a/ui/src/views/paragraph/component/ParagraphForm.vue b/ui/src/views/paragraph/component/ParagraphForm.vue index 6ca7a8e89..b3020dacc 100644 --- a/ui/src/views/paragraph/component/ParagraphForm.vue +++ b/ui/src/views/paragraph/component/ParagraphForm.vue @@ -31,13 +31,19 @@ :toolbars="toolbars" style="height: 300px" /> - + diff --git a/ui/src/views/paragraph/component/ParagraphForm.vue b/ui/src/views/paragraph/component/ParagraphForm.vue index 1272a2dd7..4c8833f5b 100644 --- a/ui/src/views/paragraph/component/ParagraphForm.vue +++ b/ui/src/views/paragraph/component/ParagraphForm.vue @@ -36,7 +36,6 @@ ref="editorRef" editorId="preview-only" :modelValue="form.content" - @onHtmlChanged="onHtmlChanged" class="maxkb-md" /> @@ -136,20 +135,20 @@ 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') - } - } - }) -} +// 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(() => { form.value = {