reactjs-tiptap-editor 1.0.20 → 1.0.21
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/lib/{ActionMenuButton-BPgqKDXT.cjs → ActionMenuButton-BVaZBdL3.cjs} +1 -1
- package/lib/{ActionMenuButton-CMXWxvWu.js → ActionMenuButton-Cpla3oSm.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +23 -23
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +1 -1
- package/lib/Callout-JL3mm4GU.cjs +1 -0
- package/lib/Callout-mb31jDcR.js +340 -0
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +8 -222
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +1 -1
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +2 -2
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +1 -1
- package/lib/{Drawer-BivLAzMN.cjs → Drawer-94nAoli4.cjs} +1 -1
- package/lib/{Drawer-BmVmgJsc.js → Drawer-d9e69c7G.js} +18 -18
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +8 -8
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +5 -5
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +3 -3
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +3 -3
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +8 -8
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +2 -2
- package/lib/History.cjs +1 -1
- package/lib/History.js +1 -1
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +1 -1
- package/lib/{Iframe-CAUrccA0.js → Iframe-CkUClxtI.js} +5 -5
- package/lib/{Iframe-hwg9FxhU.cjs → Iframe-qCivhCR5.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +4 -4
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +35 -35
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +12 -12
- package/lib/{Indent-3MoIatX1.js → Indent-BTzj50Sf.js} +1 -1
- package/lib/{Indent-MuSU0kXz.cjs → Indent-DtgugDpq.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +1 -1
- package/lib/{Katex-xS-XZKQc.js → Katex-BuFwL_MA.js} +4 -3
- package/lib/Katex-RcbH2O5p.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +2 -2
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-DLDY-8Ax.cjs → LinkEditBlock-CSKh_5n7.cjs} +1 -1
- package/lib/{LinkEditBlock-Dhvz7DCA.js → LinkEditBlock-DYOmu7jQ.js} +25 -25
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +44 -43
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +4 -4
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +7 -7
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +2 -2
- package/lib/{SlashCommandNodeView-RnDRm4Z1.js → SlashCommandNodeView-CT_-28t6.js} +6 -6
- package/lib/{SlashCommandNodeView-CavaOSwo.cjs → SlashCommandNodeView-CYdYVjeb.cjs} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-DN4TuDz1.js → Table-CEHV8gmO.js} +2 -2
- package/lib/{Table-m32ZhtxF.cjs → Table-DOl6C6To.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +1 -1
- package/lib/{Twitter-CJhQLKYS.cjs → Twitter-DDuJwWdF.cjs} +1 -1
- package/lib/{Twitter-B2FDarxE.js → Twitter-DxqKzo3U.js} +7 -7
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +3 -3
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +667 -640
- package/lib/{dropdown-menu-CWd8VVRO.js → dropdown-menu-BYbds8yQ.js} +1 -1
- package/lib/{dropdown-menu-C0VlKIZC.cjs → dropdown-menu-CoZZaqv5.cjs} +1 -1
- package/lib/{index-B2a7NqnN.js → index-B1SzsIsE.js} +1020 -1149
- package/lib/index-DirFiHQ6.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/{popover-UUKfPWue.cjs → popover-BaAurWOZ.cjs} +1 -1
- package/lib/{popover-BrSDMb_n.js → popover-CK54Ip2N.js} +1 -1
- package/lib/{separator-LH5EzF0T.cjs → separator-ByK1SKWn.cjs} +1 -1
- package/lib/{separator-fpWkZkoh.js → separator-XZA3-egy.js} +14 -14
- package/lib/style.css +1 -1
- package/lib/textarea--IMIy9VF.js +20 -0
- package/lib/textarea-mwHtiXJV.cjs +1 -0
- package/package.json +1 -1
- package/lib/Katex-BPQ7_A3w.cjs +0 -4
- package/lib/index-czmcFIW7.cjs +0 -1
package/lib/Mermaid.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { q
|
|
2
|
-
import {
|
|
3
|
-
import { N as
|
|
4
|
-
import { jsx as n, jsxs as
|
|
5
|
-
import { useState as m, useMemo as
|
|
6
|
-
import { I as V, i as W, j as
|
|
7
|
-
import { s as
|
|
8
|
-
|
|
1
|
+
import { q, m as U } from "./index-D0EmqTpe.js";
|
|
2
|
+
import { t as G, q as X, h as Z, u as Y, d as J, D as K, r as Q, A as tt, s as et, v as rt, w as it, B as at, x as st, y as nt } from "./index-B1SzsIsE.js";
|
|
3
|
+
import { N as ot, a as lt } from "./clsx-Bg-2aTKh.js";
|
|
4
|
+
import { jsx as n, jsxs as H, Fragment as ct } from "react/jsx-runtime";
|
|
5
|
+
import { useState as m, useMemo as P, useCallback as A, useEffect as R, useRef as dt } from "react";
|
|
6
|
+
import { I as V, i as W, j as ut } from "./index-BlXGgvT-.js";
|
|
7
|
+
import { s as ht, i as mt } from "./shortId-WJVkrvml.js";
|
|
8
|
+
import { T as gt } from "./textarea--IMIy9VF.js";
|
|
9
|
+
const C = {
|
|
9
10
|
TOP_LEFT: "tl",
|
|
10
11
|
TOP_RIGHT: "tr",
|
|
11
12
|
BOTTOM_LEFT: "bl",
|
|
@@ -19,18 +20,18 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
19
20
|
width: 0,
|
|
20
21
|
height: 0
|
|
21
22
|
}), [y] = m([
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
C.TOP_LEFT,
|
|
24
|
+
C.TOP_RIGHT,
|
|
25
|
+
C.BOTTOM_LEFT,
|
|
26
|
+
C.BOTTOM_RIGHT
|
|
26
27
|
]), [o, _] = m(!1), [L, d] = m({
|
|
27
28
|
x: 0,
|
|
28
29
|
y: 0,
|
|
29
30
|
w: 0,
|
|
30
31
|
h: 0,
|
|
31
32
|
dir: ""
|
|
32
|
-
}), { align: B } = t == null ? void 0 : t.attrs, g =
|
|
33
|
-
const { src: r, alt: p, width: f, height: b } = t == null ? void 0 : t.attrs, x =
|
|
33
|
+
}), { align: B } = t == null ? void 0 : t.attrs, g = P(() => {
|
|
34
|
+
const { src: r, alt: p, width: f, height: b } = t == null ? void 0 : t.attrs, x = q(f) ? `${f}px` : f, a = q(b) ? `${b}px` : b;
|
|
34
35
|
return {
|
|
35
36
|
src: r || void 0,
|
|
36
37
|
alt: p || void 0,
|
|
@@ -39,7 +40,7 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
39
40
|
height: a || void 0
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
}, [t == null ? void 0 : t.attrs]),
|
|
43
|
+
}, [t == null ? void 0 : t.attrs]), O = P(() => {
|
|
43
44
|
const {
|
|
44
45
|
style: { width: r }
|
|
45
46
|
} = g;
|
|
@@ -54,8 +55,8 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
54
55
|
function I() {
|
|
55
56
|
e.commands.setNodeSelection(s());
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
58
|
+
const E = A(
|
|
59
|
+
G(() => {
|
|
59
60
|
const { width: r } = getComputedStyle(e.view.dom);
|
|
60
61
|
c((p) => ({
|
|
61
62
|
...p,
|
|
@@ -64,7 +65,7 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
64
65
|
}, W),
|
|
65
66
|
[e]
|
|
66
67
|
);
|
|
67
|
-
function
|
|
68
|
+
function F(r, p) {
|
|
68
69
|
r.preventDefault(), r.stopPropagation();
|
|
69
70
|
const f = S.width, b = S.height, x = f / b;
|
|
70
71
|
let a = Number(t.attrs.width), v = Number(t.attrs.height);
|
|
@@ -78,12 +79,12 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
const l = A(
|
|
81
|
-
|
|
82
|
+
G((r) => {
|
|
82
83
|
if (r.preventDefault(), r.stopPropagation(), !o)
|
|
83
84
|
return;
|
|
84
|
-
const { x: p, w: f, dir: b } = L, x = (r.clientX - p) * (/l/.test(b) ? -1 : 1), { width: a, height: v } = t == null ? void 0 : t.attrs, h = a / v,
|
|
85
|
+
const { x: p, w: f, dir: b } = L, x = (r.clientX - p) * (/l/.test(b) ? -1 : 1), { width: a, height: v } = t == null ? void 0 : t.attrs, h = a / v, $ = X(f + x, ut, T.width), j = Math.round($ / h);
|
|
85
86
|
i({
|
|
86
|
-
width:
|
|
87
|
+
width: $,
|
|
87
88
|
height: j
|
|
88
89
|
});
|
|
89
90
|
}, W),
|
|
@@ -107,20 +108,20 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
107
108
|
R(() => (o ? z() : N(), () => {
|
|
108
109
|
N();
|
|
109
110
|
}), [o, z, N]);
|
|
110
|
-
const M =
|
|
111
|
+
const M = P(() => new ResizeObserver(() => E()), [E]);
|
|
111
112
|
return R(() => (M.observe(e.view.dom), () => {
|
|
112
113
|
M.disconnect();
|
|
113
114
|
}), [e.view.dom, M]), /* @__PURE__ */ n(
|
|
114
|
-
|
|
115
|
+
ot,
|
|
115
116
|
{
|
|
116
117
|
className: "image-view",
|
|
117
|
-
style: { ...
|
|
118
|
-
children: /* @__PURE__ */
|
|
118
|
+
style: { ...O, width: "100%", textAlign: B },
|
|
119
|
+
children: /* @__PURE__ */ H(
|
|
119
120
|
"div",
|
|
120
121
|
{
|
|
121
122
|
"data-drag-handle": !0,
|
|
122
123
|
draggable: "true",
|
|
123
|
-
style: { ...
|
|
124
|
+
style: { ...O, background: "#fff" },
|
|
124
125
|
className: `image-view__body ${w ? "image-view__body--focused" : ""} ${o ? "image-view__body--resizing" : ""}`,
|
|
125
126
|
children: [
|
|
126
127
|
/* @__PURE__ */ n(
|
|
@@ -139,7 +140,7 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
139
140
|
"span",
|
|
140
141
|
{
|
|
141
142
|
className: `image-resizer__handler image-resizer__handler--${r}`,
|
|
142
|
-
onMouseDown: (p) =>
|
|
143
|
+
onMouseDown: (p) => F(p, r)
|
|
143
144
|
},
|
|
144
145
|
`image-dir-${r}`
|
|
145
146
|
)) })
|
|
@@ -151,11 +152,11 @@ function pt({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
151
152
|
}
|
|
152
153
|
const ft = `graph TB
|
|
153
154
|
a-->b`;
|
|
154
|
-
function
|
|
155
|
-
const e = Z(), t = Y(vt.name), { tooltipOptions: i = {}, isActive: s = void 0, upload: w } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: T } = J(s), [c, S] = m(ft), [D, y] = m(""), [o, _] = m(!1), L =
|
|
155
|
+
function At() {
|
|
156
|
+
const e = Z(), t = Y(vt.name), { tooltipOptions: i = {}, isActive: s = void 0, upload: w } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: T } = J(s), [c, S] = m(ft), [D, y] = m(""), [o, _] = m(!1), L = dt(null), [d, B] = m(null), [g, O] = m(!0), k = A((l) => {
|
|
156
157
|
l && import("mermaid").then((u) => {
|
|
157
158
|
B(u.default);
|
|
158
|
-
}).finally(() =>
|
|
159
|
+
}).finally(() => O(!1));
|
|
159
160
|
}, []), I = async (l) => {
|
|
160
161
|
try {
|
|
161
162
|
const { svg: u } = await d.render("mermaid-svg", l);
|
|
@@ -163,7 +164,7 @@ function It() {
|
|
|
163
164
|
} catch {
|
|
164
165
|
y("");
|
|
165
166
|
}
|
|
166
|
-
},
|
|
167
|
+
}, E = () => {
|
|
167
168
|
d.initialize({
|
|
168
169
|
darkMode: !1,
|
|
169
170
|
startOnLoad: !1,
|
|
@@ -173,10 +174,10 @@ function It() {
|
|
|
173
174
|
}), I(c);
|
|
174
175
|
};
|
|
175
176
|
return R(() => {
|
|
176
|
-
!g && d && o &&
|
|
177
|
+
!g && d && o && E();
|
|
177
178
|
}, [d, o]), R(() => {
|
|
178
179
|
!g && d && o && I(c);
|
|
179
|
-
}, [d && c]), /* @__PURE__ */
|
|
180
|
+
}, [d && c]), /* @__PURE__ */ H(K, { onOpenChange: _, open: o, children: [
|
|
180
181
|
/* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ n(
|
|
181
182
|
tt,
|
|
182
183
|
{
|
|
@@ -189,11 +190,11 @@ function It() {
|
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
) }),
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ H(et, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
193
194
|
/* @__PURE__ */ n(rt, { children: "Mermaid" }),
|
|
194
|
-
/* @__PURE__ */ n("div", { ref: k, style: { height: "100%", border: "1px solid hsl(var(--border))" }, children: g ? /* @__PURE__ */ n("p", { children: "Loading..." }) : /* @__PURE__ */ n(
|
|
195
|
+
/* @__PURE__ */ n("div", { ref: k, style: { height: "100%", border: "1px solid hsl(var(--border))" }, children: g ? /* @__PURE__ */ n("p", { children: "Loading..." }) : /* @__PURE__ */ n(ct, { children: /* @__PURE__ */ H("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
|
|
195
196
|
/* @__PURE__ */ n(
|
|
196
|
-
|
|
197
|
+
gt,
|
|
197
198
|
{
|
|
198
199
|
autoFocus: !0,
|
|
199
200
|
className: "richtext-flex-1",
|
|
@@ -222,13 +223,13 @@ function It() {
|
|
|
222
223
|
}
|
|
223
224
|
)
|
|
224
225
|
] }) }) }),
|
|
225
|
-
/* @__PURE__ */ n(
|
|
226
|
+
/* @__PURE__ */ n(it, { children: /* @__PURE__ */ n(at, { disabled: !d, onClick: async () => {
|
|
226
227
|
if (c !== "") {
|
|
227
228
|
if (c) {
|
|
228
|
-
const l = L.current.querySelector("svg"), { width: u, height: z } = l.getBoundingClientRect(), N = `mermaid-${
|
|
229
|
-
let M =
|
|
229
|
+
const l = L.current.querySelector("svg"), { width: u, height: z } = l.getBoundingClientRect(), N = `mermaid-${ht()}.svg`;
|
|
230
|
+
let M = mt(l.outerHTML);
|
|
230
231
|
if (w) {
|
|
231
|
-
const r =
|
|
232
|
+
const r = st(M, N);
|
|
232
233
|
M = await w(r);
|
|
233
234
|
}
|
|
234
235
|
e == null || e.chain().focus().setMermaid(
|
|
@@ -248,7 +249,7 @@ function It() {
|
|
|
248
249
|
] })
|
|
249
250
|
] });
|
|
250
251
|
}
|
|
251
|
-
const vt = /* @__PURE__ */
|
|
252
|
+
const vt = /* @__PURE__ */ nt.extend({
|
|
252
253
|
name: "mermaid",
|
|
253
254
|
//@ts-expect-error
|
|
254
255
|
addOptions() {
|
|
@@ -315,7 +316,7 @@ const vt = /* @__PURE__ */ ot.extend({
|
|
|
315
316
|
};
|
|
316
317
|
},
|
|
317
318
|
addNodeView() {
|
|
318
|
-
return
|
|
319
|
+
return lt(pt);
|
|
319
320
|
},
|
|
320
321
|
// @ts-ignore
|
|
321
322
|
addCommands() {
|
|
@@ -369,5 +370,5 @@ const vt = /* @__PURE__ */ ot.extend({
|
|
|
369
370
|
});
|
|
370
371
|
export {
|
|
371
372
|
vt as Mermaid,
|
|
372
|
-
|
|
373
|
+
At as RichTextMermaid
|
|
373
374
|
};
|
package/lib/MoreMark.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-C4WLt4NA.cjs"),r=require("react/jsx-runtime"),M=require("react"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-C4WLt4NA.cjs"),r=require("react/jsx-runtime"),M=require("react"),c=require("./index-DirFiHQ6.cjs");require("./theme.cjs");const l=require("./dropdown-menu-CoZZaqv5.cjs");var x=u.Mark.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",u.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),f=u.Mark.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",u.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});function S(){const t=c.useButtonProps(m.name),{icon:s=void 0,tooltip:n=void 0,items:i=[],isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:a,dataState:o}=c.useActive(d),h=M.useMemo(()=>(o==null?void 0:o.title)||"",[o]);return t?r.jsxs(l.DropdownMenu,{children:[r.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:a,children:r.jsx(c.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:a,icon:s,tooltip:n,children:r.jsx(c.MenuDown,{className:"richtext-size-3 richtext-text-gray-500"})})}),r.jsx(l.DropdownMenuContent,{className:"w-full",children:i==null?void 0:i.map((e,p)=>r.jsxs(l.DropdownMenuCheckboxItem,{checked:h===e.title,className:"richtext-flex richtext-items-center richtext-gap-3",onClick:e.action,children:[r.jsx(c.IconComponent,{name:e==null?void 0:e.icon}),r.jsx("span",{className:"richtext-ml-1",children:e.title}),!!(e!=null&&e.shortcutKeys)&&r.jsx("span",{className:"richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",children:c.getShortcutKeys(e.shortcutKeys)})]},`more-mark-${p}`))})]}):r.jsx(r.Fragment,{})}const m=u.Extension.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:s,extension:n,t:i}){var p,g;const d=n.options.subscript,a=n.options.superscript,o={action:()=>s.commands.toggleSubscript(),isActive:()=>s.isActive("subscript")||!1,disabled:!s.can().toggleSubscript(),icon:"Subscript",title:i("editor.subscript.tooltip"),shortcutKeys:((p=n.options.shortcutKeys)==null?void 0:p[0])??["mod","."]},h={action:()=>s.commands.toggleSuperscript(),isActive:()=>s.isActive("superscript")||!1,disabled:!s.can().toggleSuperscript(),icon:"Superscript",title:i("editor.superscript.tooltip"),shortcutKeys:((g=n.options.shortcutKeys)==null?void 0:g[1])??["mod",","]},e=[];return d!==!1&&e.push(o),a!==!1&&e.push(h),{componentProps:{icon:"Type",tooltip:i("editor.moremark"),disabled:!s.isEditable,items:e,isActive:()=>e==null?void 0:e.find(b=>b.isActive())}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(x.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(f.configure(this.options.superscript)),t}});exports.MoreMark=m;exports.RichTextMoreMark=S;
|
package/lib/MoreMark.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { M as h, m, E as b } from "./index-D0EmqTpe.js";
|
|
2
2
|
import { jsx as e, Fragment as M, jsxs as d } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo as f } from "react";
|
|
4
|
-
import { u as x, e as A, A as S,
|
|
4
|
+
import { u as x, e as A, A as S, M as k, I as v, g as y } from "./index-B1SzsIsE.js";
|
|
5
5
|
import "./theme.js";
|
|
6
|
-
import { D as T, a as K, b as w, c as C } from "./dropdown-menu-
|
|
6
|
+
import { D as T, a as K, b as w, c as C } from "./dropdown-menu-BYbds8yQ.js";
|
|
7
7
|
var H = h.create({
|
|
8
8
|
name: "subscript",
|
|
9
9
|
addOptions() {
|
|
@@ -75,7 +75,7 @@ var H = h.create({
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
-
function
|
|
78
|
+
function z() {
|
|
79
79
|
const t = x(D.name), {
|
|
80
80
|
icon: s = void 0,
|
|
81
81
|
tooltip: n = void 0,
|
|
@@ -153,5 +153,5 @@ const D = /* @__PURE__ */ b.create({
|
|
|
153
153
|
});
|
|
154
154
|
export {
|
|
155
155
|
D as MoreMark,
|
|
156
|
-
|
|
156
|
+
z as RichTextMoreMark
|
|
157
157
|
};
|
package/lib/OrderedList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-fbGGohBT.cjs"),r=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-fbGGohBT.cjs"),r=require("react/jsx-runtime"),s=require("./index-DirFiHQ6.cjs");require("react");require("./theme.cjs");function O(){const t=s.useButtonProps(c.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:u={},action:n=void 0,isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:d,update:l}=s.useToggleActive(a),m=()=>{d||n&&(n(),l())};return t?r.jsx(s.ActionButton,{action:m,dataState:p,disabled:d,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:u}):r.jsx(r.Fragment,{})}const c=v.OrderedList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleOrderedList(),isActive:()=>e.isActive("orderedList"),disabled:!1,icon:"ListOrdered",shortcutKeys:o.options.shortcutKeys??["mod","shift","7"],tooltip:i("editor.orderedlist.tooltip")}})}}});exports.OrderedList=c;exports.RichTextOrderedList=O;
|
package/lib/OrderedList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { O as u } from "./index-DXtVL0al.js";
|
|
2
2
|
import { jsx as n, Fragment as l } from "react/jsx-runtime";
|
|
3
|
-
import { u as f, d as v, A as O } from "./index-
|
|
3
|
+
import { u as f, d as v, A as O } from "./index-B1SzsIsE.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function K() {
|
package/lib/SearchAndReplace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index-C4WLt4NA.cjs"),D=require("@tiptap/pm/state"),b=require("@tiptap/pm/view"),a=require("react/jsx-runtime"),g=require("react"),h=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index-C4WLt4NA.cjs"),D=require("@tiptap/pm/state"),b=require("@tiptap/pm/view"),a=require("react/jsx-runtime"),g=require("react"),h=require("./index-DirFiHQ6.cjs");require("./theme.cjs");const J=require("./index-BqL4vAWE.cjs"),q=require("./popover-BaAurWOZ.cjs");function Q(){const{t}=J.useLocale(),e=h.useEditorInstance(),s=h.useButtonProps(F.name),{icon:n=void 0,tooltip:u=void 0,shortcutKeys:o=void 0,tooltipOptions:c={},action:x=void 0,isActive:m=void 0}=(s==null?void 0:s.componentProps)??{},{disabled:i}=h.useActive(m),[R,f]=g.useState(!1),[p,T]=g.useState(""),[C,N]=g.useState(""),[j,M]=g.useState(!1),[V,$]=g.useState(""),w=()=>{var r,l,v,d;$(`${((l=(r=e==null?void 0:e.storage)==null?void 0:r.searchAndReplace)==null?void 0:l.resultIndex)+1}/${(d=(v=e==null?void 0:e.storage)==null?void 0:v.searchAndReplace)==null?void 0:d.results.length}`)};g.useEffect(()=>{e&&w()},[e]);const K=()=>{i||x&&x()},P=(r=!1)=>{var l,v,d,S,A,E,y,L;e&&(r&&((v=(l=e==null?void 0:e.commands)==null?void 0:l.resetIndex)==null||v.call(l)),(S=(d=e==null?void 0:e.commands)==null?void 0:d.setSearchTerm)==null||S.call(d,p),(E=(A=e==null?void 0:e.commands)==null?void 0:A.setReplaceTerm)==null||E.call(A,C),(L=(y=e==null?void 0:e.commands)==null?void 0:y.setCaseSensitive)==null||L.call(y,j),w())},k=()=>{var S,A;if(!e)return;const{results:r,resultIndex:l}=e.storage.searchAndReplace,v=r[l];if(!v)return;(A=(S=e==null?void 0:e.commands)==null?void 0:S.setTextSelection)==null||A.call(S,v);const{node:d}=e.view.domAtPos(e.state.selection.anchor);d instanceof HTMLElement&&d.scrollIntoView({behavior:"smooth",block:"center"}),w()};g.useEffect(()=>{p.trim()||B(),p.trim()&&P(!0)},[p]),g.useEffect(()=>{C.trim()&&P()},[C]),g.useEffect(()=>{P(!0)},[j]);const W=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replace)==null||l.call(r),k()},H=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.nextSearchResult)==null||l.call(r),k()},U=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.previousSearchResult)==null||l.call(r),k()},B=()=>{var r,l;T(""),N(""),(l=(r=e==null?void 0:e.commands)==null?void 0:r.resetIndex)==null||l.call(r),w()},z=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replaceAll)==null||l.call(r),$("0/0")};return s?a.jsxs(q.Popover,{onOpenChange:f,open:R,children:[a.jsx(q.PopoverTrigger,{asChild:!0,disabled:i,children:a.jsx(h.ActionButton,{action:K,disabled:i,icon:n,shortcutKeys:o,tooltip:u,tooltipOptions:c})}),a.jsxs(q.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:[a.jsxs("div",{className:"richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between",children:[a.jsx(h.Label,{children:t("editor.search.dialog.text")}),a.jsx("span",{className:"richtext-font-semibold",children:V})]}),a.jsxs("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:[a.jsx(h.Input,{autoFocus:!0,className:"richtext-w-full",onChange:r=>T(r.target.value),placeholder:"Text",required:!0,type:"text",value:p}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:U,children:a.jsx(h.IconComponent,{name:"ChevronUp"})}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:H,children:a.jsx(h.IconComponent,{name:"ChevronDown"})}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:B,children:"Clear"})]}),a.jsx(h.Label,{className:"richtext-mb-[6px]",children:t("editor.replace.dialog.text")}),a.jsx("div",{className:"richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:a.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:a.jsx(h.Input,{className:"richtext-w-80",onChange:r=>N(r.target.value),placeholder:"Text",required:!0,type:"text",value:C})})}),a.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-1",children:[a.jsx(h.Checkbox,{checked:j,onCheckedChange:r=>{M(r),e.commands.setCaseSensitive(r)}}),a.jsx(h.Label,{children:t("editor.replace.caseSensitive")})]}),a.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[a.jsx(h.Button,{className:"richtext-flex-1",onClick:W,children:t("editor.replace.dialog.text")}),a.jsx(h.Button,{className:"richtext-flex-1",onClick:z,children:t("editor.replaceAll.dialog.text")})]})]})]}):a.jsx(a.Fragment,{})}const I=(t,e)=>e(t.tr);function X(t,e,s){return RegExp(e?t.replace(/[$()*+.?[\\\]^{|}]/g,String.raw`\$&`):t,s?"gu":"gui")}function Y(t,e,s,n){const u=[],o=[];let c=[],x=0;if(!e)return{decorationsToReturn:b.DecorationSet.empty,results:[]};t==null||t.descendants((m,i)=>{m.isText?c[x]?c[x]={text:c[x].text+m.text,pos:c[x].pos}:c[x]={text:`${m.text}`,pos:i}:x+=1}),c=c.filter(Boolean);for(const m of c){const{text:i,pos:R}=m,f=Array.from(i.matchAll(e)).filter(([p])=>p.trim());for(const p of f){if(p[0]==="")break;p.index!==void 0&&o.push({from:R+p.index,to:R+p.index+p[0].length})}}for(const[m,i]of o.entries()){const R=m===n?`${s} ${s}-current`:s,f=b.Decoration.inline(i.from,i.to,{class:R});u.push(f)}return{decorationsToReturn:b.DecorationSet.create(t,u),results:o}}function O(t,e,{state:s,dispatch:n}){if(!e[0])return;const{from:o,to:c}=e[0];n&&n(s.tr.insertText(t,o,c))}function Z(t,e,s,n){const u=e+1;if(!n[u])return null;const{from:o,to:c}=n[e],x=c-o-t.length+s,{from:m,to:i}=n[u];return n[u]={to:i-x,from:m-x},[x,n]}function _(t,e,{tr:s,dispatch:n}){let u=0,o=e.slice();if(o.length!==0){for(let c=0;c<o.length;c+=1){const{from:x,to:m}=o[c];s.insertText(t,x,m);const i=Z(t,c,u,o);i&&(u=i[0],o=i[1])}n(s)}}const F=G.Extension.create({name:"searchAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchTerm:"",replaceTerm:"",results:[],searchResultClass:"search-result",searchResultCurrentClass:"search-result-current",caseSensitive:!1,disableRegex:!0,onChange:()=>{},button:({editor:e,t:s})=>({componentProps:{action:()=>{},icon:"SearchAndReplace",tooltip:s("editor.searchAndReplace.tooltip"),isActive:()=>!0,editor:e}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.searchTerm=t,I(s,n),!1),setReplaceTerm:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.replaceTerm=t,I(s,n),!1),setCaseSensitive:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.caseSensitive=t,I(s,n),!1),resetIndex:()=>({editor:t,state:e,dispatch:s})=>(t.storage.searchAndReplace.resultIndex=0,I(e,s),!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:s}=t.storage.searchAndReplace,n=s+1;return e[n]?t.storage.searchAndReplace.resultIndex=n:t.storage.searchAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:s}=t.storage.searchAndReplace,n=s-1;return e[n]?t.storage.searchAndReplace.resultIndex=n:t.storage.searchAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:s})=>{const{replaceTerm:n,results:u,resultIndex:o}=t.storage.searchAndReplace,c=u[o];return c?(O(n,[c],{state:e,dispatch:s}),t.storage.searchAndReplace.results.splice(o,1)):(O(n,u,{state:e,dispatch:s}),t.storage.searchAndReplace.results.shift()),I(e,s),!1},replaceAll:()=>({editor:t,tr:e,state:s,dispatch:n})=>{const{replaceTerm:u,results:o}=t.storage.searchAndReplace;return _(u,o,{tr:e,dispatch:n}),t.storage.searchAndReplace.resultIndex=0,t.storage.searchAndReplace.results=[],I(s,n),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:s}=this.options,n=c=>t.storage.searchAndReplace.lastSearchTerm=c,u=c=>t.storage.searchAndReplace.lastCaseSensitive=c,o=c=>t.storage.searchAndReplace.lastResultIndex=c;return[new D.Plugin({key:new D.PluginKey(`richtextCustomPlugin${this.name}`),state:{init:()=>b.DecorationSet.empty,apply({doc:c,docChanged:x},m){const{searchTerm:i,lastSearchTerm:R,caseSensitive:f,lastCaseSensitive:p,resultIndex:T,lastResultIndex:C}=t.storage.searchAndReplace;if(!x&&R===i&&p===f&&C===T)return m;if(n(i),u(f),o(T),!i)return t.storage.searchAndReplace.results=[],b.DecorationSet.empty;const{decorationsToReturn:N,results:j}=Y(c,X(i,s,f),e,T);return t.storage.searchAndReplace.results=j,N}},props:{decorations(c){return this.getState(c)}}})]}});exports.RichTextSearchAndReplace=Q;exports.SearchAndReplace=F;
|
package/lib/SearchAndReplace.js
CHANGED
|
@@ -3,12 +3,12 @@ import { Plugin as X, PluginKey as Y } from "@tiptap/pm/state";
|
|
|
3
3
|
import { DecorationSet as $, Decoration as Z } from "@tiptap/pm/view";
|
|
4
4
|
import { jsx as u, Fragment as _, jsxs as T } from "react/jsx-runtime";
|
|
5
5
|
import { useState as b, useEffect as k } from "react";
|
|
6
|
-
import { h as ee, u as te, e as se, A as re, L as B, j as V, B as N, I as q, C as ne } from "./index-
|
|
6
|
+
import { h as ee, u as te, e as se, A as re, L as B, j as V, B as N, I as q, C as ne } from "./index-B1SzsIsE.js";
|
|
7
7
|
import "./theme.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { u as ce } from "./index-BlXGgvT-.js";
|
|
9
|
+
import { P as ae, a as le, b as oe } from "./popover-CK54Ip2N.js";
|
|
10
10
|
function Ce() {
|
|
11
|
-
const { t } =
|
|
11
|
+
const { t } = ce(), e = ee(), s = te(xe.name), {
|
|
12
12
|
icon: n = void 0,
|
|
13
13
|
tooltip: i = void 0,
|
|
14
14
|
shortcutKeys: l = void 0,
|
|
@@ -61,8 +61,8 @@ function Ce() {
|
|
|
61
61
|
var r, a;
|
|
62
62
|
(a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.replaceAll) == null || a.call(r), j("0/0");
|
|
63
63
|
};
|
|
64
|
-
return s ? /* @__PURE__ */ T(
|
|
65
|
-
/* @__PURE__ */ u(
|
|
64
|
+
return s ? /* @__PURE__ */ T(ae, { onOpenChange: d, open: f, children: [
|
|
65
|
+
/* @__PURE__ */ u(le, { asChild: !0, disabled: o, children: /* @__PURE__ */ u(
|
|
66
66
|
re,
|
|
67
67
|
{
|
|
68
68
|
action: H,
|
|
@@ -73,7 +73,7 @@ function Ce() {
|
|
|
73
73
|
tooltipOptions: c
|
|
74
74
|
}
|
|
75
75
|
) }),
|
|
76
|
-
/* @__PURE__ */ T(
|
|
76
|
+
/* @__PURE__ */ T(oe, { align: "start", className: "richtext-w-full", hideWhenDetached: !0, side: "bottom", children: [
|
|
77
77
|
/* @__PURE__ */ T("div", { className: "richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between", children: [
|
|
78
78
|
/* @__PURE__ */ u(B, { children: t("editor.search.dialog.text") }),
|
|
79
79
|
/* @__PURE__ */ u("span", { className: "richtext-font-semibold", children: W })
|
package/lib/SlashCommand.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-C4WLt4NA.cjs"),u=require("@tiptap/pm/state"),d=require("./clsx-DSAWW32g.cjs"),l=require("./index-TcJ2UKnv.cjs"),r=require("./SlashCommandNodeView-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-C4WLt4NA.cjs"),u=require("@tiptap/pm/state"),d=require("./clsx-DSAWW32g.cjs"),l=require("./index-TcJ2UKnv.cjs"),r=require("./SlashCommandNodeView-CYdYVjeb.cjs"),o=require("./updatePosition-CQE1ct18.cjs"),a=require("react/jsx-runtime"),m=require("react"),c=require("./index-BqL4vAWE.cjs");function C({commandList:e}){const[,t]=r.useSignalCommandList(),{t:n}=c.useLocale();return m.useEffect(()=>{if(!(e!=null&&e.length)){const i=r.renderCommandListDefault({t:n});t(i);return}t(e)},[n,e]),a.jsx(a.Fragment,{})}const f=s.Extension.create({name:"richtextSlashCommand",priority:200,addProseMirrorPlugins(){return[l.Suggestion({pluginKey:new u.PluginKey("richtextSlashCommandPlugin"),editor:this.editor,char:"/",command:({editor:e,range:t,props:n})=>{const{view:i}=e;n.action({editor:e,range:t}),i.focus()},render:()=>{let e;return{onStart:t=>{t.clientRect&&(e=new d.ReactRenderer(r.SlashCommandNodeView,{props:t,editor:t.editor}),e.element.style.position="absolute",document.body.appendChild(e.element),o.updatePosition(t.editor,e.element))},onUpdate(t){e.updateProps(t),t.clientRect&&o.updatePosition(t.editor,e.element)},onKeyDown(t){var n;return t.event.key==="Escape"?(e.destroy(),e.element.remove(),!0):(n=e.ref)==null?void 0:n.onKeyDown(t)},onExit(){e&&(e.destroy(),e.element.remove())}}}})]}});exports.renderCommandListDefault=r.renderCommandListDefault;exports.useFilterCommandList=r.useFilterCommandList;exports.SlashCommand=f;exports.SlashCommandList=C;
|
package/lib/SlashCommand.js
CHANGED
|
@@ -2,8 +2,8 @@ import { E as i } from "./index-D0EmqTpe.js";
|
|
|
2
2
|
import { PluginKey as a } from "@tiptap/pm/state";
|
|
3
3
|
import { R as m } from "./clsx-Bg-2aTKh.js";
|
|
4
4
|
import { S as s } from "./index-P5_MyY0i.js";
|
|
5
|
-
import { u, r as l, S as d } from "./SlashCommandNodeView-
|
|
6
|
-
import { a as F } from "./SlashCommandNodeView-
|
|
5
|
+
import { u, r as l, S as d } from "./SlashCommandNodeView-CT_-28t6.js";
|
|
6
|
+
import { a as F } from "./SlashCommandNodeView-CT_-28t6.js";
|
|
7
7
|
import { u as o } from "./updatePosition-BGD41Hbg.js";
|
|
8
8
|
import { jsx as f, Fragment as c } from "react/jsx-runtime";
|
|
9
9
|
import { useEffect as h } from "react";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as d, jsxs as b } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as y, useState as w, useRef as v, useImperativeHandle as S, useEffect as B, Fragment as D } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { E as N, z as L, L as T, I as V, c as z } from "./index-B1SzsIsE.js";
|
|
4
4
|
import "./theme.js";
|
|
5
|
-
import { H as A, u as
|
|
6
|
-
import { y as
|
|
5
|
+
import { H as A, u as G } from "./index-BlXGgvT-.js";
|
|
6
|
+
import { y as $, V as q } from "./index-BG0kQamI.js";
|
|
7
7
|
function X({ t: i }) {
|
|
8
8
|
const a = [
|
|
9
9
|
{
|
|
@@ -153,13 +153,13 @@ function P(i, a) {
|
|
|
153
153
|
})
|
|
154
154
|
})).filter((l) => l.commands.length > 0);
|
|
155
155
|
}
|
|
156
|
-
const U =
|
|
156
|
+
const U = $([]);
|
|
157
157
|
function O() {
|
|
158
158
|
const [i, a] = q(U);
|
|
159
159
|
return [i, a];
|
|
160
160
|
}
|
|
161
161
|
function F(i, a) {
|
|
162
|
-
const [e] = O(), [t, l] = w(0), [s, m] = w(0), u = v(null), { t: p } =
|
|
162
|
+
const [e] = O(), [t, l] = w(0), [s, m] = w(0), u = v(null), { t: p } = G(), r = P(e, i.query), f = v([]);
|
|
163
163
|
S(a, () => ({
|
|
164
164
|
onKeyDown: h
|
|
165
165
|
})), B(() => {
|
|
@@ -216,7 +216,7 @@ function F(i, a) {
|
|
|
216
216
|
{
|
|
217
217
|
onClick: () => R(n, x),
|
|
218
218
|
ref: (E) => H(n, x, E),
|
|
219
|
-
className:
|
|
219
|
+
className: z(
|
|
220
220
|
"richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",
|
|
221
221
|
{
|
|
222
222
|
"bg-item-active": s === n && t === x
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const d=require("react/jsx-runtime"),m=require("react"),h=require("./index-
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),m=require("react"),h=require("./index-DirFiHQ6.cjs");require("./theme.cjs");const w=require("./index-BqL4vAWE.cjs"),v=require("./index-NsYff_Ni.cjs");function S({t:i}){const s=[{name:"format",title:i("editor.slash.format"),commands:[]},{name:"insert",title:i("editor.slash.insert"),commands:[]}];return w.HEADINGS.forEach(e=>{s[0].commands.push({name:`heading${e}`,label:i(e==="Paragraph"?"editor.paragraph.tooltip":`editor.heading.h${e}.tooltip`),aliases:[`h${e}`,"bt",`bt${e}`],iconName:`Heading${e}`,isActive:t=>e==="Paragraph"?!1:t.isActive("heading",{level:e})||!1,action:({editor:t,range:l})=>{const a=w.HEADINGS.find(u=>t.isActive("heading",{level:u}));if(e==="Paragraph"){a!==void 0&&a!=="Paragraph"&&t.commands.toggleHeading({level:a}),t.chain().focus().deleteRange(l).run();return}if(e){t.chain().focus().deleteRange(l).setHeading({level:e}).run();return}t.chain().focus().deleteRange(l).run()}})}),s[0].commands.push({name:"bulletList",label:i("editor.bulletlist.tooltip"),aliases:["ul","yxlb"],iconName:"List",isActive:e=>e.isActive("bulletList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}}),s[0].commands.push({name:"orderedlist",label:i("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",isActive:e=>e.isActive("orderedList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}}),s[0].commands.push({name:"taskList",label:i("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],isActive:e=>e.isActive("taskList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}}),s[0].commands.push({name:"blockquote",label:i("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",isActive:e=>e.isActive("blockquote"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setBlockquote().run()}}),s[0].commands.push({name:"codeBlock",label:i("editor.codeblock.tooltip"),iconName:"Code2",description:"Code block with syntax highlighting",shouldBeHidden:e=>e.isActive("columns"),isActive:e=>e.isActive("codeBlock"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setCodeBlock().run()}}),s[1].commands.push({name:"image",label:i("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run();const l=h.EVENTS.UPLOAD_IMAGE(e.id);h.emit(l,!0)}}),s[1].commands.push({name:"video",label:i("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run();const l=h.EVENTS.UPLOAD_VIDEO(e.id);h.emit(l,!0)}}),s[1].commands.push({name:"table",label:i("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}}),s[1].commands.push({name:"horizontalRule",label:i("editor.horizontalrule.tooltip"),iconName:"Minus",description:"Insert a horizontal divider",aliases:["hr","fgx","fg"],action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setHorizontalRule().run()}}),s[1].commands.push({name:"columns",label:i("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",action:({editor:e})=>{e.chain().focus().insertColumns({cols:2}).run()}}),s}function C(i,s){return i.map(l=>({...l,commands:l.commands.filter(a=>{const u=a.label.toLowerCase().trim(),x=s.toLowerCase().trim();if(a.aliases){const b=a.aliases.map(f=>f.toLowerCase().trim()),r=u.match(x),g=b.some(f=>f.match(x));return r||g}return u.match(x)})})).filter(l=>l.commands.length>0)}const y=v.y([]);function L(){const[i,s]=v.V(y);return[i,s]}function q(i,s){const[e]=L(),[t,l]=m.useState(0),[a,u]=m.useState(0),x=m.useRef(null),{t:b}=w.useLocale(),r=C(e,i.query),g=m.useRef([]);m.useImperativeHandle(s,()=>({onKeyDown:f})),m.useEffect(()=>{if(!x.current)return;const o=a*1e3+t,n=g.current[o];n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})},[t,a]);function f({event:o}){return o.key==="ArrowUp"?(A(),!0):o.key==="ArrowDown"?(I(),!0):o.key==="Enter"?(R(),!0):!1}function A(){var c;if(r.length===0)return!1;let o=t-1,n=a;o<0&&(n=a-1,o=((c=r[n])==null?void 0:c.commands.length)-1||0),n<0&&(n=r.length-1,o=r[n].commands.length-1),l(o),u(n)}function I(){if(r.length===0)return!1;const o=r[a].commands;let n=t+1,c=a;o.length-1<n&&(n=0,c=a+1),r.length-1<c&&(c=0),l(n),u(c)}function R(){if(r.length===0||a===-1||t===-1)return!1;N(a,t)}function N(o,n){const c=r[o].commands[n];i==null||i.command(c)}function k(o,n){N(o,n)}function E(o,n,c){g.current[o*1e3+n]=c}return d.jsx("div",{className:"richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap richtext-overflow-y-auto richtext-overflow-x-hidden richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none","data-richtext-portal":!0,ref:x,children:r!=null&&r.length?d.jsx("div",{className:"richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5",children:r==null?void 0:r.map((o,n)=>d.jsxs(m.Fragment,{children:[d.jsx(h.Label,{className:"richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase",children:o.title}),o.commands.map((c,p)=>d.jsxs("button",{onClick:()=>k(n,p),ref:H=>E(n,p,H),className:h.cn("richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",{"bg-item-active":a===n&&t===p}),children:[c.iconUrl&&d.jsx("img",{alt:"",className:"richtext-size-6",src:c.iconUrl}),c.iconName&&d.jsx(h.IconComponent,{className:"!richtext-mr-1 !richtext-text-lg",name:c.iconName}),c.label]},`command-${p}`))]},`slash-${o.title}`))}):d.jsx("div",{className:"richtext-p-3",children:d.jsx("span",{className:"richtext-text-xs richtext-text-foreground",children:b("editor.slash.empty")})})})}const D=m.forwardRef(q);exports.SlashCommandNodeView=D;exports.renderCommandListDefault=S;exports.useFilterCommandList=C;exports.useSignalCommandList=L;
|
package/lib/Strike.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-C4WLt4NA.cjs"),s=require("react/jsx-runtime"),o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-C4WLt4NA.cjs"),s=require("react/jsx-runtime"),o=require("./index-DirFiHQ6.cjs");require("react");require("./theme.cjs");var m=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,h=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,S=r.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",r.mergeAttributes(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[r.markInputRule({find:m,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:h,type:this.type})]}});function f(){const t=o.useButtonProps(d.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:n=void 0,tooltipOptions:c={},action:a=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:k,disabled:u,update:p}=o.useToggleActive(l),g=()=>{u||a&&(a(),p())};return t?s.jsx(o.ActionButton,{action:g,dataState:k,disabled:u,icon:e,shortcutKeys:n,tooltip:i,tooltipOptions:c}):s.jsx(s.Fragment,{})}const d=S.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:n})=>({componentProps:{action:()=>e.commands.toggleStrike(),isActive:()=>e.isActive("strike")||!1,disabled:!1,icon:"Strikethrough",shortcutKeys:n.options.shortcutKeys??["shift","mod","S"],tooltip:i("editor.strike.tooltip")}})}}});exports.RichTextStrike=f;exports.Strike=d;
|
package/lib/Strike.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as m, f as k, h as l, m as g } from "./index-D0EmqTpe.js";
|
|
2
2
|
import { jsx as n, Fragment as h } from "react/jsx-runtime";
|
|
3
|
-
import { u as f, d as M, A as S } from "./index-
|
|
3
|
+
import { u as f, d as M, A as S } from "./index-B1SzsIsE.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
var v = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, A = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, y = m.create({
|
|
@@ -2,11 +2,11 @@ import { O as de, S as E, W as Ve, T as W, F as v, u as L, L as ke, s as Ke, X a
|
|
|
2
2
|
import { TextSelection as Je } from "@tiptap/pm/state";
|
|
3
3
|
import { k as Ye, D as oe, a as ne } from "./index-CjLxMm5d.js";
|
|
4
4
|
import { jsxs as ee, jsx as k, Fragment as Ze } from "react/jsx-runtime";
|
|
5
|
-
import { h as Qe, u as et, d as tt, A as ot } from "./index-
|
|
5
|
+
import { h as Qe, u as et, d as tt, A as ot } from "./index-B1SzsIsE.js";
|
|
6
6
|
import { useState as _ } from "react";
|
|
7
7
|
import "./theme.js";
|
|
8
|
-
import { P as nt, a as lt, b as rt } from "./popover-BrSDMb_n.js";
|
|
9
8
|
import { T as O, k as F, m as j } from "./index-BlXGgvT-.js";
|
|
9
|
+
import { P as nt, a as lt, b as rt } from "./popover-CK54Ip2N.js";
|
|
10
10
|
let le, re;
|
|
11
11
|
if (typeof WeakMap < "u") {
|
|
12
12
|
let t = /* @__PURE__ */ new WeakMap();
|