@remarkablejames/editor 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{ActionMenuButton-Bmn3RME4.js → ActionMenuButton-D5HLfRzv.js} +9 -10
- package/lib/ActionMenuButton-DN6VHLkp.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +31 -33
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +13 -12
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +11 -10
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +9 -8
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +41 -45
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +13 -14
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +6 -5
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +30 -31
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +9 -8
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +18 -19
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +9 -8
- package/lib/{Drawer-DvGh9aXG.js → Drawer-B9l1SoRJ.js} +41 -47
- package/lib/Drawer-BN0lYcnJ.cjs +2 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +14 -15
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +24 -28
- package/lib/ExportPdf.cjs +3 -3
- package/lib/ExportPdf.js +14 -13
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +6 -6
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +7 -6
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +15 -14
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +26 -26
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +22 -23
- package/lib/History.cjs +1 -1
- package/lib/History.js +11 -11
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +10 -9
- package/lib/Iframe-CXFk3GEq.cjs +1 -0
- package/lib/{Iframe-CnnvV6cK.js → Iframe-MjeJ2OOI.js} +11 -13
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +4 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +79 -82
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +25 -26
- package/lib/Indent-BPX9XRos.cjs +1 -0
- package/lib/{Indent-Bsj8gKvT.js → Indent-CgwDItIf.js} +31 -30
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +12 -11
- package/lib/{Katex-CilGTz7u.js → Katex-CZ4g3vA9.js} +19 -22
- package/lib/Katex-DIgsR_dS.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 +19 -20
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-B2bU0Mcr.cjs +5 -0
- package/lib/{LinkEditBlock-BD_WvA3r.js → LinkEditBlock-CaDV3Vq5.js} +19 -24
- package/lib/Mention.js +3 -3
- package/lib/Mermaid-B9h7XKFo.cjs +2 -0
- package/lib/{Mermaid-BrjU75Bs.js → Mermaid-EhYj_ICn.js} +45 -48
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +26 -28
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +11 -10
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +37 -42
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +5 -5
- package/lib/SlashCommandNodeView-COlWSlnE.cjs +1 -0
- package/lib/{SlashCommandNodeView-COx5qZ2y.js → SlashCommandNodeView-CY3peX5x.js} +39 -41
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +12 -11
- package/lib/{Table-BlM8yMhr.js → Table-Bw7rLue7.js} +46 -46
- package/lib/Table-DLrtX6T7.cjs +5 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +12 -11
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +26 -27
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +18 -19
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +9 -8
- package/lib/Twitter-Ck6vGefg.cjs +1 -0
- package/lib/{Twitter-BP8sYXX7.js → Twitter-pM0y5Z-L.js} +18 -22
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +4 -5
- package/lib/bubble.cjs +3 -3
- package/lib/bubble.js +77 -86
- package/lib/{clsx-m_C5j3RU.js → clsx-CDyrfCnw.js} +24 -24
- package/lib/{dropdown-menu-CkHN04Mx.cjs → dropdown-menu-DwR8tTs9.cjs} +1 -1
- package/lib/{dropdown-menu-C1hdPLCZ.js → dropdown-menu-nX-u8e2w.js} +1 -1
- package/lib/extensions/Image/Image.d.ts +11 -0
- package/lib/extensions/Image/components/ImageCropper.d.ts +1 -1
- package/lib/{index-B3Ijnbxs.js → index-C-tDsIKJ.js} +1 -1
- package/lib/{index-C1KQsOcg.js → index-C1WCZhyA.js} +1 -1
- package/lib/{index-C8FjP66D.js → index-CsSfYR30.js} +1 -1
- package/lib/index-Dib4cXXf.cjs +10 -0
- package/lib/{index-s3l5RdyW.js → index-DjDf4BK8.js} +1 -1
- package/lib/index-_WrFM-Fk.js +5054 -0
- package/lib/index.cjs +4 -4
- package/lib/index.js +147 -392
- package/lib/{popover-B05Fd8lC.cjs → popover-BY7j9SiD.cjs} +1 -1
- package/lib/{popover-CsSXh7w6.js → popover-CSvY4C-l.js} +1 -1
- package/lib/{renderNodeView-C_hPIdEs.js → renderNodeView-BJSrgyGj.js} +2 -2
- package/lib/{select-B3-5wTqn.js → select-BelNLNvT.js} +1 -1
- package/lib/{select-7ubC1NF0.cjs → select-Bu-5iIA9.cjs} +1 -1
- package/lib/{separator-CYCA8tSn.js → separator-Br5kcIJa.js} +12 -13
- package/lib/separator-Cp9Lg3HU.cjs +1 -0
- package/lib/style.css +1 -1
- package/lib/{textarea-1FhpmBkP.js → textarea-Ceev4t42.js} +1 -1
- package/lib/{textarea-Bjhcpp76.cjs → textarea-DfqvYaA6.cjs} +1 -1
- package/lib/theme/theme.d.ts +1 -1
- package/lib/{updatePosition-DvfTZHcH.js → updatePosition-e90ZrFWW.js} +2 -2
- package/package.json +1 -1
- package/lib/ActionMenuButton-C5P0Kzrb.cjs +0 -1
- package/lib/Drawer-gz9U5ArC.cjs +0 -2
- package/lib/Icon-CKM0tYbW.js +0 -15
- package/lib/Icon-CQyFgXeo.cjs +0 -1
- package/lib/Iframe-Ds6gG2YO.cjs +0 -1
- package/lib/ImageCropper-BKhXlnXN.cjs +0 -1
- package/lib/ImageCropper-DUzu_9-6.js +0 -896
- package/lib/Indent-D_7HOYYd.cjs +0 -1
- package/lib/Katex-lL3bHXJd.cjs +0 -4
- package/lib/LinkEditBlock-D3HSHmsU.cjs +0 -5
- package/lib/Mermaid-BfeLPzoS.cjs +0 -2
- package/lib/SlashCommandNodeView-DD-nlhM-.cjs +0 -1
- package/lib/Table-C21AlUrh.cjs +0 -5
- package/lib/Twitter-D46MnvPr.cjs +0 -1
- package/lib/Video-Bpd8W8l6.js +0 -231
- package/lib/Video-BwrHx6B1.cjs +0 -1
- package/lib/button-BmTP96NR.cjs +0 -1
- package/lib/button-CDIxPURh.js +0 -35
- package/lib/checkbox-7sfSdzy9.js +0 -29
- package/lib/checkbox-DyVlLWHv.cjs +0 -1
- package/lib/dialog-B-jOQ5i3.cjs +0 -1
- package/lib/dialog-QWWUWOGP.js +0 -95
- package/lib/events.constant-Bh2uzJud.js +0 -71
- package/lib/events.constant-ELn21EzG.cjs +0 -1
- package/lib/file-BLas99n7.js +0 -43
- package/lib/file-i7e4nQY2.cjs +0 -1
- package/lib/index-CAiZY1nx.js +0 -2741
- package/lib/index-DWSAk_9a.cjs +0 -1
- package/lib/input-qvpuOf-3.js +0 -21
- package/lib/input-s0JD5kf2.cjs +0 -1
- package/lib/isNumber-BTYSVlKo.cjs +0 -1
- package/lib/isNumber-WaBzl_0s.js +0 -15
- package/lib/label-CFax-gzo.cjs +0 -1
- package/lib/label-DC37f2RQ.js +0 -11
- package/lib/separator-ncbdw4oq.cjs +0 -1
- package/lib/tabs-BeHxylKH.js +0 -46
- package/lib/tabs-DBqNpGAq.cjs +0 -1
- package/lib/throttle-CRNq0z-O.js +0 -249
- package/lib/throttle-gTTvqDTW.cjs +0 -1
- package/lib/toggle-DoJTBdvy.js +0 -89
- package/lib/toggle-oFwBZC4x.cjs +0 -1
- package/lib/useButtonProps-BE10eHkG.js +0 -165
- package/lib/useButtonProps-CFu0GHzW.cjs +0 -1
package/lib/Callout.js
CHANGED
|
@@ -1,54 +1,50 @@
|
|
|
1
|
-
import { h as D, j as x, N as H, k as M, m as B } from "./clsx-
|
|
2
|
-
import { A as T } from "./
|
|
3
|
-
import { jsx as o, jsxs as l, Fragment as
|
|
4
|
-
import { Info as P, Lightbulb as j, AlertCircle as E, TriangleAlert as R, OctagonAlert as W } from "lucide-react";
|
|
1
|
+
import { h as D, j as x, N as H, k as M, m as B } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { h as V, u as j, d as P, D as E, m as R, A as T, n as W, o as F, L as u, j as v, p as U, B as C } from "./index-_WrFM-Fk.js";
|
|
3
|
+
import { jsx as o, jsxs as l, Fragment as Y } from "react/jsx-runtime";
|
|
5
4
|
import { useState as s } from "react";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import "./theme.js";
|
|
6
|
+
import { Info as _, Lightbulb as $, AlertCircle as z, TriangleAlert as K, OctagonAlert as q } from "lucide-react";
|
|
7
|
+
import { S as G, a as J, b as Q, c as X, d as Z } from "./select-BelNLNvT.js";
|
|
9
8
|
import { u as tt } from "./index-4Q5IhypJ.js";
|
|
10
|
-
import { L as u } from "./label-DC37f2RQ.js";
|
|
11
|
-
import { I as v } from "./input-qvpuOf-3.js";
|
|
12
|
-
import { B as C } from "./button-CDIxPURh.js";
|
|
13
9
|
const y = [
|
|
14
10
|
{
|
|
15
11
|
value: "note",
|
|
16
12
|
label: "Note",
|
|
17
|
-
icon:
|
|
13
|
+
icon: _,
|
|
18
14
|
color: "#1f6feb",
|
|
19
15
|
background: "#1f6feb1f"
|
|
20
16
|
},
|
|
21
17
|
{
|
|
22
18
|
value: "tip",
|
|
23
19
|
label: "Tip",
|
|
24
|
-
icon:
|
|
20
|
+
icon: $,
|
|
25
21
|
color: "#238636",
|
|
26
22
|
background: "#2386361f"
|
|
27
23
|
},
|
|
28
24
|
{
|
|
29
25
|
value: "important",
|
|
30
26
|
label: "Important",
|
|
31
|
-
icon:
|
|
27
|
+
icon: z,
|
|
32
28
|
color: "#ab7df8",
|
|
33
29
|
background: "#ab7df81f"
|
|
34
30
|
},
|
|
35
31
|
{
|
|
36
32
|
value: "warning",
|
|
37
33
|
label: "Warning",
|
|
38
|
-
icon:
|
|
34
|
+
icon: K,
|
|
39
35
|
color: "#d29922",
|
|
40
36
|
background: "#d299221f"
|
|
41
37
|
},
|
|
42
38
|
{
|
|
43
39
|
value: "caution",
|
|
44
40
|
label: "Caution",
|
|
45
|
-
icon:
|
|
41
|
+
icon: q,
|
|
46
42
|
color: "#f85149",
|
|
47
43
|
background: "#f851491f"
|
|
48
44
|
}
|
|
49
45
|
];
|
|
50
46
|
function et({ node: t }) {
|
|
51
|
-
const { type: e = "note", title:
|
|
47
|
+
const { type: e = "note", title: a = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
|
|
52
48
|
return /* @__PURE__ */ o(D, { children: /* @__PURE__ */ l(
|
|
53
49
|
"div",
|
|
54
50
|
{
|
|
@@ -75,7 +71,7 @@ function et({ node: t }) {
|
|
|
75
71
|
}),
|
|
76
72
|
children: [
|
|
77
73
|
/* @__PURE__ */ o(c, { className: "richtext-size-5" }),
|
|
78
|
-
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children:
|
|
74
|
+
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: a })
|
|
79
75
|
]
|
|
80
76
|
}
|
|
81
77
|
),
|
|
@@ -91,39 +87,39 @@ const ot = [
|
|
|
91
87
|
{ value: "warning", label: "Warning", icon: "TriangleAlert" },
|
|
92
88
|
{ value: "caution", label: "Caution", icon: "OctagonAlert" }
|
|
93
89
|
];
|
|
94
|
-
function
|
|
95
|
-
const { t } = tt(), e =
|
|
90
|
+
function ht() {
|
|
91
|
+
const { t } = tt(), e = V(), a = j(lt.name), [n, i] = s(!1), [c, d] = s("note"), [p, b] = s(""), [g, f] = s(""), {
|
|
96
92
|
icon: A = void 0,
|
|
97
93
|
tooltip: N = void 0,
|
|
98
94
|
shortcutKeys: L = void 0,
|
|
99
|
-
tooltipOptions:
|
|
100
|
-
isActive:
|
|
101
|
-
} = (
|
|
102
|
-
e && (e.chain().focus().setCallout({ type: c, title:
|
|
95
|
+
tooltipOptions: S = {},
|
|
96
|
+
isActive: k = void 0
|
|
97
|
+
} = (a == null ? void 0 : a.componentProps) ?? {}, { dataState: I, disabled: m } = P(k), w = () => {
|
|
98
|
+
e && (e.chain().focus().setCallout({ type: c, title: p, body: g }).run(), i(!1), d("note"), b(""), f(""));
|
|
103
99
|
}, O = () => {
|
|
104
100
|
m || i(!0);
|
|
105
101
|
};
|
|
106
|
-
return
|
|
107
|
-
/* @__PURE__ */ o(
|
|
102
|
+
return a ? /* @__PURE__ */ l(E, { onOpenChange: i, open: n, children: [
|
|
103
|
+
/* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(
|
|
108
104
|
T,
|
|
109
105
|
{
|
|
110
106
|
action: O,
|
|
111
|
-
dataState:
|
|
107
|
+
dataState: I,
|
|
112
108
|
disabled: m,
|
|
113
109
|
icon: A,
|
|
114
110
|
shortcutKeys: L,
|
|
115
111
|
tooltip: N,
|
|
116
|
-
tooltipOptions:
|
|
112
|
+
tooltipOptions: S
|
|
117
113
|
}
|
|
118
114
|
) }),
|
|
119
|
-
/* @__PURE__ */ l(
|
|
120
|
-
/* @__PURE__ */ o(
|
|
115
|
+
/* @__PURE__ */ l(W, { children: [
|
|
116
|
+
/* @__PURE__ */ o(F, { children: t("editor.callout.dialog.title") }),
|
|
121
117
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
|
|
122
118
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
123
119
|
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
|
|
124
|
-
/* @__PURE__ */ l(
|
|
125
|
-
/* @__PURE__ */ o(
|
|
126
|
-
/* @__PURE__ */ o(
|
|
120
|
+
/* @__PURE__ */ l(G, { onValueChange: d, value: c, children: [
|
|
121
|
+
/* @__PURE__ */ o(J, { children: /* @__PURE__ */ o(Q, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
|
|
122
|
+
/* @__PURE__ */ o(X, { children: ot.map((r) => /* @__PURE__ */ o(Z, { value: r.value, children: t(`editor.callout.type.${r.value}`) }, r.value)) })
|
|
127
123
|
] })
|
|
128
124
|
] }),
|
|
129
125
|
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
@@ -131,9 +127,9 @@ function gt() {
|
|
|
131
127
|
/* @__PURE__ */ o(
|
|
132
128
|
v,
|
|
133
129
|
{
|
|
134
|
-
onChange: (
|
|
130
|
+
onChange: (r) => b(r.target.value),
|
|
135
131
|
placeholder: t("editor.callout.dialog.title.placeholder"),
|
|
136
|
-
value:
|
|
132
|
+
value: p
|
|
137
133
|
}
|
|
138
134
|
)
|
|
139
135
|
] }),
|
|
@@ -142,21 +138,21 @@ function gt() {
|
|
|
142
138
|
/* @__PURE__ */ o(
|
|
143
139
|
v,
|
|
144
140
|
{
|
|
145
|
-
onChange: (
|
|
141
|
+
onChange: (r) => f(r.target.value),
|
|
146
142
|
placeholder: t("editor.callout.dialog.body.placeholder"),
|
|
147
|
-
value:
|
|
143
|
+
value: g
|
|
148
144
|
}
|
|
149
145
|
)
|
|
150
146
|
] })
|
|
151
147
|
] }),
|
|
152
|
-
/* @__PURE__ */ l(
|
|
148
|
+
/* @__PURE__ */ l(U, { children: [
|
|
153
149
|
/* @__PURE__ */ o(C, { onClick: () => i(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
|
|
154
150
|
/* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
|
|
155
151
|
] })
|
|
156
152
|
] })
|
|
157
|
-
] }) : /* @__PURE__ */ o(
|
|
153
|
+
] }) : /* @__PURE__ */ o(Y, {});
|
|
158
154
|
}
|
|
159
|
-
function
|
|
155
|
+
function h(t) {
|
|
160
156
|
return (e) => e.getAttribute(t);
|
|
161
157
|
}
|
|
162
158
|
const lt = /* @__PURE__ */ H.create({
|
|
@@ -174,14 +170,14 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
174
170
|
HTMLAttributes: {
|
|
175
171
|
class: "callout"
|
|
176
172
|
},
|
|
177
|
-
button: ({ editor: e, t:
|
|
173
|
+
button: ({ editor: e, t: a }) => ({
|
|
178
174
|
component: T,
|
|
179
175
|
componentProps: {
|
|
180
176
|
action: () => !0,
|
|
181
177
|
isActive: () => e.isActive("callout"),
|
|
182
178
|
disabled: !1,
|
|
183
179
|
icon: "Callout",
|
|
184
|
-
tooltip:
|
|
180
|
+
tooltip: a("editor.callout.tooltip")
|
|
185
181
|
}
|
|
186
182
|
})
|
|
187
183
|
};
|
|
@@ -199,15 +195,15 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
199
195
|
return {
|
|
200
196
|
type: {
|
|
201
197
|
default: "",
|
|
202
|
-
parseHTML:
|
|
198
|
+
parseHTML: h("type")
|
|
203
199
|
},
|
|
204
200
|
title: {
|
|
205
201
|
default: "",
|
|
206
|
-
parseHTML:
|
|
202
|
+
parseHTML: h("title")
|
|
207
203
|
},
|
|
208
204
|
body: {
|
|
209
205
|
default: "",
|
|
210
|
-
parseHTML:
|
|
206
|
+
parseHTML: h("body")
|
|
211
207
|
}
|
|
212
208
|
};
|
|
213
209
|
},
|
|
@@ -225,5 +221,5 @@ const lt = /* @__PURE__ */ H.create({
|
|
|
225
221
|
});
|
|
226
222
|
export {
|
|
227
223
|
lt as Callout,
|
|
228
|
-
|
|
224
|
+
ht as RichTextCallout
|
|
229
225
|
};
|
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"),i=require("./index-Dib4cXXf.cjs");function v(){const t=i.useButtonProps(s.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:a=void 0,tooltipOptions:u={},action:r=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:c}=i.useActive(l),d=()=>{c||r&&r()};return t?n.jsx(i.ActionButton,{action:d,disabled:c,icon:e,shortcutKeys:a,tooltip:o,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:e,t:o})=>({componentProps:{action:()=>e.chain().focus().clearNodes().unsetAllMarks().run(),isActive:()=>e.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:o("editor.clear.tooltip")}})}}});exports.Clear=s;exports.RichTextClear=v;
|
package/lib/Clear.js
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { N as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const o = m(v.name), {
|
|
1
|
+
import { N as l } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { jsx as r, Fragment as p } from "react/jsx-runtime";
|
|
3
|
+
import { u as d, e as m, A as f } from "./index-_WrFM-Fk.js";
|
|
4
|
+
function x() {
|
|
5
|
+
const o = d(v.name), {
|
|
7
6
|
icon: t = void 0,
|
|
8
7
|
tooltip: n = void 0,
|
|
9
8
|
shortcutKeys: s = void 0,
|
|
10
9
|
tooltipOptions: c = {},
|
|
11
10
|
action: i = void 0,
|
|
12
11
|
isActive: a = void 0
|
|
13
|
-
} = (o == null ? void 0 : o.componentProps) ?? {}, { disabled:
|
|
14
|
-
|
|
12
|
+
} = (o == null ? void 0 : o.componentProps) ?? {}, { disabled: e } = m(a), u = () => {
|
|
13
|
+
e || i && i();
|
|
15
14
|
};
|
|
16
|
-
return o ? /* @__PURE__ */
|
|
17
|
-
|
|
15
|
+
return o ? /* @__PURE__ */ r(
|
|
16
|
+
f,
|
|
18
17
|
{
|
|
19
18
|
action: u,
|
|
20
|
-
disabled:
|
|
19
|
+
disabled: e,
|
|
21
20
|
icon: t,
|
|
22
21
|
shortcutKeys: s,
|
|
23
22
|
tooltip: n,
|
|
24
23
|
tooltipOptions: c
|
|
25
24
|
}
|
|
26
|
-
) : /* @__PURE__ */
|
|
25
|
+
) : /* @__PURE__ */ r(p, {});
|
|
27
26
|
}
|
|
28
|
-
const v = /* @__PURE__ */
|
|
27
|
+
const v = /* @__PURE__ */ l.create({
|
|
29
28
|
name: "clear",
|
|
30
29
|
//@ts-expect-error
|
|
31
30
|
addOptions() {
|
|
@@ -46,5 +45,5 @@ const v = /* @__PURE__ */ p.create({
|
|
|
46
45
|
});
|
|
47
46
|
export {
|
|
48
47
|
v as Clear,
|
|
49
|
-
|
|
48
|
+
x as RichTextClear
|
|
50
49
|
};
|
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"),i=require("react/jsx-runtime"),s=require("./index-Dib4cXXf.cjs");require("react");require("./theme.cjs");var h=/(^|[^`])`([^`]+)`(?!`)$/,x=/(^|[^`])`([^`]+)`(?!`)/g,C=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:h,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:x,type:this.type})]}});function v(){const e=s.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:a,update:m}=s.useToggleActive(p),g=()=>{a||d&&(d(),m())};return e?i.jsx(s.ActionButton,{action:g,dataState:l,disabled:a,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const u=C.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=v;
|
package/lib/Code.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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-CDyrfCnw.js";
|
|
2
2
|
import { jsx as a, Fragment as M } from "react/jsx-runtime";
|
|
3
|
-
import { A as f } from "./
|
|
4
|
-
import
|
|
3
|
+
import { u as v, d as C, A as f } from "./index-_WrFM-Fk.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import "./theme.js";
|
|
5
6
|
var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
6
7
|
name: "code",
|
|
7
8
|
addOptions() {
|
|
@@ -50,7 +51,7 @@ var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
|
50
51
|
];
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
|
-
function
|
|
54
|
+
function L() {
|
|
54
55
|
const t = v(A.name), {
|
|
55
56
|
icon: e = void 0,
|
|
56
57
|
tooltip: o = void 0,
|
|
@@ -95,5 +96,5 @@ const A = /* @__PURE__ */ y.extend({
|
|
|
95
96
|
});
|
|
96
97
|
export {
|
|
97
98
|
A as Code,
|
|
98
|
-
|
|
99
|
+
L as RichTextCode
|
|
99
100
|
};
|
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"),T=require("./toggle-oFwBZC4x.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-7ubC1NF0.cjs"),C=require("./useButtonProps-CFu0GHzW.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-CQyFgXeo.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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./clsx-CXbNJWDD.cjs"),r=require("react/jsx-runtime"),u=require("./index-Dib4cXXf.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-Bu-5iIA9.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;
|
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-CDyrfCnw.js";
|
|
2
2
|
import { jsx as r, Fragment as R, jsxs as f } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
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";
|
|
3
|
+
import { u as H, d as V, A as P, w as F, I as u } from "./index-_WrFM-Fk.js";
|
|
11
4
|
import { useRef as y, useCallback as v, useEffect as A } from "react";
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
5
|
+
import "./theme.js";
|
|
6
|
+
import { createEditor as O } from "prism-code-editor-lightweight";
|
|
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-BelNLNvT.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,21 +53,20 @@ 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
|
-
|
|
58
|
-
const e = U(B.name), {
|
|
56
|
+
function at() {
|
|
57
|
+
const e = H(B.name), {
|
|
59
58
|
icon: i = void 0,
|
|
60
59
|
tooltip: n = void 0,
|
|
61
60
|
tooltipOptions: s = {},
|
|
62
61
|
action: o = void 0,
|
|
63
62
|
isActive: d = void 0
|
|
64
|
-
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update:
|
|
65
|
-
m || o && (o(),
|
|
63
|
+
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update: b } = V(d), p = () => {
|
|
64
|
+
m || o && (o(), b());
|
|
66
65
|
};
|
|
67
66
|
return e ? /* @__PURE__ */ r(
|
|
68
|
-
|
|
67
|
+
P,
|
|
69
68
|
{
|
|
70
|
-
action:
|
|
69
|
+
action: p,
|
|
71
70
|
dataState: c,
|
|
72
71
|
disabled: m,
|
|
73
72
|
icon: i,
|
|
@@ -98,7 +97,7 @@ const Y = "_wrap_1x3wi_1", X = "_blockInfoEditable_1x3wi_30", z = {
|
|
|
98
97
|
{ value: "php", label: "PHP" }
|
|
99
98
|
], g = [2, 4, 8];
|
|
100
99
|
function Z(e) {
|
|
101
|
-
const i =
|
|
100
|
+
const i = F(), 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) => {
|
|
102
101
|
t == null || t.stopPropagation(), setTimeout(() => {
|
|
103
102
|
var a, l, N;
|
|
104
103
|
(N = (l = (a = o.current) == null ? void 0 : a.textarea) == null ? void 0 : l.focus) == null || N.call(l);
|
|
@@ -117,11 +116,11 @@ function Z(e) {
|
|
|
117
116
|
} finally {
|
|
118
117
|
c();
|
|
119
118
|
}
|
|
120
|
-
},
|
|
119
|
+
}, b = () => {
|
|
121
120
|
e.updateAttributes({
|
|
122
121
|
lineNumbers: !e.node.attrs.lineNumbers
|
|
123
122
|
}), c();
|
|
124
|
-
},
|
|
123
|
+
}, p = () => {
|
|
125
124
|
e.updateAttributes({
|
|
126
125
|
wordWrap: !e.node.attrs.wordWrap
|
|
127
126
|
}), c();
|
|
@@ -139,7 +138,7 @@ function Z(e) {
|
|
|
139
138
|
return A(() => {
|
|
140
139
|
if (n.current) {
|
|
141
140
|
const t = C(e.node.attrs);
|
|
142
|
-
o.current =
|
|
141
|
+
o.current = O(n.current, {
|
|
143
142
|
readOnly: !i,
|
|
144
143
|
language: t.language || "plaintext",
|
|
145
144
|
tabSize: t.tabSize ?? 2,
|
|
@@ -153,13 +152,13 @@ function Z(e) {
|
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
}), o.current.addExtensions(
|
|
156
|
-
|
|
155
|
+
U(),
|
|
156
|
+
$(),
|
|
157
157
|
D(),
|
|
158
|
+
G(),
|
|
159
|
+
q(),
|
|
158
160
|
_(),
|
|
159
|
-
J()
|
|
160
|
-
O(),
|
|
161
|
-
P(),
|
|
162
|
-
F()
|
|
161
|
+
J()
|
|
163
162
|
), e.node.attrs.shouldFocus && setTimeout(() => {
|
|
164
163
|
c(), e.updateAttributes({
|
|
165
164
|
shouldFocus: !1
|
|
@@ -199,7 +198,7 @@ function Z(e) {
|
|
|
199
198
|
}), c();
|
|
200
199
|
},
|
|
201
200
|
children: [
|
|
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(
|
|
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(K, { placeholder: "Select language" }) }),
|
|
203
202
|
/* @__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)) })
|
|
204
203
|
]
|
|
205
204
|
}
|
|
@@ -217,7 +216,7 @@ function Z(e) {
|
|
|
217
216
|
/* @__PURE__ */ r(
|
|
218
217
|
"div",
|
|
219
218
|
{
|
|
220
|
-
onClick:
|
|
219
|
+
onClick: b,
|
|
221
220
|
className: h(
|
|
222
221
|
"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
223
222
|
{
|
|
@@ -231,7 +230,7 @@ function Z(e) {
|
|
|
231
230
|
/* @__PURE__ */ r(
|
|
232
231
|
"div",
|
|
233
232
|
{
|
|
234
|
-
onClick:
|
|
233
|
+
onClick: p,
|
|
235
234
|
className: h(
|
|
236
235
|
"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
|
|
237
236
|
{
|
|
@@ -384,7 +383,7 @@ const ee = /^`{3}([a-z]+)?\s$/, te = /^~{3}([a-z]+)?\s$/, B = /* @__PURE__ */ M.
|
|
|
384
383
|
});
|
|
385
384
|
export {
|
|
386
385
|
B as CodeBlock,
|
|
387
|
-
|
|
386
|
+
at as RichTextCodeBlock,
|
|
388
387
|
ee as backtickInputRegex,
|
|
389
388
|
te as tildeInputRegex
|
|
390
389
|
};
|
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"),c=require("./index-Dib4cXXf.cjs");require("react");require("./theme.cjs");function v(){const e=c.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:r,update:p}=c.useToggleActive(l),g=()=>{r||s&&(s(),p())};return e?n.jsx(c.ActionButton,{action:g,dataState:u,disabled:r,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=v;
|
package/lib/CodeView.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { E as l } from "./clsx-
|
|
1
|
+
import { E as l } from "./clsx-CDyrfCnw.js";
|
|
2
2
|
import { jsx as c, Fragment as g } from "react/jsx-runtime";
|
|
3
|
-
import { A as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { u, d as v, A as w } from "./index-_WrFM-Fk.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import "./theme.js";
|
|
6
|
+
function h() {
|
|
7
|
+
const t = u(C.name), {
|
|
7
8
|
icon: e = void 0,
|
|
8
9
|
tooltip: o = void 0,
|
|
9
10
|
shortcutKeys: i = void 0,
|
|
10
11
|
tooltipOptions: a = {},
|
|
11
12
|
action: n = void 0,
|
|
12
13
|
isActive: r = void 0
|
|
13
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } =
|
|
14
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } = v(r), m = () => {
|
|
14
15
|
s || n && (n(), p());
|
|
15
16
|
};
|
|
16
17
|
return t ? /* @__PURE__ */ c(
|
|
17
|
-
|
|
18
|
+
w,
|
|
18
19
|
{
|
|
19
20
|
action: m,
|
|
20
21
|
dataState: d,
|
|
@@ -76,5 +77,5 @@ const C = /* @__PURE__ */ l.create({
|
|
|
76
77
|
});
|
|
77
78
|
export {
|
|
78
79
|
C as CodeView,
|
|
79
|
-
|
|
80
|
+
h as RichTextCodeView
|
|
80
81
|
};
|
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CjhjjJsN.cjs"),t=require("react/jsx-runtime"),h=require("react"),l=require("./index-Dib4cXXf.cjs"),g=require("./separator-Cp9Lg3HU.cjs");require("./theme.cjs");function v({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 j(){const e=l.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:c,dataState:u}=l.useActive(s),[f,a]=h.useState(r);h.useEffect(()=>{a(u)},[u]);function x(d){c||i&&(i==null||i(d),a(d))}return e?t.jsx(g.ColorPicker,{colors:n,disabled:c,onChange:x,value:f,children:t.jsx(l.ActionButton,{disabled:c,tooltip:o,children:t.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[t.jsx(v,{fill:u}),t.jsx(l.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=j;
|