@jhl548/duplicate-doc-vue 0.1.2 → 0.1.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/README.md +3 -1
- package/dist/DuplicateDocumentEditor.vue.d.ts +19 -2
- package/dist/index.js +376 -256
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ const highlights = computed<DuplicateHighlight[]>(() => [
|
|
|
59
59
|
similarity: 0.92,
|
|
60
60
|
active: true,
|
|
61
61
|
label: "重复点 1",
|
|
62
|
-
ranges: [{ start: 6, end: 20, blockId: "b-1" }]
|
|
62
|
+
ranges: [{ start: 6, end: 20, matchedText: "这是一段需要高亮的重复内容", blockId: "b-1" }]
|
|
63
63
|
}
|
|
64
64
|
]);
|
|
65
65
|
|
|
@@ -128,6 +128,7 @@ interface NormalizedDocument {
|
|
|
128
128
|
- `plainText` 必须与算法计算重复点范围时使用的文本一致。
|
|
129
129
|
- `rangeMap` 负责把结构块和纯文本偏移关联起来,便于联调和问题排查。
|
|
130
130
|
- `DuplicateHighlight.ranges[].start/end` 使用基于 `plainText` 的左闭右开区间。
|
|
131
|
+
- 可编辑场景建议传入 `DuplicateHighlight.ranges[].matchedText`,其值应等于原始命中文本;插件会自动记录兜底文本,但后端显式提供可提升删除、编辑和切换重复点后的高亮稳定性。
|
|
131
132
|
|
|
132
133
|
## Word 转 HTML 建议
|
|
133
134
|
|
|
@@ -193,6 +194,7 @@ npm run verify:npm
|
|
|
193
194
|
- 应用入口已导入 `@jhl548/duplicate-doc-vue/style.css`。
|
|
194
195
|
- `documentModel.documentId` 与 `highlights[].documentId` 一致。
|
|
195
196
|
- `TextRange.start/end` 不越界。
|
|
197
|
+
- 可编辑场景下 `TextRange.matchedText` 与 `plainText.slice(start, end)` 一致。
|
|
196
198
|
- `rangeMap.textStart/textEnd` 与 `plainText` 对齐。
|
|
197
199
|
- 后端块级换行规则与插件映射规则一致。
|
|
198
200
|
- 表格、列表、标题、图片在 HTML 中仍是 Tiptap 可解析结构。
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import { DuplicateHighlight, EditorChangePayload, NormalizedDocument } from '@jhl548/duplicate-doc-core';
|
|
1
|
+
import { DocumentSelectionChangePayload, DuplicateHighlight, EditorChangePayload, NormalizedDocument, PopupPosition, RangeMapEntry } from '@jhl548/duplicate-doc-core';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
documentModel: NormalizedDocument;
|
|
4
4
|
highlights?: DuplicateHighlight[];
|
|
5
5
|
editable?: boolean;
|
|
6
6
|
autofocusHighlight?: boolean;
|
|
7
7
|
};
|
|
8
|
+
type __VLS_Slots = {
|
|
9
|
+
"selection-popup"?: (props: {
|
|
10
|
+
documentId: string;
|
|
11
|
+
selection: DocumentSelectionChangePayload;
|
|
12
|
+
overlappingEntries: RangeMapEntry[];
|
|
13
|
+
visible: boolean;
|
|
14
|
+
position: PopupPosition;
|
|
15
|
+
}) => unknown;
|
|
16
|
+
};
|
|
8
17
|
interface SnapshotSource {
|
|
9
18
|
getHTML: () => string;
|
|
10
19
|
getText: () => string;
|
|
11
20
|
getJSON: () => unknown;
|
|
12
21
|
}
|
|
13
22
|
declare function getSnapshot(targetEditor?: SnapshotSource): EditorChangePayload;
|
|
14
|
-
declare const
|
|
23
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
15
24
|
getSnapshot: typeof getSnapshot;
|
|
16
25
|
getHTML: () => string;
|
|
17
26
|
getPlainText: () => string;
|
|
@@ -19,13 +28,21 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {
|
|
|
19
28
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
20
29
|
change: (payload: EditorChangePayload) => any;
|
|
21
30
|
ready: () => any;
|
|
31
|
+
"selection-change": (payload: DocumentSelectionChangePayload) => any;
|
|
22
32
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
33
|
onChange?: ((payload: EditorChangePayload) => any) | undefined;
|
|
24
34
|
onReady?: (() => any) | undefined;
|
|
35
|
+
"onSelection-change"?: ((payload: DocumentSelectionChangePayload) => any) | undefined;
|
|
25
36
|
}>, {
|
|
26
37
|
highlights: DuplicateHighlight[];
|
|
27
38
|
editable: boolean;
|
|
28
39
|
autofocusHighlight: boolean;
|
|
29
40
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
41
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
30
42
|
declare const _default: typeof __VLS_export;
|
|
31
43
|
export default _default;
|
|
44
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DuplicateHighlightExtension as
|
|
3
|
-
import { Color as
|
|
4
|
-
import { Highlight as
|
|
5
|
-
import { Image as
|
|
6
|
-
import { Subscript as
|
|
7
|
-
import { Superscript as
|
|
8
|
-
import { Table as
|
|
9
|
-
import { TableCell as
|
|
10
|
-
import { TableHeader as
|
|
11
|
-
import { TableRow as
|
|
12
|
-
import { TaskItem as
|
|
13
|
-
import { TaskList as
|
|
14
|
-
import { TextAlign as
|
|
15
|
-
import { TextStyle as
|
|
16
|
-
import
|
|
17
|
-
import { EditorContent as
|
|
1
|
+
import { Teleport as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, nextTick as s, normalizeClass as c, normalizeStyle as ee, onBeforeUnmount as l, openBlock as u, ref as d, renderSlot as te, unref as f, useSlots as ne, watch as p } from "vue";
|
|
2
|
+
import { DuplicateHighlightExtension as re, calcSelectionPopupPosition as m, findOverlappingRangeMapEntries as ie, getDomSelectionRect as h, getSelectionRangeInfo as ae, isDomSelectionInsideContainer as g, plainTextFromHtml as _, scrollToActiveHighlight as v } from "@jhl548/duplicate-doc-core";
|
|
3
|
+
import { Color as oe } from "@tiptap/extension-color";
|
|
4
|
+
import { Highlight as se } from "@tiptap/extension-highlight";
|
|
5
|
+
import { Image as ce } from "@tiptap/extension-image";
|
|
6
|
+
import { Subscript as le } from "@tiptap/extension-subscript";
|
|
7
|
+
import { Superscript as ue } from "@tiptap/extension-superscript";
|
|
8
|
+
import { Table as de } from "@tiptap/extension-table";
|
|
9
|
+
import { TableCell as fe } from "@tiptap/extension-table-cell";
|
|
10
|
+
import { TableHeader as pe } from "@tiptap/extension-table-header";
|
|
11
|
+
import { TableRow as me } from "@tiptap/extension-table-row";
|
|
12
|
+
import { TaskItem as he } from "@tiptap/extension-task-item";
|
|
13
|
+
import { TaskList as ge } from "@tiptap/extension-task-list";
|
|
14
|
+
import { TextAlign as _e } from "@tiptap/extension-text-align";
|
|
15
|
+
import { TextStyle as ve } from "@tiptap/extension-text-style";
|
|
16
|
+
import ye from "@tiptap/starter-kit";
|
|
17
|
+
import { EditorContent as be, useEditor as xe } from "@tiptap/vue-3";
|
|
18
18
|
export * from "@jhl548/duplicate-doc-core";
|
|
19
19
|
//#region src/icons/align-center.svg?raw
|
|
20
|
-
var
|
|
20
|
+
var Se = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M5 7h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M7 11h10\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5 15h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M8 19h8\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", Ce = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M5 7h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5 11h10\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5 15h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5 19h8\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", we = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M5 7h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M9 11h10\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5 15h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M11 19h8\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", y = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M8 5h5.2a3.2 3.2 0 0 1 0 6.4H8V5Z\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linejoin=\"round\"/>\n <path d=\"M8 11.4h6a3.3 3.3 0 0 1 0 6.6H8v-6.6Z\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linejoin=\"round\"/>\n <path d=\"M7 5h2v13H7\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", b = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M9 7h10\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M9 12h10\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M9 17h10\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5 7h.1M5 12h.1M5 17h.1\" stroke=\"currentColor\" stroke-width=\"2.8\" stroke-linecap=\"round\"/>\n</svg>\n", x = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m9 8-4 4 4 4\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"m15 8 4 4-4 4\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"m13 6-2 12\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", S = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M5 12h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M7 7h10\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" opacity=\".45\"/>\n <path d=\"M7 17h10\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" opacity=\".45\"/>\n</svg>\n", C = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m8 14 6.6-6.6a2 2 0 0 1 2.8 2.8L10.8 17H8v-3Z\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linejoin=\"round\"/>\n <path d=\"m13.4 8.6 2 2\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\"/>\n <path d=\"M5 20h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", w = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M10 5h7\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M7 19h7\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M14.5 5 9.5 19\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", T = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"5.2\" stroke=\"currentColor\" stroke-width=\"1.8\"/>\n <circle cx=\"12\" cy=\"12\" r=\"1.7\" fill=\"currentColor\"/>\n <path d=\"M12 3.5v3M12 17.5v3M3.5 12h3M17.5 12h3\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", E = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M10 7h9\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M10 12h9\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M10 17h9\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5.4 5.8v3.4\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <path d=\"M4.5 14.1c.2-.8.8-1.2 1.5-1.2.8 0 1.4.4 1.4 1.1 0 .5-.3.9-.9 1.3l-1.9 1.3h2.9\" stroke=\"currentColor\" stroke-width=\"1.35\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", D = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M8.5 6.5c-1.8 1.3-2.7 3-2.7 5.2v5.1h5.1v-5.1H8.1c0-1.4.6-2.6 1.9-3.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M16.5 6.5c-1.8 1.3-2.7 3-2.7 5.2v5.1h5.1v-5.1h-2.8c0-1.4.6-2.6 1.9-3.5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", O = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m15 7 4 4-4 4\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M18 11h-7.5a4.5 4.5 0 0 0 0 9H13\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", k = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M8 7.4c.9-1.4 2.4-2.1 4.3-2.1 2 0 3.5.7 4.6 2\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\"/>\n <path d=\"M16.4 16.3c-.9 1.6-2.4 2.4-4.6 2.4-2.1 0-3.8-.8-5-2.3\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\"/>\n <path d=\"M5 12h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", Te = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m6 7 7 9\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"m13 7-7 9\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M15.5 18.2c.4-.8 1.1-1.2 2-1.2 1 0 1.8.6 1.8 1.5 0 .6-.3 1.1-1 1.5l-2.7 1.8h3.9\" stroke=\"currentColor\" stroke-width=\"1.45\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", Ee = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m6 9 7 9\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"m13 9-7 9\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M15.5 5.2c.4-.8 1.1-1.2 2-1.2 1 0 1.8.6 1.8 1.5 0 .6-.3 1.1-1 1.5l-2.7 1.8h3.9\" stroke=\"currentColor\" stroke-width=\"1.45\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", De = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <rect x=\"5\" y=\"6\" width=\"14\" height=\"12\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.8\"/>\n <path d=\"M5 10h14M5 14h14M10 6v12M14 6v12\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n</svg>\n", Oe = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m4.5 7.2 1.5 1.5 3-3\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M11 7h8\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"m4.5 15.2 1.5 1.5 3-3\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M11 15h8\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", ke = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"m6 18 5-12 5 12\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M8.2 13.2h5.6\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <path d=\"M5 21h14\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", Ae = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M9 7 5 11l4 4\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M6 11h7.5a4.5 4.5 0 0 1 0 9H11\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n</svg>\n", je = {
|
|
21
21
|
class: "dupdoc-editor__toolbar",
|
|
22
22
|
"aria-label": "文档编辑工具"
|
|
23
|
-
},
|
|
23
|
+
}, Me = {
|
|
24
24
|
class: "dupdoc-editor__toolbar-group dupdoc-editor__toolbar-group--history",
|
|
25
25
|
"aria-label": "历史操作"
|
|
26
|
-
},
|
|
26
|
+
}, Ne = ["aria-disabled"], Pe = ["innerHTML"], Fe = ["aria-disabled"], Ie = ["innerHTML"], Le = { class: "dupdoc-editor__toolbar-group dupdoc-editor__toolbar-group--select" }, Re = ["value", "disabled"], ze = {
|
|
27
27
|
class: "dupdoc-editor__toolbar-group",
|
|
28
28
|
"aria-label": "基础文字样式"
|
|
29
|
-
},
|
|
29
|
+
}, Be = ["disabled"], Ve = ["innerHTML"], He = ["disabled"], Ue = ["innerHTML"], We = ["disabled"], Ge = ["innerHTML"], Ke = ["disabled"], qe = ["innerHTML"], Je = ["disabled"], Ye = ["innerHTML"], Xe = ["disabled"], Ze = ["innerHTML"], Qe = {
|
|
30
30
|
class: "dupdoc-editor__toolbar-group",
|
|
31
31
|
"aria-label": "颜色"
|
|
32
|
-
},
|
|
32
|
+
}, $e = {
|
|
33
33
|
class: "dupdoc-toolbar-color",
|
|
34
34
|
"data-tooltip": "文字颜色",
|
|
35
35
|
"aria-label": "文字颜色"
|
|
36
|
-
},
|
|
36
|
+
}, et = ["innerHTML"], tt = ["disabled"], nt = {
|
|
37
37
|
class: "dupdoc-toolbar-color",
|
|
38
38
|
"data-tooltip": "高亮颜色",
|
|
39
39
|
"aria-label": "高亮颜色"
|
|
40
|
-
},
|
|
40
|
+
}, rt = ["innerHTML"], it = ["disabled"], at = {
|
|
41
41
|
class: "dupdoc-editor__toolbar-group",
|
|
42
42
|
"aria-label": "段落对齐"
|
|
43
|
-
},
|
|
43
|
+
}, ot = ["disabled"], st = ["innerHTML"], ct = ["disabled"], lt = ["innerHTML"], ut = ["disabled"], dt = ["innerHTML"], ft = {
|
|
44
44
|
class: "dupdoc-editor__toolbar-group",
|
|
45
45
|
"aria-label": "列表与结构"
|
|
46
|
-
},
|
|
46
|
+
}, pt = ["disabled"], mt = ["innerHTML"], ht = ["disabled"], gt = ["innerHTML"], _t = ["disabled"], vt = ["innerHTML"], yt = ["disabled"], bt = ["innerHTML"], xt = ["disabled"], St = ["innerHTML"], Ct = ["disabled"], wt = ["innerHTML"], Tt = {
|
|
47
47
|
class: "dupdoc-editor__toolbar-group dupdoc-editor__toolbar-group--action",
|
|
48
48
|
"aria-label": "查重定位"
|
|
49
|
-
},
|
|
49
|
+
}, Et = ["innerHTML"], A = /* @__PURE__ */ o({
|
|
50
50
|
__name: "DuplicateDocumentEditor",
|
|
51
51
|
props: {
|
|
52
52
|
documentModel: {},
|
|
@@ -60,71 +60,86 @@ var x = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"
|
|
|
60
60
|
default: !0
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
|
-
emits: [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
emits: [
|
|
64
|
+
"change",
|
|
65
|
+
"ready",
|
|
66
|
+
"selection-change"
|
|
67
|
+
],
|
|
68
|
+
setup(o, { expose: A, emit: Dt }) {
|
|
69
|
+
let j = o, M = Dt, Ot = ne(), N = d(null), P = d(null), F = d(null), I = d(!1), L = d({
|
|
70
|
+
top: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
placement: "below"
|
|
73
|
+
}), R = d(null), z = d([]), B = d(""), V = t(() => !j.editable || !U.value), H = {
|
|
74
|
+
alignCenter: Se,
|
|
75
|
+
alignLeft: Ce,
|
|
76
|
+
alignRight: we,
|
|
77
|
+
bold: y,
|
|
78
|
+
bulletList: b,
|
|
79
|
+
code: x,
|
|
80
|
+
divider: S,
|
|
81
|
+
highlightColor: C,
|
|
82
|
+
italic: w,
|
|
83
|
+
locate: T,
|
|
84
|
+
orderedList: E,
|
|
85
|
+
quote: D,
|
|
86
|
+
redo: O,
|
|
87
|
+
strike: k,
|
|
88
|
+
subscript: Te,
|
|
89
|
+
superscript: Ee,
|
|
90
|
+
table: De,
|
|
91
|
+
taskList: Oe,
|
|
92
|
+
textColor: ke,
|
|
93
|
+
undo: Ae
|
|
94
|
+
}, kt = t(() => U.value?.isActive("heading", { level: 1 }) ? "heading-1" : U.value?.isActive("heading", { level: 2 }) ? "heading-2" : U.value?.isActive("heading", { level: 3 }) ? "heading-3" : "paragraph"), U = xe({
|
|
95
|
+
content: j.documentModel.html,
|
|
96
|
+
editable: j.editable,
|
|
89
97
|
extensions: [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
ye,
|
|
99
|
+
ve,
|
|
100
|
+
oe,
|
|
101
|
+
se.configure({ multicolor: !0 }),
|
|
102
|
+
ce.configure({
|
|
95
103
|
inline: !1,
|
|
96
104
|
allowBase64: !0
|
|
97
105
|
}),
|
|
98
|
-
|
|
99
|
-
oe,
|
|
100
|
-
se,
|
|
101
|
-
h,
|
|
102
|
-
m.configure({ nested: !0 }),
|
|
103
|
-
ce.configure({ resizable: !0 }),
|
|
104
|
-
p,
|
|
105
|
-
ue,
|
|
106
|
+
_e.configure({ types: ["heading", "paragraph"] }),
|
|
106
107
|
le,
|
|
107
|
-
|
|
108
|
+
ue,
|
|
109
|
+
ge,
|
|
110
|
+
he.configure({ nested: !0 }),
|
|
111
|
+
de.configure({ resizable: !0 }),
|
|
112
|
+
me,
|
|
113
|
+
pe,
|
|
114
|
+
fe,
|
|
115
|
+
re
|
|
108
116
|
],
|
|
109
117
|
editorProps: { attributes: { class: "dupdoc-editor__content" } },
|
|
110
118
|
onCreate: ({ editor: e }) => {
|
|
111
|
-
e.commands.setDuplicateHighlights(
|
|
119
|
+
e.commands.setDuplicateHighlights(j.highlights), M("ready");
|
|
112
120
|
},
|
|
113
121
|
onUpdate: ({ editor: e }) => {
|
|
114
|
-
|
|
122
|
+
M("change", W(e));
|
|
123
|
+
},
|
|
124
|
+
onSelectionUpdate: ({ editor: e }) => {
|
|
125
|
+
let t = ae(e);
|
|
126
|
+
M("selection-change", {
|
|
127
|
+
documentId: j.documentModel.documentId,
|
|
128
|
+
...t
|
|
129
|
+
}), t.empty ? Y() : It(t);
|
|
115
130
|
}
|
|
116
131
|
});
|
|
117
|
-
function
|
|
118
|
-
let t = e ??
|
|
132
|
+
function W(e) {
|
|
133
|
+
let t = e ?? U.value;
|
|
119
134
|
return {
|
|
120
|
-
documentId:
|
|
121
|
-
html: t?.getHTML() ??
|
|
122
|
-
plainText: t?.getText() ??
|
|
135
|
+
documentId: j.documentModel.documentId,
|
|
136
|
+
html: t?.getHTML() ?? j.documentModel.html,
|
|
137
|
+
plainText: t?.getText() ?? _(j.documentModel.html),
|
|
123
138
|
json: t?.getJSON()
|
|
124
139
|
};
|
|
125
140
|
}
|
|
126
|
-
function
|
|
127
|
-
let t = e.target.value, n =
|
|
141
|
+
function At(e) {
|
|
142
|
+
let t = e.target.value, n = U.value?.chain().focus();
|
|
128
143
|
if (!n) return;
|
|
129
144
|
if (t === "paragraph") {
|
|
130
145
|
n.setParagraph().run();
|
|
@@ -133,292 +148,397 @@ var x = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"
|
|
|
133
148
|
let r = Number(t.replace("heading-", ""));
|
|
134
149
|
n.toggleHeading({ level: r }).run();
|
|
135
150
|
}
|
|
136
|
-
function
|
|
151
|
+
function jt(e) {
|
|
137
152
|
let t = e.target.value;
|
|
138
|
-
|
|
153
|
+
U.value?.chain().focus().setColor(t).run();
|
|
139
154
|
}
|
|
140
|
-
function
|
|
155
|
+
function Mt(e) {
|
|
141
156
|
let t = e.target.value;
|
|
142
|
-
|
|
157
|
+
U.value?.chain().focus().toggleHighlight({ color: t }).run();
|
|
143
158
|
}
|
|
144
|
-
function
|
|
145
|
-
|
|
159
|
+
function Nt() {
|
|
160
|
+
U.value?.chain().focus().insertTable({
|
|
146
161
|
rows: 3,
|
|
147
162
|
cols: 3,
|
|
148
163
|
withHeaderRow: !0
|
|
149
164
|
}).run();
|
|
150
165
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
166
|
+
function Pt() {
|
|
167
|
+
V.value || !U.value?.can().undo() || U.value.chain().focus().undo().run();
|
|
168
|
+
}
|
|
169
|
+
function G() {
|
|
170
|
+
V.value || !U.value?.can().redo() || U.value.chain().focus().redo().run();
|
|
153
171
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
172
|
+
function Ft() {
|
|
173
|
+
s(() => {
|
|
174
|
+
v(N.value);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function K(e = j.highlights) {
|
|
178
|
+
return e.map((e) => [
|
|
179
|
+
e.documentId,
|
|
180
|
+
e.duplicateId,
|
|
181
|
+
e.similarity,
|
|
182
|
+
e.active ? "active" : "",
|
|
183
|
+
e.ignored ? "ignored" : "",
|
|
184
|
+
e.region,
|
|
185
|
+
e.semanticType,
|
|
186
|
+
e.noiseReason,
|
|
187
|
+
e.tableContext?.tableId,
|
|
188
|
+
e.ranges.map((e) => [
|
|
189
|
+
e.blockId,
|
|
190
|
+
e.start,
|
|
191
|
+
e.end,
|
|
192
|
+
e.matchedText
|
|
193
|
+
].join(":")).join("|")
|
|
194
|
+
].join("::")).join(";;");
|
|
195
|
+
}
|
|
196
|
+
function It(e) {
|
|
197
|
+
let t = h();
|
|
198
|
+
if (!t) return;
|
|
199
|
+
let n = P.value;
|
|
200
|
+
if (!n || !g(n)) return;
|
|
201
|
+
let r = window.innerWidth, i = window.innerHeight, a = m(t, r, i);
|
|
202
|
+
R.value = {
|
|
203
|
+
documentId: j.documentModel.documentId,
|
|
204
|
+
...e
|
|
205
|
+
}, L.value = a, e.plainTextOffset ? z.value = ie(j.documentModel.rangeMap, e.plainTextOffset) : z.value = [], I.value = !0, s(() => {
|
|
206
|
+
X();
|
|
207
|
+
});
|
|
156
208
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
|
|
209
|
+
function Lt() {
|
|
210
|
+
let e = h(), t = P.value;
|
|
211
|
+
if (!e || !t) {
|
|
212
|
+
Y();
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (!g(t)) {
|
|
216
|
+
Y();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
let n = window.innerWidth, r = window.innerHeight;
|
|
220
|
+
L.value = m(e, n, r), s(() => {
|
|
221
|
+
X();
|
|
160
222
|
});
|
|
161
223
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
224
|
+
let q = 0;
|
|
225
|
+
function J() {
|
|
226
|
+
q ||= window.requestAnimationFrame(() => {
|
|
227
|
+
q = 0, Lt();
|
|
165
228
|
});
|
|
166
229
|
}
|
|
167
|
-
|
|
168
|
-
|
|
230
|
+
function Y() {
|
|
231
|
+
I.value = !1, R.value = null, z.value = [];
|
|
232
|
+
}
|
|
233
|
+
function X() {
|
|
234
|
+
let e = F.value;
|
|
235
|
+
if (!e) return;
|
|
236
|
+
let t = window.innerWidth, n = window.innerHeight, r = e.getBoundingClientRect(), { top: i, left: a } = L.value;
|
|
237
|
+
a + r.width > t && (a = t - r.width - 8), i + r.height > n && (i = n - r.height - 8), a = Math.max(8, a), i = Math.max(8, i), L.value = {
|
|
238
|
+
...L.value,
|
|
239
|
+
top: i,
|
|
240
|
+
left: a
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function Z(e) {
|
|
244
|
+
let t = F.value;
|
|
245
|
+
if (!I.value || !t) return;
|
|
246
|
+
let n = e.target;
|
|
247
|
+
t.contains(n) || Y();
|
|
248
|
+
}
|
|
249
|
+
function Q(e) {
|
|
250
|
+
e.key === "Escape" && I.value && Y();
|
|
251
|
+
}
|
|
252
|
+
typeof window < "u" && l(() => {
|
|
253
|
+
window.removeEventListener("mousedown", Z), window.removeEventListener("keydown", Q), window.removeEventListener("scroll", J, !0), window.removeEventListener("resize", J);
|
|
254
|
+
}), p(I, (e) => {
|
|
255
|
+
e ? (window.addEventListener("mousedown", Z), window.addEventListener("keydown", Q), window.addEventListener("scroll", J, !0), window.addEventListener("resize", J)) : (window.removeEventListener("mousedown", Z), window.removeEventListener("keydown", Q), window.removeEventListener("scroll", J, !0), window.removeEventListener("resize", J));
|
|
256
|
+
});
|
|
257
|
+
function $(e = j.autofocusHighlight, t = !1) {
|
|
258
|
+
let n = K();
|
|
259
|
+
!t && n === B.value || (U.value?.commands.setDuplicateHighlights(j.highlights), B.value = n, e && s(() => {
|
|
260
|
+
v(N.value);
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
return p(() => [j.documentModel.documentId, j.documentModel.html], ([e], [t]) => {
|
|
264
|
+
if (!U.value) return;
|
|
169
265
|
let n = e === t;
|
|
170
|
-
if (
|
|
171
|
-
|
|
266
|
+
if (U.value.getHTML() !== j.documentModel.html) {
|
|
267
|
+
U.value.commands.setContent(j.documentModel.html, { emitUpdate: !1 }), $(!n && j.autofocusHighlight, !0);
|
|
172
268
|
return;
|
|
173
269
|
}
|
|
174
|
-
n || $(
|
|
175
|
-
}),
|
|
176
|
-
|
|
177
|
-
}),
|
|
178
|
-
getSnapshot:
|
|
179
|
-
getHTML: () =>
|
|
180
|
-
getPlainText: () =>
|
|
181
|
-
focus: () =>
|
|
182
|
-
}), (
|
|
270
|
+
n || $(j.autofocusHighlight, !0);
|
|
271
|
+
}), p(() => K(), () => $()), p(() => j.editable, (e) => U.value?.setEditable(e)), l(() => {
|
|
272
|
+
U.value?.destroy();
|
|
273
|
+
}), A({
|
|
274
|
+
getSnapshot: W,
|
|
275
|
+
getHTML: () => U.value?.getHTML() ?? j.documentModel.html,
|
|
276
|
+
getPlainText: () => U.value?.getText() ?? _(j.documentModel.html),
|
|
277
|
+
focus: () => U.value?.commands.focus()
|
|
278
|
+
}), (t, o) => (u(), i("div", {
|
|
183
279
|
ref_key: "editorShellRef",
|
|
184
|
-
ref:
|
|
280
|
+
ref: N,
|
|
185
281
|
class: "dupdoc-editor"
|
|
186
|
-
}, [
|
|
187
|
-
|
|
282
|
+
}, [a("div", je, [
|
|
283
|
+
a("div", Me, [a("button", {
|
|
188
284
|
type: "button",
|
|
189
|
-
class:
|
|
285
|
+
class: c(["dupdoc-toolbar-button", { "is-disabled": V.value || !f(U)?.can().undo() }]),
|
|
190
286
|
"data-tooltip": "撤销",
|
|
191
287
|
"aria-label": "撤销",
|
|
192
|
-
"aria-disabled":
|
|
193
|
-
onClick:
|
|
194
|
-
}, [
|
|
288
|
+
"aria-disabled": V.value || !f(U)?.can().undo(),
|
|
289
|
+
onClick: Pt
|
|
290
|
+
}, [a("span", {
|
|
195
291
|
class: "dupdoc-toolbar-icon",
|
|
196
|
-
innerHTML:
|
|
197
|
-
}, null, 8,
|
|
292
|
+
innerHTML: H.undo
|
|
293
|
+
}, null, 8, Pe)], 10, Ne), a("button", {
|
|
198
294
|
type: "button",
|
|
199
|
-
class:
|
|
295
|
+
class: c(["dupdoc-toolbar-button", { "is-disabled": V.value || !f(U)?.can().redo() }]),
|
|
200
296
|
"data-tooltip": "重做",
|
|
201
297
|
"aria-label": "重做",
|
|
202
|
-
"aria-disabled":
|
|
203
|
-
onClick:
|
|
204
|
-
}, [
|
|
298
|
+
"aria-disabled": V.value || !f(U)?.can().redo(),
|
|
299
|
+
onClick: G
|
|
300
|
+
}, [a("span", {
|
|
205
301
|
class: "dupdoc-toolbar-icon",
|
|
206
|
-
innerHTML:
|
|
207
|
-
}, null, 8,
|
|
208
|
-
|
|
209
|
-
value:
|
|
210
|
-
disabled:
|
|
302
|
+
innerHTML: H.redo
|
|
303
|
+
}, null, 8, Ie)], 10, Fe)]),
|
|
304
|
+
a("div", Le, [a("select", {
|
|
305
|
+
value: kt.value,
|
|
306
|
+
disabled: V.value,
|
|
211
307
|
"aria-label": "选择文本层级",
|
|
212
|
-
onChange:
|
|
213
|
-
}, [...
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
]], 40,
|
|
219
|
-
|
|
220
|
-
|
|
308
|
+
onChange: At
|
|
309
|
+
}, [...o[14] ||= [
|
|
310
|
+
a("option", { value: "paragraph" }, "P", -1),
|
|
311
|
+
a("option", { value: "heading-1" }, "H1", -1),
|
|
312
|
+
a("option", { value: "heading-2" }, "H2", -1),
|
|
313
|
+
a("option", { value: "heading-3" }, "H3", -1)
|
|
314
|
+
]], 40, Re)]),
|
|
315
|
+
a("div", ze, [
|
|
316
|
+
a("button", {
|
|
221
317
|
type: "button",
|
|
222
|
-
class:
|
|
318
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("bold") }]),
|
|
223
319
|
"data-tooltip": "加粗",
|
|
224
320
|
"aria-label": "加粗",
|
|
225
|
-
disabled:
|
|
226
|
-
onClick:
|
|
227
|
-
}, [
|
|
321
|
+
disabled: V.value,
|
|
322
|
+
onClick: o[0] ||= (e) => f(U)?.chain().focus().toggleBold().run()
|
|
323
|
+
}, [a("span", {
|
|
228
324
|
class: "dupdoc-toolbar-icon",
|
|
229
|
-
innerHTML:
|
|
230
|
-
}, null, 8,
|
|
231
|
-
|
|
325
|
+
innerHTML: H.bold
|
|
326
|
+
}, null, 8, Ve)], 10, Be),
|
|
327
|
+
a("button", {
|
|
232
328
|
type: "button",
|
|
233
|
-
class:
|
|
329
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("italic") }]),
|
|
234
330
|
"data-tooltip": "斜体",
|
|
235
331
|
"aria-label": "斜体",
|
|
236
|
-
disabled:
|
|
237
|
-
onClick:
|
|
238
|
-
}, [
|
|
332
|
+
disabled: V.value,
|
|
333
|
+
onClick: o[1] ||= (e) => f(U)?.chain().focus().toggleItalic().run()
|
|
334
|
+
}, [a("span", {
|
|
239
335
|
class: "dupdoc-toolbar-icon",
|
|
240
|
-
innerHTML:
|
|
241
|
-
}, null, 8,
|
|
242
|
-
|
|
336
|
+
innerHTML: H.italic
|
|
337
|
+
}, null, 8, Ue)], 10, He),
|
|
338
|
+
a("button", {
|
|
243
339
|
type: "button",
|
|
244
|
-
class:
|
|
340
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("strike") }]),
|
|
245
341
|
"data-tooltip": "删除线",
|
|
246
342
|
"aria-label": "删除线",
|
|
247
|
-
disabled:
|
|
248
|
-
onClick:
|
|
249
|
-
}, [
|
|
343
|
+
disabled: V.value,
|
|
344
|
+
onClick: o[2] ||= (e) => f(U)?.chain().focus().toggleStrike().run()
|
|
345
|
+
}, [a("span", {
|
|
250
346
|
class: "dupdoc-toolbar-icon",
|
|
251
|
-
innerHTML:
|
|
252
|
-
}, null, 8,
|
|
253
|
-
|
|
347
|
+
innerHTML: H.strike
|
|
348
|
+
}, null, 8, Ge)], 10, We),
|
|
349
|
+
a("button", {
|
|
254
350
|
type: "button",
|
|
255
|
-
class:
|
|
351
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("code") }]),
|
|
256
352
|
"data-tooltip": "行内代码",
|
|
257
353
|
"aria-label": "行内代码",
|
|
258
|
-
disabled:
|
|
259
|
-
onClick:
|
|
260
|
-
}, [
|
|
354
|
+
disabled: V.value,
|
|
355
|
+
onClick: o[3] ||= (e) => f(U)?.chain().focus().toggleCode().run()
|
|
356
|
+
}, [a("span", {
|
|
261
357
|
class: "dupdoc-toolbar-icon",
|
|
262
|
-
innerHTML:
|
|
263
|
-
}, null, 8,
|
|
264
|
-
|
|
358
|
+
innerHTML: H.code
|
|
359
|
+
}, null, 8, qe)], 10, Ke),
|
|
360
|
+
a("button", {
|
|
265
361
|
type: "button",
|
|
266
|
-
class:
|
|
362
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("subscript") }]),
|
|
267
363
|
"data-tooltip": "下标",
|
|
268
364
|
"aria-label": "下标",
|
|
269
|
-
disabled:
|
|
270
|
-
onClick:
|
|
271
|
-
}, [
|
|
365
|
+
disabled: V.value,
|
|
366
|
+
onClick: o[4] ||= (e) => f(U)?.chain().focus().toggleSubscript().run()
|
|
367
|
+
}, [a("span", {
|
|
272
368
|
class: "dupdoc-toolbar-icon",
|
|
273
|
-
innerHTML:
|
|
274
|
-
}, null, 8,
|
|
275
|
-
|
|
369
|
+
innerHTML: H.subscript
|
|
370
|
+
}, null, 8, Ye)], 10, Je),
|
|
371
|
+
a("button", {
|
|
276
372
|
type: "button",
|
|
277
|
-
class:
|
|
373
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("superscript") }]),
|
|
278
374
|
"data-tooltip": "上标",
|
|
279
375
|
"aria-label": "上标",
|
|
280
|
-
disabled:
|
|
281
|
-
onClick:
|
|
282
|
-
}, [
|
|
376
|
+
disabled: V.value,
|
|
377
|
+
onClick: o[5] ||= (e) => f(U)?.chain().focus().toggleSuperscript().run()
|
|
378
|
+
}, [a("span", {
|
|
283
379
|
class: "dupdoc-toolbar-icon",
|
|
284
|
-
innerHTML:
|
|
285
|
-
}, null, 8,
|
|
380
|
+
innerHTML: H.superscript
|
|
381
|
+
}, null, 8, Ze)], 10, Xe)
|
|
286
382
|
]),
|
|
287
|
-
|
|
383
|
+
a("div", Qe, [a("label", $e, [a("span", {
|
|
288
384
|
class: "dupdoc-toolbar-icon",
|
|
289
|
-
innerHTML:
|
|
290
|
-
}, null, 8,
|
|
385
|
+
innerHTML: H.textColor
|
|
386
|
+
}, null, 8, et), a("input", {
|
|
291
387
|
type: "color",
|
|
292
|
-
disabled:
|
|
388
|
+
disabled: V.value,
|
|
293
389
|
value: "#dc2626",
|
|
294
|
-
onInput:
|
|
295
|
-
}, null, 40,
|
|
390
|
+
onInput: jt
|
|
391
|
+
}, null, 40, tt)]), a("label", nt, [a("span", {
|
|
296
392
|
class: "dupdoc-toolbar-icon",
|
|
297
|
-
innerHTML:
|
|
298
|
-
}, null, 8,
|
|
393
|
+
innerHTML: H.highlightColor
|
|
394
|
+
}, null, 8, rt), a("input", {
|
|
299
395
|
type: "color",
|
|
300
|
-
disabled:
|
|
396
|
+
disabled: V.value,
|
|
301
397
|
value: "#fef08a",
|
|
302
|
-
onInput:
|
|
303
|
-
}, null, 40,
|
|
304
|
-
|
|
305
|
-
|
|
398
|
+
onInput: Mt
|
|
399
|
+
}, null, 40, it)])]),
|
|
400
|
+
a("div", at, [
|
|
401
|
+
a("button", {
|
|
306
402
|
type: "button",
|
|
307
|
-
class:
|
|
403
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive({ textAlign: "left" }) }]),
|
|
308
404
|
"data-tooltip": "左对齐",
|
|
309
405
|
"aria-label": "左对齐",
|
|
310
|
-
disabled:
|
|
311
|
-
onClick:
|
|
312
|
-
}, [
|
|
406
|
+
disabled: V.value,
|
|
407
|
+
onClick: o[6] ||= (e) => f(U)?.chain().focus().setTextAlign("left").run()
|
|
408
|
+
}, [a("span", {
|
|
313
409
|
class: "dupdoc-toolbar-icon",
|
|
314
|
-
innerHTML:
|
|
315
|
-
}, null, 8,
|
|
316
|
-
|
|
410
|
+
innerHTML: H.alignLeft
|
|
411
|
+
}, null, 8, st)], 10, ot),
|
|
412
|
+
a("button", {
|
|
317
413
|
type: "button",
|
|
318
|
-
class:
|
|
414
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive({ textAlign: "center" }) }]),
|
|
319
415
|
"data-tooltip": "居中对齐",
|
|
320
416
|
"aria-label": "居中对齐",
|
|
321
|
-
disabled:
|
|
322
|
-
onClick:
|
|
323
|
-
}, [
|
|
417
|
+
disabled: V.value,
|
|
418
|
+
onClick: o[7] ||= (e) => f(U)?.chain().focus().setTextAlign("center").run()
|
|
419
|
+
}, [a("span", {
|
|
324
420
|
class: "dupdoc-toolbar-icon",
|
|
325
|
-
innerHTML:
|
|
326
|
-
}, null, 8,
|
|
327
|
-
|
|
421
|
+
innerHTML: H.alignCenter
|
|
422
|
+
}, null, 8, lt)], 10, ct),
|
|
423
|
+
a("button", {
|
|
328
424
|
type: "button",
|
|
329
|
-
class:
|
|
425
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive({ textAlign: "right" }) }]),
|
|
330
426
|
"data-tooltip": "右对齐",
|
|
331
427
|
"aria-label": "右对齐",
|
|
332
|
-
disabled:
|
|
333
|
-
onClick:
|
|
334
|
-
}, [
|
|
428
|
+
disabled: V.value,
|
|
429
|
+
onClick: o[8] ||= (e) => f(U)?.chain().focus().setTextAlign("right").run()
|
|
430
|
+
}, [a("span", {
|
|
335
431
|
class: "dupdoc-toolbar-icon",
|
|
336
|
-
innerHTML:
|
|
337
|
-
}, null, 8,
|
|
432
|
+
innerHTML: H.alignRight
|
|
433
|
+
}, null, 8, dt)], 10, ut)
|
|
338
434
|
]),
|
|
339
|
-
|
|
340
|
-
|
|
435
|
+
a("div", ft, [
|
|
436
|
+
a("button", {
|
|
341
437
|
type: "button",
|
|
342
|
-
class:
|
|
438
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("bulletList") }]),
|
|
343
439
|
"data-tooltip": "无序列表",
|
|
344
440
|
"aria-label": "无序列表",
|
|
345
|
-
disabled:
|
|
346
|
-
onClick:
|
|
347
|
-
}, [
|
|
441
|
+
disabled: V.value,
|
|
442
|
+
onClick: o[9] ||= (e) => f(U)?.chain().focus().toggleBulletList().run()
|
|
443
|
+
}, [a("span", {
|
|
348
444
|
class: "dupdoc-toolbar-icon",
|
|
349
|
-
innerHTML:
|
|
350
|
-
}, null, 8,
|
|
351
|
-
|
|
445
|
+
innerHTML: H.bulletList
|
|
446
|
+
}, null, 8, mt)], 10, pt),
|
|
447
|
+
a("button", {
|
|
352
448
|
type: "button",
|
|
353
|
-
class:
|
|
449
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("orderedList") }]),
|
|
354
450
|
"data-tooltip": "有序列表",
|
|
355
451
|
"aria-label": "有序列表",
|
|
356
|
-
disabled:
|
|
357
|
-
onClick:
|
|
358
|
-
}, [
|
|
452
|
+
disabled: V.value,
|
|
453
|
+
onClick: o[10] ||= (e) => f(U)?.chain().focus().toggleOrderedList().run()
|
|
454
|
+
}, [a("span", {
|
|
359
455
|
class: "dupdoc-toolbar-icon",
|
|
360
|
-
innerHTML:
|
|
361
|
-
}, null, 8,
|
|
362
|
-
|
|
456
|
+
innerHTML: H.orderedList
|
|
457
|
+
}, null, 8, gt)], 10, ht),
|
|
458
|
+
a("button", {
|
|
363
459
|
type: "button",
|
|
364
|
-
class:
|
|
460
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("taskList") }]),
|
|
365
461
|
"data-tooltip": "任务列表",
|
|
366
462
|
"aria-label": "任务列表",
|
|
367
|
-
disabled:
|
|
368
|
-
onClick:
|
|
369
|
-
}, [
|
|
463
|
+
disabled: V.value,
|
|
464
|
+
onClick: o[11] ||= (e) => f(U)?.chain().focus().toggleTaskList().run()
|
|
465
|
+
}, [a("span", {
|
|
370
466
|
class: "dupdoc-toolbar-icon",
|
|
371
|
-
innerHTML:
|
|
372
|
-
}, null, 8,
|
|
373
|
-
|
|
467
|
+
innerHTML: H.taskList
|
|
468
|
+
}, null, 8, vt)], 10, _t),
|
|
469
|
+
a("button", {
|
|
374
470
|
type: "button",
|
|
375
|
-
class:
|
|
471
|
+
class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("blockquote") }]),
|
|
376
472
|
"data-tooltip": "引用",
|
|
377
473
|
"aria-label": "引用",
|
|
378
|
-
disabled:
|
|
379
|
-
onClick:
|
|
380
|
-
}, [
|
|
474
|
+
disabled: V.value,
|
|
475
|
+
onClick: o[12] ||= (e) => f(U)?.chain().focus().toggleBlockquote().run()
|
|
476
|
+
}, [a("span", {
|
|
381
477
|
class: "dupdoc-toolbar-icon",
|
|
382
|
-
innerHTML:
|
|
383
|
-
}, null, 8,
|
|
384
|
-
|
|
478
|
+
innerHTML: H.quote
|
|
479
|
+
}, null, 8, bt)], 10, yt),
|
|
480
|
+
a("button", {
|
|
385
481
|
type: "button",
|
|
386
482
|
class: "dupdoc-toolbar-button",
|
|
387
483
|
"data-tooltip": "插入分割线",
|
|
388
484
|
"aria-label": "插入分割线",
|
|
389
|
-
disabled:
|
|
390
|
-
onClick:
|
|
391
|
-
}, [
|
|
485
|
+
disabled: V.value,
|
|
486
|
+
onClick: o[13] ||= (e) => f(U)?.chain().focus().setHorizontalRule().run()
|
|
487
|
+
}, [a("span", {
|
|
392
488
|
class: "dupdoc-toolbar-icon",
|
|
393
|
-
innerHTML:
|
|
394
|
-
}, null, 8,
|
|
395
|
-
|
|
489
|
+
innerHTML: H.divider
|
|
490
|
+
}, null, 8, St)], 8, xt),
|
|
491
|
+
a("button", {
|
|
396
492
|
type: "button",
|
|
397
493
|
class: "dupdoc-toolbar-button",
|
|
398
494
|
"data-tooltip": "插入基础表格",
|
|
399
495
|
"aria-label": "插入基础表格",
|
|
400
|
-
disabled:
|
|
401
|
-
onClick:
|
|
402
|
-
}, [
|
|
496
|
+
disabled: V.value,
|
|
497
|
+
onClick: Nt
|
|
498
|
+
}, [a("span", {
|
|
403
499
|
class: "dupdoc-toolbar-icon",
|
|
404
|
-
innerHTML:
|
|
405
|
-
}, null, 8,
|
|
500
|
+
innerHTML: H.table
|
|
501
|
+
}, null, 8, wt)], 8, Ct)
|
|
406
502
|
]),
|
|
407
|
-
|
|
503
|
+
a("div", Tt, [a("button", {
|
|
408
504
|
type: "button",
|
|
409
505
|
class: "dupdoc-toolbar-button dupdoc-toolbar-button--primary",
|
|
410
506
|
"data-tooltip": "定位当前重复点",
|
|
411
507
|
"aria-label": "定位当前重复点",
|
|
412
|
-
onClick:
|
|
413
|
-
}, [
|
|
508
|
+
onClick: Ft
|
|
509
|
+
}, [a("span", {
|
|
414
510
|
class: "dupdoc-toolbar-icon",
|
|
415
|
-
innerHTML:
|
|
416
|
-
}, null, 8,
|
|
417
|
-
]),
|
|
511
|
+
innerHTML: H.locate
|
|
512
|
+
}, null, 8, Et)])])
|
|
513
|
+
]), a("div", {
|
|
514
|
+
ref_key: "editorBodyRef",
|
|
515
|
+
ref: P,
|
|
516
|
+
class: "dupdoc-editor__body"
|
|
517
|
+
}, [f(U) ? (u(), n(f(be), {
|
|
518
|
+
key: 0,
|
|
519
|
+
editor: f(U)
|
|
520
|
+
}, null, 8, ["editor"])) : r("", !0), (u(), n(e, { to: "body" }, [I.value && R.value && Ot["selection-popup"] ? (u(), i("div", {
|
|
418
521
|
key: 0,
|
|
419
|
-
|
|
420
|
-
|
|
522
|
+
ref_key: "popupRef",
|
|
523
|
+
ref: F,
|
|
524
|
+
class: "dupdoc-selection-popup",
|
|
525
|
+
style: ee({
|
|
526
|
+
position: "fixed",
|
|
527
|
+
top: L.value.top + "px",
|
|
528
|
+
left: L.value.left + "px",
|
|
529
|
+
maxWidth: "100vw",
|
|
530
|
+
maxHeight: "100vh",
|
|
531
|
+
width: "auto",
|
|
532
|
+
height: "auto"
|
|
533
|
+
})
|
|
534
|
+
}, [te(t.$slots, "selection-popup", {
|
|
535
|
+
documentId: j.documentModel.documentId,
|
|
536
|
+
selection: R.value,
|
|
537
|
+
overlappingEntries: z.value,
|
|
538
|
+
visible: I.value,
|
|
539
|
+
position: L.value
|
|
540
|
+
})], 4)) : r("", !0)]))], 512)], 512));
|
|
421
541
|
}
|
|
422
542
|
});
|
|
423
543
|
//#endregion
|
|
424
|
-
export {
|
|
544
|
+
export { A as DuplicateDocumentEditor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jhl548/duplicate-doc-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"typecheck": "vue-tsc -p tsconfig.json --noEmit"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@jhl548/duplicate-doc-core": "0.1.
|
|
30
|
+
"@jhl548/duplicate-doc-core": "0.1.3",
|
|
31
31
|
"@tiptap/extension-color": "^3.23.4",
|
|
32
32
|
"@tiptap/extension-highlight": "^3.23.4",
|
|
33
33
|
"@tiptap/extension-image": "^3.23.4",
|