reactjs-tiptap-editor 0.3.30 → 0.4.0
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 +8 -2
- package/lib/{ActionMenuButton-wiDnIxE2.cjs → ActionMenuButton-CYdM1xx5.cjs} +1 -1
- package/lib/{ActionMenuButton-B6fitGKu.js → ActionMenuButton-DKRF6oa0.js} +5 -5
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.d.cts +47 -51
- package/lib/Attachment.d.ts +47 -51
- package/lib/Attachment.js +7 -6
- package/lib/BaseKit.cjs +3 -0
- package/lib/BaseKit.d.cts +481 -0
- package/lib/BaseKit.d.ts +481 -0
- package/lib/BaseKit.js +132 -0
- package/lib/Blockquote.cjs +5 -1
- package/lib/Blockquote.d.cts +47 -51
- package/lib/Blockquote.d.ts +47 -51
- package/lib/Blockquote.js +33 -17
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +47 -51
- package/lib/Bold.d.ts +47 -51
- package/lib/Bold.js +23 -16
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +48 -52
- package/lib/BulletList.d.ts +48 -52
- package/lib/BulletList.js +11 -57
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +47 -51
- package/lib/Clear.d.ts +47 -51
- package/lib/Clear.js +4 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +47 -51
- package/lib/Code.d.ts +47 -51
- package/lib/Code.js +29 -25
- package/lib/CodeBlock.cjs +2 -2
- package/lib/CodeBlock.d.cts +47 -51
- package/lib/CodeBlock.d.ts +47 -51
- package/lib/CodeBlock.js +5 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +47 -51
- package/lib/CodeView.d.ts +47 -51
- package/lib/CodeView.js +3 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +48 -52
- package/lib/Color.d.ts +48 -52
- package/lib/Color.js +42 -74
- package/lib/Document.cjs +1 -1
- package/lib/Document.d.cts +47 -51
- package/lib/Document.d.ts +47 -51
- package/lib/Document.js +4 -8
- package/lib/{Drawer-BKTU9CpU.js → Drawer-CaAfmqNo.js} +268 -265
- package/lib/Drawer-CdvCMSzN.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +47 -51
- package/lib/Drawer.d.ts +47 -51
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +50 -52
- package/lib/Emoji.d.ts +50 -52
- package/lib/Emoji.js +19790 -178
- package/lib/Excalidraw-BbMQhNvs.cjs +1 -0
- package/lib/Excalidraw-CVWz2Vyn.js +290 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +47 -51
- package/lib/Excalidraw.d.ts +47 -51
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +47 -51
- package/lib/ExportPdf.d.ts +47 -51
- package/lib/ExportPdf.js +4 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +47 -51
- package/lib/ExportWord.d.ts +47 -51
- package/lib/ExportWord.js +22 -51
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +48 -52
- package/lib/FontFamily.d.ts +48 -52
- package/lib/FontFamily.js +46 -74
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +47 -51
- package/lib/FontSize.d.ts +47 -51
- package/lib/FontSize.js +11 -8
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +47 -51
- package/lib/FormatPainter.d.ts +47 -51
- package/lib/FormatPainter.js +4 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +47 -51
- package/lib/Heading.d.ts +47 -51
- package/lib/Heading.js +77 -65
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +47 -51
- package/lib/Highlight.d.ts +47 -51
- package/lib/Highlight.js +5 -4
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +49 -53
- package/lib/History.d.ts +49 -53
- package/lib/History.js +39 -403
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +47 -51
- package/lib/HorizontalRule.d.ts +47 -51
- package/lib/HorizontalRule.js +16 -65
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +47 -51
- package/lib/Iframe.d.ts +47 -51
- package/lib/Iframe.js +4 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +47 -51
- package/lib/Image.d.ts +47 -51
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +47 -51
- package/lib/ImageGif.d.ts +47 -51
- package/lib/ImageGif.js +5 -5
- package/lib/ImportWord.cjs +72 -72
- package/lib/ImportWord.d.cts +47 -51
- package/lib/ImportWord.d.ts +47 -51
- package/lib/ImportWord.js +5654 -5616
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +47 -51
- package/lib/Indent.d.ts +47 -51
- package/lib/Indent.js +4 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +47 -51
- package/lib/Italic.d.ts +47 -51
- package/lib/Italic.js +20 -14
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +47 -51
- package/lib/Katex.d.ts +47 -51
- package/lib/Katex.js +49 -48
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +47 -51
- package/lib/LineHeight.d.ts +47 -51
- package/lib/LineHeight.js +21 -18
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +47 -51
- package/lib/Link.d.ts +47 -51
- package/lib/Link.js +4 -4
- package/lib/ListItem.cjs +1 -1
- package/lib/ListItem.d.cts +52 -52
- package/lib/ListItem.d.ts +52 -52
- package/lib/ListItem.js +4 -30
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +47 -51
- package/lib/Mention.d.ts +47 -51
- package/lib/Mention.js +161 -132
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.d.cts +47 -51
- package/lib/Mermaid.d.ts +47 -51
- package/lib/Mermaid.js +150 -147
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +47 -51
- package/lib/MoreMark.d.ts +47 -51
- package/lib/MoreMark.js +5 -3
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +47 -51
- package/lib/MultiColumn.d.ts +47 -51
- package/lib/MultiColumn.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +48 -52
- package/lib/OrderedList.d.ts +48 -52
- package/lib/OrderedList.js +11 -75
- package/lib/RichTextEditor-CxvwGvQG.cjs +142 -0
- package/lib/RichTextEditor-DGcKEUGr.js +22166 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +60 -134
- package/lib/SearchAndReplace.d.ts +60 -134
- package/lib/SearchAndReplace.js +207 -194
- package/lib/Selection.cjs +1 -1
- package/lib/Selection.d.cts +47 -51
- package/lib/Selection.d.ts +47 -51
- package/lib/Selection.js +1 -1
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +47 -51
- package/lib/SlashCommand.d.ts +47 -51
- package/lib/SlashCommand.js +177 -222
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +47 -51
- package/lib/Strike.d.ts +47 -51
- package/lib/Strike.js +20 -14
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +47 -51
- package/lib/SubAndSuperScript.d.ts +47 -51
- package/lib/SubAndSuperScript.js +5 -3
- package/lib/Table.cjs +8 -10
- package/lib/Table.d.cts +50 -54
- package/lib/Table.d.ts +50 -54
- package/lib/Table.js +382 -2021
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +47 -51
- package/lib/TableOfContent.d.ts +47 -51
- package/lib/TableOfContent.js +53 -52
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +49 -53
- package/lib/TaskList.d.ts +49 -53
- package/lib/TaskList.js +12 -154
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +47 -51
- package/lib/TextAlign.d.ts +47 -51
- package/lib/TextAlign.js +11 -8
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +47 -51
- package/lib/TextBubble.d.ts +47 -51
- package/lib/TextBubble.js +5 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +47 -51
- package/lib/TextDirection.d.ts +47 -51
- package/lib/TextDirection.js +15 -15
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +47 -51
- package/lib/TextUnderline.d.ts +47 -51
- package/lib/TextUnderline.js +40 -12
- package/lib/TrailingNode.cjs +1 -1
- package/lib/TrailingNode.d.cts +47 -51
- package/lib/TrailingNode.d.ts +47 -51
- package/lib/TrailingNode.js +1 -1
- package/lib/Twitter-BFULyqdR.js +1628 -0
- package/lib/Twitter-Cutpkh3h.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +47 -51
- package/lib/Twitter.d.ts +47 -51
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +47 -51
- package/lib/Video.d.ts +47 -51
- package/lib/Video.js +3 -3
- package/lib/bubble-extra.cjs +2 -2
- package/lib/bubble-extra.d.cts +47 -51
- package/lib/bubble-extra.d.ts +47 -51
- package/lib/bubble-extra.js +200 -192
- package/lib/dom-dataset-_6-diIRQ.cjs +33 -0
- package/lib/dom-dataset-lYeH6gfI.js +2361 -0
- package/lib/index-5iBZLua9.cjs +12 -0
- package/lib/index-6D1J-A-o.cjs +1 -0
- package/lib/index-B96Cclrj.cjs +3 -0
- package/lib/index-BBz7Nmv9.js +55 -0
- package/lib/index-BeCTd5v2.cjs +1 -0
- package/lib/index-ByurDDMv.js +237 -0
- package/lib/index-CUogRI7j.cjs +1 -0
- package/lib/index-Ch6dBBad.js +709 -0
- package/lib/index-DF2Lp4HZ.cjs +100 -0
- package/lib/{index-LUL9mqY4.js → index-D_L6n8O8.js} +4 -4
- package/lib/index-Dbvi-Bvh.cjs +1 -0
- package/lib/index-DpCrt7xs.cjs +1 -0
- package/lib/index-DsAX1Vq8.cjs +1 -0
- package/lib/index-Dy4DlW9o.js +12 -0
- package/lib/index-J3jHHZ4d.js +200 -0
- package/lib/{index-CsK90iVd.js → index-LmrOdnen.js} +302 -389
- package/lib/index-VvXaaKe3.js +898 -0
- package/lib/index-kbO3iWqL.js +13432 -0
- package/lib/index.cjs +1 -2
- package/lib/index.d.cts +49 -251
- package/lib/index.d.ts +49 -251
- package/lib/index.js +2 -588
- package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
- package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +47 -51
- package/lib/locale-bundle.d.ts +47 -51
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{textarea-D5WVZMgt.cjs → textarea-DFo_aXnj.cjs} +1 -1
- package/lib/{textarea-BglwYF6b.js → textarea-aPtytkDx.js} +1 -1
- package/package.json +76 -70
- package/lib/Drawer-CmoEF-Zg.cjs +0 -1
- package/lib/Excalidraw-CM74U5tG.js +0 -289
- package/lib/Excalidraw-DAPP9qgY.cjs +0 -1
- package/lib/RichTextEditor-BQN2eLD_.js +0 -12775
- package/lib/RichTextEditor-C8Sm1E6J.cjs +0 -140
- package/lib/Twitter-CL2pu4QM.cjs +0 -17
- package/lib/Twitter-Dg6WWauX.js +0 -1743
- package/lib/dom-dataset-Byuf1YmW.cjs +0 -33
- package/lib/dom-dataset-Di3tIRrR.js +0 -1031
- package/lib/index-BI-IcZcN.cjs +0 -1
- package/lib/index-ByRfqzMr.cjs +0 -89
- package/lib/index-C1fzuXpN.js +0 -46
- package/lib/index-CbQQFj2T.js +0 -133
- package/lib/index-DI9T3iLd.js +0 -12354
- package/lib/index-D_A0TBRA.cjs +0 -1
- package/lib/index-DclQSrIx.cjs +0 -1
- package/lib/index-Z4b9rzn-.cjs +0 -1
package/lib/SearchAndReplace.js
CHANGED
|
@@ -1,138 +1,157 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { u as U } from "./index-CsK90iVd.js";
|
|
1
|
+
import { a as j, E as O, P as q, D as N, j as V } from "./index-kbO3iWqL.js";
|
|
2
|
+
import { jsxs as g, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useState as T, useEffect as b } from "react";
|
|
4
|
+
import { P as F, o as K, A as M, f as P, p as W, L as y, q as L, B as C, S as H } from "./RichTextEditor-DGcKEUGr.js";
|
|
5
|
+
import { u as U } from "./index-LmrOdnen.js";
|
|
7
6
|
function z({ editor: e, ...t }) {
|
|
8
|
-
const { t: s } = U(), [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
const { t: s } = U(), [a, l] = T(!1), [c, n] = T(""), [i, h] = T(""), [r, f] = T(!1), [x, m] = T(""), d = () => {
|
|
8
|
+
var u, I, v, S;
|
|
9
|
+
m(`${((I = (u = e == null ? void 0 : e.storage) == null ? void 0 : u.searchAndReplace) == null ? void 0 : I.resultIndex) + 1}/${(S = (v = e == null ? void 0 : e.storage) == null ? void 0 : v.searchAndReplace) == null ? void 0 : S.results.length}`);
|
|
10
|
+
};
|
|
11
|
+
b(() => {
|
|
12
|
+
e && d();
|
|
13
|
+
}, [e]);
|
|
14
|
+
const R = (u = !1) => {
|
|
15
|
+
e && (u && e.commands.resetIndex(), e.commands.setSearchTerm(c), e.commands.setReplaceTerm(i), e.commands.setCaseSensitive(r), d());
|
|
16
|
+
}, A = () => {
|
|
17
|
+
if (!e) return;
|
|
18
|
+
const { results: u, resultIndex: I } = e.storage.searchAndReplace, v = u[I];
|
|
19
|
+
if (!v) return;
|
|
20
|
+
e.commands.setTextSelection(v);
|
|
21
|
+
const { node: S } = e.view.domAtPos(
|
|
22
|
+
e.state.selection.anchor
|
|
23
|
+
);
|
|
24
|
+
S instanceof HTMLElement && S.scrollIntoView({ behavior: "smooth", block: "center" }), d();
|
|
25
|
+
};
|
|
26
|
+
b(() => {
|
|
27
|
+
c.trim() || k(), c.trim() && R(!0);
|
|
28
|
+
}, [c]), b(() => {
|
|
29
|
+
i.trim() && R();
|
|
30
|
+
}, [i]), b(() => {
|
|
31
|
+
R(!0);
|
|
32
|
+
}, [r]);
|
|
33
|
+
const w = () => {
|
|
34
|
+
e == null || e.commands.replace(), A();
|
|
35
|
+
}, B = () => {
|
|
36
|
+
e == null || e.commands.nextSearchResult(), A();
|
|
37
|
+
}, D = () => {
|
|
38
|
+
e == null || e.commands.previousSearchResult(), A();
|
|
39
|
+
}, k = () => {
|
|
40
|
+
n(""), h(""), e.commands.resetIndex(), d();
|
|
41
|
+
}, E = () => {
|
|
42
|
+
e == null || e.commands.replaceAll(), m("0/0");
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ g(
|
|
45
|
+
F,
|
|
32
46
|
{
|
|
33
|
-
onOpenChange:
|
|
34
|
-
open:
|
|
47
|
+
onOpenChange: l,
|
|
48
|
+
open: a,
|
|
35
49
|
children: [
|
|
36
50
|
/* @__PURE__ */ o(
|
|
37
|
-
|
|
51
|
+
K,
|
|
38
52
|
{
|
|
39
53
|
asChild: !0,
|
|
40
54
|
disabled: t == null ? void 0 : t.disabled,
|
|
41
55
|
children: /* @__PURE__ */ o(
|
|
42
|
-
|
|
56
|
+
M,
|
|
43
57
|
{
|
|
44
58
|
disabled: t == null ? void 0 : t.disabled,
|
|
45
59
|
isActive: t == null ? void 0 : t.isActive,
|
|
46
60
|
tooltip: t == null ? void 0 : t.tooltip,
|
|
47
|
-
|
|
61
|
+
tooltipOptions: t == null ? void 0 : t.tooltipOptions,
|
|
62
|
+
children: /* @__PURE__ */ o(P, { name: t == null ? void 0 : t.icon })
|
|
48
63
|
}
|
|
49
64
|
)
|
|
50
65
|
}
|
|
51
66
|
),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
67
|
+
/* @__PURE__ */ g(
|
|
68
|
+
W,
|
|
54
69
|
{
|
|
55
70
|
align: "start",
|
|
56
71
|
className: "richtext-w-full",
|
|
57
72
|
hideWhenDetached: !0,
|
|
58
73
|
side: "bottom",
|
|
59
74
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */ o(
|
|
62
|
-
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children:
|
|
75
|
+
/* @__PURE__ */ g("div", { className: "richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between", children: [
|
|
76
|
+
/* @__PURE__ */ o(y, { children: s("editor.search.dialog.text") }),
|
|
77
|
+
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: x })
|
|
63
78
|
] }),
|
|
64
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ g("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: [
|
|
65
80
|
/* @__PURE__ */ o(
|
|
66
|
-
|
|
81
|
+
L,
|
|
67
82
|
{
|
|
68
83
|
autoFocus: !0,
|
|
69
84
|
className: "richtext-w-full",
|
|
70
|
-
onChange: (
|
|
85
|
+
onChange: (u) => n(u.target.value),
|
|
71
86
|
placeholder: "Text",
|
|
72
87
|
required: !0,
|
|
73
88
|
type: "text",
|
|
74
|
-
value:
|
|
89
|
+
value: c
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ o(
|
|
93
|
+
C,
|
|
94
|
+
{
|
|
95
|
+
className: "richtext-flex-1",
|
|
96
|
+
onClick: D,
|
|
97
|
+
children: /* @__PURE__ */ o(P, { name: "ChevronUp" })
|
|
75
98
|
}
|
|
76
99
|
),
|
|
77
100
|
/* @__PURE__ */ o(
|
|
78
|
-
|
|
101
|
+
C,
|
|
79
102
|
{
|
|
80
103
|
className: "richtext-flex-1",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
children: /* @__PURE__ */ o(A, { name: "ChevronUp" })
|
|
104
|
+
onClick: B,
|
|
105
|
+
children: /* @__PURE__ */ o(P, { name: "ChevronDown" })
|
|
84
106
|
}
|
|
85
107
|
),
|
|
86
108
|
/* @__PURE__ */ o(
|
|
87
|
-
|
|
109
|
+
C,
|
|
88
110
|
{
|
|
89
111
|
className: "richtext-flex-1",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
children: /* @__PURE__ */ o(A, { name: "ChevronDown" })
|
|
112
|
+
onClick: k,
|
|
113
|
+
children: "Clear"
|
|
93
114
|
}
|
|
94
115
|
)
|
|
95
116
|
] }),
|
|
96
|
-
/* @__PURE__ */ o(
|
|
117
|
+
/* @__PURE__ */ o(y, { className: "richtext-mb-[6px]", children: s("editor.replace.dialog.text") }),
|
|
97
118
|
/* @__PURE__ */ o("div", { className: "richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ o("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ o(
|
|
98
|
-
|
|
119
|
+
L,
|
|
99
120
|
{
|
|
100
121
|
className: "richtext-w-80",
|
|
101
|
-
onChange: (
|
|
122
|
+
onChange: (u) => h(u.target.value),
|
|
102
123
|
placeholder: "Text",
|
|
103
124
|
required: !0,
|
|
104
125
|
type: "text",
|
|
105
|
-
value:
|
|
126
|
+
value: i
|
|
106
127
|
}
|
|
107
128
|
) }) }),
|
|
108
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ g("div", { className: "richtext-mb-[10px] richtext-flex richtext-items-center richtext-space-x-2", children: [
|
|
109
130
|
/* @__PURE__ */ o(
|
|
110
|
-
|
|
131
|
+
H,
|
|
111
132
|
{
|
|
112
|
-
checked:
|
|
113
|
-
onCheckedChange: (
|
|
114
|
-
|
|
133
|
+
checked: r,
|
|
134
|
+
onCheckedChange: (u) => {
|
|
135
|
+
f(u), e.commands.setCaseSensitive(u);
|
|
115
136
|
}
|
|
116
137
|
}
|
|
117
138
|
),
|
|
118
|
-
/* @__PURE__ */ o(
|
|
139
|
+
/* @__PURE__ */ o(y, { children: s("editor.replace.caseSensitive") })
|
|
119
140
|
] }),
|
|
120
|
-
/* @__PURE__ */
|
|
141
|
+
/* @__PURE__ */ g("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: [
|
|
121
142
|
/* @__PURE__ */ o(
|
|
122
|
-
|
|
143
|
+
C,
|
|
123
144
|
{
|
|
124
145
|
className: "richtext-flex-1",
|
|
125
|
-
|
|
126
|
-
onClick: e.commands.replace,
|
|
146
|
+
onClick: w,
|
|
127
147
|
children: s("editor.replace.dialog.text")
|
|
128
148
|
}
|
|
129
149
|
),
|
|
130
150
|
/* @__PURE__ */ o(
|
|
131
|
-
|
|
151
|
+
C,
|
|
132
152
|
{
|
|
133
153
|
className: "richtext-flex-1",
|
|
134
|
-
|
|
135
|
-
onClick: e.commands.replaceAll,
|
|
154
|
+
onClick: E,
|
|
136
155
|
children: s("editor.replaceAll.dialog.text")
|
|
137
156
|
}
|
|
138
157
|
)
|
|
@@ -146,87 +165,86 @@ function z({ editor: e, ...t }) {
|
|
|
146
165
|
}
|
|
147
166
|
const p = (e, t) => t(e.tr);
|
|
148
167
|
function G(e, t, s) {
|
|
149
|
-
return RegExp(
|
|
168
|
+
return RegExp(
|
|
169
|
+
t ? e.replace(/[$()*+.?[\\\]^{|}]/g, String.raw`\$&`) : e,
|
|
170
|
+
s ? "gu" : "gui"
|
|
171
|
+
);
|
|
150
172
|
}
|
|
151
|
-
function J(e, t, s) {
|
|
152
|
-
const c = [];
|
|
153
|
-
let
|
|
154
|
-
const n = [];
|
|
155
|
-
let i = 0;
|
|
173
|
+
function J(e, t, s, a) {
|
|
174
|
+
const l = [], c = [];
|
|
175
|
+
let n = [], i = 0;
|
|
156
176
|
if (!t)
|
|
157
|
-
return {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
text:
|
|
164
|
-
pos:
|
|
177
|
+
return {
|
|
178
|
+
decorationsToReturn: N.empty,
|
|
179
|
+
results: []
|
|
180
|
+
};
|
|
181
|
+
e == null || e.descendants((h, r) => {
|
|
182
|
+
h.isText ? n[i] ? n[i] = {
|
|
183
|
+
text: n[i].text + h.text,
|
|
184
|
+
pos: n[i].pos
|
|
185
|
+
} : n[i] = {
|
|
186
|
+
text: `${h.text}`,
|
|
187
|
+
pos: r
|
|
165
188
|
} : i += 1;
|
|
166
|
-
}),
|
|
167
|
-
for (const
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
189
|
+
}), n = n.filter(Boolean);
|
|
190
|
+
for (const h of n) {
|
|
191
|
+
const { text: r, pos: f } = h, x = Array.from(r.matchAll(t)).filter(
|
|
192
|
+
([m]) => m.trim()
|
|
193
|
+
);
|
|
194
|
+
for (const m of x) {
|
|
195
|
+
if (m[0] === "") break;
|
|
196
|
+
m.index !== void 0 && c.push({
|
|
197
|
+
from: f + m.index,
|
|
198
|
+
to: f + m.index + m[0].length
|
|
175
199
|
});
|
|
176
200
|
}
|
|
177
201
|
}
|
|
178
|
-
for (const
|
|
179
|
-
|
|
202
|
+
for (const [h, r] of c.entries()) {
|
|
203
|
+
const f = h === a ? `${s} ${s}-current` : s, x = V.inline(r.from, r.to, {
|
|
204
|
+
class: f
|
|
205
|
+
});
|
|
206
|
+
l.push(x);
|
|
207
|
+
}
|
|
180
208
|
return {
|
|
181
|
-
decorationsToReturn:
|
|
182
|
-
results:
|
|
209
|
+
decorationsToReturn: N.create(e, l),
|
|
210
|
+
results: c
|
|
183
211
|
};
|
|
184
212
|
}
|
|
185
|
-
function
|
|
186
|
-
if (!t[0])
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
c && c(s.tr.insertText(e, n, i));
|
|
213
|
+
function $(e, t, { state: s, dispatch: a }) {
|
|
214
|
+
if (!t[0]) return;
|
|
215
|
+
const { from: c, to: n } = t[0];
|
|
216
|
+
a && a(s.tr.insertText(e, c, n));
|
|
190
217
|
}
|
|
191
|
-
function Q(e, t, s,
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}, [a, c];
|
|
218
|
+
function Q(e, t, s, a) {
|
|
219
|
+
const l = t + 1;
|
|
220
|
+
if (!a[l]) return null;
|
|
221
|
+
const { from: c, to: n } = a[t], i = n - c - e.length + s, { from: h, to: r } = a[l];
|
|
222
|
+
return a[l] = {
|
|
223
|
+
to: r - i,
|
|
224
|
+
from: h - i
|
|
225
|
+
}, [i, a];
|
|
200
226
|
}
|
|
201
|
-
function X(e, t, { tr: s, dispatch:
|
|
202
|
-
let
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const i = t.setMeta("directDecoration", {
|
|
217
|
-
fromPos: n.from,
|
|
218
|
-
toPos: n.to,
|
|
219
|
-
attrs: { class: c }
|
|
220
|
-
});
|
|
221
|
-
return e == null || e.dispatch(i), setTimeout(() => {
|
|
222
|
-
const a = window.document.querySelector(`.${c}`);
|
|
223
|
-
a && q(a, { behavior: "smooth", scrollMode: "if-needed" });
|
|
224
|
-
}, 0), !0;
|
|
227
|
+
function X(e, t, { tr: s, dispatch: a }) {
|
|
228
|
+
let l = 0, c = t.slice();
|
|
229
|
+
if (c.length !== 0) {
|
|
230
|
+
for (let n = 0; n < c.length; n += 1) {
|
|
231
|
+
const { from: i, to: h } = c[n];
|
|
232
|
+
s.insertText(e, i, h);
|
|
233
|
+
const r = Q(
|
|
234
|
+
e,
|
|
235
|
+
n,
|
|
236
|
+
l,
|
|
237
|
+
c
|
|
238
|
+
);
|
|
239
|
+
r && (l = r[0], c = r[1]);
|
|
240
|
+
}
|
|
241
|
+
a(s);
|
|
225
242
|
}
|
|
226
|
-
return !1;
|
|
227
243
|
}
|
|
228
|
-
const Y =
|
|
229
|
-
|
|
244
|
+
const Y = new j(
|
|
245
|
+
"searchAndReplacePlugin"
|
|
246
|
+
), ae = O.create({
|
|
247
|
+
name: "searchAndReplace",
|
|
230
248
|
addOptions() {
|
|
231
249
|
var e;
|
|
232
250
|
return {
|
|
@@ -234,11 +252,10 @@ const Y = /* @__PURE__ */ _.create({
|
|
|
234
252
|
searchTerm: "",
|
|
235
253
|
replaceTerm: "",
|
|
236
254
|
results: [],
|
|
237
|
-
currentIndex: 0,
|
|
238
255
|
searchResultClass: "search-result",
|
|
239
256
|
searchResultCurrentClass: "search-result-current",
|
|
240
257
|
caseSensitive: !1,
|
|
241
|
-
disableRegex: !
|
|
258
|
+
disableRegex: !0,
|
|
242
259
|
onChange: () => {
|
|
243
260
|
},
|
|
244
261
|
button: ({ editor: t, t: s }) => ({
|
|
@@ -257,77 +274,72 @@ const Y = /* @__PURE__ */ _.create({
|
|
|
257
274
|
},
|
|
258
275
|
addStorage() {
|
|
259
276
|
return {
|
|
277
|
+
searchTerm: "",
|
|
278
|
+
replaceTerm: "",
|
|
260
279
|
results: [],
|
|
261
|
-
|
|
280
|
+
lastSearchTerm: "",
|
|
281
|
+
caseSensitive: !1,
|
|
282
|
+
lastCaseSensitive: !1,
|
|
283
|
+
resultIndex: 0,
|
|
284
|
+
lastResultIndex: 0
|
|
262
285
|
};
|
|
263
286
|
},
|
|
264
287
|
addCommands() {
|
|
265
288
|
return {
|
|
266
|
-
setSearchTerm: (e) => ({
|
|
267
|
-
setReplaceTerm: (e) => ({
|
|
268
|
-
setCaseSensitive: (e) => ({
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
289
|
+
setSearchTerm: (e) => ({ editor: t, state: s, dispatch: a }) => (t.storage.searchAndReplace.searchTerm = e, p(s, a), !1),
|
|
290
|
+
setReplaceTerm: (e) => ({ editor: t, state: s, dispatch: a }) => (t.storage.searchAndReplace.replaceTerm = e, p(s, a), !1),
|
|
291
|
+
setCaseSensitive: (e) => ({ editor: t, state: s, dispatch: a }) => (t.storage.searchAndReplace.caseSensitive = e, p(s, a), !1),
|
|
292
|
+
resetIndex: () => ({ editor: e, state: t, dispatch: s }) => (e.storage.searchAndReplace.resultIndex = 0, p(t, s), !1),
|
|
293
|
+
nextSearchResult: () => ({ editor: e }) => {
|
|
294
|
+
const { results: t, resultIndex: s } = e.storage.searchAndReplace, a = s + 1;
|
|
295
|
+
return t[a] ? e.storage.searchAndReplace.resultIndex = a : e.storage.searchAndReplace.resultIndex = 0, !1;
|
|
272
296
|
},
|
|
273
|
-
|
|
274
|
-
const {
|
|
275
|
-
return
|
|
297
|
+
previousSearchResult: () => ({ editor: e }) => {
|
|
298
|
+
const { results: t, resultIndex: s } = e.storage.searchAndReplace, a = s - 1;
|
|
299
|
+
return t[a] ? e.storage.searchAndReplace.resultIndex = a : e.storage.searchAndReplace.resultIndex = t.length - 1, !1;
|
|
276
300
|
},
|
|
277
|
-
|
|
278
|
-
const {
|
|
279
|
-
return
|
|
280
|
-
view: e,
|
|
281
|
-
tr: t,
|
|
282
|
-
searchResults: r,
|
|
283
|
-
searchResultCurrentClass: s,
|
|
284
|
-
gotoIndex: n
|
|
285
|
-
});
|
|
301
|
+
replace: () => ({ editor: e, state: t, dispatch: s }) => {
|
|
302
|
+
const { replaceTerm: a, results: l, resultIndex: c } = e.storage.searchAndReplace, n = l[c];
|
|
303
|
+
return n ? ($(a, [n], { state: t, dispatch: s }), e.storage.searchAndReplace.results.splice(c, 1)) : ($(a, l, { state: t, dispatch: s }), e.storage.searchAndReplace.results.shift()), p(t, s), !1;
|
|
286
304
|
},
|
|
287
|
-
|
|
288
|
-
const {
|
|
289
|
-
return
|
|
290
|
-
view: e,
|
|
291
|
-
tr: t,
|
|
292
|
-
searchResults: r,
|
|
293
|
-
searchResultCurrentClass: s,
|
|
294
|
-
gotoIndex: n
|
|
295
|
-
});
|
|
305
|
+
replaceAll: () => ({ editor: e, tr: t, state: s, dispatch: a }) => {
|
|
306
|
+
const { replaceTerm: l, results: c } = e.storage.searchAndReplace;
|
|
307
|
+
return X(l, c, { tr: t, dispatch: a }), e.storage.searchAndReplace.resultIndex = 0, e.storage.searchAndReplace.results = [], p(s, a), !1;
|
|
296
308
|
}
|
|
297
309
|
};
|
|
298
310
|
},
|
|
299
311
|
addProseMirrorPlugins() {
|
|
300
|
-
const e = this;
|
|
312
|
+
const e = this.editor, { searchResultClass: t, disableRegex: s } = this.options, a = (n) => e.storage.searchAndReplace.lastSearchTerm = n, l = (n) => e.storage.searchAndReplace.lastCaseSensitive = n, c = (n) => e.storage.searchAndReplace.lastResultIndex = n;
|
|
301
313
|
return [
|
|
302
|
-
new
|
|
303
|
-
key:
|
|
314
|
+
new q({
|
|
315
|
+
key: Y,
|
|
304
316
|
state: {
|
|
305
|
-
init()
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
return
|
|
317
|
+
init: () => N.empty,
|
|
318
|
+
apply({ doc: n, docChanged: i }, h) {
|
|
319
|
+
const {
|
|
320
|
+
searchTerm: r,
|
|
321
|
+
lastSearchTerm: f,
|
|
322
|
+
caseSensitive: x,
|
|
323
|
+
lastCaseSensitive: m,
|
|
324
|
+
resultIndex: d,
|
|
325
|
+
lastResultIndex: R
|
|
326
|
+
} = e.storage.searchAndReplace;
|
|
327
|
+
if (!i && f === r && m === x && R === d)
|
|
328
|
+
return h;
|
|
329
|
+
if (a(r), l(x), c(d), !r)
|
|
330
|
+
return e.storage.searchAndReplace.results = [], N.empty;
|
|
331
|
+
const { decorationsToReturn: A, results: w } = J(
|
|
332
|
+
n,
|
|
333
|
+
G(r, s, x),
|
|
334
|
+
t,
|
|
335
|
+
d
|
|
336
|
+
);
|
|
337
|
+
return e.storage.searchAndReplace.results = w, A;
|
|
326
338
|
}
|
|
327
339
|
},
|
|
328
340
|
props: {
|
|
329
|
-
decorations(
|
|
330
|
-
return this.getState(
|
|
341
|
+
decorations(n) {
|
|
342
|
+
return this.getState(n);
|
|
331
343
|
}
|
|
332
344
|
}
|
|
333
345
|
})
|
|
@@ -335,5 +347,6 @@ const Y = /* @__PURE__ */ _.create({
|
|
|
335
347
|
}
|
|
336
348
|
});
|
|
337
349
|
export {
|
|
338
|
-
|
|
350
|
+
ae as SearchAndReplace,
|
|
351
|
+
Y as searchAndReplacePluginKey
|
|
339
352
|
};
|
package/lib/Selection.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-DF2Lp4HZ.cjs"),o=e.Extension.create({name:"selection",addProseMirrorPlugins(){const{editor:i}=this;return[new e.Plugin({key:new e.PluginKey("selection"),props:{decorations(n){return n.selection.empty||i.isFocused===!0?null:e.DecorationSet.create(n.doc,[e.Decoration.inline(n.selection.from,n.selection.to,{class:"selection"})])}}})]}});exports.Selection=o;exports.default=o;
|