reactjs-tiptap-editor 1.0.6 → 1.0.7
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-htJNI0Fa.js → ActionMenuButton-fTe9ka2F.js} +10 -13
- package/lib/ActionMenuButton-wU6jxKJv.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +23 -25
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +5 -6
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +5 -6
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +11 -12
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +3 -3
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +9 -10
- package/lib/CodeBlock.cjs +39 -39
- package/lib/CodeBlock.js +837 -946
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +8 -9
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +20 -21
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +5 -6
- package/lib/Drawer-BGSwHoka.cjs +1 -0
- package/lib/{Drawer-1211urKj.js → Drawer-DmtILKW4.js} +16 -17
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +15 -16
- package/lib/Excalidraw-BG2U9i30.cjs +1 -0
- package/lib/{Excalidraw-Du3hBR8t.js → Excalidraw-CrG8fW-7.js} +31 -32
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +2 -2
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +17 -18
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +5 -6
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +15 -15
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +10 -11
- package/lib/History.cjs +1 -1
- package/lib/History.js +8 -10
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +5 -6
- package/lib/Icon-C3j4ls73.cjs +1 -0
- package/lib/{Icon-C-qYUAS1.js → Icon-CysGlJkv.js} +3 -4
- package/lib/{Iframe-DTYTLQE6.js → Iframe-BmqguWbj.js} +13 -14
- package/lib/Iframe-CXDghI6m.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +48 -49
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +22 -23
- package/lib/ImportWord.cjs +2 -2
- package/lib/ImportWord.js +10 -11
- package/lib/Indent-B1glTHHl.cjs +1 -0
- package/lib/{Indent-jOPn3eUM.js → Indent-BhnGkEaY.js} +24 -25
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +10 -11
- package/lib/Katex-BKL_6NWF.cjs +4 -0
- package/lib/{Katex-CERSrcTP.js → Katex-D4eBjS34.js} +21 -22
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +15 -16
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-B5SdhOfa.js → LinkEditBlock-D1eSM0kn.js} +55 -56
- package/lib/{LinkEditBlock-DaxljgJC.cjs → LinkEditBlock-DW17TyCA.cjs} +2 -2
- package/lib/Mention.js +2 -2
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +20 -20
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +19 -21
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +5 -6
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +22 -23
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +14 -14
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +5 -6
- package/lib/{Table-39OkCQbu.js → Table-BIZppoiY.js} +7 -8
- package/lib/Table-CIzgfvr9.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 +13 -14
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +17 -19
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +17 -19
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +5 -6
- package/lib/{Twitter-D7PhLycr.js → Twitter-DhczYjbR.js} +21 -22
- package/lib/Twitter-DwWVNAV5.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 +24 -25
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +419 -421
- package/lib/button-B6ukqDUf.cjs +1 -0
- package/lib/{button-Crm67hfl.js → button-C81t4pb1.js} +3 -4
- package/lib/{checkbox-DViVmgJ6.js → checkbox-CUE9ex4D.js} +1 -1
- package/lib/{checkbox-NQC2MdGT.cjs → checkbox-ZdxysUFa.cjs} +1 -1
- package/lib/{dialog-DaHBd2zw.cjs → dialog-Cfx8yjkr.cjs} +1 -1
- package/lib/{dialog-Ce9Cjfft.js → dialog-DMJStzBb.js} +1 -1
- package/lib/{dropdown-menu-CQykJhBs.js → dropdown-menu-B8iyTZcP.js} +1 -1
- package/lib/{dropdown-menu-CSCDQtq0.cjs → dropdown-menu-Busg3FNn.cjs} +1 -1
- package/lib/{index-DuZCJJSp.js → index--knBGB61.js} +1118 -504
- package/lib/{index-nFjllrEl.js → index-BvYjBPF9.js} +7 -7
- package/lib/index-D42xFOzI.cjs +7 -0
- package/lib/{index-D-FhWysc.js → index-Dwt9--mS.js} +1 -1
- package/lib/{index-BeUrdBxf.js → index-RKufd2EL.js} +1 -1
- package/lib/{index-prphFVsp.js → index-ccgHvIfu.js} +1 -1
- package/lib/index.cjs +2 -2
- package/lib/index.js +8 -9
- package/lib/{input-tU3H__39.cjs → input-BxzQAIRv.cjs} +1 -1
- package/lib/{input-DfqFAyKo.js → input-DR_5pbuA.js} +1 -1
- package/lib/{isNumber-CTm1pIvN.js → isNumber-1y3eeW-y.js} +1 -1
- package/lib/label-BfWfLggp.cjs +1 -0
- package/lib/label-D-0oXKCn.js +18 -0
- package/lib/{popover-CoepUobG.js → popover-D3spkemr.js} +1 -1
- package/lib/{popover-CZWSQZ0q.cjs → popover-sP8CwbV-.cjs} +1 -1
- package/lib/{separator-6SnwzytZ.js → separator-rM48NeAo.js} +18 -18
- package/lib/{separator-DCQD8P6s.cjs → separator-yycaNdlI.cjs} +1 -1
- package/lib/{store-726Zjszt.cjs → store-BajRl43v.cjs} +1 -1
- package/lib/{store-ibARMQ3h.js → store-NKeQOve_.js} +1 -1
- package/lib/{tabs-DrkJL_C2.js → tabs-Cb6Bmpbb.js} +1 -1
- package/lib/{tabs-B_ArrG09.cjs → tabs-D2nCIOVL.cjs} +1 -1
- package/lib/{textarea-CIs52G8B.js → textarea-BYZu1lUC.js} +1 -1
- package/lib/{textarea-CmZVZKOo.cjs → textarea-Cbwi_h4h.cjs} +1 -1
- package/lib/{throttle-CGM5M2yG.js → throttle-CjwXmkIY.js} +1 -1
- package/lib/{updatePosition-DpMKxYdN.js → updatePosition-BAGpT34H.js} +1 -1
- package/lib/{useButtonProps-D0SrPzuG.js → useButtonProps-BIH_9bXT.js} +35 -47
- package/lib/useButtonProps-TfmRCM9r.cjs +1 -0
- package/package.json +5 -1
- package/lib/ActionMenuButton-DYT5chmX.cjs +0 -1
- package/lib/Drawer-DUFUd5BW.cjs +0 -1
- package/lib/Excalidraw-CajgZDjU.cjs +0 -1
- package/lib/Icon-BjR_or8V.cjs +0 -1
- package/lib/Iframe-CM6mRQmv.cjs +0 -1
- package/lib/Indent-BmhiEb0S.cjs +0 -1
- package/lib/Katex-CUd3LxLh.cjs +0 -4
- package/lib/Table-3VstSlg4.cjs +0 -9
- package/lib/Twitter-DuHPeVW1.cjs +0 -1
- package/lib/button-xNppt_aK.cjs +0 -1
- package/lib/index-BQ17A_37.js +0 -393
- package/lib/index-CNzHZDls.cjs +0 -7
- package/lib/index-DmOTQudI.cjs +0 -1
- package/lib/label-DC33TZy_.js +0 -19
- package/lib/label-DkDE77kc.cjs +0 -1
- package/lib/toggle-DVCNvcqp.cjs +0 -1
- package/lib/toggle-xchtz-Kf.js +0 -92
- package/lib/tooltip-BTFcHrd9.js +0 -24
- package/lib/tooltip-DFjcKu9a.cjs +0 -1
- package/lib/useButtonProps-bei1vI37.cjs +0 -1
package/lib/Mermaid.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { s as U, u as G, m as X, R as Z } from "./index-
|
|
2
|
-
import { a as q, c as Y } from "./throttle-
|
|
1
|
+
import { s as U, u as G, m as X, R as Z } from "./index-BvYjBPF9.js";
|
|
2
|
+
import { a as q, c as Y } from "./throttle-CjwXmkIY.js";
|
|
3
3
|
import { jsxs as C, jsx as n, Fragment as J } from "react/jsx-runtime";
|
|
4
4
|
import { useState as m, useRef as K, useCallback as A, useEffect as H, useMemo as P } from "react";
|
|
5
5
|
import { s as Q, i as tt } from "./shortId-WJVkrvml.js";
|
|
6
|
-
import { A as et } from "./
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
6
|
+
import { A as et } from "./index--knBGB61.js";
|
|
7
|
+
import { B as rt } from "./button-C81t4pb1.js";
|
|
8
|
+
import { D as it, a as at, b as st, c as nt, d as ot } from "./dialog-DMJStzBb.js";
|
|
9
|
+
import { T as lt } from "./textarea-BYZu1lUC.js";
|
|
10
|
+
import { I as V, j as W, k as ct } from "./index-0OnGZkVF.js";
|
|
11
|
+
import { c as dt, u as ut, a as ht, f as mt } from "./useButtonProps-BIH_9bXT.js";
|
|
12
|
+
import { d as gt } from "./file-BLas99n7.js";
|
|
13
13
|
const pt = `graph TB
|
|
14
14
|
a-->b`;
|
|
15
15
|
function Ot() {
|
|
16
|
-
const e =
|
|
16
|
+
const e = dt(), t = ut(vt.name), {
|
|
17
17
|
tooltipOptions: i = {},
|
|
18
18
|
isActive: s = void 0,
|
|
19
19
|
upload: w
|
|
20
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: T } =
|
|
20
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: T } = ht(s), [c, S] = m(pt), [D, y] = m(""), [o, _] = m(!1), L = K(null), [d, k] = m(null), [g, O] = m(!0), B = A(
|
|
21
21
|
(l) => {
|
|
22
22
|
l && import("mermaid").then((u) => {
|
|
23
23
|
k(u.default);
|
|
@@ -45,12 +45,12 @@ function Ot() {
|
|
|
45
45
|
}, [d, o]), H(() => {
|
|
46
46
|
!g && d && o && I(c);
|
|
47
47
|
}, [d && c]), /* @__PURE__ */ C(
|
|
48
|
-
|
|
48
|
+
it,
|
|
49
49
|
{
|
|
50
50
|
onOpenChange: _,
|
|
51
51
|
open: o,
|
|
52
52
|
children: [
|
|
53
|
-
/* @__PURE__ */ n(
|
|
53
|
+
/* @__PURE__ */ n(at, { asChild: !0, children: /* @__PURE__ */ n(
|
|
54
54
|
et,
|
|
55
55
|
{
|
|
56
56
|
disabled: T,
|
|
@@ -62,8 +62,8 @@ function Ot() {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
) }),
|
|
65
|
-
/* @__PURE__ */ C(
|
|
66
|
-
/* @__PURE__ */ n(
|
|
65
|
+
/* @__PURE__ */ C(st, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
66
|
+
/* @__PURE__ */ n(nt, { children: "Mermaid" }),
|
|
67
67
|
/* @__PURE__ */ n(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
@@ -71,7 +71,7 @@ function Ot() {
|
|
|
71
71
|
style: { height: "100%", border: "1px solid hsl(var(--border))" },
|
|
72
72
|
children: g ? /* @__PURE__ */ n("p", { children: "Loading..." }) : /* @__PURE__ */ n(J, { children: /* @__PURE__ */ C("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
|
|
73
73
|
/* @__PURE__ */ n(
|
|
74
|
-
|
|
74
|
+
lt,
|
|
75
75
|
{
|
|
76
76
|
autoFocus: !0,
|
|
77
77
|
className: "richtext-flex-1",
|
|
@@ -97,8 +97,8 @@ function Ot() {
|
|
|
97
97
|
] }) })
|
|
98
98
|
}
|
|
99
99
|
),
|
|
100
|
-
/* @__PURE__ */ n(
|
|
101
|
-
|
|
100
|
+
/* @__PURE__ */ n(ot, { children: /* @__PURE__ */ n(
|
|
101
|
+
rt,
|
|
102
102
|
{
|
|
103
103
|
disabled: !d,
|
|
104
104
|
onClick: async () => {
|
|
@@ -107,7 +107,7 @@ function Ot() {
|
|
|
107
107
|
const l = L.current.querySelector("svg"), { width: u, height: R } = l.getBoundingClientRect(), N = `mermaid-${Q()}.svg`;
|
|
108
108
|
let M = tt(l.outerHTML);
|
|
109
109
|
if (w) {
|
|
110
|
-
const r =
|
|
110
|
+
const r = gt(M, N);
|
|
111
111
|
M = await w(r);
|
|
112
112
|
}
|
|
113
113
|
e == null || e.chain().focus().setMermaid(
|
|
@@ -209,7 +209,7 @@ function ft({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w })
|
|
|
209
209
|
q((r) => {
|
|
210
210
|
if (r.preventDefault(), r.stopPropagation(), !o)
|
|
211
211
|
return;
|
|
212
|
-
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, $ =
|
|
212
|
+
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, $ = mt(f + x, ct, T.width), j = Math.round($ / h);
|
|
213
213
|
i({
|
|
214
214
|
width: $,
|
|
215
215
|
height: j
|
package/lib/MoreMark.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-DLqogznp.cjs"),r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-DLqogznp.cjs"),r=require("react/jsx-runtime"),x=require("react"),h=require("./index-D42xFOzI.cjs"),f=require("./Icon-C3j4ls73.cjs"),p=require("./dropdown-menu-Busg3FNn.cjs"),b=require("./useButtonProps-TfmRCM9r.cjs");var S=c.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",c.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()}}}),k=c.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",c.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 A(){const t=b.useButtonProps(m.name),{icon:s=void 0,tooltip:n=void 0,items:i=[],isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:u,dataState:o}=b.useActive(l),d=x.useMemo(()=>(o==null?void 0:o.title)||"",[o]);return t?r.jsxs(p.DropdownMenu,{children:[r.jsx(p.DropdownMenuTrigger,{asChild:!0,disabled:u,children:r.jsx(h.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:u,icon:s,tooltip:n,children:r.jsx(h.MenuDown,{className:"richtext-size-3 richtext-text-gray-500"})})}),r.jsx(p.DropdownMenuContent,{className:"w-full",children:i==null?void 0:i.map((e,a)=>r.jsxs(p.DropdownMenuCheckboxItem,{checked:d===e.title,className:"richtext-flex richtext-items-center richtext-gap-3",onClick:e.action,children:[r.jsx(f.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:h.getShortcutKeys(e.shortcutKeys)})]},`more-mark-${a}`))})]}):r.jsx(r.Fragment,{})}const m=c.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 a,g;const l=n.options.subscript,u=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:((a=n.options.shortcutKeys)==null?void 0:a[0])??["mod","."]},d={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 l!==!1&&e.push(o),u!==!1&&e.push(d),{componentProps:{icon:"Type",tooltip:i("editor.moremark"),disabled:!s.isEditable,items:e,isActive:()=>e==null?void 0:e.find(M=>M.isActive())}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(S.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(k.configure(this.options.superscript)),t}});exports.MoreMark=m;exports.RichTextMoreMark=A;
|
package/lib/MoreMark.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { M as h, m, E as b } from "./index-
|
|
1
|
+
import { M as h, m, E as b } from "./index-BvYjBPF9.js";
|
|
2
2
|
import { jsx as e, Fragment as f, jsxs as d } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo as M } from "react";
|
|
4
|
-
import { A as x } from "./
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { M as w } from "./index-BQ17A_37.js";
|
|
9
|
-
import { I as C } from "./Icon-C-qYUAS1.js";
|
|
4
|
+
import { A as x, M as A, g as S } from "./index--knBGB61.js";
|
|
5
|
+
import { I as k } from "./Icon-CysGlJkv.js";
|
|
6
|
+
import { D as v, a as y, b as T, c as K } from "./dropdown-menu-B8iyTZcP.js";
|
|
7
|
+
import { u as w, b as C } from "./useButtonProps-BIH_9bXT.js";
|
|
10
8
|
var H = h.create({
|
|
11
9
|
name: "subscript",
|
|
12
10
|
addOptions() {
|
|
@@ -78,13 +76,13 @@ var H = h.create({
|
|
|
78
76
|
};
|
|
79
77
|
}
|
|
80
78
|
});
|
|
81
|
-
function
|
|
82
|
-
const t =
|
|
79
|
+
function F() {
|
|
80
|
+
const t = w(D.name), {
|
|
83
81
|
icon: s = void 0,
|
|
84
|
-
tooltip:
|
|
82
|
+
tooltip: n = void 0,
|
|
85
83
|
items: i = [],
|
|
86
84
|
isActive: a = void 0
|
|
87
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: c, dataState:
|
|
85
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: c, dataState: o } = C(a), p = M(() => (o == null ? void 0 : o.title) || "", [o]);
|
|
88
86
|
return t ? /* @__PURE__ */ d(v, { children: [
|
|
89
87
|
/* @__PURE__ */ e(
|
|
90
88
|
y,
|
|
@@ -97,8 +95,8 @@ function $() {
|
|
|
97
95
|
customClass: "!richtext-w-12 richtext-h-12",
|
|
98
96
|
disabled: c,
|
|
99
97
|
icon: s,
|
|
100
|
-
tooltip:
|
|
101
|
-
children: /* @__PURE__ */ e(
|
|
98
|
+
tooltip: n,
|
|
99
|
+
children: /* @__PURE__ */ e(A, { className: "richtext-size-3 richtext-text-gray-500" })
|
|
102
100
|
}
|
|
103
101
|
)
|
|
104
102
|
}
|
|
@@ -110,9 +108,9 @@ function $() {
|
|
|
110
108
|
className: "richtext-flex richtext-items-center richtext-gap-3",
|
|
111
109
|
onClick: r.action,
|
|
112
110
|
children: [
|
|
113
|
-
/* @__PURE__ */ e(
|
|
111
|
+
/* @__PURE__ */ e(k, { name: r == null ? void 0 : r.icon }),
|
|
114
112
|
/* @__PURE__ */ e("span", { className: "richtext-ml-1", children: r.title }),
|
|
115
|
-
!!(r != null && r.shortcutKeys) && /* @__PURE__ */ e("span", { className: "richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60", children:
|
|
113
|
+
!!(r != null && r.shortcutKeys) && /* @__PURE__ */ e("span", { className: "richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60", children: S(r.shortcutKeys) })
|
|
116
114
|
]
|
|
117
115
|
},
|
|
118
116
|
`more-mark-${u}`
|
|
@@ -127,24 +125,24 @@ const D = /* @__PURE__ */ b.create({
|
|
|
127
125
|
var t;
|
|
128
126
|
return {
|
|
129
127
|
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
130
|
-
button({ editor: s, extension:
|
|
128
|
+
button({ editor: s, extension: n, t: i }) {
|
|
131
129
|
var u, l;
|
|
132
|
-
const a =
|
|
130
|
+
const a = n.options.subscript, c = n.options.superscript, o = {
|
|
133
131
|
action: () => s.commands.toggleSubscript(),
|
|
134
132
|
isActive: () => s.isActive("subscript") || !1,
|
|
135
133
|
disabled: !s.can().toggleSubscript(),
|
|
136
134
|
icon: "Subscript",
|
|
137
135
|
title: i("editor.subscript.tooltip"),
|
|
138
|
-
shortcutKeys: ((u =
|
|
136
|
+
shortcutKeys: ((u = n.options.shortcutKeys) == null ? void 0 : u[0]) ?? ["mod", "."]
|
|
139
137
|
}, p = {
|
|
140
138
|
action: () => s.commands.toggleSuperscript(),
|
|
141
139
|
isActive: () => s.isActive("superscript") || !1,
|
|
142
140
|
disabled: !s.can().toggleSuperscript(),
|
|
143
141
|
icon: "Superscript",
|
|
144
142
|
title: i("editor.superscript.tooltip"),
|
|
145
|
-
shortcutKeys: ((l =
|
|
143
|
+
shortcutKeys: ((l = n.options.shortcutKeys) == null ? void 0 : l[1]) ?? ["mod", ","]
|
|
146
144
|
}, r = [];
|
|
147
|
-
return a !== !1 && r.push(
|
|
145
|
+
return a !== !1 && r.push(o), c !== !1 && r.push(p), {
|
|
148
146
|
// component: ActionMoreButton,
|
|
149
147
|
componentProps: {
|
|
150
148
|
icon: "Type",
|
|
@@ -164,5 +162,5 @@ const D = /* @__PURE__ */ b.create({
|
|
|
164
162
|
});
|
|
165
163
|
export {
|
|
166
164
|
D as MoreMark,
|
|
167
|
-
|
|
165
|
+
F as RichTextMoreMark
|
|
168
166
|
};
|
package/lib/OrderedList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("./index-TMqmkmT6.cjs"),r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("./index-TMqmkmT6.cjs"),r=require("react/jsx-runtime"),m=require("./index-D42xFOzI.cjs");require("react");const d=require("./useButtonProps-TfmRCM9r.cjs");function x(){const t=d.useButtonProps(c.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:i=void 0,tooltipOptions:u={},action:s=void 0,isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:n,update:l}=d.useToggleActive(a),v=()=>{n||s&&(s(),l())};return t?r.jsx(m.ActionButton,{action:v,dataState:p,disabled:n,icon:e,shortcutKeys:i,tooltip:o,tooltipOptions:u}):r.jsx(r.Fragment,{})}const c=O.OrderedList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:o,extension:i})=>({componentProps:{action:()=>e.commands.toggleOrderedList(),isActive:()=>e.isActive("orderedList"),disabled:!1,icon:"ListOrdered",shortcutKeys:i.options.shortcutKeys??["mod","shift","7"],tooltip:o("editor.orderedlist.tooltip")}})}}});exports.OrderedList=c;exports.RichTextOrderedList=x;
|
package/lib/OrderedList.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { O as u } from "./index-
|
|
1
|
+
import { O as u } from "./index-Dwt9--mS.js";
|
|
2
2
|
import { jsx as n, Fragment as f } from "react/jsx-runtime";
|
|
3
|
-
import { A as l } from "./
|
|
3
|
+
import { A as l } from "./index--knBGB61.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./
|
|
6
|
-
|
|
7
|
-
function b() {
|
|
5
|
+
import { u as v, a as O } from "./useButtonProps-BIH_9bXT.js";
|
|
6
|
+
function K() {
|
|
8
7
|
const t = v(A.name), {
|
|
9
8
|
icon: o = void 0,
|
|
10
9
|
tooltip: i = void 0,
|
|
@@ -50,5 +49,5 @@ const A = /* @__PURE__ */ u.extend({
|
|
|
50
49
|
});
|
|
51
50
|
export {
|
|
52
51
|
A as OrderedList,
|
|
53
|
-
|
|
52
|
+
K as RichTextOrderedList
|
|
54
53
|
};
|
package/lib/SearchAndReplace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./index-DLqogznp.cjs"),F=require("@tiptap/pm/state"),b=require("@tiptap/pm/view"),a=require("react/jsx-runtime"),f=require("react"),Z=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./index-DLqogznp.cjs"),F=require("@tiptap/pm/state"),b=require("@tiptap/pm/view"),a=require("react/jsx-runtime"),f=require("react"),Z=require("./index-D42xFOzI.cjs"),M=require("./Icon-C3j4ls73.cjs"),j=require("./button-B6ukqDUf.cjs"),V=require("./input-BxzQAIRv.cjs"),k=require("./label-BfWfLggp.cjs"),$=require("./popover-sP8CwbV-.cjs"),_=require("./checkbox-ZdxysUFa.cjs"),B=require("./useButtonProps-TfmRCM9r.cjs"),ee=require("./index-FSRjMsxW.cjs");function te(){const{t}=ee.useLocale(),e=B.useEditorInstance(),s=B.useButtonProps(W.name),{icon:n=void 0,tooltip:u=void 0,shortcutKeys:o=void 0,tooltipOptions:c={},action:x=void 0,isActive:h=void 0}=(s==null?void 0:s.componentProps)??{},{disabled:i}=B.useActive(h),[g,d]=f.useState(!1),[p,A]=f.useState(""),[T,N]=f.useState(""),[I,H]=f.useState(!1),[U,E]=f.useState(""),w=()=>{var r,l,R,m;E(`${((l=(r=e==null?void 0:e.storage)==null?void 0:r.searchAndReplace)==null?void 0:l.resultIndex)+1}/${(m=(R=e==null?void 0:e.storage)==null?void 0:R.searchAndReplace)==null?void 0:m.results.length}`)};f.useEffect(()=>{e&&w()},[e]);const z=()=>{i||x&&x()},y=(r=!1)=>{var l,R,m,v,S,D,q,O;e&&(r&&((R=(l=e==null?void 0:e.commands)==null?void 0:l.resetIndex)==null||R.call(l)),(v=(m=e==null?void 0:e.commands)==null?void 0:m.setSearchTerm)==null||v.call(m,p),(D=(S=e==null?void 0:e.commands)==null?void 0:S.setReplaceTerm)==null||D.call(S,T),(O=(q=e==null?void 0:e.commands)==null?void 0:q.setCaseSensitive)==null||O.call(q,I),w())},P=()=>{var v,S;if(!e)return;const{results:r,resultIndex:l}=e.storage.searchAndReplace,R=r[l];if(!R)return;(S=(v=e==null?void 0:e.commands)==null?void 0:v.setTextSelection)==null||S.call(v,R);const{node:m}=e.view.domAtPos(e.state.selection.anchor);m instanceof HTMLElement&&m.scrollIntoView({behavior:"smooth",block:"center"}),w()};f.useEffect(()=>{p.trim()||L(),p.trim()&&y(!0)},[p]),f.useEffect(()=>{T.trim()&&y()},[T]),f.useEffect(()=>{y(!0)},[I]);const G=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replace)==null||l.call(r),P()},J=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.nextSearchResult)==null||l.call(r),P()},Q=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.previousSearchResult)==null||l.call(r),P()},L=()=>{var r,l;A(""),N(""),(l=(r=e==null?void 0:e.commands)==null?void 0:r.resetIndex)==null||l.call(r),w()},X=()=>{var r,l;(l=(r=e==null?void 0:e.commands)==null?void 0:r.replaceAll)==null||l.call(r),E("0/0")};return s?a.jsxs($.Popover,{onOpenChange:d,open:g,children:[a.jsx($.PopoverTrigger,{asChild:!0,disabled:i,children:a.jsx(Z.ActionButton,{action:z,disabled:i,icon:n,shortcutKeys:o,tooltip:u,tooltipOptions:c})}),a.jsxs($.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(k.Label,{children:t("editor.search.dialog.text")}),a.jsx("span",{className:"richtext-font-semibold",children:U})]}),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(V.Input,{autoFocus:!0,className:"richtext-w-full",onChange:r=>A(r.target.value),placeholder:"Text",required:!0,type:"text",value:p}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:Q,children:a.jsx(M.IconComponent,{name:"ChevronUp"})}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:J,children:a.jsx(M.IconComponent,{name:"ChevronDown"})}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:L,children:"Clear"})]}),a.jsx(k.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(V.Input,{className:"richtext-w-80",onChange:r=>N(r.target.value),placeholder:"Text",required:!0,type:"text",value:T})})}),a.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-1",children:[a.jsx(_.Checkbox,{checked:I,onCheckedChange:r=>{H(r),e.commands.setCaseSensitive(r)}}),a.jsx(k.Label,{children:t("editor.replace.caseSensitive")})]}),a.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[a.jsx(j.Button,{className:"richtext-flex-1",onClick:G,children:t("editor.replace.dialog.text")}),a.jsx(j.Button,{className:"richtext-flex-1",onClick:X,children:t("editor.replaceAll.dialog.text")})]})]})]}):a.jsx(a.Fragment,{})}const C=(t,e)=>e(t.tr);function se(t,e,s){return RegExp(e?t.replace(/[$()*+.?[\\\]^{|}]/g,String.raw`\$&`):t,s?"gu":"gui")}function re(t,e,s,n){const u=[],o=[];let c=[],x=0;if(!e)return{decorationsToReturn:b.DecorationSet.empty,results:[]};t==null||t.descendants((h,i)=>{h.isText?c[x]?c[x]={text:c[x].text+h.text,pos:c[x].pos}:c[x]={text:`${h.text}`,pos:i}:x+=1}),c=c.filter(Boolean);for(const h of c){const{text:i,pos:g}=h,d=Array.from(i.matchAll(e)).filter(([p])=>p.trim());for(const p of d){if(p[0]==="")break;p.index!==void 0&&o.push({from:g+p.index,to:g+p.index+p[0].length})}}for(const[h,i]of o.entries()){const g=h===n?`${s} ${s}-current`:s,d=b.Decoration.inline(i.from,i.to,{class:g});u.push(d)}return{decorationsToReturn:b.DecorationSet.create(t,u),results:o}}function K(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 ne(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:h,to:i}=n[u];return n[u]={to:i-x,from:h-x},[x,n]}function ce(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:h}=o[c];s.insertText(t,x,h);const i=ne(t,c,u,o);i&&(u=i[0],o=i[1])}n(s)}}const W=Y.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,C(s,n),!1),setReplaceTerm:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.replaceTerm=t,C(s,n),!1),setCaseSensitive:t=>({editor:e,state:s,dispatch:n})=>(e.storage.searchAndReplace.caseSensitive=t,C(s,n),!1),resetIndex:()=>({editor:t,state:e,dispatch:s})=>(t.storage.searchAndReplace.resultIndex=0,C(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?(K(n,[c],{state:e,dispatch:s}),t.storage.searchAndReplace.results.splice(o,1)):(K(n,u,{state:e,dispatch:s}),t.storage.searchAndReplace.results.shift()),C(e,s),!1},replaceAll:()=>({editor:t,tr:e,state:s,dispatch:n})=>{const{replaceTerm:u,results:o}=t.storage.searchAndReplace;return ce(u,o,{tr:e,dispatch:n}),t.storage.searchAndReplace.resultIndex=0,t.storage.searchAndReplace.results=[],C(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 F.Plugin({key:new F.PluginKey(`richtextCustomPlugin${this.name}`),state:{init:()=>b.DecorationSet.empty,apply({doc:c,docChanged:x},h){const{searchTerm:i,lastSearchTerm:g,caseSensitive:d,lastCaseSensitive:p,resultIndex:A,lastResultIndex:T}=t.storage.searchAndReplace;if(!x&&g===i&&p===d&&T===A)return h;if(n(i),u(d),o(A),!i)return t.storage.searchAndReplace.results=[],b.DecorationSet.empty;const{decorationsToReturn:N,results:I}=re(c,se(i,s,d),e,A);return t.storage.searchAndReplace.results=I,N}},props:{decorations(c){return this.getState(c)}}})]}});exports.RichTextSearchAndReplace=te;exports.SearchAndReplace=W;
|
package/lib/SearchAndReplace.js
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import { E as Q } from "./index-
|
|
1
|
+
import { E as Q } from "./index-BvYjBPF9.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 {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const { t } = ne(), e = te(), s = se(pe.name), {
|
|
6
|
+
import { A as ee } from "./index--knBGB61.js";
|
|
7
|
+
import { I as V } from "./Icon-CysGlJkv.js";
|
|
8
|
+
import { B as N } from "./button-C81t4pb1.js";
|
|
9
|
+
import { I as q } from "./input-DR_5pbuA.js";
|
|
10
|
+
import { L as B } from "./label-D-0oXKCn.js";
|
|
11
|
+
import { P as te, a as se, b as re } from "./popover-D3spkemr.js";
|
|
12
|
+
import { C as ne } from "./checkbox-CUE9ex4D.js";
|
|
13
|
+
import { c as ce, u as ae, b as le } from "./useButtonProps-BIH_9bXT.js";
|
|
14
|
+
import { u as oe } from "./index-0OnGZkVF.js";
|
|
15
|
+
function ye() {
|
|
16
|
+
const { t } = oe(), e = ce(), s = ae(pe.name), {
|
|
18
17
|
icon: n = void 0,
|
|
19
18
|
tooltip: i = void 0,
|
|
20
19
|
shortcutKeys: l = void 0,
|
|
21
20
|
tooltipOptions: c = {},
|
|
22
21
|
action: h = void 0,
|
|
23
22
|
isActive: m = void 0
|
|
24
|
-
} = (s == null ? void 0 : s.componentProps) ?? {}, { disabled: o } =
|
|
23
|
+
} = (s == null ? void 0 : s.componentProps) ?? {}, { disabled: o } = le(m), [f, d] = b(!1), [p, A] = b(""), [S, w] = b(""), [I, M] = b(!1), [W, D] = b(""), y = () => {
|
|
25
24
|
var r, a, g, x;
|
|
26
25
|
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}`);
|
|
27
26
|
};
|
|
@@ -68,13 +67,13 @@ function Pe() {
|
|
|
68
67
|
(a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.replaceAll) == null || a.call(r), D("0/0");
|
|
69
68
|
};
|
|
70
69
|
return s ? /* @__PURE__ */ T(
|
|
71
|
-
|
|
70
|
+
te,
|
|
72
71
|
{
|
|
73
72
|
onOpenChange: d,
|
|
74
73
|
open: f,
|
|
75
74
|
children: [
|
|
76
75
|
/* @__PURE__ */ u(
|
|
77
|
-
|
|
76
|
+
se,
|
|
78
77
|
{
|
|
79
78
|
asChild: !0,
|
|
80
79
|
disabled: o,
|
|
@@ -92,7 +91,7 @@ function Pe() {
|
|
|
92
91
|
}
|
|
93
92
|
),
|
|
94
93
|
/* @__PURE__ */ T(
|
|
95
|
-
|
|
94
|
+
re,
|
|
96
95
|
{
|
|
97
96
|
align: "start",
|
|
98
97
|
className: "richtext-w-full",
|
|
@@ -105,7 +104,7 @@ function Pe() {
|
|
|
105
104
|
] }),
|
|
106
105
|
/* @__PURE__ */ T("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: [
|
|
107
106
|
/* @__PURE__ */ u(
|
|
108
|
-
|
|
107
|
+
q,
|
|
109
108
|
{
|
|
110
109
|
autoFocus: !0,
|
|
111
110
|
className: "richtext-w-full",
|
|
@@ -121,7 +120,7 @@ function Pe() {
|
|
|
121
120
|
{
|
|
122
121
|
className: "richtext-flex-1",
|
|
123
122
|
onClick: G,
|
|
124
|
-
children: /* @__PURE__ */ u(
|
|
123
|
+
children: /* @__PURE__ */ u(V, { name: "ChevronUp" })
|
|
125
124
|
}
|
|
126
125
|
),
|
|
127
126
|
/* @__PURE__ */ u(
|
|
@@ -129,7 +128,7 @@ function Pe() {
|
|
|
129
128
|
{
|
|
130
129
|
className: "richtext-flex-1",
|
|
131
130
|
onClick: z,
|
|
132
|
-
children: /* @__PURE__ */ u(
|
|
131
|
+
children: /* @__PURE__ */ u(V, { name: "ChevronDown" })
|
|
133
132
|
}
|
|
134
133
|
),
|
|
135
134
|
/* @__PURE__ */ u(
|
|
@@ -143,7 +142,7 @@ function Pe() {
|
|
|
143
142
|
] }),
|
|
144
143
|
/* @__PURE__ */ u(B, { className: "richtext-mb-[6px]", children: t("editor.replace.dialog.text") }),
|
|
145
144
|
/* @__PURE__ */ u("div", { className: "richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ u("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ u(
|
|
146
|
-
|
|
145
|
+
q,
|
|
147
146
|
{
|
|
148
147
|
className: "richtext-w-80",
|
|
149
148
|
onChange: (r) => w(r.target.value),
|
|
@@ -155,7 +154,7 @@ function Pe() {
|
|
|
155
154
|
) }) }),
|
|
156
155
|
/* @__PURE__ */ T("div", { className: "richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-1", children: [
|
|
157
156
|
/* @__PURE__ */ u(
|
|
158
|
-
|
|
157
|
+
ne,
|
|
159
158
|
{
|
|
160
159
|
checked: I,
|
|
161
160
|
onCheckedChange: (r) => {
|
|
@@ -371,6 +370,6 @@ const pe = Q.create({
|
|
|
371
370
|
}
|
|
372
371
|
});
|
|
373
372
|
export {
|
|
374
|
-
|
|
373
|
+
ye as RichTextSearchAndReplace,
|
|
375
374
|
pe as SearchAndReplace
|
|
376
375
|
};
|
package/lib/SlashCommand.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-DLqogznp.cjs"),j=require("@tiptap/pm/state"),w=require("./updatePosition-C17CDdjq.cjs"),l=require("react/jsx-runtime"),m=require("react"),D=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-DLqogznp.cjs"),j=require("@tiptap/pm/state"),w=require("./updatePosition-C17CDdjq.cjs"),l=require("react/jsx-runtime"),m=require("react"),D=require("./index-D42xFOzI.cjs"),P=require("./Icon-C3j4ls73.cjs"),$=require("./label-BfWfLggp.cjs"),A=require("./store-BajRl43v.cjs"),v=require("./events.constant-DQYeJpu5.cjs"),p=require("./index-FSRjMsxW.cjs"),B={setOpen:(t,n)=>{v.dispatchEvent(v.EVENTS.UPLOAD_VIDEO(t),n)}};function R({t}){const n=[{name:"format",title:t("editor.slash.format"),commands:[]},{name:"insert",title:t("editor.slash.insert"),commands:[]}];return[1,2,3,4,5,6].forEach(e=>{n[0].commands.push({name:`heading${e}`,label:t(`editor.heading.h${e}.tooltip`),aliases:[`h${e}`,"bt",`bt${e}`],iconName:`Heading${e}`,action:({editor:i,range:d})=>{i.chain().focus().deleteRange(d).setHeading({level:e}).run()}})}),n[0].commands.push({name:"bulletList",label:t("editor.bulletlist.tooltip"),aliases:["ul","yxlb"],iconName:"List",action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).toggleBulletList().run()}}),n[0].commands.push({name:"numberedList",label:t("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).toggleOrderedList().run()}}),n[0].commands.push({name:"taskList",label:t("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).toggleTaskList().run()}}),n[0].commands.push({name:"blockquote",label:t("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).setBlockquote().run()}}),n[0].commands.push({name:"codeBlock",label:t("editor.codeblock.tooltip"),iconName:"Code2",description:"Code block with syntax highlighting",shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).setCodeBlock().run()}}),n[1].commands.push({name:"image",label:t("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).run(),A.actionDialogImage.setOpen(e.id,!0)}}),n[1].commands.push({name:"video",label:t("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).run(),B.setOpen(e.id,!0)}}),n[1].commands.push({name:"table",label:t("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}}),n[1].commands.push({name:"horizontalRule",label:t("editor.horizontalrule.tooltip"),iconName:"Minus",description:"Insert a horizontal divider",aliases:["hr","fgx","fg"],action:({editor:e,range:i})=>{e.chain().focus().deleteRange(i).setHorizontalRule().run()}}),n[1].commands.push({name:"columns",label:t("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",action:({editor:e})=>{e.chain().focus().insertColumns({cols:2}).run()}}),n}function y(t,n){return t.map(d=>({...d,commands:d.commands.filter(c=>{const h=c.label.toLowerCase().trim(),u=n.toLowerCase().trim();if(c.aliases){const b=c.aliases.map(x=>x.toLowerCase().trim()),a=h.match(u),f=b.some(x=>x.match(u));return a||f}return h.match(u)})})).filter(d=>d.commands.length>0)}const O=p.d([]);function L(){const[t,n]=p.x(O);return[t,n]}function T(t,n){const[e]=L(),[i,d]=m.useState(0),[c,h]=m.useState(0),u=m.useRef(null),{t:b}=p.useLocale(),a=y(e,t.query),f=m.useRef([]);m.useImperativeHandle(n,()=>({onKeyDown:x})),m.useEffect(()=>{if(!u.current)return;const r=c*1e3+i,o=f.current[r];o&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},[i,c]);function x({event:r}){return r.key==="ArrowUp"?(I(),!0):r.key==="ArrowDown"?(S(),!0):r.key==="Enter"?(k(),!0):!1}function I(){var s;if(a.length===0)return!1;let r=i-1,o=c;r<0&&(o=c-1,r=((s=a[o])==null?void 0:s.commands.length)-1||0),o<0&&(o=a.length-1,r=a[o].commands.length-1),d(r),h(o)}function S(){if(a.length===0)return!1;const r=a[c].commands;let o=i+1,s=c;r.length-1<o&&(o=0,s=c+1),a.length-1<s&&(s=0),d(o),h(s)}function k(){if(a.length===0||c===-1||i===-1)return!1;C(c,i)}function C(r,o){const s=a[r].commands[o];t==null||t.command(s)}function q(r,o){C(r,o)}function E(r,o,s){f.current[r*1e3+o]=s}return l.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:u,children:a!=null&&a.length?l.jsx("div",{className:"richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5",children:a==null?void 0:a.map((r,o)=>l.jsxs(m.Fragment,{children:[l.jsx($.Label,{className:"richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase ",children:r.title}),r.commands.map((s,g)=>l.jsxs("button",{onClick:()=>q(o,g),ref:H=>E(o,g,H),className:D.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":c===o&&i===g}),children:[s.iconUrl&&l.jsx("img",{alt:"",className:"richtext-size-6",src:s.iconUrl}),s.iconName&&l.jsx(P.IconComponent,{className:"!richtext-mr-1 !richtext-text-lg",name:s.iconName}),s.label]},`command-${g}`))]},`slash-${r.title}`))}):l.jsx("div",{className:"richtext-p-3",children:l.jsx("span",{className:"richtext-text-xs richtext-text-foreground",children:b("editor.slash.empty")})})})}const V=m.forwardRef(T);function z({commandList:t}){const[,n]=L(),{t:e}=p.useLocale();return m.useEffect(()=>{if(!(t!=null&&t.length)){const i=R({t:e});n(i);return}n(t)},[e,t]),l.jsx(l.Fragment,{})}const F=N.Extension.create({name:"richtextSlashCommand",priority:200,addProseMirrorPlugins(){return[w.Suggestion({pluginKey:new j.PluginKey("richtextSlashCommandPlugin"),editor:this.editor,char:"/",command:({editor:t,range:n,props:e})=>{const{view:i}=t;e.action({editor:t,range:n}),i.focus()},render:()=>{let t;return{onStart:n=>{n.clientRect&&(t=new N.ReactRenderer(V,{props:n,editor:n.editor}),t.element.style.position="absolute",document.body.appendChild(t.element),w.updatePosition(n.editor,t.element))},onUpdate(n){t.updateProps(n),n.clientRect&&w.updatePosition(n.editor,t.element)},onKeyDown(n){var e;return n.event.key==="Escape"?(t.destroy(),t.element.remove(),!0):(e=t.ref)==null?void 0:e.onKeyDown(n)},onExit(){t&&(t.destroy(),t.element.remove())}}}})]}});exports.SlashCommand=F;exports.SlashCommandList=z;exports.renderCommandListDefault=R;exports.useFilterCommandList=y;
|
package/lib/SlashCommand.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { E as A, G as D } from "./index-
|
|
1
|
+
import { E as A, G as D } from "./index-BvYjBPF9.js";
|
|
2
2
|
import { PluginKey as $ } from "@tiptap/pm/state";
|
|
3
|
-
import { S as B, u as b } from "./updatePosition-
|
|
3
|
+
import { S as B, u as b } from "./updatePosition-BAGpT34H.js";
|
|
4
4
|
import { jsx as m, jsxs as w, Fragment as V } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef as z, useState as C, useRef as N, useImperativeHandle as G, useEffect as v, Fragment as O } from "react";
|
|
6
|
-
import { c as P } from "./index
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { c as P } from "./index--knBGB61.js";
|
|
7
|
+
import { I as T } from "./Icon-CysGlJkv.js";
|
|
8
|
+
import { L as F } from "./label-D-0oXKCn.js";
|
|
9
|
+
import { a as U } from "./store-NKeQOve_.js";
|
|
10
|
+
import { d as q, E as K } from "./events.constant-wrlJ_7JZ.js";
|
|
11
|
+
import { m as M, x as j, u as y } from "./index-0OnGZkVF.js";
|
|
12
12
|
const _ = {
|
|
13
13
|
setOpen: (t, n) => {
|
|
14
|
-
|
|
14
|
+
q(K.UPLOAD_VIDEO(t), n);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
function J({ t }) {
|
|
@@ -88,7 +88,7 @@ function J({ t }) {
|
|
|
88
88
|
aliases: ["image", "tp", "tupian"],
|
|
89
89
|
shouldBeHidden: (e) => e.isActive("columns"),
|
|
90
90
|
action: ({ editor: e, range: o }) => {
|
|
91
|
-
e.chain().focus().deleteRange(o).run(),
|
|
91
|
+
e.chain().focus().deleteRange(o).run(), U.setOpen(e.id, !0);
|
|
92
92
|
}
|
|
93
93
|
}), n[1].commands.push({
|
|
94
94
|
name: "video",
|
|
@@ -142,9 +142,9 @@ function W(t, n) {
|
|
|
142
142
|
})
|
|
143
143
|
})).filter((l) => l.commands.length > 0);
|
|
144
144
|
}
|
|
145
|
-
const X =
|
|
145
|
+
const X = M([]);
|
|
146
146
|
function R() {
|
|
147
|
-
const [t, n] =
|
|
147
|
+
const [t, n] = j(X);
|
|
148
148
|
return [t, n];
|
|
149
149
|
}
|
|
150
150
|
function Y(t, n) {
|
|
@@ -199,7 +199,7 @@ function Y(t, n) {
|
|
|
199
199
|
"data-richtext-portal": !0,
|
|
200
200
|
ref: d,
|
|
201
201
|
children: a != null && a.length ? /* @__PURE__ */ m("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: a == null ? void 0 : a.map((r, i) => /* @__PURE__ */ w(O, { children: [
|
|
202
|
-
/* @__PURE__ */ m(
|
|
202
|
+
/* @__PURE__ */ m(F, { className: "richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase ", children: r.title }),
|
|
203
203
|
r.commands.map((s, x) => /* @__PURE__ */ w(
|
|
204
204
|
"button",
|
|
205
205
|
{
|
|
@@ -218,7 +218,7 @@ function Y(t, n) {
|
|
|
218
218
|
}
|
|
219
219
|
),
|
|
220
220
|
s.iconName && /* @__PURE__ */ m(
|
|
221
|
-
|
|
221
|
+
T,
|
|
222
222
|
{
|
|
223
223
|
className: "!richtext-mr-1 !richtext-text-lg",
|
|
224
224
|
name: s.iconName
|
package/lib/Strike.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-DLqogznp.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),m=require("./index-D42xFOzI.cjs");require("react");const u=require("./useButtonProps-TfmRCM9r.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:i=void 0,shortcutKeys:n=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?s.jsx(m.ActionButton,{action:g,dataState:p,disabled:a,icon:e,shortcutKeys:n,tooltip:i,tooltipOptions:c}):s.jsx(s.Fragment,{})}const d=f.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=v;exports.Strike=d;
|
package/lib/Strike.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { M as c, h as k, j as l, m as g } from "./index-
|
|
1
|
+
import { M as c, h as k, j as l, m as g } from "./index-BvYjBPF9.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 "./index--knBGB61.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./
|
|
6
|
-
import { u as M, a as S } from "./useButtonProps-D0SrPzuG.js";
|
|
5
|
+
import { u as M, a as S } from "./useButtonProps-BIH_9bXT.js";
|
|
7
6
|
var v = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, A = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, y = c.create({
|
|
8
7
|
name: "strike",
|
|
9
8
|
addOptions() {
|
|
@@ -64,7 +63,7 @@ var v = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, A = /(?:^|\s)(~~(?!\s+~~
|
|
|
64
63
|
];
|
|
65
64
|
}
|
|
66
65
|
});
|
|
67
|
-
function
|
|
66
|
+
function L() {
|
|
68
67
|
const t = M(x.name), {
|
|
69
68
|
icon: e = void 0,
|
|
70
69
|
tooltip: r = void 0,
|
|
@@ -109,6 +108,6 @@ const x = /* @__PURE__ */ y.extend({
|
|
|
109
108
|
}
|
|
110
109
|
});
|
|
111
110
|
export {
|
|
112
|
-
|
|
111
|
+
L as RichTextStrike,
|
|
113
112
|
x as Strike
|
|
114
113
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
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 "./index-
|
|
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 "./index-BvYjBPF9.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-RKufd2EL.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 "./index--knBGB61.js";
|
|
6
6
|
import { useState as _ } from "react";
|
|
7
|
-
import "./
|
|
7
|
+
import { P as et, a as tt, b as ot } from "./popover-D3spkemr.js";
|
|
8
8
|
import { T as O, n as F, o as j } from "./index-0OnGZkVF.js";
|
|
9
|
-
import {
|
|
10
|
-
import { c as nt, u as lt, a as rt } from "./useButtonProps-D0SrPzuG.js";
|
|
9
|
+
import { c as nt, u as lt, a as rt } from "./useButtonProps-BIH_9bXT.js";
|
|
11
10
|
let le, re;
|
|
12
11
|
if (typeof WeakMap < "u") {
|
|
13
12
|
let t = /* @__PURE__ */ new WeakMap();
|
|
@@ -1909,7 +1908,7 @@ function Co(t) {
|
|
|
1909
1908
|
}
|
|
1910
1909
|
);
|
|
1911
1910
|
}
|
|
1912
|
-
function
|
|
1911
|
+
function zo() {
|
|
1913
1912
|
const t = nt(), e = lt(yo.name), {
|
|
1914
1913
|
icon: o = void 0,
|
|
1915
1914
|
tooltip: n = void 0,
|
|
@@ -1979,6 +1978,6 @@ const yo = /* @__PURE__ */ je.extend({
|
|
|
1979
1978
|
});
|
|
1980
1979
|
export {
|
|
1981
1980
|
w as C,
|
|
1982
|
-
|
|
1981
|
+
zo as R,
|
|
1983
1982
|
yo as T
|
|
1984
1983
|
};
|