reactjs-tiptap-editor 1.0.11 → 1.0.13
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-DNj0f_A4.cjs +1 -0
- package/lib/{ActionMenuButton-DTXFBdGX.js → ActionMenuButton-l5rSmAO_.js} +18 -14
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +24 -21
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +7 -5
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +11 -9
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +14 -12
- package/lib/Callout.cjs +1 -0
- package/lib/Callout.js +230 -0
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +3 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +11 -9
- package/lib/CodeBlock.cjs +39 -39
- package/lib/CodeBlock.js +840 -945
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +10 -8
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +20 -18
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +7 -5
- package/lib/{Drawer-D0yQ0wR7.js → Drawer-Cbi_MURj.js} +10 -9
- package/lib/Drawer-DKU32YW_.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +11 -9
- package/lib/{Excalidraw-CO4IRHmG.js → Excalidraw-CWrVL5hs.js} +28 -27
- package/lib/Excalidraw-Kb-TRcWY.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +2 -2
- package/lib/ExportPdf.cjs +2 -2
- package/lib/ExportPdf.js +7 -5
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +7 -5
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +9 -8
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +13 -12
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +20 -19
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +9 -7
- package/lib/History.cjs +1 -1
- package/lib/History.js +11 -8
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +7 -5
- package/lib/Icon-Ctva8VeB.js +12 -0
- package/lib/Icon-yqCglrdK.cjs +1 -0
- package/lib/Iframe-BczF8Hex.cjs +1 -0
- package/lib/{Iframe-BEO28NPs.js → Iframe-C942bNjs.js} +42 -40
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +25 -23
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +50 -48
- package/lib/ImportWord.cjs +31 -31
- package/lib/ImportWord.js +8 -6
- package/lib/{Indent-CXurBbOr.js → Indent-C_O5WdyR.js} +26 -24
- package/lib/Indent-CkEC7x36.cjs +1 -0
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +12 -10
- package/lib/{Katex-Bvj469K1.js → Katex-D3PEWimM.js} +12 -10
- package/lib/Katex-DW_HjgNM.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +10 -8
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-8ePAZ-G1.cjs → LinkEditBlock-DL1e2ILk.cjs} +1 -1
- package/lib/{LinkEditBlock-DjXUEubR.js → LinkEditBlock-h5054QDo.js} +22 -20
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +3 -3
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +8 -8
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +25 -22
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +10 -8
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +43 -41
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +6 -6
- package/lib/SlashCommandNodeView-BqrmHCpu.cjs +1 -0
- package/lib/{SlashCommandNodeView-CcqL8ymb.js → SlashCommandNodeView-DXUqkx82.js} +75 -66
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +7 -5
- package/lib/{Table-9Y0Cg8Ab.js → Table-DdrY4jcM.js} +10 -8
- package/lib/Table-kY0nbqJo.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +15 -13
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +20 -17
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +20 -17
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +7 -5
- package/lib/{Twitter-DWwd0vHR.js → Twitter-B-JQ3ZJ1.js} +51 -49
- package/lib/Twitter-DjZcVa3l.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +13 -11
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +2084 -1949
- package/lib/button-BS3n6_Aq.cjs +1 -0
- package/lib/{button-RnHbJfd-.js → button-Uv01FNnd.js} +9 -8
- package/lib/{checkbox-CTEN0q4y.cjs → checkbox-C8ByRi7-.cjs} +1 -1
- package/lib/{checkbox-CLSoR1Qj.js → checkbox-DEFNwGwb.js} +1 -1
- package/lib/{index-sVScpCFG.js → clsx-BWSGDJNJ.js} +224 -224
- package/lib/{index-BBNITgNi.cjs → clsx-CXbNJWDD.cjs} +13 -13
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
- package/lib/components/Bubble/index.d.ts +1 -0
- package/lib/components/ui/index.d.ts +1 -0
- package/lib/{dialog-CMC9hsCo.cjs → dialog-Bt5zwGYB.cjs} +1 -1
- package/lib/{dialog-D_HCtKvc.js → dialog-DwTMZSt6.js} +1 -1
- package/lib/{dropdown-menu-66q7Ofc5.js → dropdown-menu-BetI14G6.js} +1 -1
- package/lib/{dropdown-menu-DKSAS-w_.cjs → dropdown-menu-Bo68IEOT.cjs} +1 -1
- package/lib/events.constant-Dq21NPdV.cjs +1 -0
- package/lib/events.constant-do95b767.js +21 -0
- package/lib/extensions/Callout/Callout.d.ts +18 -0
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
- package/lib/extensions/Callout/index.d.ts +1 -0
- package/lib/{index-CApXPpjF.cjs → index-BCzvbrf5.cjs} +1 -1
- package/lib/{index-9A6-kVBM.js → index-BDKHXe7R.js} +1 -1
- package/lib/{index-DmPwbBqm.js → index-CHKWG6E8.js} +1 -1
- package/lib/index-CcoWj0mF.js +426 -0
- package/lib/index-CjhjjJsN.cjs +1 -0
- package/lib/index-Cs6cp0Y6.cjs +1 -0
- package/lib/index-D3RLYf-J.cjs +1 -0
- package/lib/{index-C3zg3DPB.js → index-DF5ZPtWM.js} +371 -1177
- package/lib/{index-DRHrDScg.js → index-DJbmnBzK.js} +1 -1
- package/lib/index-Doks9cbR.cjs +1 -0
- package/lib/{index-0OnGZkVF.js → index-Dujzr6bY.js} +179 -317
- package/lib/index-VhKd73hZ.cjs +1 -0
- package/lib/{index-DKt5wfAc.js → index-mR8PNv5P.js} +1 -1
- package/lib/{index--nUS7Y66.cjs → index-neeeY2o7.cjs} +3 -3
- package/lib/index.cjs +9 -2
- package/lib/index.js +142 -26
- package/lib/{input-CvyMYMZG.js → input-DUBdJD3L.js} +5 -5
- package/lib/{input-D555880-.cjs → input-Dt_BA_9B.cjs} +1 -1
- package/lib/{isNumber-Bv1Qhmw8.cjs → isNumber-BTYSVlKo.cjs} +1 -1
- package/lib/{isNumber-DF0fU3ob.js → isNumber-CIgubz2e.js} +1 -1
- package/lib/label-JNOksCA-.cjs +1 -0
- package/lib/label-topD46-u.js +19 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +6 -7
- package/lib/locales/en.d.ts +16 -0
- package/lib/locales/fi.d.ts +16 -0
- package/lib/locales/hu.d.ts +16 -0
- package/lib/locales/index.d.ts +99 -4316
- package/lib/locales/pt-br.d.ts +16 -0
- package/lib/locales/vi.d.ts +16 -0
- package/lib/locales/zh-cn.d.ts +16 -0
- package/lib/{popover-B7ec5-u2.js → popover-LfNBhRyz.js} +1 -1
- package/lib/{popover-BSzR_R01.cjs → popover-mL-2sX5r.cjs} +1 -1
- package/lib/react-BEoMZB61.cjs +1 -0
- package/lib/react-c9FSfB30.js +27 -0
- package/lib/select-CwGYPsPq.cjs +1 -0
- package/lib/select-DctYuHLH.js +117 -0
- package/lib/separator-Ddfrhn4D.js +329 -0
- package/lib/separator-NoH_SLRW.cjs +1 -0
- package/lib/store/EditorEditableReactive.d.ts +1 -0
- package/lib/store/ThemeColorReactive.d.ts +1 -0
- package/lib/store/commandList.d.ts +1 -1
- package/lib/store/store.d.ts +6 -7
- package/lib/store-CkjKIgjQ.cjs +1 -0
- package/lib/store-DNpS8vXA.js +10 -0
- package/lib/style.css +1 -1
- package/lib/{tabs-CWr9HYaM.js → tabs-BT3AeqQQ.js} +1 -1
- package/lib/{tabs-BTwiZkWd.cjs → tabs-DRSwUeKP.cjs} +1 -1
- package/lib/{textarea-Yetl_PZi.cjs → textarea-BDO6XQoF.cjs} +1 -1
- package/lib/{textarea-BdeLXbp8.js → textarea-DZzMEDfZ.js} +1 -1
- package/lib/theme/theme.d.ts +5 -0
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +37 -8
- package/lib/{throttle-DsowOft0.js → throttle-IERhwcLa.js} +1 -1
- package/lib/throttle-gTTvqDTW.cjs +1 -0
- package/lib/toggle-BQHMh_Q-.cjs +1 -0
- package/lib/toggle-DKHg5sLm.js +99 -0
- package/lib/tooltip-BYtGp6FM.cjs +1 -0
- package/lib/tooltip-DNKq7zgN.js +24 -0
- package/lib/{updatePosition-Bbd8ETMv.js → updatePosition-Bie75EFq.js} +2 -2
- package/lib/updatePosition-Cjuj2E26.cjs +1 -0
- package/lib/useButtonProps-DBJkNDS2.cjs +1 -0
- package/lib/{useButtonProps-cMoicZgd.js → useButtonProps-DVP4s_ER.js} +48 -36
- package/lib/utils/customEvents/events.constant.d.ts +0 -5
- package/package.json +3 -3
- package/lib/ActionMenuButton-BLlse5KO.cjs +0 -1
- package/lib/Drawer-kv6BU_6O.cjs +0 -1
- package/lib/Excalidraw-B82ThkJA.cjs +0 -1
- package/lib/Icon-DRuJhcHK.js +0 -10
- package/lib/Icon-DXePECFW.cjs +0 -1
- package/lib/Iframe-03dn9wcM.cjs +0 -1
- package/lib/Indent-Cqjdn3Jt.cjs +0 -1
- package/lib/Katex-DdWTV5NJ.cjs +0 -4
- package/lib/SlashCommandNodeView-Bl_gwZJB.cjs +0 -1
- package/lib/Table-DBGjezZK.cjs +0 -9
- package/lib/Twitter-Cnvt7GBg.cjs +0 -1
- package/lib/button-BW5bDPz_.cjs +0 -1
- package/lib/events.constant-DQYeJpu5.cjs +0 -1
- package/lib/events.constant-wrlJ_7JZ.js +0 -26
- package/lib/index-BZ6DfR2r.cjs +0 -1
- package/lib/index-C838s-or.cjs +0 -8
- package/lib/index-Cv9Z6dyV.cjs +0 -1
- package/lib/index-FSRjMsxW.cjs +0 -1
- package/lib/label-DsOYPjAo.js +0 -18
- package/lib/label-E6jF3Xud.cjs +0 -1
- package/lib/separator-JaTTqb3J.js +0 -241
- package/lib/separator-PGnA-6Hr.cjs +0 -1
- package/lib/store/ProviderUniqueId.d.ts +0 -6
- package/lib/store-Cf7tFiiI.js +0 -10
- package/lib/store-oDk-lTPM.cjs +0 -1
- package/lib/throttle-BM3Bmbf_.cjs +0 -1
- package/lib/updatePosition-M2IyqkI1.cjs +0 -1
- package/lib/useButtonProps-DfnJiJLV.cjs +0 -1
package/lib/SearchAndReplace.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { E as Q } from "./
|
|
1
|
+
import { E as Q } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
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 { A as ee } from "./
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { I as
|
|
14
|
-
import {
|
|
15
|
-
|
|
6
|
+
import { A as ee } from "./toggle-DKHg5sLm.js";
|
|
7
|
+
import "./index-DF5ZPtWM.js";
|
|
8
|
+
import "./theme.js";
|
|
9
|
+
import { c as te, u as se, b as re } from "./useButtonProps-DVP4s_ER.js";
|
|
10
|
+
import { u as ne } from "./index-Dujzr6bY.js";
|
|
11
|
+
import { P as ce, a as ae, b as le } from "./popover-LfNBhRyz.js";
|
|
12
|
+
import { L as B } from "./label-topD46-u.js";
|
|
13
|
+
import { I as V } from "./input-DUBdJD3L.js";
|
|
14
|
+
import { B as N } from "./button-Uv01FNnd.js";
|
|
15
|
+
import { I as q } from "./Icon-Ctva8VeB.js";
|
|
16
|
+
import { C as oe } from "./checkbox-DEFNwGwb.js";
|
|
17
|
+
function ke() {
|
|
16
18
|
const { t } = ne(), e = te(), s = se(pe.name), {
|
|
17
19
|
icon: n = void 0,
|
|
18
20
|
tooltip: i = void 0,
|
|
19
21
|
shortcutKeys: l = void 0,
|
|
20
22
|
tooltipOptions: c = {},
|
|
21
|
-
action:
|
|
22
|
-
isActive:
|
|
23
|
-
} = (s == null ? void 0 : s.componentProps) ?? {}, { disabled: o } = re(
|
|
23
|
+
action: m = void 0,
|
|
24
|
+
isActive: h = void 0
|
|
25
|
+
} = (s == null ? void 0 : s.componentProps) ?? {}, { disabled: o } = re(h), [f, d] = b(!1), [p, A] = b(""), [S, w] = b(""), [I, M] = b(!1), [W, D] = b(""), y = () => {
|
|
24
26
|
var r, a, g, x;
|
|
25
27
|
D(`${((a = (r = e == null ? void 0 : e.storage) == null ? void 0 : r.searchAndReplace) == null ? void 0 : a.resultIndex) + 1}/${(x = (g = e == null ? void 0 : e.storage) == null ? void 0 : g.searchAndReplace) == null ? void 0 : x.results.length}`);
|
|
26
28
|
};
|
|
@@ -28,7 +30,7 @@ function ye() {
|
|
|
28
30
|
e && y();
|
|
29
31
|
}, [e]);
|
|
30
32
|
const H = () => {
|
|
31
|
-
o ||
|
|
33
|
+
o || m && m();
|
|
32
34
|
}, L = (r = !1) => {
|
|
33
35
|
var a, g, x, R, v, F, P, O;
|
|
34
36
|
e && (r && ((g = (a = e == null ? void 0 : e.commands) == null ? void 0 : a.resetIndex) == null || g.call(a)), (R = (x = e == null ? void 0 : e.commands) == null ? void 0 : x.setSearchTerm) == null || R.call(x, p), (F = (v = e == null ? void 0 : e.commands) == null ? void 0 : v.setReplaceTerm) == null || F.call(v, S), (O = (P = e == null ? void 0 : e.commands) == null ? void 0 : P.setCaseSensitive) == null || O.call(P, I), y());
|
|
@@ -198,23 +200,23 @@ function ie(t, e, s) {
|
|
|
198
200
|
}
|
|
199
201
|
function ue(t, e, s, n) {
|
|
200
202
|
const i = [], l = [];
|
|
201
|
-
let c = [],
|
|
203
|
+
let c = [], m = 0;
|
|
202
204
|
if (!e)
|
|
203
205
|
return {
|
|
204
206
|
decorationsToReturn: $.empty,
|
|
205
207
|
results: []
|
|
206
208
|
};
|
|
207
|
-
t == null || t.descendants((
|
|
208
|
-
|
|
209
|
-
text: c[
|
|
210
|
-
pos: c[
|
|
211
|
-
} : c[
|
|
212
|
-
text: `${
|
|
209
|
+
t == null || t.descendants((h, o) => {
|
|
210
|
+
h.isText ? c[m] ? c[m] = {
|
|
211
|
+
text: c[m].text + h.text,
|
|
212
|
+
pos: c[m].pos
|
|
213
|
+
} : c[m] = {
|
|
214
|
+
text: `${h.text}`,
|
|
213
215
|
pos: o
|
|
214
|
-
} :
|
|
216
|
+
} : m += 1;
|
|
215
217
|
}), c = c.filter(Boolean);
|
|
216
|
-
for (const
|
|
217
|
-
const { text: o, pos: f } =
|
|
218
|
+
for (const h of c) {
|
|
219
|
+
const { text: o, pos: f } = h, d = Array.from(o.matchAll(e)).filter(
|
|
218
220
|
([p]) => p.trim()
|
|
219
221
|
);
|
|
220
222
|
for (const p of d) {
|
|
@@ -225,8 +227,8 @@ function ue(t, e, s, n) {
|
|
|
225
227
|
});
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
|
-
for (const [
|
|
229
|
-
const f =
|
|
230
|
+
for (const [h, o] of l.entries()) {
|
|
231
|
+
const f = h === n ? `${s} ${s}-current` : s, d = Z.inline(o.from, o.to, {
|
|
230
232
|
class: f
|
|
231
233
|
});
|
|
232
234
|
i.push(d);
|
|
@@ -241,22 +243,22 @@ function K(t, e, { state: s, dispatch: n }) {
|
|
|
241
243
|
const { from: l, to: c } = e[0];
|
|
242
244
|
n && n(s.tr.insertText(t, l, c));
|
|
243
245
|
}
|
|
244
|
-
function
|
|
246
|
+
function me(t, e, s, n) {
|
|
245
247
|
const i = e + 1;
|
|
246
248
|
if (!n[i]) return null;
|
|
247
|
-
const { from: l, to: c } = n[e],
|
|
249
|
+
const { from: l, to: c } = n[e], m = c - l - t.length + s, { from: h, to: o } = n[i];
|
|
248
250
|
return n[i] = {
|
|
249
|
-
to: o -
|
|
250
|
-
from:
|
|
251
|
-
}, [
|
|
251
|
+
to: o - m,
|
|
252
|
+
from: h - m
|
|
253
|
+
}, [m, n];
|
|
252
254
|
}
|
|
253
|
-
function
|
|
255
|
+
function he(t, e, { tr: s, dispatch: n }) {
|
|
254
256
|
let i = 0, l = e.slice();
|
|
255
257
|
if (l.length !== 0) {
|
|
256
258
|
for (let c = 0; c < l.length; c += 1) {
|
|
257
|
-
const { from:
|
|
258
|
-
s.insertText(t,
|
|
259
|
-
const o =
|
|
259
|
+
const { from: m, to: h } = l[c];
|
|
260
|
+
s.insertText(t, m, h);
|
|
261
|
+
const o = me(
|
|
260
262
|
t,
|
|
261
263
|
c,
|
|
262
264
|
i,
|
|
@@ -327,7 +329,7 @@ const pe = Q.create({
|
|
|
327
329
|
},
|
|
328
330
|
replaceAll: () => ({ editor: t, tr: e, state: s, dispatch: n }) => {
|
|
329
331
|
const { replaceTerm: i, results: l } = t.storage.searchAndReplace;
|
|
330
|
-
return
|
|
332
|
+
return he(i, l, { tr: e, dispatch: n }), t.storage.searchAndReplace.resultIndex = 0, t.storage.searchAndReplace.results = [], C(s, n), !1;
|
|
331
333
|
}
|
|
332
334
|
};
|
|
333
335
|
},
|
|
@@ -338,7 +340,7 @@ const pe = Q.create({
|
|
|
338
340
|
key: new Y(`richtextCustomPlugin${this.name}`),
|
|
339
341
|
state: {
|
|
340
342
|
init: () => $.empty,
|
|
341
|
-
apply({ doc: c, docChanged:
|
|
343
|
+
apply({ doc: c, docChanged: m }, h) {
|
|
342
344
|
const {
|
|
343
345
|
searchTerm: o,
|
|
344
346
|
lastSearchTerm: f,
|
|
@@ -347,8 +349,8 @@ const pe = Q.create({
|
|
|
347
349
|
resultIndex: A,
|
|
348
350
|
lastResultIndex: S
|
|
349
351
|
} = t.storage.searchAndReplace;
|
|
350
|
-
if (!
|
|
351
|
-
return
|
|
352
|
+
if (!m && f === o && p === d && S === A)
|
|
353
|
+
return h;
|
|
352
354
|
if (n(o), i(d), l(A), !o)
|
|
353
355
|
return t.storage.searchAndReplace.results = [], $.empty;
|
|
354
356
|
const { decorationsToReturn: w, results: I } = ue(
|
|
@@ -370,6 +372,6 @@ const pe = Q.create({
|
|
|
370
372
|
}
|
|
371
373
|
});
|
|
372
374
|
export {
|
|
373
|
-
|
|
375
|
+
ke as RichTextSearchAndReplace,
|
|
374
376
|
pe as SearchAndReplace
|
|
375
377
|
};
|
package/lib/SlashCommand.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),u=require("@tiptap/pm/state"),d=require("./index-Cs6cp0Y6.cjs"),r=require("./SlashCommandNodeView-BqrmHCpu.cjs"),a=require("./updatePosition-Cjuj2E26.cjs"),s=require("react/jsx-runtime"),l=require("./index-Doks9cbR.cjs"),m=require("react");function c({commandList:e}){const[,t]=r.useSignalCommandList(),{t:n}=l.useLocale();return m.useEffect(()=>{if(!(e!=null&&e.length)){const o=r.renderCommandListDefault({t:n});t(o);return}t(e)},[n,e]),s.jsx(s.Fragment,{})}const C=i.Extension.create({name:"richtextSlashCommand",priority:200,addProseMirrorPlugins(){return[d.Suggestion({pluginKey:new u.PluginKey("richtextSlashCommandPlugin"),editor:this.editor,char:"/",command:({editor:e,range:t,props:n})=>{const{view:o}=e;n.action({editor:e,range:t}),o.focus()},render:()=>{let e;return{onStart:t=>{t.clientRect&&(e=new i.ReactRenderer(r.SlashCommandNodeView,{props:t,editor:t.editor}),e.element.style.position="absolute",document.body.appendChild(e.element),a.updatePosition(t.editor,e.element))},onUpdate(t){e.updateProps(t),t.clientRect&&a.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=C;exports.SlashCommandList=c;
|
package/lib/SlashCommand.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { E as i, R as a } from "./
|
|
1
|
+
import { E as i, R as a } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { PluginKey as m } from "@tiptap/pm/state";
|
|
3
|
-
import { S as s } from "./index-
|
|
4
|
-
import { u, r as l, S as d } from "./SlashCommandNodeView-
|
|
5
|
-
import { a as b } from "./SlashCommandNodeView-
|
|
6
|
-
import { u as o } from "./updatePosition-
|
|
3
|
+
import { S as s } from "./index-BDKHXe7R.js";
|
|
4
|
+
import { u, r as l, S as d } from "./SlashCommandNodeView-DXUqkx82.js";
|
|
5
|
+
import { a as b } from "./SlashCommandNodeView-DXUqkx82.js";
|
|
6
|
+
import { u as o } from "./updatePosition-Bie75EFq.js";
|
|
7
7
|
import { jsx as f, Fragment as c } from "react/jsx-runtime";
|
|
8
|
-
import { u as h } from "./index-
|
|
8
|
+
import { u as h } from "./index-Dujzr6bY.js";
|
|
9
9
|
import { useEffect as C } from "react";
|
|
10
10
|
function E({ commandList: e }) {
|
|
11
11
|
const [, t] = u(), { t: r } = h();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),m=require("react"),S=require("./index-D3RLYf-J.cjs");require("./theme.cjs");const b=require("./index-Doks9cbR.cjs"),y=require("./store-CkjKIgjQ.cjs"),w=require("./events.constant-Dq21NPdV.cjs"),E=require("./react-BEoMZB61.cjs"),j=require("./label-JNOksCA-.cjs"),D=require("./Icon-yqCglrdK.cjs"),B={setOpen:(i,o)=>{w.dispatchEvent(w.EVENTS.UPLOAD_VIDEO(i),o)}};function $({t:i}){const o=[{name:"format",title:i("editor.slash.format"),commands:[]},{name:"insert",title:i("editor.slash.insert"),commands:[]}];return b.HEADINGS.forEach(e=>{o[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=b.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()}})}),o[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()}}),o[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()}}),o[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()}}),o[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()}}),o[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()}}),o[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(),y.actionDialogImage.setOpen(e.id,!0)}}),o[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(),B.setOpen(e.id,!0)}}),o[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()}}),o[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()}}),o[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()}}),o}function C(i,o){return i.map(l=>({...l,commands:l.commands.filter(a=>{const u=a.label.toLowerCase().trim(),h=o.toLowerCase().trim();if(a.aliases){const p=a.aliases.map(x=>x.toLowerCase().trim()),r=u.match(h),f=p.some(x=>x.match(h));return r||f}return u.match(h)})})).filter(l=>l.commands.length>0)}const L=E.create((i=>({commandList:[],setCommandList:o=>{i(()=>({commandList:o}))}})));function N(){const i=L(e=>e.commandList),o=L(e=>e.setCommandList);return[i,o]}function G(i,o){const[e]=N(),[t,l]=m.useState(0),[a,u]=m.useState(0),h=m.useRef(null),{t:p}=b.useLocale(),r=C(e,i.query),f=m.useRef([]);m.useImperativeHandle(o,()=>({onKeyDown:x})),m.useEffect(()=>{if(!h.current)return;const s=a*1e3+t,n=f.current[s];n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})},[t,a]);function x({event:s}){return s.key==="ArrowUp"?(A(),!0):s.key==="ArrowDown"?(R(),!0):s.key==="Enter"?(I(),!0):!1}function A(){var c;if(r.length===0)return!1;let s=t-1,n=a;s<0&&(n=a-1,s=((c=r[n])==null?void 0:c.commands.length)-1||0),n<0&&(n=r.length-1,s=r[n].commands.length-1),l(s),u(n)}function R(){if(r.length===0)return!1;const s=r[a].commands;let n=t+1,c=a;s.length-1<n&&(n=0,c=a+1),r.length-1<c&&(c=0),l(n),u(c)}function I(){if(r.length===0||a===-1||t===-1)return!1;v(a,t)}function v(s,n){const c=r[s].commands[n];i==null||i.command(c)}function k(s,n){v(s,n)}function q(s,n,c){f.current[s*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:h,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((s,n)=>d.jsxs(m.Fragment,{children:[d.jsx(j.Label,{className:"richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase ",children:s.title}),s.commands.map((c,g)=>d.jsxs("button",{onClick:()=>k(n,g),ref:H=>q(n,g,H),className:S.cn("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-text-foreground richtext-text-left richtext-w-full richtext-rounded-sm !richtext-outline-none !richtext-border-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ",{"bg-item-active":a===n&&t===g}),children:[c.iconUrl&&d.jsx("img",{alt:"",className:"richtext-size-6",src:c.iconUrl}),c.iconName&&d.jsx(D.IconComponent,{className:"!richtext-mr-1 !richtext-text-lg",name:c.iconName}),c.label]},`command-${g}`))]},`slash-${s.title}`))}):d.jsx("div",{className:"richtext-p-3",children:d.jsx("span",{className:"richtext-text-xs richtext-text-foreground",children:p("editor.slash.empty")})})})}const V=m.forwardRef(G);exports.SlashCommandNodeView=V;exports.renderCommandListDefault=$;exports.useFilterCommandList=C;exports.useSignalCommandList=N;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { jsx as d, jsxs as b } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { forwardRef as y, useState as v, useRef as w, useImperativeHandle as E, useEffect as S, Fragment as B } from "react";
|
|
3
|
+
import { c as D } from "./index-DF5ZPtWM.js";
|
|
4
|
+
import "./theme.js";
|
|
5
|
+
import { H as L, u as $ } from "./index-Dujzr6bY.js";
|
|
6
|
+
import { a as z } from "./store-DNpS8vXA.js";
|
|
7
|
+
import { d as G, E as O } from "./events.constant-do95b767.js";
|
|
8
|
+
import { c as T } from "./react-c9FSfB30.js";
|
|
9
|
+
import { L as V } from "./label-topD46-u.js";
|
|
10
|
+
import { I as q } from "./Icon-Ctva8VeB.js";
|
|
9
11
|
const P = {
|
|
10
|
-
setOpen: (i,
|
|
11
|
-
O
|
|
12
|
+
setOpen: (i, n) => {
|
|
13
|
+
G(O.UPLOAD_VIDEO(i), n);
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
+
function te({ t: i }) {
|
|
17
|
+
const n = [
|
|
16
18
|
{
|
|
17
19
|
name: "format",
|
|
18
20
|
title: i("editor.slash.format"),
|
|
@@ -24,17 +26,17 @@ function ee({ t: i }) {
|
|
|
24
26
|
commands: []
|
|
25
27
|
}
|
|
26
28
|
];
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
+
return L.forEach((e) => {
|
|
30
|
+
n[0].commands.push({
|
|
29
31
|
name: `heading${e}`,
|
|
30
32
|
label: i(e === "Paragraph" ? "editor.paragraph.tooltip" : `editor.heading.h${e}.tooltip`),
|
|
31
33
|
aliases: [`h${e}`, "bt", `bt${e}`],
|
|
32
34
|
iconName: `Heading${e}`,
|
|
33
35
|
isActive: (t) => e === "Paragraph" ? !1 : t.isActive("heading", { level: e }) || !1,
|
|
34
36
|
action: ({ editor: t, range: l }) => {
|
|
35
|
-
const s =
|
|
37
|
+
const s = L.find((m) => t.isActive("heading", { level: m }));
|
|
36
38
|
if (e === "Paragraph") {
|
|
37
|
-
s !== void 0 && s !== "Paragraph"
|
|
39
|
+
s !== void 0 && s !== "Paragraph" && t.commands.toggleHeading({ level: s }), t.chain().focus().deleteRange(l).run();
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
40
42
|
if (e) {
|
|
@@ -44,7 +46,7 @@ function ee({ t: i }) {
|
|
|
44
46
|
t.chain().focus().deleteRange(l).run();
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
|
-
}),
|
|
49
|
+
}), n[0].commands.push({
|
|
48
50
|
name: "bulletList",
|
|
49
51
|
label: i("editor.bulletlist.tooltip"),
|
|
50
52
|
aliases: ["ul", "yxlb"],
|
|
@@ -53,7 +55,7 @@ function ee({ t: i }) {
|
|
|
53
55
|
action: ({ editor: e, range: t }) => {
|
|
54
56
|
e.chain().focus().deleteRange(t).toggleBulletList().run();
|
|
55
57
|
}
|
|
56
|
-
}),
|
|
58
|
+
}), n[0].commands.push({
|
|
57
59
|
name: "orderedlist",
|
|
58
60
|
label: i("editor.orderedlist.tooltip"),
|
|
59
61
|
aliases: ["ol", "yxlb"],
|
|
@@ -62,7 +64,7 @@ function ee({ t: i }) {
|
|
|
62
64
|
action: ({ editor: e, range: t }) => {
|
|
63
65
|
e.chain().focus().deleteRange(t).toggleOrderedList().run();
|
|
64
66
|
}
|
|
65
|
-
}),
|
|
67
|
+
}), n[0].commands.push({
|
|
66
68
|
name: "taskList",
|
|
67
69
|
label: i("editor.tasklist.tooltip"),
|
|
68
70
|
iconName: "ListTodo",
|
|
@@ -72,7 +74,7 @@ function ee({ t: i }) {
|
|
|
72
74
|
action: ({ editor: e, range: t }) => {
|
|
73
75
|
e.chain().focus().deleteRange(t).toggleTaskList().run();
|
|
74
76
|
}
|
|
75
|
-
}),
|
|
77
|
+
}), n[0].commands.push({
|
|
76
78
|
name: "blockquote",
|
|
77
79
|
label: i("editor.blockquote.tooltip"),
|
|
78
80
|
description: "插入引入格式",
|
|
@@ -82,7 +84,7 @@ function ee({ t: i }) {
|
|
|
82
84
|
action: ({ editor: e, range: t }) => {
|
|
83
85
|
e.chain().focus().deleteRange(t).setBlockquote().run();
|
|
84
86
|
}
|
|
85
|
-
}),
|
|
87
|
+
}), n[0].commands.push({
|
|
86
88
|
name: "codeBlock",
|
|
87
89
|
label: i("editor.codeblock.tooltip"),
|
|
88
90
|
iconName: "Code2",
|
|
@@ -92,7 +94,7 @@ function ee({ t: i }) {
|
|
|
92
94
|
action: ({ editor: e, range: t }) => {
|
|
93
95
|
e.chain().focus().deleteRange(t).setCodeBlock().run();
|
|
94
96
|
}
|
|
95
|
-
}),
|
|
97
|
+
}), n[1].commands.push({
|
|
96
98
|
name: "image",
|
|
97
99
|
label: i("editor.image.tooltip"),
|
|
98
100
|
iconName: "ImageUp",
|
|
@@ -100,9 +102,9 @@ function ee({ t: i }) {
|
|
|
100
102
|
aliases: ["image", "tp", "tupian"],
|
|
101
103
|
shouldBeHidden: (e) => e.isActive("columns"),
|
|
102
104
|
action: ({ editor: e, range: t }) => {
|
|
103
|
-
e.chain().focus().deleteRange(t).run(),
|
|
105
|
+
e.chain().focus().deleteRange(t).run(), z.setOpen(e.id, !0);
|
|
104
106
|
}
|
|
105
|
-
}),
|
|
107
|
+
}), n[1].commands.push({
|
|
106
108
|
name: "video",
|
|
107
109
|
label: i("editor.video.tooltip"),
|
|
108
110
|
iconName: "Video",
|
|
@@ -112,7 +114,7 @@ function ee({ t: i }) {
|
|
|
112
114
|
action: ({ editor: e, range: t }) => {
|
|
113
115
|
e.chain().focus().deleteRange(t).run(), P.setOpen(e.id, !0);
|
|
114
116
|
}
|
|
115
|
-
}),
|
|
117
|
+
}), n[1].commands.push({
|
|
116
118
|
name: "table",
|
|
117
119
|
label: i("editor.table.tooltip"),
|
|
118
120
|
iconName: "Table",
|
|
@@ -122,7 +124,7 @@ function ee({ t: i }) {
|
|
|
122
124
|
action: ({ editor: e, range: t }) => {
|
|
123
125
|
e.chain().focus().deleteRange(t).insertTable({ rows: 3, cols: 3, withHeaderRow: !1 }).run();
|
|
124
126
|
}
|
|
125
|
-
}),
|
|
127
|
+
}), n[1].commands.push({
|
|
126
128
|
name: "horizontalRule",
|
|
127
129
|
label: i("editor.horizontalrule.tooltip"),
|
|
128
130
|
iconName: "Minus",
|
|
@@ -131,7 +133,7 @@ function ee({ t: i }) {
|
|
|
131
133
|
action: ({ editor: e, range: t }) => {
|
|
132
134
|
e.chain().focus().deleteRange(t).setHorizontalRule().run();
|
|
133
135
|
}
|
|
134
|
-
}),
|
|
136
|
+
}), n[1].commands.push({
|
|
135
137
|
name: "columns",
|
|
136
138
|
label: i("editor.columns.tooltip"),
|
|
137
139
|
iconName: "Columns2",
|
|
@@ -139,13 +141,13 @@ function ee({ t: i }) {
|
|
|
139
141
|
action: ({ editor: e }) => {
|
|
140
142
|
e.chain().focus().insertColumns({ cols: 2 }).run();
|
|
141
143
|
}
|
|
142
|
-
}),
|
|
144
|
+
}), n;
|
|
143
145
|
}
|
|
144
|
-
function U(i,
|
|
146
|
+
function U(i, n) {
|
|
145
147
|
return i.map((l) => ({
|
|
146
148
|
...l,
|
|
147
149
|
commands: l.commands.filter((s) => {
|
|
148
|
-
const m = s.label.toLowerCase().trim(), u =
|
|
150
|
+
const m = s.label.toLowerCase().trim(), u = n.toLowerCase().trim();
|
|
149
151
|
if (s.aliases) {
|
|
150
152
|
const x = s.aliases.map((h) => h.toLowerCase().trim()), r = m.match(u), f = x.some((h) => h.match(u));
|
|
151
153
|
return r || f;
|
|
@@ -154,55 +156,62 @@ function U(i, a) {
|
|
|
154
156
|
})
|
|
155
157
|
})).filter((l) => l.commands.length > 0);
|
|
156
158
|
}
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
const C = T(((i) => ({
|
|
160
|
+
commandList: [],
|
|
161
|
+
setCommandList: (n) => {
|
|
162
|
+
i(() => ({
|
|
163
|
+
commandList: n
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
})));
|
|
167
|
+
function F() {
|
|
168
|
+
const i = C((e) => e.commandList), n = C((e) => e.setCommandList);
|
|
169
|
+
return [i, n];
|
|
161
170
|
}
|
|
162
|
-
function
|
|
163
|
-
const [e] =
|
|
164
|
-
|
|
171
|
+
function M(i, n) {
|
|
172
|
+
const [e] = F(), [t, l] = v(0), [s, m] = v(0), u = w(null), { t: x } = $(), r = U(e, i.query), f = w([]);
|
|
173
|
+
E(n, () => ({
|
|
165
174
|
onKeyDown: h
|
|
166
|
-
})),
|
|
175
|
+
})), S(() => {
|
|
167
176
|
if (!u.current)
|
|
168
177
|
return;
|
|
169
|
-
const
|
|
170
|
-
|
|
178
|
+
const a = s * 1e3 + t, o = f.current[a];
|
|
179
|
+
o && o.scrollIntoView({
|
|
171
180
|
behavior: "smooth",
|
|
172
181
|
block: "nearest"
|
|
173
182
|
});
|
|
174
183
|
}, [t, s]);
|
|
175
|
-
function h({ event:
|
|
176
|
-
return
|
|
184
|
+
function h({ event: a }) {
|
|
185
|
+
return a.key === "ArrowUp" ? (N(), !0) : a.key === "ArrowDown" ? (A(), !0) : a.key === "Enter" ? (I(), !0) : !1;
|
|
177
186
|
}
|
|
178
187
|
function N() {
|
|
179
188
|
var c;
|
|
180
189
|
if (r.length === 0)
|
|
181
190
|
return !1;
|
|
182
|
-
let
|
|
183
|
-
|
|
191
|
+
let a = t - 1, o = s;
|
|
192
|
+
a < 0 && (o = s - 1, a = ((c = r[o]) == null ? void 0 : c.commands.length) - 1 || 0), o < 0 && (o = r.length - 1, a = r[o].commands.length - 1), l(a), m(o);
|
|
184
193
|
}
|
|
185
|
-
function
|
|
194
|
+
function A() {
|
|
186
195
|
if (r.length === 0)
|
|
187
196
|
return !1;
|
|
188
|
-
const
|
|
189
|
-
let
|
|
190
|
-
|
|
197
|
+
const a = r[s].commands;
|
|
198
|
+
let o = t + 1, c = s;
|
|
199
|
+
a.length - 1 < o && (o = 0, c = s + 1), r.length - 1 < c && (c = 0), l(o), m(c);
|
|
191
200
|
}
|
|
192
|
-
function
|
|
201
|
+
function I() {
|
|
193
202
|
if (r.length === 0 || s === -1 || t === -1)
|
|
194
203
|
return !1;
|
|
195
204
|
g(s, t);
|
|
196
205
|
}
|
|
197
|
-
function g(
|
|
198
|
-
const c = r[
|
|
206
|
+
function g(a, o) {
|
|
207
|
+
const c = r[a].commands[o];
|
|
199
208
|
i == null || i.command(c);
|
|
200
209
|
}
|
|
201
|
-
function
|
|
202
|
-
g(
|
|
210
|
+
function k(a, o) {
|
|
211
|
+
g(a, o);
|
|
203
212
|
}
|
|
204
|
-
function
|
|
205
|
-
f.current[
|
|
213
|
+
function R(a, o, c) {
|
|
214
|
+
f.current[a * 1e3 + o] = c;
|
|
206
215
|
}
|
|
207
216
|
return /* @__PURE__ */ d(
|
|
208
217
|
"div",
|
|
@@ -210,15 +219,15 @@ function j(i, a) {
|
|
|
210
219
|
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",
|
|
211
220
|
"data-richtext-portal": !0,
|
|
212
221
|
ref: u,
|
|
213
|
-
children: r != null && r.length ? /* @__PURE__ */ d("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: r == null ? void 0 : r.map((
|
|
214
|
-
/* @__PURE__ */ d(V, { className: "richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase ", children:
|
|
215
|
-
|
|
222
|
+
children: r != null && r.length ? /* @__PURE__ */ d("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: r == null ? void 0 : r.map((a, o) => /* @__PURE__ */ b(B, { children: [
|
|
223
|
+
/* @__PURE__ */ d(V, { className: "richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase ", children: a.title }),
|
|
224
|
+
a.commands.map((c, p) => /* @__PURE__ */ b(
|
|
216
225
|
"button",
|
|
217
226
|
{
|
|
218
|
-
onClick: () =>
|
|
219
|
-
ref: (
|
|
220
|
-
className:
|
|
221
|
-
"bg-item-active": s ===
|
|
227
|
+
onClick: () => k(o, p),
|
|
228
|
+
ref: (H) => R(o, p, H),
|
|
229
|
+
className: D("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-text-foreground richtext-text-left richtext-w-full richtext-rounded-sm !richtext-outline-none !richtext-border-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ", {
|
|
230
|
+
"bg-item-active": s === o && t === p
|
|
222
231
|
}),
|
|
223
232
|
children: [
|
|
224
233
|
c.iconUrl && /* @__PURE__ */ d(
|
|
@@ -241,14 +250,14 @@ function j(i, a) {
|
|
|
241
250
|
},
|
|
242
251
|
`command-${p}`
|
|
243
252
|
))
|
|
244
|
-
] }, `slash-${
|
|
253
|
+
] }, `slash-${a.title}`)) }) : /* @__PURE__ */ d("div", { className: "richtext-p-3", children: /* @__PURE__ */ d("span", { className: "richtext-text-xs richtext-text-foreground", children: x("editor.slash.empty") }) })
|
|
245
254
|
}
|
|
246
255
|
);
|
|
247
256
|
}
|
|
248
|
-
const
|
|
257
|
+
const ie = y(M);
|
|
249
258
|
export {
|
|
250
|
-
|
|
259
|
+
ie as S,
|
|
251
260
|
U as a,
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
te as r,
|
|
262
|
+
F as u
|
|
254
263
|
};
|
package/lib/Strike.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),m=require("./toggle-BQHMh_Q-.cjs");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const u=require("./useButtonProps-DBJkNDS2.cjs");var h=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,S=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,f=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:h,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:S,type:this.type})]}});function v(){const t=u.useButtonProps(d.name),{icon:e=void 0,tooltip:s=void 0,shortcutKeys:i=void 0,tooltipOptions:c={},action:o=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:a,update:k}=u.useToggleActive(l),g=()=>{a||o&&(o(),k())};return t?n.jsx(m.ActionButton,{action:g,dataState:p,disabled:a,icon:e,shortcutKeys:i,tooltip:s,tooltipOptions:c}):n.jsx(n.Fragment,{})}const d=f.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:s,extension:i})=>({componentProps:{action:()=>e.commands.toggleStrike(),isActive:()=>e.isActive("strike")||!1,disabled:!1,icon:"Strikethrough",shortcutKeys:i.options.shortcutKeys??["shift","mod","S"],tooltip:s("editor.strike.tooltip")}})}}});exports.RichTextStrike=v;exports.Strike=d;
|
package/lib/Strike.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { M as c,
|
|
1
|
+
import { M as c, e as k, f as l, m as g } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { jsx as n, Fragment as h } from "react/jsx-runtime";
|
|
3
|
-
import { A as f } from "./
|
|
3
|
+
import { A as f } from "./toggle-DKHg5sLm.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import
|
|
5
|
+
import "./index-DF5ZPtWM.js";
|
|
6
|
+
import "./theme.js";
|
|
7
|
+
import { u as M, a as S } from "./useButtonProps-DVP4s_ER.js";
|
|
6
8
|
var v = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, A = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, y = c.create({
|
|
7
9
|
name: "strike",
|
|
8
10
|
addOptions() {
|
|
@@ -63,7 +65,7 @@ var v = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, A = /(?:^|\s)(~~(?!\s+~~
|
|
|
63
65
|
];
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
|
-
function
|
|
68
|
+
function w() {
|
|
67
69
|
const t = M(x.name), {
|
|
68
70
|
icon: e = void 0,
|
|
69
71
|
tooltip: r = void 0,
|
|
@@ -108,6 +110,6 @@ const x = /* @__PURE__ */ y.extend({
|
|
|
108
110
|
}
|
|
109
111
|
});
|
|
110
112
|
export {
|
|
111
|
-
|
|
113
|
+
w as RichTextStrike,
|
|
112
114
|
x as Strike
|
|
113
115
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { U as de, S as E, Z as Ve, T as $, F as v, x as L, Q as ke, v as Ke, _ as Xe, N as Z, m as J, W as Ue, X as Ge, E as Ee, $ as qe } from "./
|
|
1
|
+
import { U as de, S as E, Z as Ve, T as $, F as v, x as L, Q as ke, v as Ke, _ as Xe, N as Z, m as J, W as Ue, X as Ge, E as Ee, $ as qe } from "./clsx-BWSGDJNJ.js";
|
|
2
2
|
import { TextSelection as Ze } from "@tiptap/pm/state";
|
|
3
|
-
import { k as Je, D as oe, a as ne } from "./index-
|
|
3
|
+
import { k as Je, D as oe, a as ne } from "./index-mR8PNv5P.js";
|
|
4
4
|
import { jsxs as ee, jsx as k, Fragment as Ye } from "react/jsx-runtime";
|
|
5
|
-
import { A as Qe } from "./
|
|
5
|
+
import { A as Qe } from "./toggle-DKHg5sLm.js";
|
|
6
6
|
import { useState as _ } from "react";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
7
|
+
import "./index-DF5ZPtWM.js";
|
|
8
|
+
import "./theme.js";
|
|
9
|
+
import { T as O, k as F, m as j } from "./index-Dujzr6bY.js";
|
|
10
|
+
import { P as et, a as tt, b as ot } from "./popover-LfNBhRyz.js";
|
|
11
|
+
import { c as nt, u as lt, a as rt } from "./useButtonProps-DVP4s_ER.js";
|
|
10
12
|
let le, re;
|
|
11
13
|
if (typeof WeakMap < "u") {
|
|
12
14
|
let t = /* @__PURE__ */ new WeakMap();
|
|
@@ -1908,7 +1910,7 @@ function Co(t) {
|
|
|
1908
1910
|
}
|
|
1909
1911
|
);
|
|
1910
1912
|
}
|
|
1911
|
-
function
|
|
1913
|
+
function Lo() {
|
|
1912
1914
|
const t = nt(), e = lt(yo.name), {
|
|
1913
1915
|
icon: o = void 0,
|
|
1914
1916
|
tooltip: n = void 0,
|
|
@@ -1978,6 +1980,6 @@ const yo = /* @__PURE__ */ je.extend({
|
|
|
1978
1980
|
});
|
|
1979
1981
|
export {
|
|
1980
1982
|
w as C,
|
|
1981
|
-
|
|
1983
|
+
Lo as R,
|
|
1982
1984
|
yo as T
|
|
1983
1985
|
};
|