@jhl548/duplicate-doc-vue 0.1.3 → 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.
@@ -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 __VLS_export: import('vue').DefineComponent<__VLS_Props, {
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 { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, nextTick as o, normalizeClass as s, onBeforeUnmount as ee, openBlock as c, ref as l, unref as u, watch as d } from "vue";
2
- import { DuplicateHighlightExtension as te, plainTextFromHtml as f, scrollToActiveHighlight as p } from "@jhl548/duplicate-doc-core";
3
- import { Color as ne } from "@tiptap/extension-color";
4
- import { Highlight as re } from "@tiptap/extension-highlight";
5
- import { Image as ie } from "@tiptap/extension-image";
6
- import { Subscript as ae } from "@tiptap/extension-subscript";
7
- import { Superscript as oe } from "@tiptap/extension-superscript";
8
- import { Table as se } from "@tiptap/extension-table";
9
- import { TableCell as ce } from "@tiptap/extension-table-cell";
10
- import { TableHeader as le } from "@tiptap/extension-table-header";
11
- import { TableRow as ue } from "@tiptap/extension-table-row";
12
- import { TaskItem as de } from "@tiptap/extension-task-item";
13
- import { TaskList as fe } from "@tiptap/extension-task-list";
14
- import { TextAlign as m } from "@tiptap/extension-text-align";
15
- import { TextStyle as h } from "@tiptap/extension-text-style";
16
- import g from "@tiptap/starter-kit";
17
- import { EditorContent as _, useEditor as v } from "@tiptap/vue-3";
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 y = "<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", b = "<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", x = "<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", S = "<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", C = "<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", w = "<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", T = "<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", E = "<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", D = "<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", O = "<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", k = "<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", A = "<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", j = "<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", M = "<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", N = "<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", P = "<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", F = "<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", I = "<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", L = "<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", R = "<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", z = {
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
- }, B = {
23
+ }, Me = {
24
24
  class: "dupdoc-editor__toolbar-group dupdoc-editor__toolbar-group--history",
25
25
  "aria-label": "历史操作"
26
- }, V = ["aria-disabled"], pe = ["innerHTML"], me = ["aria-disabled"], he = ["innerHTML"], ge = { class: "dupdoc-editor__toolbar-group dupdoc-editor__toolbar-group--select" }, _e = ["value", "disabled"], ve = {
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
- }, ye = ["disabled"], be = ["innerHTML"], xe = ["disabled"], Se = ["innerHTML"], Ce = ["disabled"], we = ["innerHTML"], Te = ["disabled"], H = ["innerHTML"], Ee = ["disabled"], De = ["innerHTML"], Oe = ["disabled"], ke = ["innerHTML"], Ae = {
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
- }, je = {
32
+ }, $e = {
33
33
  class: "dupdoc-toolbar-color",
34
34
  "data-tooltip": "文字颜色",
35
35
  "aria-label": "文字颜色"
36
- }, Me = ["innerHTML"], Ne = ["disabled"], Pe = {
36
+ }, et = ["innerHTML"], tt = ["disabled"], nt = {
37
37
  class: "dupdoc-toolbar-color",
38
38
  "data-tooltip": "高亮颜色",
39
39
  "aria-label": "高亮颜色"
40
- }, Fe = ["innerHTML"], Ie = ["disabled"], Le = {
40
+ }, rt = ["innerHTML"], it = ["disabled"], at = {
41
41
  class: "dupdoc-editor__toolbar-group",
42
42
  "aria-label": "段落对齐"
43
- }, Re = ["disabled"], ze = ["innerHTML"], Be = ["disabled"], Ve = ["innerHTML"], He = ["disabled"], Ue = ["innerHTML"], We = {
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
- }, Ge = ["disabled"], Ke = ["innerHTML"], qe = ["disabled"], Je = ["innerHTML"], Ye = ["disabled"], Xe = ["innerHTML"], Ze = ["disabled"], Qe = ["innerHTML"], $e = ["disabled"], et = ["innerHTML"], tt = ["disabled"], nt = ["innerHTML"], rt = {
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
- }, it = ["innerHTML"], at = { class: "dupdoc-editor__body" }, U = /* @__PURE__ */ a({
49
+ }, Et = ["innerHTML"], A = /* @__PURE__ */ o({
50
50
  __name: "DuplicateDocumentEditor",
51
51
  props: {
52
52
  documentModel: {},
@@ -60,71 +60,86 @@ var y = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"
60
60
  default: !0
61
61
  }
62
62
  },
63
- emits: ["change", "ready"],
64
- setup(a, { expose: U, emit: ot }) {
65
- let W = a, G = ot, K = l(null), q = l(""), J = e(() => !W.editable || !X.value), Y = {
66
- alignCenter: y,
67
- alignLeft: b,
68
- alignRight: x,
69
- bold: S,
70
- bulletList: C,
71
- code: w,
72
- divider: T,
73
- highlightColor: E,
74
- italic: D,
75
- locate: O,
76
- orderedList: k,
77
- quote: A,
78
- redo: j,
79
- strike: M,
80
- subscript: N,
81
- superscript: P,
82
- table: F,
83
- taskList: I,
84
- textColor: L,
85
- undo: R
86
- }, st = e(() => X.value?.isActive("heading", { level: 1 }) ? "heading-1" : X.value?.isActive("heading", { level: 2 }) ? "heading-2" : X.value?.isActive("heading", { level: 3 }) ? "heading-3" : "paragraph"), X = v({
87
- content: W.documentModel.html,
88
- editable: W.editable,
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
- g,
91
- h,
92
- ne,
93
- re.configure({ multicolor: !0 }),
94
- ie.configure({
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
- m.configure({ types: ["heading", "paragraph"] }),
99
- ae,
100
- oe,
101
- fe,
102
- de.configure({ nested: !0 }),
103
- se.configure({ resizable: !0 }),
104
- ue,
106
+ _e.configure({ types: ["heading", "paragraph"] }),
105
107
  le,
106
- ce,
107
- te
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(W.highlights), G("ready");
119
+ e.commands.setDuplicateHighlights(j.highlights), M("ready");
112
120
  },
113
121
  onUpdate: ({ editor: e }) => {
114
- G("change", Z(e));
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 Z(e) {
118
- let t = e ?? X.value;
132
+ function W(e) {
133
+ let t = e ?? U.value;
119
134
  return {
120
- documentId: W.documentModel.documentId,
121
- html: t?.getHTML() ?? W.documentModel.html,
122
- plainText: t?.getText() ?? f(W.documentModel.html),
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 ct(e) {
127
- let t = e.target.value, n = X.value?.chain().focus();
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,33 +148,33 @@ var y = "<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 lt(e) {
151
+ function jt(e) {
137
152
  let t = e.target.value;
138
- X.value?.chain().focus().setColor(t).run();
153
+ U.value?.chain().focus().setColor(t).run();
139
154
  }
140
- function ut(e) {
155
+ function Mt(e) {
141
156
  let t = e.target.value;
142
- X.value?.chain().focus().toggleHighlight({ color: t }).run();
157
+ U.value?.chain().focus().toggleHighlight({ color: t }).run();
143
158
  }
144
- function dt() {
145
- X.value?.chain().focus().insertTable({
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 ft() {
152
- J.value || !X.value?.can().undo() || X.value.chain().focus().undo().run();
166
+ function Pt() {
167
+ V.value || !U.value?.can().undo() || U.value.chain().focus().undo().run();
153
168
  }
154
- function pt() {
155
- J.value || !X.value?.can().redo() || X.value.chain().focus().redo().run();
169
+ function G() {
170
+ V.value || !U.value?.can().redo() || U.value.chain().focus().redo().run();
156
171
  }
157
- function mt() {
158
- o(() => {
159
- p(K.value);
172
+ function Ft() {
173
+ s(() => {
174
+ v(N.value);
160
175
  });
161
176
  }
162
- function Q(e = W.highlights) {
177
+ function K(e = j.highlights) {
163
178
  return e.map((e) => [
164
179
  e.documentId,
165
180
  e.duplicateId,
@@ -178,267 +193,352 @@ var y = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"
178
193
  ].join(":")).join("|")
179
194
  ].join("::")).join(";;");
180
195
  }
181
- function $(e = W.autofocusHighlight, t = !1) {
182
- let n = Q();
183
- !t && n === q.value || (X.value?.commands.setDuplicateHighlights(W.highlights), q.value = n, e && o(() => {
184
- p(K.value);
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
+ });
208
+ }
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();
222
+ });
223
+ }
224
+ let q = 0;
225
+ function J() {
226
+ q ||= window.requestAnimationFrame(() => {
227
+ q = 0, Lt();
228
+ });
229
+ }
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);
185
261
  }));
186
262
  }
187
- return d(() => [W.documentModel.documentId, W.documentModel.html], ([e], [t]) => {
188
- if (!X.value) return;
263
+ return p(() => [j.documentModel.documentId, j.documentModel.html], ([e], [t]) => {
264
+ if (!U.value) return;
189
265
  let n = e === t;
190
- if (X.value.getHTML() !== W.documentModel.html) {
191
- X.value.commands.setContent(W.documentModel.html, { emitUpdate: !1 }), $(!n && W.autofocusHighlight, !0);
266
+ if (U.value.getHTML() !== j.documentModel.html) {
267
+ U.value.commands.setContent(j.documentModel.html, { emitUpdate: !1 }), $(!n && j.autofocusHighlight, !0);
192
268
  return;
193
269
  }
194
- n || $(W.autofocusHighlight, !0);
195
- }), d(() => Q(), () => $()), d(() => W.editable, (e) => X.value?.setEditable(e)), ee(() => {
196
- X.value?.destroy();
197
- }), U({
198
- getSnapshot: Z,
199
- getHTML: () => X.value?.getHTML() ?? W.documentModel.html,
200
- getPlainText: () => X.value?.getText() ?? f(W.documentModel.html),
201
- focus: () => X.value?.commands.focus()
202
- }), (e, a) => (c(), r("div", {
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", {
203
279
  ref_key: "editorShellRef",
204
- ref: K,
280
+ ref: N,
205
281
  class: "dupdoc-editor"
206
- }, [i("div", z, [
207
- i("div", B, [i("button", {
282
+ }, [a("div", je, [
283
+ a("div", Me, [a("button", {
208
284
  type: "button",
209
- class: s(["dupdoc-toolbar-button", { "is-disabled": J.value || !u(X)?.can().undo() }]),
285
+ class: c(["dupdoc-toolbar-button", { "is-disabled": V.value || !f(U)?.can().undo() }]),
210
286
  "data-tooltip": "撤销",
211
287
  "aria-label": "撤销",
212
- "aria-disabled": J.value || !u(X)?.can().undo(),
213
- onClick: ft
214
- }, [i("span", {
288
+ "aria-disabled": V.value || !f(U)?.can().undo(),
289
+ onClick: Pt
290
+ }, [a("span", {
215
291
  class: "dupdoc-toolbar-icon",
216
- innerHTML: Y.undo
217
- }, null, 8, pe)], 10, V), i("button", {
292
+ innerHTML: H.undo
293
+ }, null, 8, Pe)], 10, Ne), a("button", {
218
294
  type: "button",
219
- class: s(["dupdoc-toolbar-button", { "is-disabled": J.value || !u(X)?.can().redo() }]),
295
+ class: c(["dupdoc-toolbar-button", { "is-disabled": V.value || !f(U)?.can().redo() }]),
220
296
  "data-tooltip": "重做",
221
297
  "aria-label": "重做",
222
- "aria-disabled": J.value || !u(X)?.can().redo(),
223
- onClick: pt
224
- }, [i("span", {
298
+ "aria-disabled": V.value || !f(U)?.can().redo(),
299
+ onClick: G
300
+ }, [a("span", {
225
301
  class: "dupdoc-toolbar-icon",
226
- innerHTML: Y.redo
227
- }, null, 8, he)], 10, me)]),
228
- i("div", ge, [i("select", {
229
- value: st.value,
230
- disabled: J.value,
302
+ innerHTML: H.redo
303
+ }, null, 8, Ie)], 10, Fe)]),
304
+ a("div", Le, [a("select", {
305
+ value: kt.value,
306
+ disabled: V.value,
231
307
  "aria-label": "选择文本层级",
232
- onChange: ct
233
- }, [...a[14] ||= [
234
- i("option", { value: "paragraph" }, "P", -1),
235
- i("option", { value: "heading-1" }, "H1", -1),
236
- i("option", { value: "heading-2" }, "H2", -1),
237
- i("option", { value: "heading-3" }, "H3", -1)
238
- ]], 40, _e)]),
239
- i("div", ve, [
240
- i("button", {
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", {
241
317
  type: "button",
242
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("bold") }]),
318
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("bold") }]),
243
319
  "data-tooltip": "加粗",
244
320
  "aria-label": "加粗",
245
- disabled: J.value,
246
- onClick: a[0] ||= (e) => u(X)?.chain().focus().toggleBold().run()
247
- }, [i("span", {
321
+ disabled: V.value,
322
+ onClick: o[0] ||= (e) => f(U)?.chain().focus().toggleBold().run()
323
+ }, [a("span", {
248
324
  class: "dupdoc-toolbar-icon",
249
- innerHTML: Y.bold
250
- }, null, 8, be)], 10, ye),
251
- i("button", {
325
+ innerHTML: H.bold
326
+ }, null, 8, Ve)], 10, Be),
327
+ a("button", {
252
328
  type: "button",
253
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("italic") }]),
329
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("italic") }]),
254
330
  "data-tooltip": "斜体",
255
331
  "aria-label": "斜体",
256
- disabled: J.value,
257
- onClick: a[1] ||= (e) => u(X)?.chain().focus().toggleItalic().run()
258
- }, [i("span", {
332
+ disabled: V.value,
333
+ onClick: o[1] ||= (e) => f(U)?.chain().focus().toggleItalic().run()
334
+ }, [a("span", {
259
335
  class: "dupdoc-toolbar-icon",
260
- innerHTML: Y.italic
261
- }, null, 8, Se)], 10, xe),
262
- i("button", {
336
+ innerHTML: H.italic
337
+ }, null, 8, Ue)], 10, He),
338
+ a("button", {
263
339
  type: "button",
264
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("strike") }]),
340
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("strike") }]),
265
341
  "data-tooltip": "删除线",
266
342
  "aria-label": "删除线",
267
- disabled: J.value,
268
- onClick: a[2] ||= (e) => u(X)?.chain().focus().toggleStrike().run()
269
- }, [i("span", {
343
+ disabled: V.value,
344
+ onClick: o[2] ||= (e) => f(U)?.chain().focus().toggleStrike().run()
345
+ }, [a("span", {
270
346
  class: "dupdoc-toolbar-icon",
271
- innerHTML: Y.strike
272
- }, null, 8, we)], 10, Ce),
273
- i("button", {
347
+ innerHTML: H.strike
348
+ }, null, 8, Ge)], 10, We),
349
+ a("button", {
274
350
  type: "button",
275
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("code") }]),
351
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("code") }]),
276
352
  "data-tooltip": "行内代码",
277
353
  "aria-label": "行内代码",
278
- disabled: J.value,
279
- onClick: a[3] ||= (e) => u(X)?.chain().focus().toggleCode().run()
280
- }, [i("span", {
354
+ disabled: V.value,
355
+ onClick: o[3] ||= (e) => f(U)?.chain().focus().toggleCode().run()
356
+ }, [a("span", {
281
357
  class: "dupdoc-toolbar-icon",
282
- innerHTML: Y.code
283
- }, null, 8, H)], 10, Te),
284
- i("button", {
358
+ innerHTML: H.code
359
+ }, null, 8, qe)], 10, Ke),
360
+ a("button", {
285
361
  type: "button",
286
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("subscript") }]),
362
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("subscript") }]),
287
363
  "data-tooltip": "下标",
288
364
  "aria-label": "下标",
289
- disabled: J.value,
290
- onClick: a[4] ||= (e) => u(X)?.chain().focus().toggleSubscript().run()
291
- }, [i("span", {
365
+ disabled: V.value,
366
+ onClick: o[4] ||= (e) => f(U)?.chain().focus().toggleSubscript().run()
367
+ }, [a("span", {
292
368
  class: "dupdoc-toolbar-icon",
293
- innerHTML: Y.subscript
294
- }, null, 8, De)], 10, Ee),
295
- i("button", {
369
+ innerHTML: H.subscript
370
+ }, null, 8, Ye)], 10, Je),
371
+ a("button", {
296
372
  type: "button",
297
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("superscript") }]),
373
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("superscript") }]),
298
374
  "data-tooltip": "上标",
