@remarkablejames/editor 0.0.6 → 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-CpmEfz31.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 -40
- 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 +33 -31
- 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-CayP4Ww4.js → Drawer-CF6Z_IA2.js} +36 -30
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +18 -17
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +37 -32
- 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 +28 -28
- 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-C6Sb97KS.js → Iframe-Dfd3LI7b.js} +14 -11
- 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 +83 -80
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +37 -35
- package/lib/{Indent-CcFe8py3.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-Bp6AnIUF.js → Katex-DqhWWAA-.js} +22 -18
- 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-BiHumIJR.js → LinkEditBlock-xP0pGVhB.js} +27 -22
- package/lib/Mention.js +3 -3
- package/lib/{Mermaid-Dlx0XTJj.js → Mermaid-BJ6ryVdY.js} +59 -55
- 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 -1
- package/lib/PaywallSeparator.js +9 -9
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +39 -34
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +5 -5
- package/lib/SlashCommandNodeView-CUJrDQS7.cjs +1 -0
- package/lib/{SlashCommandNodeView-DzmsYaNc.js → SlashCommandNodeView-DS9FqMiY.js} +23 -21
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +11 -12
- package/lib/Table-CV6pUoVf.cjs +5 -0
- package/lib/{Table-IH34r4jd.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-FVQKPaq6.js → Twitter-BIL3o833.js} +19 -15
- 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 +112 -101
- 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-Ce2TorkG.js → dropdown-menu-DWt_xj4h.js} +1 -1
- package/lib/{dropdown-menu-DirUyRAI.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/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-BzJyaFvy.js → popover-BC7FRr8B.js} +1 -1
- package/lib/{popover-BdLwAlrM.cjs → popover-C3A6zzNV.cjs} +1 -1
- package/lib/{renderNodeView-dj6AaFSX.js → renderNodeView-C_hPIdEs.js} +2 -2
- package/lib/select-B8HIWDXf.cjs +1 -0
- package/lib/select-DSKqhVGR.js +120 -0
- package/lib/{separator-D-fyzbfx.js → separator-BJWSNjvr.js} +23 -22
- 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-Ch5w3PiI.js +20 -0
- package/lib/textarea-CtVdqwSM.cjs +1 -0
- 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/{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 +21 -32
- package/lib/ActionMenuButton-NfiUDE60.cjs +0 -1
- package/lib/Drawer-DlgdaO_B.cjs +0 -2
- package/lib/Iframe-CANdxSpV.cjs +0 -1
- package/lib/Indent-DuB2U6Cs.cjs +0 -1
- package/lib/Katex-DFU1unCm.cjs +0 -4
- package/lib/LinkEditBlock-C2zX0WVK.cjs +0 -5
- package/lib/Mermaid-B8lQSOGn.cjs +0 -2
- package/lib/SlashCommandNodeView-BfWNWGRr.cjs +0 -1
- package/lib/Table-BfM6ywrZ.cjs +0 -5
- package/lib/Twitter-axcoCgD7.cjs +0 -1
- package/lib/index-BynXHtjJ.cjs +0 -28
- package/lib/index-CnKgiZFQ.js +0 -5576
- package/lib/separator-CoQaQmFK.cjs +0 -1
package/lib/Callout.js
CHANGED
|
@@ -1,49 +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 {
|
|
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";
|
|
7
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";
|
|
8
13
|
const y = [
|
|
9
14
|
{
|
|
10
15
|
value: "note",
|
|
11
16
|
label: "Note",
|
|
12
|
-
icon:
|
|
17
|
+
icon: P,
|
|
13
18
|
color: "#1f6feb",
|
|
14
19
|
background: "#1f6feb1f"
|
|
15
20
|
},
|
|
16
21
|
{
|
|
17
22
|
value: "tip",
|
|
18
23
|
label: "Tip",
|
|
19
|
-
icon:
|
|
24
|
+
icon: j,
|
|
20
25
|
color: "#238636",
|
|
21
26
|
background: "#2386361f"
|
|
22
27
|
},
|
|
23
28
|
{
|
|
24
29
|
value: "important",
|
|
25
30
|
label: "Important",
|
|
26
|
-
icon:
|
|
31
|
+
icon: E,
|
|
27
32
|
color: "#ab7df8",
|
|
28
33
|
background: "#ab7df81f"
|
|
29
34
|
},
|
|
30
35
|
{
|
|
31
36
|
value: "warning",
|
|
32
37
|
label: "Warning",
|
|
33
|
-
icon:
|
|
38
|
+
icon: R,
|
|
34
39
|
color: "#d29922",
|
|
35
40
|
background: "#d299221f"
|
|
36
41
|
},
|
|
37
42
|
{
|
|
38
43
|
value: "caution",
|
|
39
44
|
label: "Caution",
|
|
40
|
-
icon:
|
|
45
|
+
icon: W,
|
|
41
46
|
color: "#f85149",
|
|
42
47
|
background: "#f851491f"
|
|
43
48
|
}
|
|
44
49
|
];
|
|
45
50
|
function et({ node: t }) {
|
|
46
|
-
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;
|
|
47
52
|
return /* @__PURE__ */ o(D, { children: /* @__PURE__ */ l(
|
|
48
53
|
"div",
|
|
49
54
|
{
|
|
@@ -70,7 +75,7 @@ function et({ node: t }) {
|
|
|
70
75
|
}),
|
|
71
76
|
children: [
|
|
72
77
|
/* @__PURE__ */ o(c, { className: "richtext-size-5" }),
|
|
73
|
-
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children:
|
|
78
|
+
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: r })
|
|
74
79
|
]
|
|
75
80
|
}
|
|
76
81
|
),
|
|
@@ -86,39 +91,39 @@ const ot = [
|
|
|
86
91
|
{ value: "warning", label: "Warning", icon: "TriangleAlert" },
|
|
87
92
|
{ value: "caution", label: "Caution", icon: "OctagonAlert" }
|
|
88
93
|
];
|
|
89
|
-
function
|
|
90
|
-
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(""), {
|
|
91
96
|
icon: A = void 0,
|
|
92
97
|
tooltip: N = void 0,
|
|
93
98
|
shortcutKeys: L = void 0,
|
|
94
|
-
tooltipOptions:
|
|
95
|
-
isActive:
|
|
96
|
-
} = (
|
|
97
|
-
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(""));
|
|
98
103
|
}, O = () => {
|
|
99
104
|
m || i(!0);
|
|
100
105
|
};
|
|
101
|
-
return
|
|
102
|
-
/* @__PURE__ */ o(
|
|
106
|
+
return r ? /* @__PURE__ */ l(F, { onOpenChange: i, open: n, children: [
|
|
107
|
+
/* @__PURE__ */ o(U, { asChild: !0, children: /* @__PURE__ */ o(
|
|
103
108
|
T,
|
|
104
109
|
{
|
|
105
110
|
action: O,
|
|
106
|
-
dataState:
|
|
111
|
+
dataState: k,
|
|
107
112
|
disabled: m,
|
|
108
113
|
icon: A,
|
|
109
114
|
shortcutKeys: L,
|
|
110
115
|
tooltip: N,
|
|
111
|
-
tooltipOptions:
|
|
116
|
+
tooltipOptions: I
|
|
112
117
|
}
|
|
113
118
|
) }),
|
|
114
|
-
/* @__PURE__ */ l(
|
|
115
|
-
/* @__PURE__ */ o(
|
|
119
|
+
/* @__PURE__ */ l(Y, { children: [
|
|
120
|
+
/* @__PURE__ */ o(_, { children: t("editor.callout.dialog.title") }),
|
|
116
121
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
|
|
117
122
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
118
123
|
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
|
|
119
|
-
/* @__PURE__ */ l(
|
|
120
|
-
/* @__PURE__ */ o(
|
|
121
|
-
/* @__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)) })
|
|
122
127
|
] })
|
|
123
128
|
] }),
|
|
124
129
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
@@ -126,9 +131,9 @@ function ut() {
|
|
|
126
131
|
/* @__PURE__ */ o(
|
|
127
132
|
v,
|
|
128
133
|
{
|
|
129
|
-
onChange: (
|
|
134
|
+
onChange: (a) => b(a.target.value),
|
|
130
135
|
placeholder: t("editor.callout.dialog.title.placeholder"),
|
|
131
|
-
value:
|
|
136
|
+
value: h
|
|
132
137
|
}
|
|
133
138
|
)
|
|
134
139
|
] }),
|
|
@@ -137,21 +142,21 @@ function ut() {
|
|
|
137
142
|
/* @__PURE__ */ o(
|
|
138
143
|
v,
|
|
139
144
|
{
|
|
140
|
-
onChange: (
|
|
145
|
+
onChange: (a) => g(a.target.value),
|
|
141
146
|
placeholder: t("editor.callout.dialog.body.placeholder"),
|
|
142
|
-
value:
|
|
147
|
+
value: f
|
|
143
148
|
}
|
|
144
149
|
)
|
|
145
150
|
] })
|
|
146
151
|
] }),
|
|
147
|
-
/* @__PURE__ */ l(
|
|
152
|
+
/* @__PURE__ */ l($, { children: [
|
|
148
153
|
/* @__PURE__ */ o(C, { onClick: () => i(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
|
|
149
154
|
/* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
|
|
150
155
|
] })
|
|
151
156
|
] })
|
|
152
|
-
] }) : /* @__PURE__ */ o(
|
|
157
|
+
] }) : /* @__PURE__ */ o(V, {});
|
|
153
158
|
}
|
|
154
|
-
function
|
|
159
|
+
function p(t) {
|
|
155
160
|
return (e) => e.getAttribute(t);
|
|
156
161
|
}
|
|
157
162
|
const lt = /* @__PURE__ */ H.create({
|
|
@@ -169,14 +174,14 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
169
174
|
HTMLAttributes: {
|
|
170
175
|
class: "callout"
|
|
171
176
|
},
|
|
172
|
-
button: ({ editor: e, t:
|
|
177
|
+
button: ({ editor: e, t: r }) => ({
|
|
173
178
|
component: T,
|
|
174
179
|
componentProps: {
|
|
175
180
|
action: () => !0,
|
|
176
181
|
isActive: () => e.isActive("callout"),
|
|
177
182
|
disabled: !1,
|
|
178
183
|
icon: "Callout",
|
|
179
|
-
tooltip:
|
|
184
|
+
tooltip: r("editor.callout.tooltip")
|
|
180
185
|
}
|
|
181
186
|
})
|
|
182
187
|
};
|
|
@@ -194,15 +199,15 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
194
199
|
return {
|
|
195
200
|
type: {
|
|
196
201
|
default: "",
|
|
197
|
-
parseHTML:
|
|
202
|
+
parseHTML: p("type")
|
|
198
203
|
},
|
|
199
204
|
title: {
|
|
200
205
|
default: "",
|
|
201
|
-
parseHTML:
|
|
206
|
+
parseHTML: p("title")
|
|
202
207
|
},
|
|
203
208
|
body: {
|
|
204
209
|
default: "",
|
|
205
|
-
parseHTML:
|
|
210
|
+
parseHTML: p("body")
|
|
206
211
|
}
|
|
207
212
|
};
|
|
208
213
|
},
|
|
@@ -220,5 +225,5 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
220
225
|
});
|
|
221
226
|
export {
|
|
222
227
|
lt as Callout,
|
|
223
|
-
|
|
228
|
+
gt as RichTextCallout
|
|
224
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 s=require("./clsx-CXbNJWDD.cjs"),r=require("react/jsx-runtime"),i=require("./index-BynXHtjJ.cjs"),d=require("react");require("./theme.cjs");const w=require("prism-code-editor-lightweight"),j=require("prism-code-editor-lightweight/commands"),S=require("prism-code-editor-lightweight/cursor"),T=require("prism-code-editor-lightweight/guides"),I=require("prism-code-editor-lightweight/highlight-brackets"),B=require("prism-code-editor-lightweight/match-brackets"),R=require("prism-code-editor-lightweight/match-tags"),E=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 z(){const e=i.useButtonProps(q.name),{icon:c=void 0,tooltip:o=void 0,tooltipOptions:x={},action:n=void 0,isActive:h=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:l,disabled:m,update:g}=i.useToggleActive(h),v=()=>{m||n&&(n(),g())};return e?r.jsx(i.ActionButton,{action:v,dataState:l,disabled:m,icon:c,tooltip:o,tooltipOptions:x}):r.jsx(r.Fragment,{})}const L="_wrap_1x3wi_1",M="_blockInfoEditable_1x3wi_30",p={wrap:L,blockInfoEditable:M},b=[{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"}],f=[2,4,8];function W(e){const c=i.useEditableEditor(),o=d.useRef(null),x=d.useCallback(()=>E.deleteNode(q.name,e==null?void 0:e.editor),[e==null?void 0:e.editor]),n=d.useRef(null),h=e.node.attrs.code||e.node.textContent||"",l=d.useCallback(t=>{t==null||t.stopPropagation(),setTimeout(()=>{var a,u,k;(k=(u=(a=n.current)==null?void 0:a.textarea)==null?void 0:u.focus)==null||k.call(u)},0)},[]),m=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{l()}},g=()=>{e.updateAttributes({lineNumbers:!e.node.attrs.lineNumbers}),l()},v=()=>{e.updateAttributes({wordWrap:!e.node.attrs.wordWrap}),l()},C=t=>{const a={...t};return a.language&&!b.some(u=>u.value===a.language)&&(a.language="plaintext",e.updateAttributes({language:"plaintext"})),a},A=d.useCallback(t=>{l(t)},[l]);return d.useEffect(()=>{if(o.current){const t=C(e.node.attrs);n.current=w.createEditor(o.current,{readOnly:!c,language:t.language||"plaintext",tabSize:t.tabSize??2,lineNumbers:t.lineNumbers??!0,wordWrap:t.wordWrap??!1,value:h,rtl:!1,onUpdate(a){queueMicrotask(()=>{e.updateAttributes({code:a})})}}),n.current.addExtensions(B.matchBrackets(),R.matchTags(),T.indentGuides(),I.highlightBracketPairs(),S.cursorPosition(),j.defaultCommands(),j.editHistory()),e.node.attrs.shouldFocus&&setTimeout(()=>{l(),e.updateAttributes({shouldFocus:!1})},0)}return()=>{var t,a;(t=n.current)!=null&&t.remove&&((a=n.current)==null||a.remove())}},[o]),d.useEffect(()=>{var t,a;if((t=n.current)!=null&&t.setOptions){const u=C(e.node.attrs);(a=n.current)==null||a.setOptions(u)}},[n,e.node.attrs]),r.jsx(s.NodeViewWrapper,{className:s.clsx(p.wrap,"render-wrapper"),children:r.jsx("div",{onClick:A,ref:o,className:s.clsx("richtext-node-container richtext-hover-shadow richtext-select-outline richtext-node-code-block !richtext-my-[10px]",{[p.blockInfoEditable]:!c}),children:r.jsxs("div",{className:"richtext-code-block-toolbar",children:[r.jsx("div",{children:r.jsxs(i.Select,{defaultValue:e.node.attrs.language,disabled:!c,onValueChange:t=>{e.updateAttributes({language:t}),l()},children:[r.jsx(i.SelectTrigger,{className:"richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(i.SelectValue,{placeholder:"Select language"})}),r.jsx(i.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:b==null?void 0:b.map(t=>r.jsx(i.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:m,children:r.jsx(i.IconComponent,{className:"richtext-size-4",name:"Copy"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:g,className:s.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(i.IconComponent,{className:"richtext-size-4",name:"List"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:v,className:s.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(i.IconComponent,{className:"richtext-size-4",name:"WrapText"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{children:r.jsxs(i.Select,{defaultValue:e.node.attrs.tabSize,disabled:!c,onValueChange:t=>{e.updateAttributes({tabSize:t}),l()},children:[r.jsx(i.SelectTrigger,{className:"richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(i.IconComponent,{className:"richtext-size-4",name:"IndentIncrease"})}),r.jsx(i.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:f==null?void 0:f.map(t=>r.jsx(i.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(i.IconComponent,{className:"richtext-size-4",name:"Trash2"})})]})})})}const N=/^`{3}([a-z]+)?\s$/,y=/^~{3}([a-z]+)?\s$/,q=s.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:c,t:o})=>({componentProps:{action:()=>c.commands.setCodeBlock({}),isActive:()=>c.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:o("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:c}){var x;const o=c.attrs.code||((x=c.content.firstChild)==null?void 0:x.text)||"";return["pre",s.mergeAttributes(this.options.HTMLAttributes,e),["code",{},o]]},addNodeView(){return s.ReactNodeViewRenderer(W)},addCommands(){return{setCodeBlock:e=>({commands:c})=>c.insertContent({type:this.name,attrs:{...e,shouldFocus:!0}})}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.setCodeBlock({})}},addInputRules(){return[s.textblockTypeInputRule({find:N,type:this.type,getAttributes:e=>({language:e[1]})}),s.textblockTypeInputRule({find:y,type:this.type,getAttributes:e=>({language:e[1]})})]}});exports.CodeBlock=q;exports.RichTextCodeBlock=z;exports.backtickInputRegex=N;exports.tildeInputRegex=y;
|
|
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,15 +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 {
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
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";
|
|
11
|
+
import { useRef as y, useCallback as v, useEffect as A } from "react";
|
|
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";
|
|
13
14
|
import { d as Q } from "./delete-node-eQHsyyhR.js";
|
|
14
15
|
import "prism-code-editor-lightweight/prism/languages/bash";
|
|
15
16
|
import "prism-code-editor-lightweight/prism/languages/css";
|
|
@@ -52,18 +53,19 @@ import "prism-code-editor-lightweight/prism/languages/yaml";
|
|
|
52
53
|
import "prism-code-editor-lightweight/prism/languages/regex";
|
|
53
54
|
import "prism-code-editor-lightweight/prism/languages/php";
|
|
54
55
|
import "prism-code-editor-lightweight/prism/languages/markdown";
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
import { I as u } from "./Icon-BvGyfX2j.js";
|
|
57
|
+
function it() {
|
|
58
|
+
const e = U(B.name), {
|
|
57
59
|
icon: i = void 0,
|
|
58
60
|
tooltip: n = void 0,
|
|
59
61
|
tooltipOptions: s = {},
|
|
60
62
|
action: o = void 0,
|
|
61
63
|
isActive: d = void 0
|
|
62
|
-
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update: p } =
|
|
64
|
+
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update: p } = $(d), b = () => {
|
|
63
65
|
m || o && (o(), p());
|
|
64
66
|
};
|
|
65
67
|
return e ? /* @__PURE__ */ r(
|
|
66
|
-
|
|
68
|
+
H,
|
|
67
69
|
{
|
|
68
70
|
action: b,
|
|
69
71
|
dataState: c,
|
|
@@ -96,7 +98,7 @@ const Y = "_wrap_1x3wi_1", X = "_blockInfoEditable_1x3wi_30", z = {
|
|
|
96
98
|
{ value: "php", label: "PHP" }
|
|
97
99
|
], g = [2, 4, 8];
|
|
98
100
|
function Z(e) {
|
|
99
|
-
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) => {
|
|
100
102
|
t == null || t.stopPropagation(), setTimeout(() => {
|
|
101
103
|
var a, l, N;
|
|
102
104
|
(N = (l = (a = o.current) == null ? void 0 : a.textarea) == null ? void 0 : l.focus) == null || N.call(l);
|
|
@@ -134,10 +136,10 @@ function Z(e) {
|
|
|
134
136
|
},
|
|
135
137
|
[c]
|
|
136
138
|
);
|
|
137
|
-
return
|
|
139
|
+
return A(() => {
|
|
138
140
|
if (n.current) {
|
|
139
141
|
const t = C(e.node.attrs);
|
|
140
|
-
o.current =
|
|
142
|
+
o.current = V(n.current, {
|
|
141
143
|
readOnly: !i,
|
|
142
144
|
language: t.language || "plaintext",
|
|
143
145
|
tabSize: t.tabSize ?? 2,
|
|
@@ -151,13 +153,13 @@ function Z(e) {
|
|
|
151
153
|
});
|
|
152
154
|
}
|
|
153
155
|
}), o.current.addExtensions(
|
|
154
|
-
|
|
155
|
-
K(),
|
|
156
|
+
q(),
|
|
156
157
|
D(),
|
|
157
|
-
|
|
158
|
+
_(),
|
|
158
159
|
J(),
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
O(),
|
|
161
|
+
P(),
|
|
162
|
+
F()
|
|
161
163
|
), e.node.attrs.shouldFocus && setTimeout(() => {
|
|
162
164
|
c(), e.updateAttributes({
|
|
163
165
|
shouldFocus: !1
|
|
@@ -168,7 +170,7 @@ function Z(e) {
|
|
|
168
170
|
var t, a;
|
|
169
171
|
(t = o.current) != null && t.remove && ((a = o.current) == null || a.remove());
|
|
170
172
|
};
|
|
171
|
-
}, [n]),
|
|
173
|
+
}, [n]), A(() => {
|
|
172
174
|
var t, a;
|
|
173
175
|
if ((t = o.current) != null && t.setOptions) {
|
|
174
176
|
const l = C(e.node.attrs);
|
|
@@ -187,7 +189,7 @@ function Z(e) {
|
|
|
187
189
|
),
|
|
188
190
|
children: /* @__PURE__ */ f("div", { className: "richtext-code-block-toolbar", children: [
|
|
189
191
|
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ f(
|
|
190
|
-
|
|
192
|
+
w,
|
|
191
193
|
{
|
|
192
194
|
defaultValue: e.node.attrs.language,
|
|
193
195
|
disabled: !i,
|
|
@@ -197,8 +199,8 @@ function Z(e) {
|
|
|
197
199
|
}), c();
|
|
198
200
|
},
|
|
199
201
|
children: [
|
|
200
|
-
/* @__PURE__ */ r(
|
|
201
|
-
/* @__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" }) }),
|
|
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)) })
|
|
202
204
|
]
|
|
203
205
|
}
|
|
204
206
|
) }),
|
|
@@ -241,7 +243,7 @@ function Z(e) {
|
|
|
241
243
|
),
|
|
242
244
|
/* @__PURE__ */ r("div", { className: "toolbar-divider" }),
|
|
243
245
|
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ f(
|
|
244
|
-
|
|
246
|
+
w,
|
|
245
247
|
{
|
|
246
248
|
defaultValue: e.node.attrs.tabSize,
|
|
247
249
|
disabled: !i,
|
|
@@ -251,8 +253,8 @@ function Z(e) {
|
|
|
251
253
|
}), c();
|
|
252
254
|
},
|
|
253
255
|
children: [
|
|
254
|
-
/* @__PURE__ */ r(
|
|
255
|
-
/* @__PURE__ */ r(
|
|
256
|
+
/* @__PURE__ */ r(S, { className: "richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ r(u, { className: "richtext-size-4", name: "IndentIncrease" }) }),
|
|
257
|
+
/* @__PURE__ */ r(T, { onCloseAutoFocus: (t) => t.preventDefault(), children: g == null ? void 0 : g.map((t) => /* @__PURE__ */ r(E, { value: t, children: t }, t)) })
|
|
256
258
|
]
|
|
257
259
|
}
|
|
258
260
|
) }),
|
|
@@ -382,7 +384,7 @@ const ee = /^`{3}([a-z]+)?\s$/, te = /^~{3}([a-z]+)?\s$/, B = /* @__PURE__ */ M.
|
|
|
382
384
|
});
|
|
383
385
|
export {
|
|
384
386
|
B as CodeBlock,
|
|
385
|
-
|
|
387
|
+
it as RichTextCodeBlock,
|
|
386
388
|
ee as backtickInputRegex,
|
|
387
389
|
te as tildeInputRegex
|
|
388
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;
|