@remarkablejames/editor 0.0.5 → 0.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/README.md +1 -1
- package/lib/ActionMenuButton-D9o3Kwmv.cjs +1 -0
- package/lib/{ActionMenuButton-DBZjUu-F.js → ActionMenuButton-nxV91Fqo.js} +10 -9
- package/lib/Attachment.cjs +19 -1
- package/lib/Attachment.js +270 -7
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +12 -13
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +10 -11
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +8 -9
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +45 -41
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +14 -13
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +5 -6
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +31 -30
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +8 -9
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +19 -18
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +8 -9
- package/lib/Drawer-Bh-y5bs8.cjs +2 -0
- package/lib/{Drawer-DTCwtJEs.js → Drawer-CF6Z_IA2.js} +24 -18
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +15 -14
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +33 -28
- package/lib/ExportPdf.cjs +3 -3
- package/lib/ExportPdf.js +13 -14
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +6 -6
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +6 -7
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +14 -15
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +26 -26
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +23 -22
- package/lib/History.cjs +1 -1
- package/lib/History.js +11 -11
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +9 -10
- package/lib/Icon-BvGyfX2j.js +15 -0
- package/lib/Icon-wjwoRc9F.cjs +1 -0
- package/lib/Iframe-BbfZKbPY.cjs +1 -0
- package/lib/{Iframe-D-UYBxiv.js → Iframe-Dfd3LI7b.js} +18 -15
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +5 -4
- package/lib/ImageCropper-CY1ETEjC.cjs +10 -0
- package/lib/ImageCropper-DrSdjo9x.js +979 -0
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +80 -77
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +28 -26
- package/lib/{Indent-Bvt-Qwar.js → Indent-CDVF9DWN.js} +30 -31
- package/lib/Indent-Q1VuhSM2.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 +11 -12
- package/lib/{Katex-CJDtvu-v.js → Katex-DqhWWAA-.js} +22 -19
- package/lib/Katex-K1QU2SB2.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 +20 -19
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-CBYGLs3J.cjs +5 -0
- package/lib/{LinkEditBlock-Cdqwj_NU.js → LinkEditBlock-xP0pGVhB.js} +24 -19
- package/lib/Mention.js +3 -3
- package/lib/{Mermaid-CnMYVX1P.js → Mermaid-BJ6ryVdY.js} +48 -45
- package/lib/Mermaid-D3_nLeOW.cjs +2 -0
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +28 -26
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +10 -11
- package/lib/PaywallSeparator.cjs +1 -0
- package/lib/PaywallSeparator.js +140 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +42 -37
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +5 -5
- package/lib/SlashCommandNodeView-CUJrDQS7.cjs +1 -0
- package/lib/{SlashCommandNodeView-DcoLvt_6.js → SlashCommandNodeView-DS9FqMiY.js} +80 -62
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +11 -12
- package/lib/Table-CV6pUoVf.cjs +5 -0
- package/lib/{Table-Cu12PvQ_.js → Table-CcG-JNtV.js} +46 -46
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +11 -12
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +27 -26
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +19 -18
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +8 -9
- package/lib/{Twitter-CrX4XY1j.js → Twitter-BIL3o833.js} +22 -18
- package/lib/Twitter-BfSTqPDh.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video-DAKr90QL.js +231 -0
- package/lib/Video-HAinT0w6.cjs +1 -0
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -4
- package/lib/bubble.cjs +3 -3
- package/lib/bubble.js +86 -77
- package/lib/button-090-I3tp.js +35 -0
- package/lib/button-B4Sz2ZhW.cjs +1 -0
- package/lib/checkbox-BCPsu7yR.cjs +1 -0
- package/lib/checkbox-DiXWHAI0.js +29 -0
- package/lib/{clsx-BUPZHhq3.js → clsx-m_C5j3RU.js} +24 -24
- package/lib/components/RichTextProvider.d.ts +1 -1
- package/lib/dialog-C8J59d2J.cjs +1 -0
- package/lib/dialog-bDkDW-C_.js +95 -0
- package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
- package/lib/dom-dataset-CIEeltF6.js +47 -0
- package/lib/{dropdown-menu-CVwXaR3Z.js → dropdown-menu-DWt_xj4h.js} +1 -1
- package/lib/{dropdown-menu-XIrQk3jr.cjs → dropdown-menu-tUP872Zv.cjs} +1 -1
- package/lib/events.constant-Bke62qxm.cjs +1 -0
- package/lib/events.constant-CSWD3-ho.js +72 -0
- package/lib/extensions/PaywallSeparator/PaywallSeparator.d.ts +35 -0
- package/lib/extensions/PaywallSeparator/components/PaywallIcon.d.ts +2 -0
- package/lib/extensions/PaywallSeparator/components/PaywallSeparatorView.d.ts +17 -0
- package/lib/extensions/PaywallSeparator/components/RichTextPaywallSeparator.d.ts +1 -0
- package/lib/extensions/PaywallSeparator/components/index.d.ts +2 -0
- package/lib/extensions/PaywallSeparator/index.d.ts +1 -0
- package/lib/file-i7e4nQY2.cjs +1 -0
- package/lib/file-jDdkhyj7.js +43 -0
- package/lib/{index-RkKGy5oa.js → index-B3Ijnbxs.js} +1 -1
- package/lib/index-BXh8X1ch.cjs +1 -0
- package/lib/{index-Dl3OjzmR.js → index-C1KQsOcg.js} +1 -1
- package/lib/{index-D4M4hrH4.js → index-C8FjP66D.js} +1 -1
- package/lib/index-jMN4V2hr.js +2763 -0
- package/lib/{index-DZj2z9_1.js → index-s3l5RdyW.js} +1 -1
- package/lib/index.cjs +4 -4
- package/lib/index.js +464 -149
- package/lib/input-C_J-pfTx.js +21 -0
- package/lib/input-DwLo4r7V.cjs +1 -0
- package/lib/isNumber-BTYSVlKo.cjs +1 -0
- package/lib/isNumber-WaBzl_0s.js +15 -0
- package/lib/label-BgIVynq3.cjs +1 -0
- package/lib/label-ClsOg9Hr.js +11 -0
- package/lib/{popover-DDT8YRht.js → popover-BC7FRr8B.js} +1 -1
- package/lib/{popover-0syCfWYi.cjs → popover-C3A6zzNV.cjs} +1 -1
- package/lib/{renderNodeView-dj6AaFSX.js → renderNodeView-C_hPIdEs.js} +2 -2
- package/lib/{select-DTNz0ZeE.cjs → select-B8HIWDXf.cjs} +1 -1
- package/lib/{select-D9wQw2qB.js → select-DSKqhVGR.js} +1 -1
- package/lib/{separator-DRGTEiX4.js → separator-BJWSNjvr.js} +13 -12
- package/lib/separator-D6ruF682.cjs +1 -0
- package/lib/style.css +1 -1
- package/lib/tabs-D1J1iB7B.js +46 -0
- package/lib/tabs-IEbMQmNX.cjs +1 -0
- package/lib/{textarea-DfVzbMr5.js → textarea-Ch5w3PiI.js} +1 -1
- package/lib/{textarea-DpkwluT0.cjs → textarea-CtVdqwSM.cjs} +1 -1
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +18 -18
- package/lib/throttle-CRNq0z-O.js +249 -0
- package/lib/throttle-gTTvqDTW.cjs +1 -0
- package/lib/toggle-C9tcMm1r.cjs +1 -0
- package/lib/toggle-CaSwYCk4.js +89 -0
- package/lib/types.d.ts +5 -5
- package/lib/{updatePosition-C294Pixi.js → updatePosition-DvfTZHcH.js} +2 -2
- package/lib/use-toast-C6zPo25l.cjs +1 -0
- package/lib/use-toast-CEOqhXfx.js +97 -0
- package/lib/useButtonProps-D-ruygH7.js +165 -0
- package/lib/useButtonProps-D9ndBdmA.cjs +1 -0
- package/package.json +34 -32
- package/lib/ActionMenuButton-C6jGtl3k.cjs +0 -1
- package/lib/Drawer-B031ezmA.cjs +0 -2
- package/lib/Iframe-BUK2pkOL.cjs +0 -1
- package/lib/Indent-_y6N8MIQ.cjs +0 -1
- package/lib/Katex-bJXkt-VP.cjs +0 -4
- package/lib/LinkEditBlock-ewTApx0K.cjs +0 -5
- package/lib/Mermaid-Dwz9o-yM.cjs +0 -2
- package/lib/SlashCommandNodeView-BMgQJ4xT.cjs +0 -1
- package/lib/Table-B8CHl8jK.cjs +0 -5
- package/lib/Twitter-6HYP_upt.cjs +0 -1
- package/lib/index-B0d-u29p.js +0 -5425
- package/lib/index-De9MZVWQ.cjs +0 -28
- package/lib/separator-D8lOAf8f.cjs +0 -1
package/lib/Callout.js
CHANGED
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
import { h as D, j as x, N as H, k as M, m as B } from "./clsx-
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as o, jsxs as l, Fragment as
|
|
1
|
+
import { h as D, j as x, N as H, k as M, m as B } from "./clsx-m_C5j3RU.js";
|
|
2
|
+
import { A as T } from "./toggle-CaSwYCk4.js";
|
|
3
|
+
import { jsx as o, jsxs as l, Fragment as V } from "react/jsx-runtime";
|
|
4
|
+
import { Info as P, Lightbulb as j, AlertCircle as E, TriangleAlert as R, OctagonAlert as W } from "lucide-react";
|
|
4
5
|
import { useState as s } from "react";
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { D as F, a as U, b as Y, c as _, d as $ } from "./dialog-bDkDW-C_.js";
|
|
7
|
+
import { S as z, a as K, b as q, c as G, d as J } from "./select-DSKqhVGR.js";
|
|
8
|
+
import { f as Q, u as X, c as Z } from "./useButtonProps-D-ruygH7.js";
|
|
8
9
|
import { u as tt } from "./index-BGd2HiwP.js";
|
|
10
|
+
import { L as u } from "./label-ClsOg9Hr.js";
|
|
11
|
+
import { I as v } from "./input-C_J-pfTx.js";
|
|
12
|
+
import { B as C } from "./button-090-I3tp.js";
|
|
9
13
|
const y = [
|
|
10
14
|
{
|
|
11
15
|
value: "note",
|
|
12
16
|
label: "Note",
|
|
13
|
-
icon:
|
|
17
|
+
icon: P,
|
|
14
18
|
color: "#1f6feb",
|
|
15
19
|
background: "#1f6feb1f"
|
|
16
20
|
},
|
|
17
21
|
{
|
|
18
22
|
value: "tip",
|
|
19
23
|
label: "Tip",
|
|
20
|
-
icon:
|
|
24
|
+
icon: j,
|
|
21
25
|
color: "#238636",
|
|
22
26
|
background: "#2386361f"
|
|
23
27
|
},
|
|
24
28
|
{
|
|
25
29
|
value: "important",
|
|
26
30
|
label: "Important",
|
|
27
|
-
icon:
|
|
31
|
+
icon: E,
|
|
28
32
|
color: "#ab7df8",
|
|
29
33
|
background: "#ab7df81f"
|
|
30
34
|
},
|
|
31
35
|
{
|
|
32
36
|
value: "warning",
|
|
33
37
|
label: "Warning",
|
|
34
|
-
icon:
|
|
38
|
+
icon: R,
|
|
35
39
|
color: "#d29922",
|
|
36
40
|
background: "#d299221f"
|
|
37
41
|
},
|
|
38
42
|
{
|
|
39
43
|
value: "caution",
|
|
40
44
|
label: "Caution",
|
|
41
|
-
icon:
|
|
45
|
+
icon: W,
|
|
42
46
|
color: "#f85149",
|
|
43
47
|
background: "#f851491f"
|
|
44
48
|
}
|
|
45
49
|
];
|
|
46
50
|
function et({ node: t }) {
|
|
47
|
-
const { type: e = "note", title:
|
|
51
|
+
const { type: e = "note", title: r = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
|
|
48
52
|
return /* @__PURE__ */ o(D, { children: /* @__PURE__ */ l(
|
|
49
53
|
"div",
|
|
50
54
|
{
|
|
@@ -71,7 +75,7 @@ function et({ node: t }) {
|
|
|
71
75
|
}),
|
|
72
76
|
children: [
|
|
73
77
|
/* @__PURE__ */ o(c, { className: "richtext-size-5" }),
|
|
74
|
-
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children:
|
|
78
|
+
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: r })
|
|
75
79
|
]
|
|
76
80
|
}
|
|
77
81
|
),
|
|
@@ -87,39 +91,39 @@ const ot = [
|
|
|
87
91
|
{ value: "warning", label: "Warning", icon: "TriangleAlert" },
|
|
88
92
|
{ value: "caution", label: "Caution", icon: "OctagonAlert" }
|
|
89
93
|
];
|
|
90
|
-
function
|
|
91
|
-
const { t } = tt(), e =
|
|
94
|
+
function gt() {
|
|
95
|
+
const { t } = tt(), e = Q(), r = X(lt.name), [n, i] = s(!1), [c, d] = s("note"), [h, b] = s(""), [f, g] = s(""), {
|
|
92
96
|
icon: A = void 0,
|
|
93
97
|
tooltip: N = void 0,
|
|
94
98
|
shortcutKeys: L = void 0,
|
|
95
|
-
tooltipOptions:
|
|
96
|
-
isActive:
|
|
97
|
-
} = (
|
|
98
|
-
e && (e.chain().focus().setCallout({ type: c, title:
|
|
99
|
+
tooltipOptions: I = {},
|
|
100
|
+
isActive: S = void 0
|
|
101
|
+
} = (r == null ? void 0 : r.componentProps) ?? {}, { dataState: k, disabled: m } = Z(S), w = () => {
|
|
102
|
+
e && (e.chain().focus().setCallout({ type: c, title: h, body: f }).run(), i(!1), d("note"), b(""), g(""));
|
|
99
103
|
}, O = () => {
|
|
100
104
|
m || i(!0);
|
|
101
105
|
};
|
|
102
|
-
return
|
|
103
|
-
/* @__PURE__ */ o(
|
|
106
|
+
return r ? /* @__PURE__ */ l(F, { onOpenChange: i, open: n, children: [
|
|
107
|
+
/* @__PURE__ */ o(U, { asChild: !0, children: /* @__PURE__ */ o(
|
|
104
108
|
T,
|
|
105
109
|
{
|
|
106
110
|
action: O,
|
|
107
|
-
dataState:
|
|
111
|
+
dataState: k,
|
|
108
112
|
disabled: m,
|
|
109
113
|
icon: A,
|
|
110
114
|
shortcutKeys: L,
|
|
111
115
|
tooltip: N,
|
|
112
|
-
tooltipOptions:
|
|
116
|
+
tooltipOptions: I
|
|
113
117
|
}
|
|
114
118
|
) }),
|
|
115
|
-
/* @__PURE__ */ l(
|
|
116
|
-
/* @__PURE__ */ o(
|
|
119
|
+
/* @__PURE__ */ l(Y, { children: [
|
|
120
|
+
/* @__PURE__ */ o(_, { children: t("editor.callout.dialog.title") }),
|
|
117
121
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
|
|
118
122
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
119
123
|
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
|
|
120
|
-
/* @__PURE__ */ l(
|
|
121
|
-
/* @__PURE__ */ o(
|
|
122
|
-
/* @__PURE__ */ o(
|
|
124
|
+
/* @__PURE__ */ l(z, { onValueChange: d, value: c, children: [
|
|
125
|
+
/* @__PURE__ */ o(K, { children: /* @__PURE__ */ o(q, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
|
|
126
|
+
/* @__PURE__ */ o(G, { children: ot.map((a) => /* @__PURE__ */ o(J, { value: a.value, children: t(`editor.callout.type.${a.value}`) }, a.value)) })
|
|
123
127
|
] })
|
|
124
128
|
] }),
|
|
125
129
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
@@ -127,9 +131,9 @@ function ht() {
|
|
|
127
131
|
/* @__PURE__ */ o(
|
|
128
132
|
v,
|
|
129
133
|
{
|
|
130
|
-
onChange: (
|
|
134
|
+
onChange: (a) => b(a.target.value),
|
|
131
135
|
placeholder: t("editor.callout.dialog.title.placeholder"),
|
|
132
|
-
value:
|
|
136
|
+
value: h
|
|
133
137
|
}
|
|
134
138
|
)
|
|
135
139
|
] }),
|
|
@@ -138,21 +142,21 @@ function ht() {
|
|
|
138
142
|
/* @__PURE__ */ o(
|
|
139
143
|
v,
|
|
140
144
|
{
|
|
141
|
-
onChange: (
|
|
145
|
+
onChange: (a) => g(a.target.value),
|
|
142
146
|
placeholder: t("editor.callout.dialog.body.placeholder"),
|
|
143
|
-
value:
|
|
147
|
+
value: f
|
|
144
148
|
}
|
|
145
149
|
)
|
|
146
150
|
] })
|
|
147
151
|
] }),
|
|
148
|
-
/* @__PURE__ */ l(
|
|
152
|
+
/* @__PURE__ */ l($, { children: [
|
|
149
153
|
/* @__PURE__ */ o(C, { onClick: () => i(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
|
|
150
154
|
/* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
|
|
151
155
|
] })
|
|
152
156
|
] })
|
|
153
|
-
] }) : /* @__PURE__ */ o(
|
|
157
|
+
] }) : /* @__PURE__ */ o(V, {});
|
|
154
158
|
}
|
|
155
|
-
function
|
|
159
|
+
function p(t) {
|
|
156
160
|
return (e) => e.getAttribute(t);
|
|
157
161
|
}
|
|
158
162
|
const lt = /* @__PURE__ */ H.create({
|
|
@@ -170,14 +174,14 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
170
174
|
HTMLAttributes: {
|
|
171
175
|
class: "callout"
|
|
172
176
|
},
|
|
173
|
-
button: ({ editor: e, t:
|
|
177
|
+
button: ({ editor: e, t: r }) => ({
|
|
174
178
|
component: T,
|
|
175
179
|
componentProps: {
|
|
176
180
|
action: () => !0,
|
|
177
181
|
isActive: () => e.isActive("callout"),
|
|
178
182
|
disabled: !1,
|
|
179
183
|
icon: "Callout",
|
|
180
|
-
tooltip:
|
|
184
|
+
tooltip: r("editor.callout.tooltip")
|
|
181
185
|
}
|
|
182
186
|
})
|
|
183
187
|
};
|
|
@@ -195,15 +199,15 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
195
199
|
return {
|
|
196
200
|
type: {
|
|
197
201
|
default: "",
|
|
198
|
-
parseHTML:
|
|
202
|
+
parseHTML: p("type")
|
|
199
203
|
},
|
|
200
204
|
title: {
|
|
201
205
|
default: "",
|
|
202
|
-
parseHTML:
|
|
206
|
+
parseHTML: p("title")
|
|
203
207
|
},
|
|
204
208
|
body: {
|
|
205
209
|
default: "",
|
|
206
|
-
parseHTML:
|
|
210
|
+
parseHTML: p("body")
|
|
207
211
|
}
|
|
208
212
|
};
|
|
209
213
|
},
|
|
@@ -221,5 +225,5 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
221
225
|
});
|
|
222
226
|
export {
|
|
223
227
|
lt as Callout,
|
|
224
|
-
|
|
228
|
+
gt as RichTextCallout
|
|
225
229
|
};
|
package/lib/Clear.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),v=require("./toggle-C9tcMm1r.cjs"),c=require("./useButtonProps-D9ndBdmA.cjs");function f(){const t=c.useButtonProps(s.name),{icon:o=void 0,tooltip:e=void 0,shortcutKeys:a=void 0,tooltipOptions:u={},action:i=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:r}=c.useActive(l),d=()=>{r||i&&i()};return t?n.jsx(v.ActionButton,{action:d,disabled:r,icon:o,shortcutKeys:a,tooltip:e,tooltipOptions:u}):n.jsx(n.Fragment,{})}const s=p.Node3.create({name:"clear",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:o,t:e})=>({componentProps:{action:()=>o.chain().focus().clearNodes().unsetAllMarks().run(),isActive:()=>o.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:e("editor.clear.tooltip")}})}}});exports.Clear=s;exports.RichTextClear=f;
|
package/lib/Clear.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { N as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { N as p } from "./clsx-m_C5j3RU.js";
|
|
2
|
+
import { jsx as e, Fragment as l } from "react/jsx-runtime";
|
|
3
|
+
import { A as d } from "./toggle-CaSwYCk4.js";
|
|
4
|
+
import { u as m, d as f } from "./useButtonProps-D-ruygH7.js";
|
|
5
|
+
function k() {
|
|
6
|
+
const o = m(v.name), {
|
|
6
7
|
icon: t = void 0,
|
|
7
8
|
tooltip: n = void 0,
|
|
8
9
|
shortcutKeys: s = void 0,
|
|
9
10
|
tooltipOptions: c = {},
|
|
10
11
|
action: i = void 0,
|
|
11
12
|
isActive: a = void 0
|
|
12
|
-
} = (o == null ? void 0 : o.componentProps) ?? {}, { disabled:
|
|
13
|
-
|
|
13
|
+
} = (o == null ? void 0 : o.componentProps) ?? {}, { disabled: r } = f(a), u = () => {
|
|
14
|
+
r || i && i();
|
|
14
15
|
};
|
|
15
|
-
return o ? /* @__PURE__ */
|
|
16
|
-
|
|
16
|
+
return o ? /* @__PURE__ */ e(
|
|
17
|
+
d,
|
|
17
18
|
{
|
|
18
19
|
action: u,
|
|
19
|
-
disabled:
|
|
20
|
+
disabled: r,
|
|
20
21
|
icon: t,
|
|
21
22
|
shortcutKeys: s,
|
|
22
23
|
tooltip: n,
|
|
23
24
|
tooltipOptions: c
|
|
24
25
|
}
|
|
25
|
-
) : /* @__PURE__ */
|
|
26
|
+
) : /* @__PURE__ */ e(l, {});
|
|
26
27
|
}
|
|
27
|
-
const v = /* @__PURE__ */
|
|
28
|
+
const v = /* @__PURE__ */ p.create({
|
|
28
29
|
name: "clear",
|
|
29
30
|
//@ts-expect-error
|
|
30
31
|
addOptions() {
|
|
@@ -45,5 +46,5 @@ const v = /* @__PURE__ */ l.create({
|
|
|
45
46
|
});
|
|
46
47
|
export {
|
|
47
48
|
v as Clear,
|
|
48
|
-
|
|
49
|
+
k as RichTextClear
|
|
49
50
|
};
|
package/lib/Code.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-C9tcMm1r.cjs"),a=require("./useButtonProps-D9ndBdmA.cjs");var x=/(^|[^`])`([^`]+)`(?!`)$/,C=/(^|[^`])`([^`]+)`(?!`)/g,v=o.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",o.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[o.markInputRule({find:x,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:C,type:this.type})]}});function M(){const e=a.useButtonProps(u.name),{icon:t=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:l,disabled:i,update:g}=a.useToggleActive(p),m=()=>{i||d&&(d(),g())};return e?s.jsx(h.ActionButton,{action:m,dataState:l,disabled:i,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):s.jsx(s.Fragment,{})}const u=v.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r,extension:n})=>({componentProps:{action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code"),disabled:!t.can().toggleCode(),icon:"Code",shortcutKeys:n.options.shortcutKeys??["mod","E"],tooltip:r("editor.code.tooltip")}})}}});exports.Code=u;exports.RichTextCode=M;
|
package/lib/Code.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { M as m, e as l, f as g, m as h } from "./clsx-
|
|
1
|
+
import { M as m, e as l, f as g, m as h } from "./clsx-m_C5j3RU.js";
|
|
2
2
|
import { jsx as a, Fragment as M } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import "./theme.js";
|
|
3
|
+
import { A as f } from "./toggle-CaSwYCk4.js";
|
|
4
|
+
import { u as v, c as C } from "./useButtonProps-D-ruygH7.js";
|
|
6
5
|
var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
7
6
|
name: "code",
|
|
8
7
|
addOptions() {
|
|
@@ -51,7 +50,7 @@ var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
|
51
50
|
];
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
|
-
function
|
|
53
|
+
function K() {
|
|
55
54
|
const t = v(A.name), {
|
|
56
55
|
icon: e = void 0,
|
|
57
56
|
tooltip: o = void 0,
|
|
@@ -96,5 +95,5 @@ const A = /* @__PURE__ */ y.extend({
|
|
|
96
95
|
});
|
|
97
96
|
export {
|
|
98
97
|
A as Code,
|
|
99
|
-
|
|
98
|
+
K as RichTextCode
|
|
100
99
|
};
|
package/lib/CodeBlock.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./clsx-CXbNJWDD.cjs"),r=require("react/jsx-runtime"),u=require("./index-De9MZVWQ.cjs"),x=require("react");require("./theme.cjs");const S=require("prism-code-editor-lightweight"),p=require("prism-code-editor-lightweight/commands"),T=require("prism-code-editor-lightweight/cursor"),I=require("prism-code-editor-lightweight/guides"),B=require("prism-code-editor-lightweight/highlight-brackets"),R=require("prism-code-editor-lightweight/match-brackets"),E=require("prism-code-editor-lightweight/match-tags"),s=require("./select-DTNz0ZeE.cjs"),z=require("./delete-node-CosiBes5.cjs");require("prism-code-editor-lightweight/prism/languages/bash");require("prism-code-editor-lightweight/prism/languages/css");require("prism-code-editor-lightweight/prism/languages/css-extras");require("prism-code-editor-lightweight/prism/languages/ini");require("prism-code-editor-lightweight/prism/languages/kotlin");require("prism-code-editor-lightweight/prism/languages/xml");require("prism-code-editor-lightweight/prism/languages/markup");require("prism-code-editor-lightweight/prism/languages/r");require("prism-code-editor-lightweight/prism/languages/basic");require("prism-code-editor-lightweight/prism/languages/vbnet");require("prism-code-editor-lightweight/prism/languages/c");require("prism-code-editor-lightweight/prism/languages/opencl");require("prism-code-editor-lightweight/prism/languages/diff");require("prism-code-editor-lightweight/prism/languages/java");require("prism-code-editor-lightweight/prism/languages/less");require("prism-code-editor-lightweight/prism/languages/objectivec");require("prism-code-editor-lightweight/prism/languages/ruby");require("prism-code-editor-lightweight/prism/languages/sql");require("prism-code-editor-lightweight/prism/languages/wasm");require("prism-code-editor-lightweight/prism/languages/cpp");require("prism-code-editor-lightweight/prism/languages/go");require("prism-code-editor-lightweight/prism/languages/javascript");require("prism-code-editor-lightweight/prism/languages/js-templates");require("prism-code-editor-lightweight/prism/languages/jsx");require("prism-code-editor-lightweight/prism/languages/lua");require("prism-code-editor-lightweight/prism/languages/perl");require("prism-code-editor-lightweight/prism/languages/python");require("prism-code-editor-lightweight/prism/languages/rust");require("prism-code-editor-lightweight/prism/languages/swift");require("prism-code-editor-lightweight/prism/languages/clike");require("prism-code-editor-lightweight/prism/languages/csharp");require("prism-code-editor-lightweight/prism/languages/graphql");require("prism-code-editor-lightweight/prism/languages/json");require("prism-code-editor-lightweight/prism/languages/makefile");require("prism-code-editor-lightweight/prism/languages/scss");require("prism-code-editor-lightweight/prism/languages/typescript");require("prism-code-editor-lightweight/prism/languages/tsx");require("prism-code-editor-lightweight/prism/languages/yaml");require("prism-code-editor-lightweight/prism/languages/regex");require("prism-code-editor-lightweight/prism/languages/php");require("prism-code-editor-lightweight/prism/languages/markdown");function L(){const e=u.useButtonProps(C.name),{icon:a=void 0,tooltip:n=void 0,tooltipOptions:h={},action:c=void 0,isActive:m=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:o,disabled:b,update:v}=u.useToggleActive(m),f=()=>{b||c&&(c(),v())};return e?r.jsx(u.ActionButton,{action:f,dataState:o,disabled:b,icon:a,tooltip:n,tooltipOptions:h}):r.jsx(r.Fragment,{})}const M="_wrap_1x3wi_1",W="_blockInfoEditable_1x3wi_30",N={wrap:M,blockInfoEditable:W},g=[{value:"plaintext",label:"plaintext"},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"cpp",label:"C++"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"sql",label:"SQL"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"bash",label:"Bash"},{value:"php",label:"PHP"}],q=[2,4,8];function H(e){const a=u.useEditableEditor(),n=x.useRef(null),h=x.useCallback(()=>z.deleteNode(C.name,e==null?void 0:e.editor),[e==null?void 0:e.editor]),c=x.useRef(null),m=e.node.attrs.code||e.node.textContent||"",o=x.useCallback(t=>{t==null||t.stopPropagation(),setTimeout(()=>{var i,d,j;(j=(d=(i=c.current)==null?void 0:i.textarea)==null?void 0:d.focus)==null||j.call(d)},0)},[]),b=async()=>{if(m)try{if(navigator.clipboard)await navigator.clipboard.writeText(m);else{const t=document.createElement("textarea");t.value=m,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}}catch(t){console.error("Error:",t)}finally{o()}},v=()=>{e.updateAttributes({lineNumbers:!e.node.attrs.lineNumbers}),o()},f=()=>{e.updateAttributes({wordWrap:!e.node.attrs.wordWrap}),o()},k=t=>{const i={...t};return i.language&&!g.some(d=>d.value===i.language)&&(i.language="plaintext",e.updateAttributes({language:"plaintext"})),i},w=x.useCallback(t=>{o(t)},[o]);return x.useEffect(()=>{if(n.current){const t=k(e.node.attrs);c.current=S.createEditor(n.current,{readOnly:!a,language:t.language||"plaintext",tabSize:t.tabSize??2,lineNumbers:t.lineNumbers??!0,wordWrap:t.wordWrap??!1,value:m,rtl:!1,onUpdate(i){queueMicrotask(()=>{e.updateAttributes({code:i})})}}),c.current.addExtensions(R.matchBrackets(),E.matchTags(),I.indentGuides(),B.highlightBracketPairs(),T.cursorPosition(),p.defaultCommands(),p.editHistory()),e.node.attrs.shouldFocus&&setTimeout(()=>{o(),e.updateAttributes({shouldFocus:!1})},0)}return()=>{var t,i;(t=c.current)!=null&&t.remove&&((i=c.current)==null||i.remove())}},[n]),x.useEffect(()=>{var t,i;if((t=c.current)!=null&&t.setOptions){const d=k(e.node.attrs);(i=c.current)==null||i.setOptions(d)}},[c,e.node.attrs]),r.jsx(l.NodeViewWrapper,{className:l.clsx(N.wrap,"render-wrapper"),children:r.jsx("div",{onClick:w,ref:n,className:l.clsx("richtext-node-container richtext-hover-shadow richtext-select-outline richtext-node-code-block !richtext-my-[10px]",{[N.blockInfoEditable]:!a}),children:r.jsxs("div",{className:"richtext-code-block-toolbar",children:[r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.language,disabled:!a,onValueChange:t=>{e.updateAttributes({language:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(s.SelectValue,{placeholder:"Select language"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:g==null?void 0:g.map(t=>r.jsx(s.SelectItem,{value:t.value,children:t.label},t.value))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:b,children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"Copy"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:v,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.lineNumbers}),children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"List"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:f,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.wordWrap}),children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"WrapText"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.tabSize,disabled:!a,onValueChange:t=>{e.updateAttributes({tabSize:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"IndentIncrease"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:q==null?void 0:q.map(t=>r.jsx(s.SelectItem,{value:t,children:t},t))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:h,children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"Trash2"})})]})})})}const y=/^`{3}([a-z]+)?\s$/,A=/^~{3}([a-z]+)?\s$/,C=l.Node3.create({name:"codeBlock",group:"block",atom:!0,content:"text*",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),languages:[],button:({editor:a,t:n})=>({componentProps:{action:()=>a.commands.setCodeBlock({}),isActive:()=>a.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:n("editor.codeblock.tooltip")}})}},addAttributes(){return{code:{default:"",parseHTML:e=>e.textContent||""},language:{default:"plaintext"},lineNumbers:{default:!0},wordWrap:{default:!1},tabSize:{default:2},shouldFocus:{default:!0,parseHTML:()=>!1,renderHTML:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})},{tag:"pre code",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})}]},renderHTML({HTMLAttributes:e,node:a}){var h;const n=a.attrs.code||((h=a.content.firstChild)==null?void 0:h.text)||"";return["pre",l.mergeAttributes(this.options.HTMLAttributes,e),["code",{},n]]},addNodeView(){return l.ReactNodeViewRenderer(H)},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.insertContent({type:this.name,attrs:{...e,shouldFocus:!0}})}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.setCodeBlock({})}},addInputRules(){return[l.textblockTypeInputRule({find:y,type:this.type,getAttributes:e=>({language:e[1]})}),l.textblockTypeInputRule({find:A,type:this.type,getAttributes:e=>({language:e[1]})})]}});exports.CodeBlock=C;exports.RichTextCodeBlock=L;exports.backtickInputRegex=y;exports.tildeInputRegex=A;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./clsx-CXbNJWDD.cjs"),r=require("react/jsx-runtime"),T=require("./toggle-C9tcMm1r.cjs"),I=require("prism-code-editor-lightweight"),N=require("prism-code-editor-lightweight/commands"),B=require("prism-code-editor-lightweight/cursor"),R=require("prism-code-editor-lightweight/guides"),E=require("prism-code-editor-lightweight/highlight-brackets"),z=require("prism-code-editor-lightweight/match-brackets"),L=require("prism-code-editor-lightweight/match-tags"),d=require("react"),s=require("./select-B8HIWDXf.cjs"),C=require("./useButtonProps-D9ndBdmA.cjs"),M=require("./delete-node-CosiBes5.cjs");require("prism-code-editor-lightweight/prism/languages/bash");require("prism-code-editor-lightweight/prism/languages/css");require("prism-code-editor-lightweight/prism/languages/css-extras");require("prism-code-editor-lightweight/prism/languages/ini");require("prism-code-editor-lightweight/prism/languages/kotlin");require("prism-code-editor-lightweight/prism/languages/xml");require("prism-code-editor-lightweight/prism/languages/markup");require("prism-code-editor-lightweight/prism/languages/r");require("prism-code-editor-lightweight/prism/languages/basic");require("prism-code-editor-lightweight/prism/languages/vbnet");require("prism-code-editor-lightweight/prism/languages/c");require("prism-code-editor-lightweight/prism/languages/opencl");require("prism-code-editor-lightweight/prism/languages/diff");require("prism-code-editor-lightweight/prism/languages/java");require("prism-code-editor-lightweight/prism/languages/less");require("prism-code-editor-lightweight/prism/languages/objectivec");require("prism-code-editor-lightweight/prism/languages/ruby");require("prism-code-editor-lightweight/prism/languages/sql");require("prism-code-editor-lightweight/prism/languages/wasm");require("prism-code-editor-lightweight/prism/languages/cpp");require("prism-code-editor-lightweight/prism/languages/go");require("prism-code-editor-lightweight/prism/languages/javascript");require("prism-code-editor-lightweight/prism/languages/js-templates");require("prism-code-editor-lightweight/prism/languages/jsx");require("prism-code-editor-lightweight/prism/languages/lua");require("prism-code-editor-lightweight/prism/languages/perl");require("prism-code-editor-lightweight/prism/languages/python");require("prism-code-editor-lightweight/prism/languages/rust");require("prism-code-editor-lightweight/prism/languages/swift");require("prism-code-editor-lightweight/prism/languages/clike");require("prism-code-editor-lightweight/prism/languages/csharp");require("prism-code-editor-lightweight/prism/languages/graphql");require("prism-code-editor-lightweight/prism/languages/json");require("prism-code-editor-lightweight/prism/languages/makefile");require("prism-code-editor-lightweight/prism/languages/scss");require("prism-code-editor-lightweight/prism/languages/typescript");require("prism-code-editor-lightweight/prism/languages/tsx");require("prism-code-editor-lightweight/prism/languages/yaml");require("prism-code-editor-lightweight/prism/languages/regex");require("prism-code-editor-lightweight/prism/languages/php");require("prism-code-editor-lightweight/prism/languages/markdown");const m=require("./Icon-wjwoRc9F.cjs");function W(){const e=C.useButtonProps(k.name),{icon:a=void 0,tooltip:n=void 0,tooltipOptions:x={},action:c=void 0,isActive:h=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:o,disabled:b,update:v}=C.useToggleActive(h),f=()=>{b||c&&(c(),v())};return e?r.jsx(T.ActionButton,{action:f,dataState:o,disabled:b,icon:a,tooltip:n,tooltipOptions:x}):r.jsx(r.Fragment,{})}const P="_wrap_1x3wi_1",H="_blockInfoEditable_1x3wi_30",y={wrap:P,blockInfoEditable:H},g=[{value:"plaintext",label:"plaintext"},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"cpp",label:"C++"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"sql",label:"SQL"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"bash",label:"Bash"},{value:"php",label:"PHP"}],q=[2,4,8];function V(e){const a=C.useEditableEditor(),n=d.useRef(null),x=d.useCallback(()=>M.deleteNode(k.name,e==null?void 0:e.editor),[e==null?void 0:e.editor]),c=d.useRef(null),h=e.node.attrs.code||e.node.textContent||"",o=d.useCallback(t=>{t==null||t.stopPropagation(),setTimeout(()=>{var i,u,p;(p=(u=(i=c.current)==null?void 0:i.textarea)==null?void 0:u.focus)==null||p.call(u)},0)},[]),b=async()=>{if(h)try{if(navigator.clipboard)await navigator.clipboard.writeText(h);else{const t=document.createElement("textarea");t.value=h,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}}catch(t){console.error("Error:",t)}finally{o()}},v=()=>{e.updateAttributes({lineNumbers:!e.node.attrs.lineNumbers}),o()},f=()=>{e.updateAttributes({wordWrap:!e.node.attrs.wordWrap}),o()},j=t=>{const i={...t};return i.language&&!g.some(u=>u.value===i.language)&&(i.language="plaintext",e.updateAttributes({language:"plaintext"})),i},S=d.useCallback(t=>{o(t)},[o]);return d.useEffect(()=>{if(n.current){const t=j(e.node.attrs);c.current=I.createEditor(n.current,{readOnly:!a,language:t.language||"plaintext",tabSize:t.tabSize??2,lineNumbers:t.lineNumbers??!0,wordWrap:t.wordWrap??!1,value:h,rtl:!1,onUpdate(i){queueMicrotask(()=>{e.updateAttributes({code:i})})}}),c.current.addExtensions(z.matchBrackets(),L.matchTags(),R.indentGuides(),E.highlightBracketPairs(),B.cursorPosition(),N.defaultCommands(),N.editHistory()),e.node.attrs.shouldFocus&&setTimeout(()=>{o(),e.updateAttributes({shouldFocus:!1})},0)}return()=>{var t,i;(t=c.current)!=null&&t.remove&&((i=c.current)==null||i.remove())}},[n]),d.useEffect(()=>{var t,i;if((t=c.current)!=null&&t.setOptions){const u=j(e.node.attrs);(i=c.current)==null||i.setOptions(u)}},[c,e.node.attrs]),r.jsx(l.NodeViewWrapper,{className:l.clsx(y.wrap,"render-wrapper"),children:r.jsx("div",{onClick:S,ref:n,className:l.clsx("richtext-node-container richtext-hover-shadow richtext-select-outline richtext-node-code-block !richtext-my-[10px]",{[y.blockInfoEditable]:!a}),children:r.jsxs("div",{className:"richtext-code-block-toolbar",children:[r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.language,disabled:!a,onValueChange:t=>{e.updateAttributes({language:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(s.SelectValue,{placeholder:"Select language"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:g==null?void 0:g.map(t=>r.jsx(s.SelectItem,{value:t.value,children:t.label},t.value))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:b,children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"Copy"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:v,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.lineNumbers}),children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"List"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:f,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.wordWrap}),children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"WrapText"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.tabSize,disabled:!a,onValueChange:t=>{e.updateAttributes({tabSize:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"IndentIncrease"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:q==null?void 0:q.map(t=>r.jsx(s.SelectItem,{value:t,children:t},t))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:x,children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"Trash2"})})]})})})}const A=/^`{3}([a-z]+)?\s$/,w=/^~{3}([a-z]+)?\s$/,k=l.Node3.create({name:"codeBlock",group:"block",atom:!0,content:"text*",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),languages:[],button:({editor:a,t:n})=>({componentProps:{action:()=>a.commands.setCodeBlock({}),isActive:()=>a.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:n("editor.codeblock.tooltip")}})}},addAttributes(){return{code:{default:"",parseHTML:e=>e.textContent||""},language:{default:"plaintext"},lineNumbers:{default:!0},wordWrap:{default:!1},tabSize:{default:2},shouldFocus:{default:!0,parseHTML:()=>!1,renderHTML:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})},{tag:"pre code",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})}]},renderHTML({HTMLAttributes:e,node:a}){var x;const n=a.attrs.code||((x=a.content.firstChild)==null?void 0:x.text)||"";return["pre",l.mergeAttributes(this.options.HTMLAttributes,e),["code",{},n]]},addNodeView(){return l.ReactNodeViewRenderer(V)},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.insertContent({type:this.name,attrs:{...e,shouldFocus:!0}})}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.setCodeBlock({})}},addInputRules(){return[l.textblockTypeInputRule({find:A,type:this.type,getAttributes:e=>({language:e[1]})}),l.textblockTypeInputRule({find:w,type:this.type,getAttributes:e=>({language:e[1]})})]}});exports.CodeBlock=k;exports.RichTextCodeBlock=W;exports.backtickInputRegex=A;exports.tildeInputRegex=w;
|
package/lib/CodeBlock.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { h as L, j as h, N as M, t as k, k as W, m as j } from "./clsx-
|
|
1
|
+
import { h as L, j as h, N as M, t as k, k as W, m as j } from "./clsx-m_C5j3RU.js";
|
|
2
2
|
import { jsx as r, Fragment as R, jsxs as f } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { A as H } from "./toggle-CaSwYCk4.js";
|
|
4
|
+
import { createEditor as V } from "prism-code-editor-lightweight";
|
|
5
|
+
import { defaultCommands as P, editHistory as F } from "prism-code-editor-lightweight/commands";
|
|
6
|
+
import { cursorPosition as O } from "prism-code-editor-lightweight/cursor";
|
|
7
|
+
import { indentGuides as _ } from "prism-code-editor-lightweight/guides";
|
|
8
|
+
import { highlightBracketPairs as J } from "prism-code-editor-lightweight/highlight-brackets";
|
|
9
|
+
import { matchBrackets as q } from "prism-code-editor-lightweight/match-brackets";
|
|
10
|
+
import { matchTags as D } from "prism-code-editor-lightweight/match-tags";
|
|
4
11
|
import { useRef as y, useCallback as v, useEffect as A } from "react";
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import { defaultCommands as _, editHistory as J } from "prism-code-editor-lightweight/commands";
|
|
8
|
-
import { cursorPosition as q } from "prism-code-editor-lightweight/cursor";
|
|
9
|
-
import { indentGuides as D } from "prism-code-editor-lightweight/guides";
|
|
10
|
-
import { highlightBracketPairs as G } from "prism-code-editor-lightweight/highlight-brackets";
|
|
11
|
-
import { matchBrackets as U } from "prism-code-editor-lightweight/match-brackets";
|
|
12
|
-
import { matchTags as $ } from "prism-code-editor-lightweight/match-tags";
|
|
13
|
-
import { S as w, a as S, b as K, c as T, d as E } from "./select-D9wQw2qB.js";
|
|
12
|
+
import { S as w, a as S, b as G, c as T, d as E } from "./select-DSKqhVGR.js";
|
|
13
|
+
import { u as U, c as $, l as K } from "./useButtonProps-D-ruygH7.js";
|
|
14
14
|
import { d as Q } from "./delete-node-eQHsyyhR.js";
|
|
15
15
|
import "prism-code-editor-lightweight/prism/languages/bash";
|
|
16
16
|
import "prism-code-editor-lightweight/prism/languages/css";
|
|
@@ -53,20 +53,21 @@ import "prism-code-editor-lightweight/prism/languages/yaml";
|
|
|
53
53
|
import "prism-code-editor-lightweight/prism/languages/regex";
|
|
54
54
|
import "prism-code-editor-lightweight/prism/languages/php";
|
|
55
55
|
import "prism-code-editor-lightweight/prism/languages/markdown";
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
import { I as u } from "./Icon-BvGyfX2j.js";
|
|
57
|
+
function it() {
|
|
58
|
+
const e = U(B.name), {
|
|
58
59
|
icon: i = void 0,
|
|
59
60
|
tooltip: n = void 0,
|
|
60
61
|
tooltipOptions: s = {},
|
|
61
62
|
action: o = void 0,
|
|
62
63
|
isActive: d = void 0
|
|
63
|
-
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update:
|
|
64
|
-
m || o && (o(),
|
|
64
|
+
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update: p } = $(d), b = () => {
|
|
65
|
+
m || o && (o(), p());
|
|
65
66
|
};
|
|
66
67
|
return e ? /* @__PURE__ */ r(
|
|
67
|
-
|
|
68
|
+
H,
|
|
68
69
|
{
|
|
69
|
-
action:
|
|
70
|
+
action: b,
|
|
70
71
|
dataState: c,
|
|
71
72
|
disabled: m,
|
|
72
73
|
icon: i,
|
|
@@ -97,7 +98,7 @@ const Y = "_wrap_1x3wi_1", X = "_blockInfoEditable_1x3wi_30", z = {
|
|
|
97
98
|
{ value: "php", label: "PHP" }
|
|
98
99
|
], g = [2, 4, 8];
|
|
99
100
|
function Z(e) {
|
|
100
|
-
const i =
|
|
101
|
+
const i = K(), n = y(null), s = v(() => Q(B.name, e == null ? void 0 : e.editor), [e == null ? void 0 : e.editor]), o = y(null), d = e.node.attrs.code || e.node.textContent || "", c = v((t) => {
|
|
101
102
|
t == null || t.stopPropagation(), setTimeout(() => {
|
|
102
103
|
var a, l, N;
|
|
103
104
|
(N = (l = (a = o.current) == null ? void 0 : a.textarea) == null ? void 0 : l.focus) == null || N.call(l);
|
|
@@ -116,11 +117,11 @@ function Z(e) {
|
|
|
116
117
|
} finally {
|
|
117
118
|
c();
|
|
118
119
|
}
|
|
119
|
-
},
|
|
120
|
+
}, p = () => {
|
|
120
121
|
e.updateAttributes({
|
|
121
122
|
lineNumbers: !e.node.attrs.lineNumbers
|
|
122
123
|
}), c();
|
|
123
|
-
},
|
|
124
|
+
}, b = () => {
|
|
124
125
|
e.updateAttributes({
|
|
125
126
|
wordWrap: !e.node.attrs.wordWrap
|
|
126
127
|
}), c();
|
|
@@ -138,7 +139,7 @@ function Z(e) {
|
|
|
138
139
|
return A(() => {
|
|
139
140
|
if (n.current) {
|
|
140
141
|
const t = C(e.node.attrs);
|
|
141
|
-
o.current =
|
|
142
|
+
o.current = V(n.current, {
|
|
142
143
|
readOnly: !i,
|
|
143
144
|
language: t.language || "plaintext",
|
|
144
145
|
tabSize: t.tabSize ?? 2,
|
|
@@ -152,13 +153,13 @@ function Z(e) {
|
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
}), o.current.addExtensions(
|
|
155
|
-
U(),
|
|
156
|
-
$(),
|
|
157
|
-
D(),
|
|
158
|
-
G(),
|
|
159
156
|
q(),
|
|
157
|
+
D(),
|
|
160
158
|
_(),
|
|
161
|
-
J()
|
|
159
|
+
J(),
|
|
160
|
+
O(),
|
|
161
|
+
P(),
|
|
162
|
+
F()
|
|
162
163
|
), e.node.attrs.shouldFocus && setTimeout(() => {
|
|
163
164
|
c(), e.updateAttributes({
|
|
164
165
|
shouldFocus: !1
|
|
@@ -198,7 +199,7 @@ function Z(e) {
|
|
|
198
199
|
}), c();
|
|
199
200
|
},
|
|
200
201
|
children: [
|
|
201
|
-
/* @__PURE__ */ r(S, { className: "richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ r(
|
|
202
|
+
/* @__PURE__ */ r(S, { className: "richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ r(G, { placeholder: "Select language" }) }),
|
|
202
203
|
/* @__PURE__ */ r(T, { onCloseAutoFocus: (t) => t.preventDefault(), children: x == null ? void 0 : x.map((t) => /* @__PURE__ */ r(E, { value: t.value, children: t.label }, t.value)) })
|
|
203
204
|
]
|
|
204
205
|
}
|
|
@@ -216,7 +217,7 @@ function Z(e) {
|
|
|
216
217
|
/* @__PURE__ */ r(
|
|
217
218
|
"div",
|
|
218
219
|
{
|
|
219
|
-
onClick:
|
|
220
|
+
onClick: p,
|
|
220
221
|
className: h(
|
|
221
222
|
"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
222
223
|
{
|
|
@@ -230,7 +231,7 @@ function Z(e) {
|
|
|
230
231
|
/* @__PURE__ */ r(
|
|
231
232
|
"div",
|
|
232
233
|
{
|
|
233
|
-
onClick:
|
|
234
|
+
onClick: b,
|
|
234
235
|
className: h(
|
|
235
236
|
"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
236
237
|
{
|
|
@@ -383,7 +384,7 @@ const ee = /^`{3}([a-z]+)?\s$/, te = /^~{3}([a-z]+)?\s$/, B = /* @__PURE__ */ M.
|
|
|
383
384
|
});
|
|
384
385
|
export {
|
|
385
386
|
B as CodeBlock,
|
|
386
|
-
|
|
387
|
+
it as RichTextCodeBlock,
|
|
387
388
|
ee as backtickInputRegex,
|
|
388
389
|
te as tildeInputRegex
|
|
389
390
|
};
|
package/lib/CodeView.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),v=require("./toggle-C9tcMm1r.cjs"),r=require("./useButtonProps-D9ndBdmA.cjs");function w(){const e=r.useButtonProps(a.name),{icon:t=void 0,tooltip:o=void 0,shortcutKeys:i=void 0,tooltipOptions:d={},action:s=void 0,isActive:l=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:u,disabled:c,update:p}=r.useToggleActive(l),g=()=>{c||s&&(s(),p())};return e?n.jsx(v.ActionButton,{action:g,dataState:u,disabled:c,icon:t,shortcutKeys:i,tooltip:o,tooltipOptions:d}):n.jsx(n.Fragment,{})}const a=m.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const i=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${i}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=a;exports.RichTextCodeView=w;
|
package/lib/CodeView.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { E as l } from "./clsx-
|
|
1
|
+
import { E as l } from "./clsx-m_C5j3RU.js";
|
|
2
2
|
import { jsx as c, Fragment as g } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const t = u(C.name), {
|
|
3
|
+
import { A as u } from "./toggle-CaSwYCk4.js";
|
|
4
|
+
import { u as v, c as w } from "./useButtonProps-D-ruygH7.js";
|
|
5
|
+
function T() {
|
|
6
|
+
const t = v(C.name), {
|
|
8
7
|
icon: e = void 0,
|
|
9
8
|
tooltip: o = void 0,
|
|
10
9
|
shortcutKeys: i = void 0,
|
|
11
10
|
tooltipOptions: a = {},
|
|
12
11
|
action: n = void 0,
|
|
13
12
|
isActive: r = void 0
|
|
14
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } =
|
|
13
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } = w(r), m = () => {
|
|
15
14
|
s || n && (n(), p());
|
|
16
15
|
};
|
|
17
16
|
return t ? /* @__PURE__ */ c(
|
|
18
|
-
|
|
17
|
+
u,
|
|
19
18
|
{
|
|
20
19
|
action: m,
|
|
21
20
|
dataState: d,
|
|
@@ -77,5 +76,5 @@ const C = /* @__PURE__ */ l.create({
|
|
|
77
76
|
});
|
|
78
77
|
export {
|
|
79
78
|
C as CodeView,
|
|
80
|
-
|
|
79
|
+
T as RichTextCodeView
|
|
81
80
|
};
|
package/lib/Color.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CjhjjJsN.cjs"),t=require("react/jsx-runtime"),d=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CjhjjJsN.cjs"),t=require("react/jsx-runtime"),d=require("react"),g=require("./toggle-C9tcMm1r.cjs"),v=require("./separator-D6ruF682.cjs"),h=require("./useButtonProps-D9ndBdmA.cjs"),j=require("./Icon-wjwoRc9F.cjs");function m({fill:e}){return t.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 240 240",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:t.jsx("g",{transform:"translate(0.000000, 0.500000)",children:t.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[t.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:typeof e=="string"?e:"#000",fillRule:"evenodd"}),t.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor",fillRule:"nonzero"}),t.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor",fillRule:"nonzero"})]})})})})}function L(){const e=h.useButtonProps(C.name),{tooltip:o=void 0,isActive:s=void 0,defaultColor:r=void 0,colors:n,action:i}=(e==null?void 0:e.componentProps)??{},{disabled:l,dataState:c}=h.useActive(s),[f,u]=d.useState(r);d.useEffect(()=>{u(c)},[c]);function x(a){l||i&&(i==null||i(a),u(a))}return e?t.jsx(v.ColorPicker,{colors:n,disabled:l,onChange:x,value:f,children:t.jsx(g.ActionButton,{disabled:l,tooltip:o,children:t.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[t.jsx(m,{fill:c}),t.jsx(j.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):t.jsx(t.Fragment,{})}const C=p.Color.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:o,t:s,extension:r}){return{componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{if(typeof n=="string"){o.storage.color.currentColor=n,o.chain().focus().setColor(n).run();return}o.chain().focus().unsetColor().run()},isActive:()=>{const{color:n}=o.getAttributes("textStyle");return n},disabled:!1,shortcutKeys:r.options.shortcutKeys??["⇧","alt","C"],tooltip:s("editor.color.tooltip")}}}}},addKeyboardShortcuts(){var e;return{...(e=this.parent)==null?void 0:e.call(this),"Alt-Shift-c":()=>{const o=this.storage.currentColor||this.options.defaultColor;if(!o){const{color:r}=this.editor.getAttributes("textStyle");return r?this.editor.chain().focus().unsetColor().run():!1}return this.editor.isActive("textStyle",{color:o})?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().setColor(o).run()}}}});exports.Color=C;exports.RichTextColor=L;
|