299
375
  "aria-label": "上标",
300
- disabled: J.value,
301
- onClick: a[5] ||= (e) => u(X)?.chain().focus().toggleSuperscript().run()
302
- }, [i("span", {
376
+ disabled: V.value,
377
+ onClick: o[5] ||= (e) => f(U)?.chain().focus().toggleSuperscript().run()
378
+ }, [a("span", {
303
379
  class: "dupdoc-toolbar-icon",
304
- innerHTML: Y.superscript
305
- }, null, 8, ke)], 10, Oe)
380
+ innerHTML: H.superscript
381
+ }, null, 8, Ze)], 10, Xe)
306
382
  ]),
307
- i("div", Ae, [i("label", je, [i("span", {
383
+ a("div", Qe, [a("label", $e, [a("span", {
308
384
  class: "dupdoc-toolbar-icon",
309
- innerHTML: Y.textColor
310
- }, null, 8, Me), i("input", {
385
+ innerHTML: H.textColor
386
+ }, null, 8, et), a("input", {
311
387
  type: "color",
312
- disabled: J.value,
388
+ disabled: V.value,
313
389
  value: "#dc2626",
314
- onInput: lt
315
- }, null, 40, Ne)]), i("label", Pe, [i("span", {
390
+ onInput: jt
391
+ }, null, 40, tt)]), a("label", nt, [a("span", {
316
392
  class: "dupdoc-toolbar-icon",
317
- innerHTML: Y.highlightColor
318
- }, null, 8, Fe), i("input", {
393
+ innerHTML: H.highlightColor
394
+ }, null, 8, rt), a("input", {
319
395
  type: "color",
320
- disabled: J.value,
396
+ disabled: V.value,
321
397
  value: "#fef08a",
322
- onInput: ut
323
- }, null, 40, Ie)])]),
324
- i("div", Le, [
325
- i("button", {
398
+ onInput: Mt
399
+ }, null, 40, it)])]),
400
+ a("div", at, [
401
+ a("button", {
326
402
  type: "button",
327
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive({ textAlign: "left" }) }]),
403
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive({ textAlign: "left" }) }]),
328
404
  "data-tooltip": "左对齐",
329
405
  "aria-label": "左对齐",
330
- disabled: J.value,
331
- onClick: a[6] ||= (e) => u(X)?.chain().focus().setTextAlign("left").run()
332
- }, [i("span", {
406
+ disabled: V.value,
407
+ onClick: o[6] ||= (e) => f(U)?.chain().focus().setTextAlign("left").run()
408
+ }, [a("span", {
333
409
  class: "dupdoc-toolbar-icon",
334
- innerHTML: Y.alignLeft
335
- }, null, 8, ze)], 10, Re),
336
- i("button", {
410
+ innerHTML: H.alignLeft
411
+ }, null, 8, st)], 10, ot),
412
+ a("button", {
337
413
  type: "button",
338
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive({ textAlign: "center" }) }]),
414
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive({ textAlign: "center" }) }]),
339
415
  "data-tooltip": "居中对齐",
