build(deps): 移除 ckeditor 和 tiptap 相关依赖

This commit is contained in:
yelan
2026-09-14 09:38:24 +08:00
parent 545326bd81
commit ff67f88696
9 changed files with 144 additions and 3882 deletions
@@ -4,8 +4,6 @@ import { ElMessage } from 'element-plus'
import type { CampusRecord, DepartmentRecord } from '@/api/management/types'
import EditorCkPane from './editors/EditorCkPane.vue'
import EditorTipTapPane from './editors/EditorTipTapPane.vue'
import EditorWangPane from './editors/EditorWangPane.vue'
import type { DocumentTemplate, TemplateEditorForm } from '../types'
@@ -24,40 +22,13 @@ const emit = defineEmits<{
// Word 自维护方案:科室把文书从 Word/WPS 直接粘贴进来(保留表格与基本格式),
// 或上传 .docx 由 mammoth 转换;签署时由交互管线识别"勾选"表并转为签署域。
// 富文本引擎做成可切换的三套(对比 Word 粘贴保真度),存储统一为编辑器产出的 HTML。
type EditorEngine = 'wangeditor' | 'ckeditor5' | 'tiptap'
// 编辑引擎固定为 WangEditor(MIT)。更换引擎只需新增一个实现 EditorPaneHandle 的面板组件,
// 注意把 Word 粘贴的归一化处理重新挂到新引擎的粘贴钩子上(WangEditor 见 EditorWangPane 的 customPaste)。
interface EditorPaneHandle {
getText: () => string
insertText: (text: string) => void
}
const engineComponents = {
wangeditor: EditorWangPane,
ckeditor5: EditorCkPane,
tiptap: EditorTipTapPane,
}
const engineOptions: Array<{ key: EditorEngine; label: string; note: string }> = [
{
key: 'wangeditor',
label: 'WangEditor',
note: '已接管粘贴,尽量保留内联样式(MIT)',
},
{
key: 'ckeditor5',
label: 'CKEditor 5',
note: 'PasteFromOffice 插件,Word 粘贴保真最强(GPL2)',
},
{
key: 'tiptap',
label: 'TipTap',
note: 'ProseMirror 架构,可自定义签署域节点;粘贴走 schema,样式有损(MIT)',
},
]
const engine = ref<EditorEngine>('wangeditor')
const engineNote = ref(engineOptions[0]?.note ?? '')
const valueHtml = ref('<p><br></p>')
const docxInput = ref<HTMLInputElement | null>(null)
const importing = ref(false)
@@ -126,11 +97,6 @@ function handleCampusChange() {
}
}
function selectEngine(next: EditorEngine) {
engine.value = next
engineNote.value = engineOptions.find((option) => option.key === next)?.note ?? ''
}
function insertPlaceholder(text: string) {
paneRef.value?.insertText(text)
}
@@ -270,20 +236,6 @@ function save() {
</div>
<div class="editor-shell">
<div class="engine-bar">
<span class="engine-label">编辑器引擎</span>
<button
v-for="option in engineOptions"
:key="option.key"
type="button"
class="engine-button"
:class="{ active: engine === option.key }"
@click="selectEngine(option.key)"
>
{{ option.label }}
</button>
<span class="engine-note">{{ engineNote }}</span>
</div>
<div class="docx-bar">
<button
type="button"
@@ -307,9 +259,7 @@ function save() {
</span>
</div>
<div class="editor-area">
<component
:is="engineComponents[engine]"
:key="engine"
<EditorWangPane
ref="paneRef"
:model-value="valueHtml"
@update:model-value="valueHtml = $event"
@@ -514,46 +464,6 @@ function save() {
font-size: 12px;
}
.engine-bar {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
margin-bottom: 8px;
}
.engine-label {
color: var(--ink);
font-size: 12px;
font-weight: 700;
}
.engine-button {
padding: 5px 12px;
color: var(--mut);
font-size: 12px;
font-weight: 700;
background: #fff;
border: 1px solid var(--line);
border-radius: 14px;
}
.engine-button:hover {
border-color: var(--brand);
color: var(--brand);
}
.engine-button.active {
color: #fff;
background: var(--brand);
border-color: var(--brand);
}
.engine-note {
color: var(--mut);
font-size: 11.5px;
}
.editor-area {
display: flex;
flex-direction: column;