@editorcn/editor 0.3.0 → 0.3.1
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/dist/index.cjs +153 -199
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +198 -215
- package/dist/index.js.map +1 -1
- package/dist/style.css +1079 -979
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
DEFAULT_ICONS: () => DEFAULT_ICONS,
|
|
36
36
|
DEFAULT_LABELS: () => DEFAULT_LABELS,
|
|
37
37
|
DEFAULT_LANGUAGE_ICONS: () => DEFAULT_LANGUAGE_ICONS,
|
|
38
|
-
Link: () =>
|
|
38
|
+
Link: () => Link2,
|
|
39
39
|
RichTextEditor: () => RichTextEditor,
|
|
40
40
|
TwitterEmbed: () => TwitterEmbed,
|
|
41
41
|
YouTubeEmbed: () => YouTubeEmbed,
|
|
@@ -71,11 +71,17 @@ var useRichTextEditorContext = () => {
|
|
|
71
71
|
var import_react2 = require("react");
|
|
72
72
|
var defaultEqual = (a, b) => a === b;
|
|
73
73
|
var shallowEqual = (a, b) => {
|
|
74
|
-
if (a === b)
|
|
75
|
-
|
|
74
|
+
if (a === b) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
if (!a || !b) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
76
80
|
const ak = Object.keys(a);
|
|
77
81
|
const bk = Object.keys(b);
|
|
78
|
-
if (ak.length !== bk.length)
|
|
82
|
+
if (ak.length !== bk.length) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
79
85
|
return ak.every((k) => a[k] === b[k]);
|
|
80
86
|
};
|
|
81
87
|
var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
@@ -87,7 +93,9 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
|
87
93
|
value: editor ? selector(editor) : void 0
|
|
88
94
|
});
|
|
89
95
|
const updateSnapshot = (0, import_react2.useCallback)(() => {
|
|
90
|
-
if (!editor)
|
|
96
|
+
if (!editor) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
91
99
|
const next = selectorRef.current(editor);
|
|
92
100
|
if (snapshotRef.current && isEqualRef.current(snapshotRef.current.value, next)) {
|
|
93
101
|
return;
|
|
@@ -139,6 +147,30 @@ var CODE_BLOCK_LANGUAGES = [
|
|
|
139
147
|
"xml",
|
|
140
148
|
"plaintext"
|
|
141
149
|
];
|
|
150
|
+
var CODE_BLOCK_LANGUAGE_LABELS = {
|
|
151
|
+
bash: "Bash",
|
|
152
|
+
c: "C",
|
|
153
|
+
cpp: "C++",
|
|
154
|
+
css: "CSS",
|
|
155
|
+
go: "Go",
|
|
156
|
+
html: "HTML",
|
|
157
|
+
java: "Java",
|
|
158
|
+
javascript: "JavaScript",
|
|
159
|
+
json: "JSON",
|
|
160
|
+
kotlin: "Kotlin",
|
|
161
|
+
markdown: "Markdown",
|
|
162
|
+
php: "PHP",
|
|
163
|
+
plaintext: "Plain Text",
|
|
164
|
+
python: "Python",
|
|
165
|
+
ruby: "Ruby",
|
|
166
|
+
rust: "Rust",
|
|
167
|
+
sql: "SQL",
|
|
168
|
+
swift: "Swift",
|
|
169
|
+
typescript: "TypeScript",
|
|
170
|
+
xml: "XML",
|
|
171
|
+
yaml: "YAML"
|
|
172
|
+
};
|
|
173
|
+
var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
|
|
142
174
|
|
|
143
175
|
// src/bubble-menu/language-selector.tsx
|
|
144
176
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -161,6 +193,7 @@ var FallbackIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
|
161
193
|
);
|
|
162
194
|
var LanguageSelector = ({ editor }) => {
|
|
163
195
|
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
196
|
+
const [pill, setPill] = (0, import_react3.useState)(null);
|
|
164
197
|
const { icons } = useRichTextEditorContext();
|
|
165
198
|
const { currentLanguage } = useEditorState(
|
|
166
199
|
editor,
|
|
@@ -170,6 +203,32 @@ var LanguageSelector = ({ editor }) => {
|
|
|
170
203
|
shallowEqual
|
|
171
204
|
);
|
|
172
205
|
const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackIcon, {});
|
|
206
|
+
const handleItemEnter = (0, import_react3.useCallback)((target) => {
|
|
207
|
+
const item = target.closest(
|
|
208
|
+
"[data-dropdown-item]"
|
|
209
|
+
);
|
|
210
|
+
if (!item) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
setPill({
|
|
214
|
+
height: item.offsetHeight,
|
|
215
|
+
left: item.offsetLeft,
|
|
216
|
+
top: item.offsetTop,
|
|
217
|
+
width: item.offsetWidth
|
|
218
|
+
});
|
|
219
|
+
}, []);
|
|
220
|
+
const handleMouseOver = (0, import_react3.useCallback)(
|
|
221
|
+
(event) => {
|
|
222
|
+
handleItemEnter(event.target);
|
|
223
|
+
},
|
|
224
|
+
[handleItemEnter]
|
|
225
|
+
);
|
|
226
|
+
const handleFocus = (0, import_react3.useCallback)(
|
|
227
|
+
(event) => {
|
|
228
|
+
handleItemEnter(event.target);
|
|
229
|
+
},
|
|
230
|
+
[handleItemEnter]
|
|
231
|
+
);
|
|
173
232
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { position: "relative" }, children: [
|
|
174
233
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
175
234
|
"button",
|
|
@@ -180,7 +239,7 @@ var LanguageSelector = ({ editor }) => {
|
|
|
180
239
|
onClick: () => setOpen(!open),
|
|
181
240
|
children: [
|
|
182
241
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-btn-icon", children: langIcon }),
|
|
183
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-btn-text", children: currentLanguage }),
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-btn-text", children: getLanguageLabel(currentLanguage) }),
|
|
184
243
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-btn-icon", style: { height: 12, width: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
185
244
|
"svg",
|
|
186
245
|
{
|
|
@@ -211,36 +270,51 @@ var LanguageSelector = ({ editor }) => {
|
|
|
211
270
|
}
|
|
212
271
|
}
|
|
213
272
|
),
|
|
214
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
215
|
-
"
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
274
|
+
"div",
|
|
216
275
|
{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
editor.chain().focus().updateAttributes("codeBlock", { language: lang }).run();
|
|
222
|
-
setOpen(false);
|
|
223
|
-
},
|
|
276
|
+
className: "rte-bubble-dropdown rte-bubble-dropdown--language",
|
|
277
|
+
onFocus: handleFocus,
|
|
278
|
+
onMouseLeave: () => setPill(null),
|
|
279
|
+
onMouseOver: handleMouseOver,
|
|
224
280
|
children: [
|
|
225
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
226
|
-
|
|
227
|
-
currentLanguage === lang && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-dropdown-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
|
-
"svg",
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
282
|
+
"div",
|
|
229
283
|
{
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
284
|
+
"aria-hidden": "true",
|
|
285
|
+
className: [
|
|
286
|
+
"rte-bubble-dropdown-pill",
|
|
287
|
+
pill ? "rte-bubble-dropdown-pill--visible" : ""
|
|
288
|
+
].filter(Boolean).join(" "),
|
|
289
|
+
style: pill ? {
|
|
290
|
+
height: pill.height,
|
|
291
|
+
left: pill.left,
|
|
292
|
+
top: pill.top,
|
|
293
|
+
width: pill.width
|
|
294
|
+
} : void 0
|
|
238
295
|
}
|
|
239
|
-
)
|
|
296
|
+
),
|
|
297
|
+
CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
298
|
+
"button",
|
|
299
|
+
{
|
|
300
|
+
type: "button",
|
|
301
|
+
"data-dropdown-item": true,
|
|
302
|
+
className: `rte-bubble-dropdown-item${currentLanguage === lang ? " rte-bubble-dropdown-item--active" : ""}`,
|
|
303
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
304
|
+
onClick: () => {
|
|
305
|
+
editor.chain().focus().updateAttributes("codeBlock", { language: lang }).run();
|
|
306
|
+
setOpen(false);
|
|
307
|
+
},
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-dropdown-icon", children: icons.languageIcons[lang] ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackIcon, {}) }),
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: getLanguageLabel(lang) })
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
lang
|
|
314
|
+
))
|
|
240
315
|
]
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
)) })
|
|
316
|
+
}
|
|
317
|
+
)
|
|
244
318
|
] })
|
|
245
319
|
] });
|
|
246
320
|
};
|
|
@@ -1589,27 +1663,10 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
1589
1663
|
};
|
|
1590
1664
|
|
|
1591
1665
|
// src/icons.tsx
|
|
1666
|
+
var import_lucide_react = require("lucide-react");
|
|
1592
1667
|
var import_react15 = require("react");
|
|
1593
1668
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1594
1669
|
var iconProps = { className: "rte-editor-icon" };
|
|
1595
|
-
var Svg2 = ({
|
|
1596
|
-
children,
|
|
1597
|
-
className,
|
|
1598
|
-
strokeWidth = 2
|
|
1599
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1600
|
-
"svg",
|
|
1601
|
-
{
|
|
1602
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1603
|
-
viewBox: "0 0 24 24",
|
|
1604
|
-
fill: "none",
|
|
1605
|
-
stroke: "currentColor",
|
|
1606
|
-
strokeWidth,
|
|
1607
|
-
strokeLinecap: "round",
|
|
1608
|
-
strokeLinejoin: "round",
|
|
1609
|
-
className,
|
|
1610
|
-
children
|
|
1611
|
-
}
|
|
1612
|
-
);
|
|
1613
1670
|
var LangIcon = ({
|
|
1614
1671
|
children,
|
|
1615
1672
|
className
|
|
@@ -1742,154 +1799,35 @@ var DEFAULT_LANGUAGE_ICONS = {
|
|
|
1742
1799
|
] })
|
|
1743
1800
|
};
|
|
1744
1801
|
var DEFAULT_ICONS = {
|
|
1745
|
-
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
] }),
|
|
1765
|
-
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1766
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M7 8a3 3 0 0 0-3 3v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H6a3 3 0 0 1 2-3" }),
|
|
1767
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M16 8a3 3 0 0 0-3 3v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-1a3 3 0 0 1 2-3" })
|
|
1768
|
-
] }),
|
|
1769
|
-
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1770
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6 4h7a4 4 0 0 1 0 8H6z" }),
|
|
1771
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6 12h9a4 4 0 0 1 0 8H6z" })
|
|
1772
|
-
] }),
|
|
1773
|
-
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1774
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "9", y1: "6", x2: "21", y2: "6" }),
|
|
1775
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "9", y1: "12", x2: "21", y2: "12" }),
|
|
1776
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "9", y1: "18", x2: "21", y2: "18" }),
|
|
1777
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "4", cy: "6", r: "1.2", fill: "currentColor", stroke: "none" }),
|
|
1778
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "4", cy: "12", r: "1.2", fill: "currentColor", stroke: "none" }),
|
|
1779
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "4", cy: "18", r: "1.2", fill: "currentColor", stroke: "none" })
|
|
1780
|
-
] }),
|
|
1781
|
-
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1782
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 7V4h16v3" }),
|
|
1783
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M5 20h6" }),
|
|
1784
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M13 4 8 20" }),
|
|
1785
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m16 16 5 5" }),
|
|
1786
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m21 16-5 5" })
|
|
1787
|
-
] }),
|
|
1788
|
-
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1789
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
1790
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("polyline", { points: "10 9 8 12 10 15" }),
|
|
1791
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("polyline", { points: "14 9 16 12 14 15" })
|
|
1792
|
-
] }),
|
|
1793
|
-
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1794
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
1795
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
1796
|
-
] }),
|
|
1797
|
-
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1798
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 6v12" }),
|
|
1799
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 6v12" }),
|
|
1800
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 12h8" }),
|
|
1801
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m17 10 3-2v8" })
|
|
1802
|
-
] }),
|
|
1803
|
-
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1804
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 6v12" }),
|
|
1805
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 6v12" }),
|
|
1806
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 12h8" }),
|
|
1807
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M17 9.5a2.5 2.5 0 0 1 4.8-1c0 2-4.8 2.5-4.8 5.5h5" })
|
|
1808
|
-
] }),
|
|
1809
|
-
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1810
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 6v12" }),
|
|
1811
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 6v12" }),
|
|
1812
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 12h8" }),
|
|
1813
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M17.5 9.5c1.5-1 3.5-.2 3.5 1.3a1.8 1.8 0 0 1-1.8 1.7" }),
|
|
1814
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M19.2 12.5a1.8 1.8 0 0 1 1.8 1.7c0 1.5-2 2.3-3.5 1.3" })
|
|
1815
|
-
] }),
|
|
1816
|
-
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1817
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 6v12" }),
|
|
1818
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 6v12" }),
|
|
1819
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 12h8" }),
|
|
1820
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M20 9v5h-4l3.5-5.5" }),
|
|
1821
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M20 14v3" })
|
|
1822
|
-
] }),
|
|
1823
|
-
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1824
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 6v12" }),
|
|
1825
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 6v12" }),
|
|
1826
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 12h8" }),
|
|
1827
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M21 9h-4v3.5c2.5-.7 4.5.3 4.5 2a2.3 2.3 0 0 1-4.3 1.3" })
|
|
1828
|
-
] }),
|
|
1829
|
-
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1830
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 6v12" }),
|
|
1831
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 6v12" }),
|
|
1832
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 12h8" }),
|
|
1833
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M20.5 9.5c-3 1-3.5 4-3.5 5.5a2.5 2.5 0 1 0 2.5-2.5c-1 0-2 .4-2.5 1" })
|
|
1834
|
-
] }),
|
|
1835
|
-
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1836
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 11 3 17v3h3l6-6" }),
|
|
1837
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14 6l4-4 4 4-4 4" }),
|
|
1838
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m9 11 4-4 5 5-4 4" })
|
|
1839
|
-
] }),
|
|
1840
|
-
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Svg2, { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" }) }),
|
|
1841
|
-
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1842
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
1843
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
1844
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
1845
|
-
] }),
|
|
1802
|
+
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
|
|
1803
|
+
alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
|
|
1804
|
+
alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
|
|
1805
|
+
alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
|
|
1806
|
+
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
|
|
1807
|
+
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Bold, { ...iconProps }),
|
|
1808
|
+
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.List, { ...iconProps }),
|
|
1809
|
+
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
|
|
1810
|
+
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
|
|
1811
|
+
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Code, { ...iconProps }),
|
|
1812
|
+
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading1, { ...iconProps }),
|
|
1813
|
+
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading2, { ...iconProps }),
|
|
1814
|
+
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading3, { ...iconProps }),
|
|
1815
|
+
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading4, { ...iconProps }),
|
|
1816
|
+
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading5, { ...iconProps }),
|
|
1817
|
+
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading6, { ...iconProps }),
|
|
1818
|
+
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
|
|
1819
|
+
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Minus, { ...iconProps }),
|
|
1820
|
+
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Italic, { ...iconProps }),
|
|
1846
1821
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1847
|
-
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 5h2v4" }),
|
|
1857
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 9h2" }),
|
|
1858
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 13h2.5L4 16h2.5" }),
|
|
1859
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 19h2.5" })
|
|
1860
|
-
] }),
|
|
1861
|
-
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1862
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m15 14 5-5-5-5" }),
|
|
1863
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M20 9H9.5a5.5 5.5 0 0 0 0 11H13" })
|
|
1864
|
-
] }),
|
|
1865
|
-
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1866
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
|
|
1867
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
|
|
1868
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
1869
|
-
] }),
|
|
1870
|
-
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1871
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m4 4 8 9" }),
|
|
1872
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m12 4-8 9" }),
|
|
1873
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M19 16h-3.5c0-1.6 3.5-1.9 3.5-3.8a1.8 1.8 0 0 0-3.3-1" })
|
|
1874
|
-
] }),
|
|
1875
|
-
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1876
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m4 20 8-9" }),
|
|
1877
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "m12 20-8-9" }),
|
|
1878
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M19 11h-3.5c0-1.6 3.5-1.9 3.5-3.8a1.8 1.8 0 0 0-3.3-1" })
|
|
1879
|
-
] }),
|
|
1880
|
-
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1881
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
|
|
1882
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
|
|
1883
|
-
] }),
|
|
1884
|
-
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1885
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 14 4 9l5-5" }),
|
|
1886
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 0 11H11" })
|
|
1887
|
-
] }),
|
|
1888
|
-
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Svg2, { ...iconProps, children: [
|
|
1889
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 17H7a5 5 0 0 1-1.7-9.7" }),
|
|
1890
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M15 7h2a5 5 0 0 1 1.7 9.7" }),
|
|
1891
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "3", y1: "3", x2: "21", y2: "21" })
|
|
1892
|
-
] })
|
|
1822
|
+
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Link, { ...iconProps }),
|
|
1823
|
+
orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
|
|
1824
|
+
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Redo2, { ...iconProps }),
|
|
1825
|
+
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
|
|
1826
|
+
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Subscript, { ...iconProps }),
|
|
1827
|
+
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Superscript, { ...iconProps }),
|
|
1828
|
+
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Underline, { ...iconProps }),
|
|
1829
|
+
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Undo2, { ...iconProps }),
|
|
1830
|
+
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Link2Off, { ...iconProps })
|
|
1893
1831
|
};
|
|
1894
1832
|
|
|
1895
1833
|
// src/labels.ts
|
|
@@ -2011,7 +1949,7 @@ var Footer = ({
|
|
|
2011
1949
|
const count = editor.storage.characterCount;
|
|
2012
1950
|
const words = count?.words() ?? 0;
|
|
2013
1951
|
const characters = count?.characters() ?? 0;
|
|
2014
|
-
return
|
|
1952
|
+
return { characters, words };
|
|
2015
1953
|
}, [
|
|
2016
1954
|
editor,
|
|
2017
1955
|
showWordCount,
|
|
@@ -2033,7 +1971,23 @@ var Footer = ({
|
|
|
2033
1971
|
"data-sticky": sticky ? "" : void 0,
|
|
2034
1972
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2035
1973
|
children: [
|
|
2036
|
-
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCount
|
|
1974
|
+
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
|
|
1978
|
+
] }),
|
|
1979
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1980
|
+
"span",
|
|
1981
|
+
{
|
|
1982
|
+
className: "rte-footer-word-count-separator",
|
|
1983
|
+
"aria-hidden": "true"
|
|
1984
|
+
}
|
|
1985
|
+
),
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
|
|
1989
|
+
] })
|
|
1990
|
+
] }) }),
|
|
2037
1991
|
children
|
|
2038
1992
|
]
|
|
2039
1993
|
}
|
|
@@ -2155,7 +2109,7 @@ var RichTextEditor = Object.assign(RichTextEditorRoot, {
|
|
|
2155
2109
|
|
|
2156
2110
|
// src/extensions/link.ts
|
|
2157
2111
|
var import_extension_link = __toESM(require("@tiptap/extension-link"), 1);
|
|
2158
|
-
var
|
|
2112
|
+
var Link2 = import_extension_link.default.extend({
|
|
2159
2113
|
addKeyboardShortcuts() {
|
|
2160
2114
|
return {
|
|
2161
2115
|
"Mod-k": () => {
|