340
416
  "aria-label": "居中对齐",
341
- disabled: J.value,
342
- onClick: a[7] ||= (e) => u(X)?.chain().focus().setTextAlign("center").run()
343
- }, [i("span", {
417
+ disabled: V.value,
418
+ onClick: o[7] ||= (e) => f(U)?.chain().focus().setTextAlign("center").run()
419
+ }, [a("span", {
344
420
  class: "dupdoc-toolbar-icon",
345
- innerHTML: Y.alignCenter
346
- }, null, 8, Ve)], 10, Be),
347
- i("button", {
421
+ innerHTML: H.alignCenter
422
+ }, null, 8, lt)], 10, ct),
423
+ a("button", {
348
424
  type: "button",
349
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive({ textAlign: "right" }) }]),
425
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive({ textAlign: "right" }) }]),
350
426
  "data-tooltip": "右对齐",
351
427
  "aria-label": "右对齐",
352
- disabled: J.value,
353
- onClick: a[8] ||= (e) => u(X)?.chain().focus().setTextAlign("right").run()
354
- }, [i("span", {
428
+ disabled: V.value,
429
+ onClick: o[8] ||= (e) => f(U)?.chain().focus().setTextAlign("right").run()
430
+ }, [a("span", {
355
431
  class: "dupdoc-toolbar-icon",
356
- innerHTML: Y.alignRight
357
- }, null, 8, Ue)], 10, He)
432
+ innerHTML: H.alignRight
433
+ }, null, 8, dt)], 10, ut)
358
434
  ]),
