adtec-core-package 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<!-- RichTextEditor:基于预编译 Umo Editor(prebuilt/umo-editor),对外 API 与原 AiEditor 封装保持一致 -->
|
|
2
2
|
<template>
|
|
3
|
-
<div
|
|
3
|
+
<div
|
|
4
|
+
ref="rootRef"
|
|
5
|
+
class="umo-rich-text-editor-root"
|
|
6
|
+
:class="{ 'umo-rich-text-editor-root--readonly': !editable }">
|
|
4
7
|
<UmoEditor
|
|
5
8
|
v-if="umoMountOptions"
|
|
6
9
|
:key="umoRuntimeKey"
|
|
@@ -36,9 +39,44 @@ export type RichTextEditorConfig = {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/** 始终保留 BlockImage NodeView;只读由 document.readOnly + node-view 静态分支控制 */
|
|
39
|
-
const DISABLED_EXTENSIONS = [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const DISABLED_EXTENSIONS = [
|
|
43
|
+
'locale', // 视图 Tab:隐藏语言设置下拉(locale 固定 zh-CN;状态栏指示器另用 CSS 隐藏)
|
|
44
|
+
'theme', // 视图 Tab:隐藏主题设置(light/dark,theme 固定 light)
|
|
45
|
+
'mermaid',
|
|
46
|
+
'diagrams',
|
|
47
|
+
// Block 菜单(+ 插入新内容):仅保留表格与图片
|
|
48
|
+
'qrcode',
|
|
49
|
+
'barcode',
|
|
50
|
+
'signature',
|
|
51
|
+
'math',
|
|
52
|
+
'echarts',
|
|
53
|
+
'print', // 开始 Tab:隐藏打印
|
|
54
|
+
// 插入 Tab:仅保留图片
|
|
55
|
+
'link',
|
|
56
|
+
'video',
|
|
57
|
+
'audio',
|
|
58
|
+
'file',
|
|
59
|
+
'text-box',
|
|
60
|
+
'details',
|
|
61
|
+
'code-block',
|
|
62
|
+
'symbol',
|
|
63
|
+
'chinese-date',
|
|
64
|
+
'emoji',
|
|
65
|
+
'tag',
|
|
66
|
+
'columns',
|
|
67
|
+
'callout',
|
|
68
|
+
'mention',
|
|
69
|
+
'option-box',
|
|
70
|
+
'hard-break',
|
|
71
|
+
'hr',
|
|
72
|
+
'bookmark',
|
|
73
|
+
'footnote',
|
|
74
|
+
'toc',
|
|
75
|
+
'template',
|
|
76
|
+
'web-page',
|
|
77
|
+
] as const
|
|
78
|
+
|
|
79
|
+
const OFFICIAL_TOOLBAR_MENUS = ['base', 'insert', 'table', 'page', 'view'] as const
|
|
42
80
|
|
|
43
81
|
const emit = defineEmits<{
|
|
44
82
|
onBlur: [payload: { html: string; text: string }]
|
|
@@ -211,7 +249,7 @@ function seedUmoLayoutStorage() {
|
|
|
211
249
|
localStorage.setItem(`umo-editor:${umoRuntimeKey.value}:layout`, JSON.stringify('web'))
|
|
212
250
|
localStorage.setItem(
|
|
213
251
|
`umo-editor:${umoRuntimeKey.value}:toolbar`,
|
|
214
|
-
JSON.stringify({ mode: '
|
|
252
|
+
JSON.stringify({ mode: 'classic', show: showToolbar }),
|
|
215
253
|
)
|
|
216
254
|
} catch {
|
|
217
255
|
// ignore quota / private mode
|
|
@@ -280,11 +318,12 @@ function buildUmoMountOptions(content: string) {
|
|
|
280
318
|
fullscreenZIndex: 2500,
|
|
281
319
|
toolbar: {
|
|
282
320
|
showSaveLabel: false,
|
|
283
|
-
defaultMode: '
|
|
321
|
+
defaultMode: 'classic',
|
|
322
|
+
// Umo schema 要求 menus 至少含 base;只读时 readOnly=true 会隐藏工具栏 UI
|
|
284
323
|
menus:
|
|
285
324
|
props.showToolbar && editableNow
|
|
286
325
|
? [...OFFICIAL_TOOLBAR_MENUS]
|
|
287
|
-
: [],
|
|
326
|
+
: (['base'] as unknown as string[]),
|
|
288
327
|
},
|
|
289
328
|
page: {
|
|
290
329
|
layouts: ['page', 'web'],
|
|
@@ -367,7 +406,7 @@ async function applyEditableState() {
|
|
|
367
406
|
editor.setReadOnly?.(!canEdit)
|
|
368
407
|
ensureTipTapEditable(canEdit)
|
|
369
408
|
editor.setToolbar?.({
|
|
370
|
-
mode: '
|
|
409
|
+
mode: 'classic',
|
|
371
410
|
show: props.showToolbar && canEdit,
|
|
372
411
|
})
|
|
373
412
|
const tipTap = editor.getEditor?.()?.value
|
|
@@ -647,4 +686,18 @@ onUnmounted(() => {
|
|
|
647
686
|
cursor: text;
|
|
648
687
|
min-height: 120px;
|
|
649
688
|
}
|
|
689
|
+
|
|
690
|
+
.umo-rich-text-editor-root--readonly {
|
|
691
|
+
:deep(.umo-loading),
|
|
692
|
+
:deep(.umo-loading--visible),
|
|
693
|
+
:deep(.umo-loading__overlay),
|
|
694
|
+
:deep(.umo-loading--center),
|
|
695
|
+
:deep(.umo-icon-loading) {
|
|
696
|
+
display: none !important;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
:deep(.umo-editor-content .ProseMirror) {
|
|
700
|
+
cursor: default;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
650
703
|
</style>
|
|
@@ -5,6 +5,26 @@ import { umoGlobalComponents } from '../../../prebuilt/umo-editor/umo-editor.js'
|
|
|
5
5
|
const registeredApps = new WeakSet<App>()
|
|
6
6
|
const tdesignApps = new WeakSet<App>()
|
|
7
7
|
|
|
8
|
+
/** 嵌入 Umo 的全局样式覆盖(须注入 document.head,全屏 Teleport 到 body 时组件 scoped :deep 无法命中) */
|
|
9
|
+
function injectUmoEmbedStyles() {
|
|
10
|
+
if (typeof document === 'undefined') return
|
|
11
|
+
if (document.getElementById('umo-embed-overrides')) return
|
|
12
|
+
|
|
13
|
+
const style = document.createElement('style')
|
|
14
|
+
style.id = 'umo-embed-overrides'
|
|
15
|
+
style.textContent = `
|
|
16
|
+
svg.umo-icon:not(.t-icon) {
|
|
17
|
+
fill: none;
|
|
18
|
+
}
|
|
19
|
+
.umo-status-bar-button.umo-lang-button {
|
|
20
|
+
display: none !important;
|
|
21
|
+
}
|
|
22
|
+
`
|
|
23
|
+
document.head.appendChild(style)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
injectUmoEmbedStyles()
|
|
27
|
+
|
|
8
28
|
/** 预编译 Umo 内部用 resolveComponent,须在宿主 Vue App 上注册 umoGlobalComponents */
|
|
9
29
|
export function installUmoEditorApp(app?: App | null) {
|
|
10
30
|
if (!app) return false
|