359
- i("div", We, [
360
- i("button", {
435
+ a("div", ft, [
436
+ a("button", {
361
437
  type: "button",
362
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("bulletList") }]),
438
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("bulletList") }]),
363
439
  "data-tooltip": "无序列表",
364
440
  "aria-label": "无序列表",
365
- disabled: J.value,
366
- onClick: a[9] ||= (e) => u(X)?.chain().focus().toggleBulletList().run()
367
- }, [i("span", {
441
+ disabled: V.value,
442
+ onClick: o[9] ||= (e) => f(U)?.chain().focus().toggleBulletList().run()
443
+ }, [a("span", {
368
444
  class: "dupdoc-toolbar-icon",
369
- innerHTML: Y.bulletList
370
- }, null, 8, Ke)], 10, Ge),
371
- i("button", {
445
+ innerHTML: H.bulletList
446
+ }, null, 8, mt)], 10, pt),
447
+ a("button", {
372
448
  type: "button",
373
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("orderedList") }]),
449
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("orderedList") }]),
374
450
  "data-tooltip": "有序列表",
375
451
  "aria-label": "有序列表",
376
- disabled: J.value,
377
- onClick: a[10] ||= (e) => u(X)?.chain().focus().toggleOrderedList().run()
378
- }, [i("span", {
452
+ disabled: V.value,
453
+ onClick: o[10] ||= (e) => f(U)?.chain().focus().toggleOrderedList().run()
454
+ }, [a("span", {
379
455
  class: "dupdoc-toolbar-icon",
380
- innerHTML: Y.orderedList
381
- }, null, 8, Je)], 10, qe),
382
- i("button", {
456
+ innerHTML: H.orderedList
457
+ }, null, 8, gt)], 10, ht),
458
+ a("button", {
383
459
  type: "button",
384
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("taskList") }]),
460
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("taskList") }]),
385
461
  "data-tooltip": "任务列表",
386
462
  "aria-label": "任务列表",
387
- disabled: J.value,
388
- onClick: a[11] ||= (e) => u(X)?.chain().focus().toggleTaskList().run()
389
- }, [i("span", {
463
+ disabled: V.value,
464
+ onClick: o[11] ||= (e) => f(U)?.chain().focus().toggleTaskList().run()
465
+ }, [a("span", {
390
466
  class: "dupdoc-toolbar-icon",
391
- innerHTML: Y.taskList
392
- }, null, 8, Xe)], 10, Ye),
393
- i("button", {
467
+ innerHTML: H.taskList
468
+ }, null, 8, vt)], 10, _t),
469
+ a("button", {
394
470
  type: "button",
395
- class: s(["dupdoc-toolbar-button", { active: u(X)?.isActive("blockquote") }]),
471
+ class: c(["dupdoc-toolbar-button", { active: f(U)?.isActive("blockquote") }]),
396
472
  "data-tooltip": "引用",
397
473
  "aria-label": "引用",
398
- disabled: J.value,
399
- onClick: a[12] ||= (e) => u(X)?.chain().focus().toggleBlockquote().run()
400
- }, [i("span", {
474
+ disabled: V.value,
475
+ onClick: o[12] ||= (e) => f(U)?.chain().focus().toggleBlockquote().run()
476
+ }, [a("span", {
401
477
  class: "dupdoc-toolbar-icon",
402
- innerHTML: Y.quote
403
- }, null, 8, Qe)], 10, Ze),
404
- i("button", {
478
+ innerHTML: H.quote
479
+ }, null, 8, bt)], 10, yt),
480
+ a("button", {
405
481
  type: "button",
406
482
  class: "dupdoc-toolbar-button",
407
483
  "data-tooltip": "插入分割线",
408
484
  "aria-label": "插入分割线",
409
- disabled: J.value,
410
- onClick: a[13] ||= (e) => u(X)?.chain().focus().setHorizontalRule().run()
411
- }, [i("span", {
485
+ disabled: V.value,
486
+ onClick: o[13] ||= (e) => f(U)?.chain().focus().setHorizontalRule().run()
487
+ }, [a("span", {
412
488
  class: "dupdoc-toolbar-icon",
413
- innerHTML: Y.divider
414
- }, null, 8, et)], 8, $e),
415
- i("button", {
489
+ innerHTML: H.divider
490
+ }, null, 8, St)], 8, xt),
491
+ a("button", {
416
492
  type: "button",
417
493
  class: "dupdoc-toolbar-button",
418
494
  "data-tooltip": "插入基础表格",
419
495
  "aria-label": "插入基础表格",
420
- disabled: J.value,
421
- onClick: dt
422
- }, [i("span", {
496
+ disabled: V.value,
497
+ onClick: Nt
498
+ }, [a("span", {
423
499
  class: "dupdoc-toolbar-icon",
424
- innerHTML: Y.table
425
- }, null, 8, nt)], 8, tt)
500
+ innerHTML: H.table
501
+ }, null, 8, wt)], 8, Ct)
426
502
  ]),
427
- i("div", rt, [i("button", {
503
+ a("div", Tt, [a("button", {
428
504
  type: "button",
429
505
  class: "dupdoc-toolbar-button dupdoc-toolbar-button--primary",
430
506
  "data-tooltip": "定位当前重复点",
431
507
  "aria-label": "定位当前重复点",
432
- onClick: mt
433
- }, [i("span", {
508
+ onClick: Ft
509
+ }, [a("span", {
434
510
  class: "dupdoc-toolbar-icon",
435
- innerHTML: Y.locate
436
- }, null, 8, it)])])
437
- ]), i("div", at, [u(X) ? (c(), t(u(_), {
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", {
438
521
  key: 0,
439
- editor: u(X)
440
- }, null, 8, ["editor"])) : n("", !0)])], 512));
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));
441
541
  }
442
542
  });
443
543
  //#endregion
444
- export { U as DuplicateDocumentEditor };
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",
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.2",
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",