@omnitron-dev/prism 0.1.3 → 0.2.0

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.
Files changed (60) hide show
  1. package/dist/blocks/index.js +49 -9
  2. package/dist/blocks/index.js.map +1 -1
  3. package/dist/chunk-2FYNRDXR.js +192 -0
  4. package/dist/chunk-2FYNRDXR.js.map +1 -0
  5. package/dist/chunk-A2Z7NVGL.js +11496 -0
  6. package/dist/chunk-A2Z7NVGL.js.map +1 -0
  7. package/dist/{chunk-E3XANPTO.js → chunk-IZOIO7PA.js} +5 -191
  8. package/dist/{chunk-E3XANPTO.js.map → chunk-IZOIO7PA.js.map} +1 -1
  9. package/dist/{chunk-LAEY5USO.js → chunk-KTCWPGON.js} +55 -25
  10. package/dist/chunk-KTCWPGON.js.map +1 -0
  11. package/dist/{chunk-DXXZ3ITR.js → chunk-MEFT6XPH.js} +721 -455
  12. package/dist/chunk-MEFT6XPH.js.map +1 -0
  13. package/dist/{chunk-BTIT7WYH.js → chunk-SNKGGHBT.js} +2 -2
  14. package/dist/chunk-SNKGGHBT.js.map +1 -0
  15. package/dist/{chunk-UR6X3W5I.js → chunk-VAAIHNWQ.js} +3 -3
  16. package/dist/{chunk-UR6X3W5I.js.map → chunk-VAAIHNWQ.js.map} +1 -1
  17. package/dist/{chunk-GYDT5EKX.js → chunk-XQXGE2PW.js} +760 -472
  18. package/dist/chunk-XQXGE2PW.js.map +1 -0
  19. package/dist/{chunk-WC2WM2JD.js → chunk-XXP3ZGU6.js} +18 -8
  20. package/dist/chunk-XXP3ZGU6.js.map +1 -0
  21. package/dist/chunk-YJMAQL3S.js +1887 -0
  22. package/dist/chunk-YJMAQL3S.js.map +1 -0
  23. package/dist/cli/index.js +4 -4
  24. package/dist/cli/index.js.map +1 -1
  25. package/dist/components/editor/index.d.ts +107 -0
  26. package/dist/components/editor/index.js +4 -0
  27. package/dist/components/editor/index.js.map +1 -0
  28. package/dist/components/index.css +131 -0
  29. package/dist/components/index.css.map +1 -0
  30. package/dist/components/index.d.ts +7073 -0
  31. package/dist/components/index.js +13 -0
  32. package/dist/components/index.js.map +1 -0
  33. package/dist/components-BCGZ-Rwt.d.ts +142 -0
  34. package/dist/{config-BA6IeTq9.d.ts → config-Pct0n_Kq.d.ts} +2 -2
  35. package/dist/core/index.d.ts +20 -5
  36. package/dist/core/index.js +2 -2
  37. package/dist/hooks/index.d.ts +3 -2
  38. package/dist/hooks/index.js +4 -3
  39. package/dist/{index-odhPSv9I.d.ts → index-nmJ8Muwg.d.ts} +4 -127
  40. package/dist/index.d.ts +265 -6615
  41. package/dist/index.js +119 -11662
  42. package/dist/index.js.map +1 -1
  43. package/dist/layouts/index.js +1 -1
  44. package/dist/popover-Dmw7SJLR.d.ts +127 -0
  45. package/dist/registry/index.d.ts +2 -2
  46. package/dist/{registry-BrDNftd5.d.ts → registry-DQcIzW2s.d.ts} +2 -2
  47. package/dist/{settings-plpR26Xk.d.ts → settings-CAC0qFjS.d.ts} +2 -2
  48. package/dist/state/index.d.ts +2 -2
  49. package/dist/state/index.js +1 -1
  50. package/dist/text-transform-D6MzzF7V.d.ts +165 -0
  51. package/dist/theme/index.d.ts +2 -2
  52. package/dist/theme/index.js +2 -2
  53. package/dist/{theme-CrXLfP1c.d.ts → theme-B4Q3Bg5o.d.ts} +1 -1
  54. package/dist/types/index.d.ts +6 -145
  55. package/package.json +46 -40
  56. package/dist/chunk-BTIT7WYH.js.map +0 -1
  57. package/dist/chunk-DXXZ3ITR.js.map +0 -1
  58. package/dist/chunk-GYDT5EKX.js.map +0 -1
  59. package/dist/chunk-LAEY5USO.js.map +0 -1
  60. package/dist/chunk-WC2WM2JD.js.map +0 -1
@@ -0,0 +1,1887 @@
1
+ import { useState, useCallback, useMemo, useEffect } from 'react';
2
+ import { createLowlight, common } from 'lowlight';
3
+ import StarterKitExtension from '@tiptap/starter-kit';
4
+ import UnderlineExtension from '@tiptap/extension-underline';
5
+ import TextAlignExtension from '@tiptap/extension-text-align';
6
+ import ImageExtension from '@tiptap/extension-image';
7
+ import LinkExtension from '@tiptap/extension-link';
8
+ import PlaceholderExtension from '@tiptap/extension-placeholder';
9
+ import TaskListExtension from '@tiptap/extension-task-list';
10
+ import TaskItemExtension from '@tiptap/extension-task-item';
11
+ import CodeBlockLowlightExtension from '@tiptap/extension-code-block-lowlight';
12
+ import { useEditorState, NodeViewWrapper, NodeViewContent, ReactNodeViewRenderer, useEditor, EditorContent } from '@tiptap/react';
13
+ import Box from '@mui/material/Box';
14
+ import Portal from '@mui/material/Portal';
15
+ import Backdrop from '@mui/material/Backdrop';
16
+ import FormHelperText from '@mui/material/FormHelperText';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import Divider from '@mui/material/Divider';
19
+ import SvgIcon2 from '@mui/material/SvgIcon';
20
+ import Tooltip from '@mui/material/Tooltip';
21
+ import ButtonBase, { buttonBaseClasses } from '@mui/material/ButtonBase';
22
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
23
+ import Menu from '@mui/material/Menu';
24
+ import { listClasses } from '@mui/material/List';
25
+ import Button from '@mui/material/Button';
26
+ import Popover from '@mui/material/Popover';
27
+ import TextField2 from '@mui/material/TextField';
28
+ import Typography from '@mui/material/Typography';
29
+ import { BubbleMenu } from '@tiptap/react/menus';
30
+ import { Extension, Mark } from '@tiptap/core';
31
+
32
+ // src/components/editor/classes.ts
33
+ var cls = (name) => `prism-editor-${name}`;
34
+ var editorClasses = {
35
+ root: cls("root"),
36
+ toolbar: {
37
+ root: cls("toolbar"),
38
+ hr: cls("toolbar-hr"),
39
+ bold: cls("toolbar-bold"),
40
+ italic: cls("toolbar-italic"),
41
+ underline: cls("toolbar-underline"),
42
+ strike: cls("toolbar-strike"),
43
+ code: cls("toolbar-code"),
44
+ codeBlock: cls("toolbar-code-block"),
45
+ link: cls("toolbar-link"),
46
+ unlink: cls("toolbar-unlink"),
47
+ image: cls("toolbar-image"),
48
+ alignLeft: cls("toolbar-align-left"),
49
+ alignCenter: cls("toolbar-align-center"),
50
+ alignRight: cls("toolbar-align-right"),
51
+ alignJustify: cls("toolbar-align-justify"),
52
+ bulletList: cls("toolbar-bullet-list"),
53
+ orderedList: cls("toolbar-ordered-list"),
54
+ taskList: cls("toolbar-task-list"),
55
+ blockquote: cls("toolbar-blockquote"),
56
+ hardBreak: cls("toolbar-hard-break"),
57
+ clear: cls("toolbar-clear"),
58
+ undo: cls("toolbar-undo"),
59
+ redo: cls("toolbar-redo"),
60
+ fullscreen: cls("toolbar-fullscreen")
61
+ },
62
+ content: {
63
+ root: cls("content"),
64
+ hr: cls("content-hr"),
65
+ link: cls("content-link"),
66
+ image: cls("content-image"),
67
+ heading: cls("content-heading"),
68
+ codeInline: cls("content-code-inline"),
69
+ codeBlock: cls("content-code-block"),
70
+ langSelect: cls("content-lang-select"),
71
+ blockquote: cls("content-blockquote"),
72
+ bulletList: cls("content-bullet-list"),
73
+ orderedList: cls("content-ordered-list"),
74
+ listItem: cls("content-list-item"),
75
+ taskList: cls("content-task-list"),
76
+ taskItem: cls("content-task-item"),
77
+ placeholder: cls("content-placeholder")
78
+ },
79
+ state: {
80
+ error: cls("state-error"),
81
+ disabled: cls("state-disabled"),
82
+ fullscreen: cls("state-fullscreen")
83
+ }
84
+ };
85
+ var MARGIN = "0.75em";
86
+ var EditorRoot = styled("div")(({ theme }) => ({
87
+ minHeight: 240,
88
+ display: "flex",
89
+ flexDirection: "column",
90
+ borderRadius: Number(theme.shape.borderRadius) * 1.5,
91
+ border: `solid 1px ${alpha(theme.palette.grey[500], 0.2)}`,
92
+ transition: theme.transitions.create(["border-color", "box-shadow"], {
93
+ duration: theme.transitions.duration.short
94
+ }),
95
+ "&:focus-within": {
96
+ borderColor: theme.palette.primary.main,
97
+ boxShadow: `0 0 0 1px ${alpha(theme.palette.primary.main, 0.2)}`
98
+ },
99
+ // ---------------------------------------------------------------------------
100
+ // State: error
101
+ // ---------------------------------------------------------------------------
102
+ [`&.${editorClasses.state.error}`]: {
103
+ borderColor: theme.palette.error.main,
104
+ [`& .${editorClasses.content.root}`]: {
105
+ backgroundColor: alpha(theme.palette.error.main, 0.04)
106
+ }
107
+ },
108
+ // ---------------------------------------------------------------------------
109
+ // State: disabled
110
+ // ---------------------------------------------------------------------------
111
+ [`&.${editorClasses.state.disabled}`]: {
112
+ opacity: 0.48,
113
+ pointerEvents: "none"
114
+ },
115
+ // ---------------------------------------------------------------------------
116
+ // State: fullscreen
117
+ // ---------------------------------------------------------------------------
118
+ [`&.${editorClasses.state.fullscreen}`]: {
119
+ top: 16,
120
+ left: 16,
121
+ position: "fixed",
122
+ maxHeight: "unset",
123
+ width: "calc(100% - 32px)",
124
+ height: "calc(100% - 32px)",
125
+ zIndex: theme.zIndex.modal,
126
+ borderRadius: Number(theme.shape.borderRadius) * 2,
127
+ backgroundColor: theme.palette.background.default,
128
+ boxShadow: theme.shadows[24]
129
+ },
130
+ // ---------------------------------------------------------------------------
131
+ // Placeholder
132
+ // ---------------------------------------------------------------------------
133
+ [`& .${editorClasses.content.placeholder}`]: {
134
+ "&:first-of-type::before": {
135
+ ...theme.typography.body2,
136
+ height: 0,
137
+ float: "left",
138
+ pointerEvents: "none",
139
+ content: "attr(data-placeholder)",
140
+ color: theme.palette.text.disabled
141
+ }
142
+ },
143
+ // ---------------------------------------------------------------------------
144
+ // Content area
145
+ // ---------------------------------------------------------------------------
146
+ [`& .${editorClasses.content.root}`]: {
147
+ display: "flex",
148
+ flex: "1 1 auto",
149
+ overflowY: "auto",
150
+ flexDirection: "column",
151
+ borderBottomLeftRadius: "inherit",
152
+ borderBottomRightRadius: "inherit",
153
+ backgroundColor: alpha(theme.palette.grey[500], 0.04),
154
+ "& .tiptap": {
155
+ "> * + *": { marginTop: 0, marginBottom: MARGIN },
156
+ "&.ProseMirror": {
157
+ flex: "1 1 auto",
158
+ outline: "none",
159
+ padding: theme.spacing(0, 2)
160
+ },
161
+ // Headings
162
+ h1: { ...theme.typography.h1, marginTop: 40, marginBottom: 8 },
163
+ h2: { ...theme.typography.h2, marginTop: 40, marginBottom: 8 },
164
+ h3: { ...theme.typography.h3, marginTop: 24, marginBottom: 8 },
165
+ h4: { ...theme.typography.h4, marginTop: 24, marginBottom: 8 },
166
+ h5: { ...theme.typography.h5, marginTop: 24, marginBottom: 8 },
167
+ h6: { ...theme.typography.h6, marginTop: 24, marginBottom: 8 },
168
+ p: { ...theme.typography.body1, marginBottom: "1.25rem" },
169
+ // Link
170
+ [`& .${editorClasses.content.link}`]: {
171
+ color: theme.palette.primary.main,
172
+ textDecoration: "none",
173
+ "&:hover": { textDecoration: "underline" }
174
+ },
175
+ // Horizontal rule
176
+ [`& .${editorClasses.content.hr}`]: {
177
+ flexShrink: 0,
178
+ borderWidth: 0,
179
+ margin: "2em 0",
180
+ borderStyle: "solid",
181
+ borderBottomWidth: "thin",
182
+ borderColor: theme.palette.divider
183
+ },
184
+ // Image
185
+ [`& .${editorClasses.content.image}`]: {
186
+ width: "100%",
187
+ height: "auto",
188
+ maxWidth: "100%",
189
+ borderRadius: theme.shape.borderRadius,
190
+ margin: "auto auto 1.25em",
191
+ "&.ProseMirror-selectednode": {
192
+ outline: `2px solid ${theme.palette.primary.main}`,
193
+ outlineOffset: 2
194
+ }
195
+ },
196
+ // Lists
197
+ [`& .${editorClasses.content.bulletList}`]: {
198
+ paddingLeft: 16,
199
+ listStyleType: "disc"
200
+ },
201
+ [`& .${editorClasses.content.orderedList}`]: {
202
+ paddingLeft: 16
203
+ },
204
+ [`& .${editorClasses.content.listItem}`]: {
205
+ lineHeight: 2,
206
+ "& > p": { margin: 0 }
207
+ },
208
+ // Task list
209
+ [`& .${editorClasses.content.taskList}`]: {
210
+ listStyle: "none",
211
+ padding: 0,
212
+ "& li": {
213
+ display: "flex",
214
+ alignItems: "flex-start",
215
+ gap: theme.spacing(1),
216
+ "& > label": {
217
+ marginTop: 4,
218
+ flexShrink: 0
219
+ },
220
+ "& > div": { flex: 1 }
221
+ }
222
+ },
223
+ // Blockquote
224
+ [`& .${editorClasses.content.blockquote}`]: {
225
+ lineHeight: 1.5,
226
+ fontSize: "1.5em",
227
+ margin: "24px auto",
228
+ position: "relative",
229
+ fontFamily: "Georgia, serif",
230
+ padding: theme.spacing(3, 3, 3, 8),
231
+ color: theme.palette.text.secondary,
232
+ borderLeft: `solid 8px ${alpha(theme.palette.grey[500], 0.08)}`,
233
+ [theme.breakpoints.up("md")]: { width: "100%", maxWidth: 640 },
234
+ "& p": { margin: 0, fontSize: "inherit", fontFamily: "inherit" },
235
+ "&::before": {
236
+ left: 16,
237
+ top: -8,
238
+ display: "block",
239
+ fontSize: "3em",
240
+ content: '"\\201C"',
241
+ position: "absolute",
242
+ color: theme.palette.text.disabled
243
+ }
244
+ },
245
+ // Inline code
246
+ [`& .${editorClasses.content.codeInline}`]: {
247
+ padding: theme.spacing(0.25, 0.5),
248
+ color: theme.palette.text.secondary,
249
+ fontSize: theme.typography.body2.fontSize,
250
+ borderRadius: Number(theme.shape.borderRadius) / 2,
251
+ backgroundColor: alpha(theme.palette.grey[500], 0.16),
252
+ fontFamily: "'JetBrains Mono', 'Fira Code', monospace"
253
+ },
254
+ // Code block
255
+ [`& .${editorClasses.content.codeBlock}`]: {
256
+ position: "relative",
257
+ "& pre": {
258
+ overflowX: "auto",
259
+ color: theme.palette.common.white,
260
+ padding: theme.spacing(5, 3, 3, 3),
261
+ borderRadius: theme.shape.borderRadius,
262
+ backgroundColor: theme.palette.grey[900],
263
+ fontFamily: "'JetBrains Mono', 'Fira Code', monospace",
264
+ "& code": { fontSize: theme.typography.body2.fontSize }
265
+ },
266
+ [`& .${editorClasses.content.langSelect}`]: {
267
+ top: 8,
268
+ right: 8,
269
+ zIndex: 1,
270
+ padding: 4,
271
+ outline: "none",
272
+ borderRadius: 4,
273
+ position: "absolute",
274
+ color: theme.palette.common.white,
275
+ fontWeight: theme.typography.fontWeightMedium,
276
+ borderColor: alpha(theme.palette.grey[500], 0.08),
277
+ backgroundColor: alpha(theme.palette.grey[500], 0.08)
278
+ }
279
+ }
280
+ }
281
+ }
282
+ }));
283
+
284
+ // src/components/editor/presets.ts
285
+ var PRESET_ITEMS = {
286
+ /**
287
+ * Full — CMS pages, blog articles, documentation.
288
+ * Everything enabled including headings, alignment, code blocks, images.
289
+ */
290
+ full: [
291
+ "heading",
292
+ "bold",
293
+ "italic",
294
+ "underline",
295
+ "strike",
296
+ "code",
297
+ "bulletList",
298
+ "orderedList",
299
+ "taskList",
300
+ "alignLeft",
301
+ "alignCenter",
302
+ "alignRight",
303
+ "alignJustify",
304
+ "blockquote",
305
+ "codeBlock",
306
+ "horizontalRule",
307
+ "link",
308
+ "image",
309
+ "hardBreak",
310
+ "clearFormat",
311
+ "undo",
312
+ "redo",
313
+ "fullscreen"
314
+ ],
315
+ /**
316
+ * Standard — blog posts, forum discussions, product descriptions.
317
+ * Most formatting without advanced alignment and task lists.
318
+ */
319
+ standard: [
320
+ "heading",
321
+ "bold",
322
+ "italic",
323
+ "underline",
324
+ "strike",
325
+ "bulletList",
326
+ "orderedList",
327
+ "blockquote",
328
+ "codeBlock",
329
+ "link",
330
+ "image",
331
+ "hardBreak",
332
+ "clearFormat",
333
+ "undo",
334
+ "redo",
335
+ "fullscreen"
336
+ ],
337
+ /**
338
+ * Compact — comments, forum replies.
339
+ * Basic formatting, links, code, no images/headings.
340
+ */
341
+ compact: [
342
+ "bold",
343
+ "italic",
344
+ "underline",
345
+ "strike",
346
+ "code",
347
+ "bulletList",
348
+ "orderedList",
349
+ "blockquote",
350
+ "link",
351
+ "clearFormat"
352
+ ],
353
+ /**
354
+ * Minimal — quick feedback, short messages.
355
+ * Only essential inline formatting.
356
+ */
357
+ minimal: ["bold", "italic", "code", "link"],
358
+ /**
359
+ * Chat — messaging system.
360
+ * Lightweight formatting, optimized for speed.
361
+ */
362
+ chat: ["bold", "italic", "strike", "code", "link", "bulletList", "orderedList", "codeBlock"],
363
+ /**
364
+ * Inline — single-line fields (titles, captions).
365
+ * No toolbar, no block-level elements.
366
+ */
367
+ inline: []
368
+ };
369
+ var PRESET_BUBBLE_MENU = {
370
+ full: true,
371
+ standard: true,
372
+ compact: true,
373
+ minimal: false,
374
+ chat: false,
375
+ inline: false
376
+ };
377
+ function resolveToolbar(config) {
378
+ if (!config) {
379
+ return resolveToolbar("standard");
380
+ }
381
+ if (typeof config === "string") {
382
+ return {
383
+ items: new Set(PRESET_ITEMS[config]),
384
+ bubbleMenu: PRESET_BUBBLE_MENU[config]
385
+ };
386
+ }
387
+ return {
388
+ items: new Set(config.items),
389
+ bubbleMenu: config.bubbleMenu ?? false
390
+ };
391
+ }
392
+ function ToolbarItem({ sx, icon, label, active, disabled, ...other }) {
393
+ const ariaLabel = other["aria-label"];
394
+ const renderItem = () => /* @__PURE__ */ jsxs(ItemRoot, { disableRipple: true, disableTouchRipple: true, disabled, active, sx, ...other, children: [
395
+ icon && /* @__PURE__ */ jsx(SvgIcon2, { sx: { fontSize: 18 }, children: icon }),
396
+ label && label
397
+ ] });
398
+ if (ariaLabel) {
399
+ return /* @__PURE__ */ jsx(Tooltip, { title: ariaLabel, children: renderItem() });
400
+ }
401
+ return renderItem();
402
+ }
403
+ var ItemRoot = styled(ButtonBase, {
404
+ shouldForwardProp: (prop) => !["active", "disabled", "sx"].includes(prop)
405
+ })(({ theme }) => ({
406
+ ...theme.typography.body2,
407
+ width: 28,
408
+ height: 28,
409
+ padding: theme.spacing(0, 0.75),
410
+ borderRadius: Number(theme.shape.borderRadius) * 0.75,
411
+ "&:hover": {
412
+ backgroundColor: theme.palette.action.hover
413
+ },
414
+ variants: [
415
+ {
416
+ props: (props) => !!props.active,
417
+ style: {
418
+ backgroundColor: theme.palette.action.selected,
419
+ border: `solid 1px ${theme.palette.action.hover}`
420
+ }
421
+ },
422
+ {
423
+ props: (props) => !!props.disabled,
424
+ style: {
425
+ opacity: 0.48,
426
+ cursor: "default",
427
+ pointerEvents: "none"
428
+ }
429
+ }
430
+ ]
431
+ }));
432
+ var BoldIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
433
+ /* @__PURE__ */ jsx(
434
+ "path",
435
+ {
436
+ fill: "none",
437
+ stroke: "currentColor",
438
+ strokeWidth: "1.5",
439
+ strokeLinecap: "round",
440
+ strokeLinejoin: "round",
441
+ fillRule: "evenodd",
442
+ clipRule: "evenodd",
443
+ d: "M5 6C5 4.58579 5 3.87868 5.43934 3.43934C5.87868 3 6.58579 3 8 3H12.5789C15.0206 3 17 5.01472 17 7.5C17 9.98528 15.0206 12 12.5789 12H5V6Z"
444
+ }
445
+ ),
446
+ /* @__PURE__ */ jsx(
447
+ "path",
448
+ {
449
+ fill: "none",
450
+ stroke: "currentColor",
451
+ strokeWidth: "1.5",
452
+ strokeLinecap: "round",
453
+ strokeLinejoin: "round",
454
+ d: "M12.4286 12H13.6667C16.0599 12 18 14.0147 18 16.5C18 18.9853 16.0599 21 13.6667 21H8C6.58579 21 5.87868 21 5.43934 20.5607C5 20.1213 5 19.4142 5 18V12"
455
+ }
456
+ )
457
+ ] });
458
+ var ItalicIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
459
+ /* @__PURE__ */ jsx("path", { d: "M12 4H19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
460
+ /* @__PURE__ */ jsx("path", { d: "M8 20L16 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
461
+ /* @__PURE__ */ jsx("path", { d: "M5 20H12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
462
+ ] });
463
+ var UnderlineIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
464
+ /* @__PURE__ */ jsx(
465
+ "path",
466
+ {
467
+ fill: "none",
468
+ stroke: "currentColor",
469
+ strokeWidth: "1.5",
470
+ strokeLinecap: "round",
471
+ strokeLinejoin: "round",
472
+ d: "M5.5 3V11.5C5.5 15.0899 8.41015 18 12 18C15.5899 18 18.5 15.0899 18.5 11.5V3"
473
+ }
474
+ ),
475
+ /* @__PURE__ */ jsx("path", { d: "M3 21H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
476
+ ] });
477
+ var StrikeIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
478
+ /* @__PURE__ */ jsx("path", { d: "M4 12H20", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
479
+ /* @__PURE__ */ jsx(
480
+ "path",
481
+ {
482
+ fill: "none",
483
+ stroke: "currentColor",
484
+ strokeWidth: "1.5",
485
+ strokeLinecap: "round",
486
+ d: "M17.5 7.66667C17.5 5.08934 15.0376 3 12 3C8.96243 3 6.5 5.08934 6.5 7.66667C6.5 8.15279 6.55336 8.59783 6.6668 9M6 16.3333C6 18.9107 8.68629 21 12 21C15.3137 21 18 19.6667 18 16.3333C18 13.9404 16.9693 12.5782 14.9079 12"
487
+ }
488
+ )
489
+ ] });
490
+ var InlineCodeIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
491
+ /* @__PURE__ */ jsx(
492
+ "path",
493
+ {
494
+ fill: "none",
495
+ stroke: "currentColor",
496
+ strokeWidth: "1.5",
497
+ strokeLinecap: "round",
498
+ strokeLinejoin: "round",
499
+ d: "M17 8L18.8398 9.85008C19.6133 10.6279 20 11.0168 20 11.5C20 11.9832 19.6133 12.3721 18.8398 13.1499L17 15"
500
+ }
501
+ ),
502
+ /* @__PURE__ */ jsx(
503
+ "path",
504
+ {
505
+ fill: "none",
506
+ stroke: "currentColor",
507
+ strokeWidth: "1.5",
508
+ strokeLinecap: "round",
509
+ strokeLinejoin: "round",
510
+ d: "M7 8L5.16019 9.85008C4.38673 10.6279 4 11.0168 4 11.5C4 11.9832 4.38673 12.3721 5.16019 13.1499L7 15"
511
+ }
512
+ ),
513
+ /* @__PURE__ */ jsx("path", { d: "M14.5 4L9.5 20", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
514
+ ] });
515
+ var CodeBlockIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
516
+ /* @__PURE__ */ jsx(
517
+ "path",
518
+ {
519
+ stroke: "currentColor",
520
+ strokeWidth: "1.5",
521
+ strokeLinecap: "round",
522
+ strokeLinejoin: "round",
523
+ d: "M16 10L17.2265 11.0572C17.7422 11.5016 18 11.7239 18 12C18 12.2761 17.7422 12.4984 17.2265 12.9428L16 14"
524
+ }
525
+ ),
526
+ /* @__PURE__ */ jsx(
527
+ "path",
528
+ {
529
+ stroke: "currentColor",
530
+ strokeWidth: "1.5",
531
+ strokeLinecap: "round",
532
+ strokeLinejoin: "round",
533
+ d: "M8 10L6.77346 11.0572C6.25782 11.5016 6 11.7239 6 12C6 12.2761 6.25782 12.4984 6.77346 12.9428L8 14"
534
+ }
535
+ ),
536
+ /* @__PURE__ */ jsx("path", { d: "M13 9L11 15", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
537
+ /* @__PURE__ */ jsx(
538
+ "path",
539
+ {
540
+ fill: "none",
541
+ stroke: "currentColor",
542
+ strokeWidth: "1.5",
543
+ d: "M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z"
544
+ }
545
+ )
546
+ ] });
547
+ var H1Icon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
548
+ /* @__PURE__ */ jsx("path", { d: "M4 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
549
+ /* @__PURE__ */ jsx("path", { d: "M14 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
550
+ /* @__PURE__ */ jsx(
551
+ "path",
552
+ {
553
+ d: "M17 19H18.5M20 19H18.5M18.5 19V11L17 12",
554
+ stroke: "currentColor",
555
+ strokeWidth: "1.5",
556
+ strokeLinecap: "round",
557
+ strokeLinejoin: "round"
558
+ }
559
+ ),
560
+ /* @__PURE__ */ jsx("path", { d: "M4 12L14 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
561
+ ] });
562
+ var H2Icon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
563
+ /* @__PURE__ */ jsx("path", { d: "M3.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
564
+ /* @__PURE__ */ jsx("path", { d: "M13.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
565
+ /* @__PURE__ */ jsx(
566
+ "path",
567
+ {
568
+ fill: "none",
569
+ stroke: "currentColor",
570
+ strokeWidth: "1.5",
571
+ strokeLinecap: "round",
572
+ strokeLinejoin: "round",
573
+ d: "M20.5 19H16.5V18.6907C16.5 18.2521 16.5 18.0327 16.5865 17.8385C16.673 17.6443 16.836 17.4976 17.1621 17.2041L19.7671 14.8596C20.2336 14.4397 20.5 13.8416 20.5 13.214V13C20.5 11.8954 19.6046 11 18.5 11C17.3954 11 16.5 11.8954 16.5 13V13.4"
574
+ }
575
+ ),
576
+ /* @__PURE__ */ jsx("path", { d: "M3.5 12L13.5 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
577
+ ] });
578
+ var H3Icon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
579
+ /* @__PURE__ */ jsx("path", { d: "M3.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
580
+ /* @__PURE__ */ jsx("path", { d: "M13.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
581
+ /* @__PURE__ */ jsx(
582
+ "path",
583
+ {
584
+ fill: "none",
585
+ stroke: "currentColor",
586
+ strokeWidth: "1.5",
587
+ strokeLinecap: "round",
588
+ strokeLinejoin: "round",
589
+ d: "M16.5 17C16.5 18.1046 17.3954 19 18.5 19C19.6046 19 20.5 18.1046 20.5 17C20.5 15.8954 19.6046 15 18.5 15C19.6046 15 20.5 14.1046 20.5 13C20.5 11.8954 19.6046 11 18.5 11C17.3954 11 16.5 11.8954 16.5 13"
590
+ }
591
+ ),
592
+ /* @__PURE__ */ jsx("path", { d: "M3.5 12L13.5 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
593
+ ] });
594
+ var H4Icon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
595
+ /* @__PURE__ */ jsx("path", { d: "M3.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
596
+ /* @__PURE__ */ jsx("path", { d: "M13.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
597
+ /* @__PURE__ */ jsx(
598
+ "path",
599
+ {
600
+ fill: "none",
601
+ d: "M16.5 11V15H20.5M20.5 15V19M20.5 15V11",
602
+ stroke: "currentColor",
603
+ strokeWidth: "1.5",
604
+ strokeLinecap: "round",
605
+ strokeLinejoin: "round"
606
+ }
607
+ ),
608
+ /* @__PURE__ */ jsx("path", { d: "M3.5 12L13.5 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
609
+ ] });
610
+ var H5Icon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
611
+ /* @__PURE__ */ jsx("path", { d: "M3.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
612
+ /* @__PURE__ */ jsx("path", { d: "M13.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
613
+ /* @__PURE__ */ jsx(
614
+ "path",
615
+ {
616
+ fill: "none",
617
+ d: "M16.5 16.5V17C16.5 18.1046 17.3954 19 18.5 19C19.6046 19 20.5 18.1046 20.5 17V16.5C20.5 15.1193 19.3807 14 18 14H16.5V11H20.5",
618
+ stroke: "currentColor",
619
+ strokeWidth: "1.5",
620
+ strokeLinecap: "round",
621
+ strokeLinejoin: "round"
622
+ }
623
+ ),
624
+ /* @__PURE__ */ jsx("path", { d: "M3.5 12L13.5 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
625
+ ] });
626
+ var H6Icon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
627
+ /* @__PURE__ */ jsx("path", { d: "M3.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
628
+ /* @__PURE__ */ jsx("path", { d: "M13.5 5V19", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
629
+ /* @__PURE__ */ jsx(
630
+ "path",
631
+ {
632
+ fill: "none",
633
+ d: "M16.5 17C16.5 18.1046 17.3954 19 18.5 19C19.6046 19 20.5 18.1046 20.5 17C20.5 15.8954 19.6046 15 18.5 15C17.3954 15 16.5 15.8954 16.5 17ZM16.5 17V13C16.5 11.8954 17.3954 11 18.5 11C19.6046 11 20.5 11.8954 20.5 13",
634
+ stroke: "currentColor",
635
+ strokeWidth: "1.5",
636
+ strokeLinecap: "round",
637
+ strokeLinejoin: "round"
638
+ }
639
+ ),
640
+ /* @__PURE__ */ jsx("path", { d: "M3.5 12L13.5 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
641
+ ] });
642
+ var ParagraphIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
643
+ /* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", d: "M15 21.001H9" }),
644
+ /* @__PURE__ */ jsx(
645
+ "path",
646
+ {
647
+ stroke: "currentColor",
648
+ strokeWidth: "1.5",
649
+ strokeLinecap: "round",
650
+ d: "M12 3.00001V21.0008M12 3.00001C13.3874 3.00001 15.1695 3.03055 16.5884 3.17649C17.1885 3.2382 17.4886 3.26906 17.7541 3.37791C18.3066 3.60429 18.7518 4.10063 18.9194 4.67681C19 4.95382 19 5.26992 19 5.90215M12 3.00001C10.6126 3.00001 8.83047 3.03055 7.41161 3.17649C6.8115 3.2382 6.51144 3.26906 6.24586 3.37791C5.69344 3.60429 5.24816 4.10063 5.08057 4.67681C5 4.95382 5 5.26992 5 5.90215"
651
+ }
652
+ )
653
+ ] });
654
+ var AlignLeftIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
655
+ /* @__PURE__ */ jsx("path", { d: "M3 3H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
656
+ /* @__PURE__ */ jsx("path", { d: "M3 9H11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
657
+ /* @__PURE__ */ jsx("path", { d: "M3 15H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
658
+ /* @__PURE__ */ jsx("path", { d: "M3 21H11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
659
+ ] });
660
+ var AlignCenterIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
661
+ /* @__PURE__ */ jsx("path", { d: "M3 3H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
662
+ /* @__PURE__ */ jsx("path", { d: "M8 9H16", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
663
+ /* @__PURE__ */ jsx("path", { d: "M3 15H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
664
+ /* @__PURE__ */ jsx("path", { d: "M8 21H16", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
665
+ ] });
666
+ var AlignRightIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
667
+ /* @__PURE__ */ jsx("path", { d: "M3 3H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
668
+ /* @__PURE__ */ jsx("path", { d: "M13 9H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
669
+ /* @__PURE__ */ jsx("path", { d: "M3 15H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
670
+ /* @__PURE__ */ jsx("path", { d: "M13 21H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
671
+ ] });
672
+ var AlignJustifyIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
673
+ /* @__PURE__ */ jsx("path", { d: "M3 3H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
674
+ /* @__PURE__ */ jsx("path", { d: "M3 9H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
675
+ /* @__PURE__ */ jsx("path", { d: "M3 15H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
676
+ /* @__PURE__ */ jsx("path", { d: "M3 21H21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
677
+ ] });
678
+ var BulletListIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
679
+ /* @__PURE__ */ jsx("path", { d: "M11 5.5L21 5.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
680
+ /* @__PURE__ */ jsx(
681
+ "path",
682
+ {
683
+ fill: "none",
684
+ stroke: "currentColor",
685
+ strokeWidth: "1.5",
686
+ strokeLinecap: "round",
687
+ d: "M5.4 16.8926C6.46667 17.607 7 17.9642 7 18.5C7 19.0358 6.46667 19.393 5.4 20.1074C4.33333 20.8218 3.8 21.1789 3.4 20.9111C3 20.6432 3 19.9288 3 18.5C3 17.0712 3 16.3568 3.4 16.0889C3.8 15.8211 4.33333 16.1782 5.4 16.8926Z"
688
+ }
689
+ ),
690
+ /* @__PURE__ */ jsx(
691
+ "path",
692
+ {
693
+ fill: "none",
694
+ stroke: "currentColor",
695
+ strokeWidth: "1.5",
696
+ strokeLinecap: "round",
697
+ d: "M5.4 3.89263C6.46667 4.60702 7 4.96421 7 5.5C7 6.03579 6.46667 6.39298 5.4 7.10737C4.33333 7.82176 3.8 8.17895 3.4 7.91105C3 7.64316 3 6.92877 3 5.5C3 4.07123 3 3.35684 3.4 3.08895C3.8 2.82105 4.33333 3.17824 5.4 3.89263Z"
698
+ }
699
+ ),
700
+ /* @__PURE__ */ jsx("path", { d: "M11 12L21 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
701
+ /* @__PURE__ */ jsx("path", { d: "M11 18.5L21 18.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
702
+ ] });
703
+ var OrderedListIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
704
+ /* @__PURE__ */ jsx("path", { d: "M11 6L21 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
705
+ /* @__PURE__ */ jsx("path", { d: "M11 12L21 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
706
+ /* @__PURE__ */ jsx("path", { d: "M11 18L21 18", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
707
+ /* @__PURE__ */ jsx(
708
+ "path",
709
+ {
710
+ fill: "none",
711
+ stroke: "currentColor",
712
+ strokeWidth: "1.5",
713
+ strokeLinecap: "round",
714
+ strokeLinejoin: "round",
715
+ d: "M3 15H4.5C4.77879 15 4.91819 15 5.03411 15.0231C5.51014 15.1177 5.88225 15.4899 5.97694 15.9659C6 16.0818 6 16.2212 6 16.5C6 16.7788 6 16.9182 5.97694 17.0341C5.88225 17.5101 5.51014 17.8823 5.03411 17.9769C4.91819 18 4.77879 18 4.5 18C4.22121 18 4.08181 18 3.96589 18.0231C3.48986 18.1177 3.11775 18.4899 3.02306 18.9659C3 19.0818 3 19.2212 3 19.5V20.4C3 20.6828 3 20.8243 3.08787 20.9121C3.17574 21 3.31716 21 3.6 21H6"
716
+ }
717
+ ),
718
+ /* @__PURE__ */ jsx(
719
+ "path",
720
+ {
721
+ d: "M3 3H4.2C4.36569 3 4.5 3.13431 4.5 3.3V9M4.5 9H3M4.5 9H6",
722
+ stroke: "currentColor",
723
+ strokeWidth: "1.5",
724
+ strokeLinecap: "round",
725
+ strokeLinejoin: "round"
726
+ }
727
+ )
728
+ ] });
729
+ var CheckListIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
730
+ /* @__PURE__ */ jsx("path", { d: "M11 6L21 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
731
+ /* @__PURE__ */ jsx("path", { d: "M11 12L21 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
732
+ /* @__PURE__ */ jsx("path", { d: "M11 18L21 18", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
733
+ /* @__PURE__ */ jsx(
734
+ "path",
735
+ {
736
+ stroke: "currentColor",
737
+ strokeWidth: "1.5",
738
+ strokeLinecap: "round",
739
+ strokeLinejoin: "round",
740
+ d: "M3 7.39286C3 7.39286 4 8.04466 4.5 9C4.5 9 6 5.25 8 4"
741
+ }
742
+ ),
743
+ /* @__PURE__ */ jsx(
744
+ "path",
745
+ {
746
+ stroke: "currentColor",
747
+ strokeWidth: "1.5",
748
+ strokeLinecap: "round",
749
+ strokeLinejoin: "round",
750
+ d: "M3 18.3929C3 18.3929 4 19.0447 4.5 20C4.5 20 6 16.25 8 15"
751
+ }
752
+ )
753
+ ] });
754
+ var QuoteIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
755
+ /* @__PURE__ */ jsx(
756
+ "path",
757
+ {
758
+ fill: "none",
759
+ stroke: "currentColor",
760
+ strokeWidth: "1.5",
761
+ d: "M14 16C14 14.1144 14 13.1716 14.5858 12.5858C15.1716 12 16.1144 12 18 12C19.8856 12 20.8284 12 21.4142 12.5858C22 13.1716 22 14.1144 22 16C22 17.8856 22 18.8284 21.4142 19.4142C20.8284 20 19.8856 20 18 20C16.1144 20 15.1716 20 14.5858 19.4142C14 18.8284 14 17.8856 14 16Z"
762
+ }
763
+ ),
764
+ /* @__PURE__ */ jsx(
765
+ "path",
766
+ {
767
+ fill: "none",
768
+ d: "M14 16V11.8626C14 8.19569 16.5157 5.08584 20 4",
769
+ stroke: "currentColor",
770
+ strokeWidth: "1.5",
771
+ strokeLinecap: "round"
772
+ }
773
+ ),
774
+ /* @__PURE__ */ jsx(
775
+ "path",
776
+ {
777
+ fill: "none",
778
+ stroke: "currentColor",
779
+ strokeWidth: "1.5",
780
+ d: "M2 16C2 14.1144 2 13.1716 2.58579 12.5858C3.17157 12 4.11438 12 6 12C7.88562 12 8.82843 12 9.41421 12.5858C10 13.1716 10 14.1144 10 16C10 17.8856 10 18.8284 9.41421 19.4142C8.82843 20 7.88562 20 6 20C4.11438 20 3.17157 20 2.58579 19.4142C2 18.8284 2 17.8856 2 16Z"
781
+ }
782
+ ),
783
+ /* @__PURE__ */ jsx(
784
+ "path",
785
+ {
786
+ fill: "none",
787
+ d: "M2 16V11.8626C2 8.19569 4.51571 5.08584 8 4",
788
+ stroke: "currentColor",
789
+ strokeWidth: "1.5",
790
+ strokeLinecap: "round"
791
+ }
792
+ )
793
+ ] });
794
+ var HorizontalRuleIcon = (props) => /* @__PURE__ */ jsx(SvgIcon2, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M2.5 12L21.5002 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
795
+ var TableIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
796
+ /* @__PURE__ */ jsx(
797
+ "path",
798
+ {
799
+ fill: "none",
800
+ stroke: "currentColor",
801
+ strokeWidth: "1.5",
802
+ strokeLinecap: "round",
803
+ strokeLinejoin: "round",
804
+ d: "M3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088Z"
805
+ }
806
+ ),
807
+ /* @__PURE__ */ jsx("path", { d: "M2.5 9L21.5 9", stroke: "currentColor", strokeWidth: "1.5" }),
808
+ /* @__PURE__ */ jsx("path", { d: "M2.5 13L21.5 13", stroke: "currentColor", strokeWidth: "1.5" }),
809
+ /* @__PURE__ */ jsx("path", { d: "M2.5 17L21.5 17", stroke: "currentColor", strokeWidth: "1.5" }),
810
+ /* @__PURE__ */ jsx("path", { d: "M12 21.5L12 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
811
+ ] });
812
+ var LinkIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
813
+ /* @__PURE__ */ jsx("path", { d: "M9.5 14.5L14.5 9.49995", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
814
+ /* @__PURE__ */ jsx(
815
+ "path",
816
+ {
817
+ fill: "none",
818
+ stroke: "currentColor",
819
+ strokeWidth: "1.5",
820
+ strokeLinecap: "round",
821
+ d: "M16.8463 14.6095L19.4558 12C21.5147 9.94108 21.5147 6.60298 19.4558 4.54411C17.397 2.48524 14.0589 2.48524 12 4.54411L9.39045 7.15366M14.6095 16.8463L12 19.4558C9.94113 21.5147 6.60303 21.5147 4.54416 19.4558C2.48528 17.3969 2.48528 14.0588 4.54416 12L7.1537 9.39041"
822
+ }
823
+ )
824
+ ] });
825
+ var UnlinkIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
826
+ /* @__PURE__ */ jsx(
827
+ "path",
828
+ {
829
+ fill: "none",
830
+ d: "M16.8463 14.6095L19.4558 12C21.5147 9.94113 21.5147 6.60303 19.4558 4.54416C17.397 2.48528 14.0589 2.48528 12 4.54416L9.39045 7.1537M14.6095 16.8463L12 19.4558C9.94113 21.5147 6.60303 21.5147 4.54416 19.4558C2.48528 17.397 2.48528 14.0589 4.54416 12L7.1537 9.39045",
831
+ stroke: "currentColor",
832
+ strokeWidth: "1.5",
833
+ strokeLinecap: "round"
834
+ }
835
+ ),
836
+ /* @__PURE__ */ jsx(
837
+ "path",
838
+ {
839
+ d: "M22 17H19.9211M17 22L17 19.9211",
840
+ stroke: "currentColor",
841
+ strokeWidth: "1.5",
842
+ strokeLinecap: "round",
843
+ strokeLinejoin: "round"
844
+ }
845
+ ),
846
+ /* @__PURE__ */ jsx(
847
+ "path",
848
+ {
849
+ d: "M2 7H4.07889M7 2L7 4.07889",
850
+ stroke: "currentColor",
851
+ strokeWidth: "1.5",
852
+ strokeLinecap: "round",
853
+ strokeLinejoin: "round"
854
+ }
855
+ )
856
+ ] });
857
+ var ImageIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
858
+ /* @__PURE__ */ jsx(
859
+ "circle",
860
+ {
861
+ fill: "none",
862
+ cx: "7.5",
863
+ cy: "7.5",
864
+ r: "1.5",
865
+ stroke: "currentColor",
866
+ strokeWidth: "1.5",
867
+ strokeLinecap: "round",
868
+ strokeLinejoin: "round"
869
+ }
870
+ ),
871
+ /* @__PURE__ */ jsx(
872
+ "path",
873
+ {
874
+ fill: "none",
875
+ stroke: "currentColor",
876
+ strokeWidth: "1.5",
877
+ d: "M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z"
878
+ }
879
+ ),
880
+ /* @__PURE__ */ jsx(
881
+ "path",
882
+ {
883
+ fill: "none",
884
+ stroke: "currentColor",
885
+ strokeWidth: "1.5",
886
+ d: "M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424"
887
+ }
888
+ )
889
+ ] });
890
+ var ClearMarksIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
891
+ /* @__PURE__ */ jsx("path", { d: "M11 20.001H5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
892
+ /* @__PURE__ */ jsx("path", { d: "M3 3L21 21", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
893
+ /* @__PURE__ */ jsx(
894
+ "path",
895
+ {
896
+ fill: "none",
897
+ stroke: "currentColor",
898
+ strokeWidth: "1.5",
899
+ strokeLinecap: "round",
900
+ d: "M19 7C19 6.36778 19 5.95381 18.9194 5.6768C18.7518 5.10062 18.3066 4.60428 17.7541 4.37789C17.4886 4.26905 17.1885 4.23819 16.5884 4.17648C15.1695 4.03054 13.3874 4 12 4H8"
901
+ }
902
+ ),
903
+ /* @__PURE__ */ jsx(
904
+ "path",
905
+ {
906
+ d: "M12 4L11.2 7.20003M8 20.0008L10.4001 10.4001",
907
+ stroke: "currentColor",
908
+ strokeWidth: "1.5",
909
+ strokeLinecap: "round",
910
+ strokeLinejoin: "round"
911
+ }
912
+ )
913
+ ] });
914
+ var UndoIcon = (props) => /* @__PURE__ */ jsx(SvgIcon2, { ...props, children: /* @__PURE__ */ jsx(
915
+ "path",
916
+ {
917
+ fill: "none",
918
+ d: "M3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C8.79275 3 5.97733 4.67765 4.38341 7.20327M3.29339 3.00076L3.46556 5.05452C3.58958 6.53384 3.65159 7.27349 4.13359 7.68914C4.61559 8.10479 5.32673 8.03185 6.74899 7.88595L8.79339 7.67625",
919
+ stroke: "currentColor",
920
+ strokeWidth: "1.5",
921
+ strokeLinecap: "round",
922
+ strokeLinejoin: "round"
923
+ }
924
+ ) });
925
+ var RedoIcon = (props) => /* @__PURE__ */ jsx(SvgIcon2, { ...props, children: /* @__PURE__ */ jsx(
926
+ "path",
927
+ {
928
+ fill: "none",
929
+ stroke: "currentColor",
930
+ strokeWidth: "1.5",
931
+ strokeLinecap: "round",
932
+ strokeLinejoin: "round",
933
+ d: "M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C15.2073 3 18.0227 4.67765 19.6166 7.20327M20.7066 3.00076L20.5344 5.05452C20.4104 6.53384 20.3484 7.27349 19.8664 7.68914C19.3844 8.10479 18.6733 8.03185 17.251 7.88595L15.2066 7.67625"
934
+ }
935
+ ) });
936
+ var HardBreakIcon = (props) => /* @__PURE__ */ jsxs(SvgIcon2, { ...props, children: [
937
+ /* @__PURE__ */ jsx(
938
+ "path",
939
+ {
940
+ fill: "none",
941
+ stroke: "currentColor",
942
+ strokeWidth: "1.5",
943
+ strokeLinecap: "round",
944
+ strokeLinejoin: "round",
945
+ d: "M13 6H8.5C6.01472 6 4 8.01472 4 10.5C4 12.9853 6.01472 15 8.5 15H20"
946
+ }
947
+ ),
948
+ /* @__PURE__ */ jsx(
949
+ "path",
950
+ {
951
+ fill: "none",
952
+ stroke: "currentColor",
953
+ strokeWidth: "1.5",
954
+ strokeLinecap: "round",
955
+ strokeLinejoin: "round",
956
+ d: "M17 12C17 12 20 14.2095 20 15C20 15.7906 17 18 17 18"
957
+ }
958
+ )
959
+ ] });
960
+ var FullscreenIcon = (props) => /* @__PURE__ */ jsx(SvgIcon2, { ...props, children: /* @__PURE__ */ jsx(
961
+ "path",
962
+ {
963
+ fill: "none",
964
+ stroke: "currentColor",
965
+ strokeWidth: "1.5",
966
+ strokeLinecap: "round",
967
+ strokeLinejoin: "round",
968
+ d: "M15.5 21C16.8956 21 17.5933 21 18.1611 20.8278C19.4395 20.44 20.44 19.4395 20.8278 18.1611C21 17.5933 21 16.8956 21 15.5M21 8.5C21 7.10444 21 6.40666 20.8278 5.83886C20.44 4.56046 19.4395 3.56004 18.1611 3.17224C17.5933 3 16.8956 3 15.5 3M8.5 21C7.10444 21 6.40666 21 5.83886 20.8278C4.56046 20.44 3.56004 19.4395 3.17224 18.1611C3 17.5933 3 16.8956 3 15.5M3 8.5C3 7.10444 3 6.40666 3.17224 5.83886C3.56004 4.56046 4.56046 3.56004 5.83886 3.17224C6.40666 3 7.10444 3 8.5 3"
969
+ }
970
+ ) });
971
+ var ExitFullscreenIcon = (props) => /* @__PURE__ */ jsx(SvgIcon2, { ...props, children: /* @__PURE__ */ jsx(
972
+ "path",
973
+ {
974
+ fill: "none",
975
+ stroke: "currentColor",
976
+ strokeWidth: "1.5",
977
+ strokeLinecap: "round",
978
+ strokeLinejoin: "round",
979
+ d: "M15.5 9.5L21 4M15.5 9.5V5M15.5 9.5H20M8.5 14.5L3 20M8.5 14.5V19M8.5 14.5H4"
980
+ }
981
+ ) });
982
+ var HEADING_OPTIONS = [
983
+ { key: "Paragraph", level: null, icon: /* @__PURE__ */ jsx(ParagraphIcon, { sx: { fontSize: 18 } }) },
984
+ { key: "Heading 1", level: 1, icon: /* @__PURE__ */ jsx(H1Icon, { sx: { fontSize: 18 } }) },
985
+ { key: "Heading 2", level: 2, icon: /* @__PURE__ */ jsx(H2Icon, { sx: { fontSize: 18 } }) },
986
+ { key: "Heading 3", level: 3, icon: /* @__PURE__ */ jsx(H3Icon, { sx: { fontSize: 18 } }) },
987
+ { key: "Heading 4", level: 4, icon: /* @__PURE__ */ jsx(H4Icon, { sx: { fontSize: 18 } }) },
988
+ { key: "Heading 5", level: 5, icon: /* @__PURE__ */ jsx(H5Icon, { sx: { fontSize: 18 } }) },
989
+ { key: "Heading 6", level: 6, icon: /* @__PURE__ */ jsx(H6Icon, { sx: { fontSize: 18 } }) }
990
+ ];
991
+ function HeadingBlock({ editor, isActive }) {
992
+ const [anchorEl, setAnchorEl] = useState(null);
993
+ const open = Boolean(anchorEl);
994
+ const handleOpen = useCallback((event) => {
995
+ setAnchorEl(event.currentTarget);
996
+ }, []);
997
+ const handleClose = useCallback(() => {
998
+ setAnchorEl(null);
999
+ }, []);
1000
+ const handleSelect = useCallback(
1001
+ (value) => {
1002
+ handleClose();
1003
+ if (value) {
1004
+ editor.chain().focus().toggleHeading({ level: value }).run();
1005
+ } else {
1006
+ editor.chain().focus().setParagraph().run();
1007
+ }
1008
+ },
1009
+ [editor, handleClose]
1010
+ );
1011
+ const activeIcon = editor.isActive("heading", { level: 1 }) && /* @__PURE__ */ jsx(H1Icon, { sx: { fontSize: 18 } }) || editor.isActive("heading", { level: 2 }) && /* @__PURE__ */ jsx(H2Icon, { sx: { fontSize: 18 } }) || editor.isActive("heading", { level: 3 }) && /* @__PURE__ */ jsx(H3Icon, { sx: { fontSize: 18 } }) || editor.isActive("heading", { level: 4 }) && /* @__PURE__ */ jsx(H4Icon, { sx: { fontSize: 18 } }) || editor.isActive("heading", { level: 5 }) && /* @__PURE__ */ jsx(H5Icon, { sx: { fontSize: 18 } }) || editor.isActive("heading", { level: 6 }) && /* @__PURE__ */ jsx(H6Icon, { sx: { fontSize: 18 } }) || /* @__PURE__ */ jsx(ParagraphIcon, { sx: { fontSize: 18 } });
1012
+ const buttonId = "heading-menu-button";
1013
+ const menuId = "heading-menu";
1014
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1015
+ /* @__PURE__ */ jsx(
1016
+ HeadingButton,
1017
+ {
1018
+ id: buttonId,
1019
+ "aria-label": "Heading menu",
1020
+ "aria-controls": open ? menuId : void 0,
1021
+ "aria-haspopup": "true",
1022
+ "aria-expanded": open ? "true" : void 0,
1023
+ onClick: handleOpen,
1024
+ children: activeIcon
1025
+ }
1026
+ ),
1027
+ /* @__PURE__ */ jsx(
1028
+ Menu,
1029
+ {
1030
+ id: menuId,
1031
+ anchorEl,
1032
+ open,
1033
+ onClose: handleClose,
1034
+ slotProps: {
1035
+ list: { "aria-labelledby": buttonId },
1036
+ paper: {
1037
+ sx: {
1038
+ width: 42,
1039
+ [`& .${listClasses.root}`]: { gap: 0.5, display: "flex", flexDirection: "column" },
1040
+ [`& .${buttonBaseClasses.root}`]: {
1041
+ px: 1,
1042
+ width: 1,
1043
+ height: 34,
1044
+ borderRadius: 0.75,
1045
+ justifyContent: "flex-start",
1046
+ "&:hover": { backgroundColor: "action.hover" }
1047
+ }
1048
+ }
1049
+ }
1050
+ },
1051
+ children: HEADING_OPTIONS.map((option) => /* @__PURE__ */ jsx(
1052
+ ToolbarItem,
1053
+ {
1054
+ component: "li",
1055
+ "aria-label": option.key,
1056
+ icon: option.icon,
1057
+ active: isActive(option.level),
1058
+ onClick: () => handleSelect(option.level)
1059
+ },
1060
+ option.key
1061
+ ))
1062
+ }
1063
+ )
1064
+ ] });
1065
+ }
1066
+ var HeadingButton = styled(ButtonBase)(({ theme }) => ({
1067
+ width: 28,
1068
+ height: 28,
1069
+ borderRadius: Number(theme.shape.borderRadius) * 0.75,
1070
+ justifyContent: "center",
1071
+ "&:hover": {
1072
+ backgroundColor: theme.palette.action.hover
1073
+ }
1074
+ }));
1075
+ function LinkBlock({ editor, linkIcon, unlinkIcon, active }) {
1076
+ const [linkUrl, setLinkUrl] = useState("");
1077
+ const [anchorEl, setAnchorEl] = useState(null);
1078
+ const open = Boolean(anchorEl);
1079
+ const handleOpen = useCallback(
1080
+ (event) => {
1081
+ const currentUrl = editor.getAttributes("link").href ?? "";
1082
+ setAnchorEl(event.currentTarget);
1083
+ setLinkUrl(currentUrl);
1084
+ },
1085
+ [editor]
1086
+ );
1087
+ const handleClose = useCallback(() => {
1088
+ setAnchorEl(null);
1089
+ }, []);
1090
+ const handleApply = useCallback(() => {
1091
+ handleClose();
1092
+ const chain = () => editor.chain().focus().extendMarkRange("link");
1093
+ if (linkUrl) {
1094
+ chain().setLink({ href: linkUrl }).run();
1095
+ } else {
1096
+ chain().unsetLink().run();
1097
+ }
1098
+ }, [editor, linkUrl, handleClose]);
1099
+ const popoverId = open ? "link-popover" : void 0;
1100
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1101
+ /* @__PURE__ */ jsx(
1102
+ ToolbarItem,
1103
+ {
1104
+ "aria-describedby": popoverId,
1105
+ "aria-label": "Insert link",
1106
+ active,
1107
+ className: editorClasses.toolbar.link,
1108
+ onClick: handleOpen,
1109
+ icon: linkIcon
1110
+ }
1111
+ ),
1112
+ /* @__PURE__ */ jsx(
1113
+ ToolbarItem,
1114
+ {
1115
+ "aria-label": "Remove link",
1116
+ disabled: !active,
1117
+ className: editorClasses.toolbar.unlink,
1118
+ onClick: () => editor.chain().focus().unsetLink().run(),
1119
+ icon: unlinkIcon
1120
+ }
1121
+ ),
1122
+ /* @__PURE__ */ jsxs(
1123
+ Popover,
1124
+ {
1125
+ id: popoverId,
1126
+ open,
1127
+ anchorEl,
1128
+ onClose: handleClose,
1129
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
1130
+ slotProps: {
1131
+ paper: {
1132
+ sx: { p: 2.5, gap: 1.25, width: 1, maxWidth: 320, display: "flex", flexDirection: "column" }
1133
+ }
1134
+ },
1135
+ children: [
1136
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Link URL" }),
1137
+ /* @__PURE__ */ jsxs(Box, { sx: { gap: 1, display: "flex", alignItems: "center" }, children: [
1138
+ /* @__PURE__ */ jsx(
1139
+ TextField2,
1140
+ {
1141
+ fullWidth: true,
1142
+ size: "small",
1143
+ placeholder: "https://",
1144
+ value: linkUrl,
1145
+ onChange: (e) => setLinkUrl(e.target.value),
1146
+ onKeyDown: (e) => {
1147
+ if (e.key === "Enter") handleApply();
1148
+ }
1149
+ }
1150
+ ),
1151
+ /* @__PURE__ */ jsx(Button, { variant: "contained", disabled: !linkUrl, onClick: handleApply, children: "Apply" })
1152
+ ] })
1153
+ ]
1154
+ }
1155
+ )
1156
+ ] });
1157
+ }
1158
+ function ImageBlock({ editor, icon }) {
1159
+ const [anchorEl, setAnchorEl] = useState(null);
1160
+ const open = Boolean(anchorEl);
1161
+ const [state, setState] = useState({ imageUrl: "", altText: "" });
1162
+ const handleOpen = useCallback((event) => {
1163
+ setAnchorEl(event.currentTarget);
1164
+ }, []);
1165
+ const handleClose = useCallback(() => {
1166
+ setAnchorEl(null);
1167
+ }, []);
1168
+ const handleApply = useCallback(() => {
1169
+ handleClose();
1170
+ setState({ imageUrl: "", altText: "" });
1171
+ editor.chain().focus().setImage({ src: state.imageUrl, alt: state.altText }).run();
1172
+ }, [editor, handleClose, state]);
1173
+ const popoverId = open ? "image-popover" : void 0;
1174
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1175
+ /* @__PURE__ */ jsx(
1176
+ ToolbarItem,
1177
+ {
1178
+ "aria-describedby": popoverId,
1179
+ "aria-label": "Insert image",
1180
+ className: editorClasses.toolbar.image,
1181
+ onClick: handleOpen,
1182
+ icon
1183
+ }
1184
+ ),
1185
+ /* @__PURE__ */ jsxs(
1186
+ Popover,
1187
+ {
1188
+ id: popoverId,
1189
+ open,
1190
+ anchorEl,
1191
+ onClose: handleClose,
1192
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
1193
+ slotProps: {
1194
+ paper: {
1195
+ sx: { p: 2.5, gap: 1.25, width: 1, maxWidth: 320, display: "flex", flexDirection: "column" }
1196
+ }
1197
+ },
1198
+ children: [
1199
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Add image" }),
1200
+ /* @__PURE__ */ jsx(
1201
+ TextField2,
1202
+ {
1203
+ fullWidth: true,
1204
+ size: "small",
1205
+ placeholder: "Image URL",
1206
+ value: state.imageUrl,
1207
+ onChange: (e) => setState((prev) => ({ ...prev, imageUrl: e.target.value }))
1208
+ }
1209
+ ),
1210
+ /* @__PURE__ */ jsx(
1211
+ TextField2,
1212
+ {
1213
+ fullWidth: true,
1214
+ size: "small",
1215
+ placeholder: "Alt text",
1216
+ value: state.altText,
1217
+ onChange: (e) => setState((prev) => ({ ...prev, altText: e.target.value }))
1218
+ }
1219
+ ),
1220
+ /* @__PURE__ */ jsx(Button, { variant: "contained", disabled: !state.imageUrl, onClick: handleApply, sx: { alignSelf: "flex-end" }, children: "Apply" })
1221
+ ]
1222
+ }
1223
+ )
1224
+ ] });
1225
+ }
1226
+ function useToolbarState(editor) {
1227
+ return useEditorState({
1228
+ editor,
1229
+ selector: (ctx) => {
1230
+ const canRun = ctx.editor.can().chain().focus();
1231
+ return {
1232
+ isBold: ctx.editor.isActive("bold"),
1233
+ isCode: ctx.editor.isActive("code"),
1234
+ isLink: ctx.editor.isActive("link"),
1235
+ isItalic: ctx.editor.isActive("italic"),
1236
+ isStrike: ctx.editor.isActive("strike"),
1237
+ isUnderline: ctx.editor.isActive("underline"),
1238
+ isCodeBlock: ctx.editor.isActive("codeBlock"),
1239
+ isBulletList: ctx.editor.isActive("bulletList"),
1240
+ isBlockquote: ctx.editor.isActive("blockquote"),
1241
+ isOrderedList: ctx.editor.isActive("orderedList"),
1242
+ isTaskList: ctx.editor.isActive("taskList"),
1243
+ isAlign: (value) => ctx.editor.isActive({ textAlign: value }),
1244
+ isTextTransform: (value) => ctx.editor.isActive("textTransform", { textTransform: value }),
1245
+ isTextLevel: (value) => value ? ctx.editor.isActive("heading", { level: value }) : ctx.editor.isActive("paragraph"),
1246
+ canUndo: canRun.undo().run(),
1247
+ canRedo: canRun.redo().run()
1248
+ };
1249
+ }
1250
+ });
1251
+ }
1252
+ function Toolbar({ editor, toolbar, fullscreen, onToggleFullscreen }) {
1253
+ const state = useToolbarState(editor);
1254
+ const has = (item) => toolbar.items.has(item);
1255
+ const chain = () => editor.chain().focus();
1256
+ const hasAnyInGroup = (...items) => items.some(has);
1257
+ return /* @__PURE__ */ jsxs(ToolbarRoot, { className: editorClasses.toolbar.root, children: [
1258
+ has("heading") && /* @__PURE__ */ jsxs(Fragment, { children: [
1259
+ /* @__PURE__ */ jsx(HeadingBlock, { editor, isActive: state.isTextLevel }),
1260
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1261
+ ] }),
1262
+ hasAnyInGroup("bold", "italic", "underline", "strike", "code") && /* @__PURE__ */ jsxs(Fragment, { children: [
1263
+ /* @__PURE__ */ jsxs(ToolbarBlock, { children: [
1264
+ has("bold") && /* @__PURE__ */ jsx(
1265
+ ToolbarItem,
1266
+ {
1267
+ "aria-label": "Bold (\u2318B)",
1268
+ active: state.isBold,
1269
+ className: editorClasses.toolbar.bold,
1270
+ onClick: () => chain().toggleBold().run(),
1271
+ icon: /* @__PURE__ */ jsx(BoldIcon, {})
1272
+ }
1273
+ ),
1274
+ has("italic") && /* @__PURE__ */ jsx(
1275
+ ToolbarItem,
1276
+ {
1277
+ "aria-label": "Italic (\u2318I)",
1278
+ active: state.isItalic,
1279
+ className: editorClasses.toolbar.italic,
1280
+ onClick: () => chain().toggleItalic().run(),
1281
+ icon: /* @__PURE__ */ jsx(ItalicIcon, {})
1282
+ }
1283
+ ),
1284
+ has("underline") && /* @__PURE__ */ jsx(
1285
+ ToolbarItem,
1286
+ {
1287
+ "aria-label": "Underline (\u2318U)",
1288
+ active: state.isUnderline,
1289
+ className: editorClasses.toolbar.underline,
1290
+ onClick: () => chain().toggleUnderline().run(),
1291
+ icon: /* @__PURE__ */ jsx(UnderlineIcon, {})
1292
+ }
1293
+ ),
1294
+ has("strike") && /* @__PURE__ */ jsx(
1295
+ ToolbarItem,
1296
+ {
1297
+ "aria-label": "Strikethrough",
1298
+ active: state.isStrike,
1299
+ className: editorClasses.toolbar.strike,
1300
+ onClick: () => chain().toggleStrike().run(),
1301
+ icon: /* @__PURE__ */ jsx(StrikeIcon, {})
1302
+ }
1303
+ ),
1304
+ has("code") && /* @__PURE__ */ jsx(
1305
+ ToolbarItem,
1306
+ {
1307
+ "aria-label": "Inline code (\u2318E)",
1308
+ active: state.isCode,
1309
+ className: editorClasses.toolbar.code,
1310
+ onClick: () => chain().toggleCode().run(),
1311
+ icon: /* @__PURE__ */ jsx(InlineCodeIcon, {})
1312
+ }
1313
+ )
1314
+ ] }),
1315
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1316
+ ] }),
1317
+ hasAnyInGroup("bulletList", "orderedList", "taskList") && /* @__PURE__ */ jsxs(Fragment, { children: [
1318
+ /* @__PURE__ */ jsxs(ToolbarBlock, { children: [
1319
+ has("bulletList") && /* @__PURE__ */ jsx(
1320
+ ToolbarItem,
1321
+ {
1322
+ "aria-label": "Bullet list",
1323
+ active: state.isBulletList,
1324
+ className: editorClasses.toolbar.bulletList,
1325
+ onClick: () => chain().toggleBulletList().run(),
1326
+ icon: /* @__PURE__ */ jsx(BulletListIcon, {})
1327
+ }
1328
+ ),
1329
+ has("orderedList") && /* @__PURE__ */ jsx(
1330
+ ToolbarItem,
1331
+ {
1332
+ "aria-label": "Ordered list",
1333
+ active: state.isOrderedList,
1334
+ className: editorClasses.toolbar.orderedList,
1335
+ onClick: () => chain().toggleOrderedList().run(),
1336
+ icon: /* @__PURE__ */ jsx(OrderedListIcon, {})
1337
+ }
1338
+ ),
1339
+ has("taskList") && /* @__PURE__ */ jsx(
1340
+ ToolbarItem,
1341
+ {
1342
+ "aria-label": "Task list",
1343
+ active: state.isTaskList,
1344
+ className: editorClasses.toolbar.taskList,
1345
+ onClick: () => chain().toggleTaskList().run(),
1346
+ icon: /* @__PURE__ */ jsx(CheckListIcon, {})
1347
+ }
1348
+ )
1349
+ ] }),
1350
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1351
+ ] }),
1352
+ hasAnyInGroup("alignLeft", "alignCenter", "alignRight", "alignJustify") && /* @__PURE__ */ jsxs(Fragment, { children: [
1353
+ /* @__PURE__ */ jsxs(ToolbarBlock, { children: [
1354
+ has("alignLeft") && /* @__PURE__ */ jsx(
1355
+ ToolbarItem,
1356
+ {
1357
+ "aria-label": "Align left",
1358
+ active: state.isAlign("left"),
1359
+ className: editorClasses.toolbar.alignLeft,
1360
+ onClick: () => chain().setTextAlign("left").run(),
1361
+ icon: /* @__PURE__ */ jsx(AlignLeftIcon, {})
1362
+ }
1363
+ ),
1364
+ has("alignCenter") && /* @__PURE__ */ jsx(
1365
+ ToolbarItem,
1366
+ {
1367
+ "aria-label": "Align center",
1368
+ active: state.isAlign("center"),
1369
+ className: editorClasses.toolbar.alignCenter,
1370
+ onClick: () => chain().setTextAlign("center").run(),
1371
+ icon: /* @__PURE__ */ jsx(AlignCenterIcon, {})
1372
+ }
1373
+ ),
1374
+ has("alignRight") && /* @__PURE__ */ jsx(
1375
+ ToolbarItem,
1376
+ {
1377
+ "aria-label": "Align right",
1378
+ active: state.isAlign("right"),
1379
+ className: editorClasses.toolbar.alignRight,
1380
+ onClick: () => chain().setTextAlign("right").run(),
1381
+ icon: /* @__PURE__ */ jsx(AlignRightIcon, {})
1382
+ }
1383
+ ),
1384
+ has("alignJustify") && /* @__PURE__ */ jsx(
1385
+ ToolbarItem,
1386
+ {
1387
+ "aria-label": "Align justify",
1388
+ active: state.isAlign("justify"),
1389
+ className: editorClasses.toolbar.alignJustify,
1390
+ onClick: () => chain().setTextAlign("justify").run(),
1391
+ icon: /* @__PURE__ */ jsx(AlignJustifyIcon, {})
1392
+ }
1393
+ )
1394
+ ] }),
1395
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1396
+ ] }),
1397
+ hasAnyInGroup("blockquote", "codeBlock", "horizontalRule") && /* @__PURE__ */ jsxs(Fragment, { children: [
1398
+ /* @__PURE__ */ jsxs(ToolbarBlock, { children: [
1399
+ has("blockquote") && /* @__PURE__ */ jsx(
1400
+ ToolbarItem,
1401
+ {
1402
+ "aria-label": "Blockquote",
1403
+ active: state.isBlockquote,
1404
+ className: editorClasses.toolbar.blockquote,
1405
+ onClick: () => chain().toggleBlockquote().run(),
1406
+ icon: /* @__PURE__ */ jsx(QuoteIcon, {})
1407
+ }
1408
+ ),
1409
+ has("codeBlock") && /* @__PURE__ */ jsx(
1410
+ ToolbarItem,
1411
+ {
1412
+ "aria-label": "Code block",
1413
+ active: state.isCodeBlock,
1414
+ className: editorClasses.toolbar.codeBlock,
1415
+ onClick: () => chain().toggleCodeBlock().run(),
1416
+ icon: /* @__PURE__ */ jsx(CodeBlockIcon, {})
1417
+ }
1418
+ ),
1419
+ has("horizontalRule") && /* @__PURE__ */ jsx(
1420
+ ToolbarItem,
1421
+ {
1422
+ "aria-label": "Horizontal rule",
1423
+ className: editorClasses.toolbar.hr,
1424
+ onClick: () => chain().setHorizontalRule().run(),
1425
+ icon: /* @__PURE__ */ jsx(HorizontalRuleIcon, {})
1426
+ }
1427
+ )
1428
+ ] }),
1429
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1430
+ ] }),
1431
+ hasAnyInGroup("link", "image") && /* @__PURE__ */ jsxs(Fragment, { children: [
1432
+ /* @__PURE__ */ jsxs(ToolbarBlock, { children: [
1433
+ has("link") && /* @__PURE__ */ jsx(LinkBlock, { editor, active: state.isLink, linkIcon: /* @__PURE__ */ jsx(LinkIcon, {}), unlinkIcon: /* @__PURE__ */ jsx(UnlinkIcon, {}) }),
1434
+ has("image") && /* @__PURE__ */ jsx(ImageBlock, { editor, icon: /* @__PURE__ */ jsx(ImageIcon, {}) })
1435
+ ] }),
1436
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1437
+ ] }),
1438
+ hasAnyInGroup("hardBreak", "clearFormat") && /* @__PURE__ */ jsxs(Fragment, { children: [
1439
+ /* @__PURE__ */ jsxs(ToolbarBlock, { children: [
1440
+ has("hardBreak") && /* @__PURE__ */ jsx(
1441
+ ToolbarItem,
1442
+ {
1443
+ "aria-label": "Hard break",
1444
+ className: editorClasses.toolbar.hardBreak,
1445
+ onClick: () => chain().setHardBreak().run(),
1446
+ icon: /* @__PURE__ */ jsx(HardBreakIcon, {})
1447
+ }
1448
+ ),
1449
+ has("clearFormat") && /* @__PURE__ */ jsx(
1450
+ ToolbarItem,
1451
+ {
1452
+ "aria-label": "Clear format (\u2318\u21E7X)",
1453
+ className: editorClasses.toolbar.clear,
1454
+ onClick: () => chain().clearNodes().unsetAllMarks().run(),
1455
+ icon: /* @__PURE__ */ jsx(ClearMarksIcon, {})
1456
+ }
1457
+ )
1458
+ ] }),
1459
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1460
+ ] }),
1461
+ hasAnyInGroup("undo", "redo") && /* @__PURE__ */ jsxs(Fragment, { children: [
1462
+ /* @__PURE__ */ jsxs(ToolbarBlock, { children: [
1463
+ has("undo") && /* @__PURE__ */ jsx(
1464
+ ToolbarItem,
1465
+ {
1466
+ "aria-label": "Undo (\u2318Z)",
1467
+ disabled: !state.canUndo,
1468
+ className: editorClasses.toolbar.undo,
1469
+ onClick: () => chain().undo().run(),
1470
+ icon: /* @__PURE__ */ jsx(UndoIcon, {})
1471
+ }
1472
+ ),
1473
+ has("redo") && /* @__PURE__ */ jsx(
1474
+ ToolbarItem,
1475
+ {
1476
+ "aria-label": "Redo (\u2318\u21E7Z)",
1477
+ disabled: !state.canRedo,
1478
+ className: editorClasses.toolbar.redo,
1479
+ onClick: () => chain().redo().run(),
1480
+ icon: /* @__PURE__ */ jsx(RedoIcon, {})
1481
+ }
1482
+ )
1483
+ ] }),
1484
+ /* @__PURE__ */ jsx(ToolbarDivider, {})
1485
+ ] }),
1486
+ has("fullscreen") && /* @__PURE__ */ jsx(ToolbarBlock, { children: /* @__PURE__ */ jsx(
1487
+ ToolbarItem,
1488
+ {
1489
+ "aria-label": fullscreen ? "Exit fullscreen" : "Fullscreen",
1490
+ active: fullscreen,
1491
+ className: editorClasses.toolbar.fullscreen,
1492
+ onClick: onToggleFullscreen,
1493
+ icon: fullscreen ? /* @__PURE__ */ jsx(ExitFullscreenIcon, {}) : /* @__PURE__ */ jsx(FullscreenIcon, {})
1494
+ }
1495
+ ) })
1496
+ ] });
1497
+ }
1498
+ var ToolbarRoot = styled("div")(({ theme }) => ({
1499
+ flexWrap: "wrap",
1500
+ display: "flex",
1501
+ flexDirection: "row",
1502
+ alignItems: "center",
1503
+ gap: theme.spacing(1),
1504
+ padding: theme.spacing(1.25),
1505
+ borderTopLeftRadius: "inherit",
1506
+ borderTopRightRadius: "inherit",
1507
+ backgroundColor: theme.palette.background.paper,
1508
+ borderBottom: `solid 1px ${alpha(theme.palette.grey[500], 0.2)}`
1509
+ }));
1510
+ var ToolbarBlock = styled("div")(({ theme }) => ({
1511
+ display: "flex",
1512
+ alignItems: "center",
1513
+ gap: theme.spacing(0.5)
1514
+ }));
1515
+ function ToolbarDivider() {
1516
+ return /* @__PURE__ */ jsx(Divider, { orientation: "vertical", flexItem: true, sx: { height: 16, my: "auto" } });
1517
+ }
1518
+ function BubbleToolbar({ editor }) {
1519
+ const state = useToolbarState(editor);
1520
+ const chain = () => editor.chain().focus();
1521
+ return /* @__PURE__ */ jsx(BubbleMenu, { editor, children: /* @__PURE__ */ jsxs(BubbleRoot, { children: [
1522
+ /* @__PURE__ */ jsx(
1523
+ ToolbarItem,
1524
+ {
1525
+ "aria-label": "Bold",
1526
+ active: state.isBold,
1527
+ className: editorClasses.toolbar.bold,
1528
+ onClick: () => chain().toggleBold().run(),
1529
+ icon: /* @__PURE__ */ jsx(BoldIcon, {})
1530
+ }
1531
+ ),
1532
+ /* @__PURE__ */ jsx(
1533
+ ToolbarItem,
1534
+ {
1535
+ "aria-label": "Italic",
1536
+ active: state.isItalic,
1537
+ className: editorClasses.toolbar.italic,
1538
+ onClick: () => chain().toggleItalic().run(),
1539
+ icon: /* @__PURE__ */ jsx(ItalicIcon, {})
1540
+ }
1541
+ ),
1542
+ /* @__PURE__ */ jsx(
1543
+ ToolbarItem,
1544
+ {
1545
+ "aria-label": "Underline",
1546
+ active: state.isUnderline,
1547
+ className: editorClasses.toolbar.underline,
1548
+ onClick: () => chain().toggleUnderline().run(),
1549
+ icon: /* @__PURE__ */ jsx(UnderlineIcon, {})
1550
+ }
1551
+ ),
1552
+ /* @__PURE__ */ jsx(
1553
+ ToolbarItem,
1554
+ {
1555
+ "aria-label": "Strike",
1556
+ active: state.isStrike,
1557
+ className: editorClasses.toolbar.strike,
1558
+ onClick: () => chain().toggleStrike().run(),
1559
+ icon: /* @__PURE__ */ jsx(StrikeIcon, {})
1560
+ }
1561
+ ),
1562
+ /* @__PURE__ */ jsx(LinkBlock, { editor, active: state.isLink, linkIcon: /* @__PURE__ */ jsx(LinkIcon, {}), unlinkIcon: /* @__PURE__ */ jsx(UnlinkIcon, {}) }),
1563
+ /* @__PURE__ */ jsx(Divider, { orientation: "vertical", flexItem: true, sx: { height: 16, my: "auto" } }),
1564
+ /* @__PURE__ */ jsx(
1565
+ ToolbarItem,
1566
+ {
1567
+ "aria-label": "Clear format",
1568
+ className: editorClasses.toolbar.clear,
1569
+ onClick: () => chain().clearNodes().unsetAllMarks().run(),
1570
+ icon: /* @__PURE__ */ jsx(ClearMarksIcon, {})
1571
+ }
1572
+ )
1573
+ ] }) });
1574
+ }
1575
+ var BubbleRoot = styled("div")(({ theme }) => ({
1576
+ display: "flex",
1577
+ gap: theme.spacing(0.5),
1578
+ padding: theme.spacing(0.5),
1579
+ borderRadius: theme.shape.borderRadius,
1580
+ boxShadow: theme.shadows[8],
1581
+ backgroundColor: theme.palette.background.paper,
1582
+ border: `1px solid ${alpha(theme.palette.grey[500], 0.16)}`
1583
+ }));
1584
+ function CodeHighlightBlock(props) {
1585
+ const { node, extension, updateAttributes } = props;
1586
+ const language = node.attrs.language;
1587
+ const lowlight = extension.options.lowlight;
1588
+ const handleChangeLanguage = useCallback(
1589
+ (event) => {
1590
+ updateAttributes({ language: event.target.value });
1591
+ },
1592
+ [updateAttributes]
1593
+ );
1594
+ return /* @__PURE__ */ jsxs(NodeViewWrapper, { className: editorClasses.content.codeBlock, children: [
1595
+ /* @__PURE__ */ jsxs(
1596
+ "select",
1597
+ {
1598
+ name: "language",
1599
+ contentEditable: false,
1600
+ value: language || "null",
1601
+ onChange: handleChangeLanguage,
1602
+ className: editorClasses.content.langSelect,
1603
+ children: [
1604
+ /* @__PURE__ */ jsx("option", { value: "null", children: "auto" }),
1605
+ /* @__PURE__ */ jsx("option", { disabled: true, children: "\u2014" }),
1606
+ lowlight.listLanguages().map((lang) => /* @__PURE__ */ jsx("option", { value: lang, children: lang }, lang))
1607
+ ]
1608
+ }
1609
+ ),
1610
+ /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx(NodeViewContent, { as: "code" }) })
1611
+ ] });
1612
+ }
1613
+ var ClearFormat = Extension.create({
1614
+ name: "clearFormat",
1615
+ addKeyboardShortcuts() {
1616
+ return {
1617
+ "Mod-Shift-X": ({ editor }) => editor.chain().focus().clearNodes().unsetAllMarks().run()
1618
+ };
1619
+ }
1620
+ });
1621
+ var isHTMLElement = (node) => node instanceof HTMLElement;
1622
+ var isValidTextTransform = (value, allowed) => typeof value === "string" && allowed.includes(value);
1623
+ var TextTransform = Mark.create({
1624
+ name: "textTransform",
1625
+ addOptions() {
1626
+ return {
1627
+ allowedValues: ["uppercase", "lowercase", "capitalize"],
1628
+ defaultValue: void 0
1629
+ };
1630
+ },
1631
+ addAttributes() {
1632
+ return {
1633
+ textTransform: {
1634
+ default: this.options.defaultValue,
1635
+ parseHTML: (element) => {
1636
+ if (!isHTMLElement(element)) return void 0;
1637
+ const rawValue = element.style.textTransform || element.getAttribute("style")?.match(/text-transform:\s*(\w+)/)?.[1];
1638
+ return isValidTextTransform(rawValue, this.options.allowedValues) ? rawValue : void 0;
1639
+ },
1640
+ renderHTML: (attributes) => {
1641
+ if (!attributes.textTransform) return {};
1642
+ return { style: `text-transform: ${attributes.textTransform}` };
1643
+ }
1644
+ }
1645
+ };
1646
+ },
1647
+ parseHTML() {
1648
+ return [
1649
+ {
1650
+ tag: "span[style]",
1651
+ getAttrs: (node) => {
1652
+ if (!isHTMLElement(node)) return null;
1653
+ const styleValue = node.style.textTransform;
1654
+ return isValidTextTransform(styleValue, this.options.allowedValues) ? {} : false;
1655
+ }
1656
+ }
1657
+ ];
1658
+ },
1659
+ renderHTML({ HTMLAttributes }) {
1660
+ return ["span", HTMLAttributes, 0];
1661
+ },
1662
+ addCommands() {
1663
+ return {
1664
+ setTextTransform: (value) => ({ commands }) => {
1665
+ if (!isValidTextTransform(value, this.options.allowedValues)) return false;
1666
+ return commands.setMark(this.name, { textTransform: value });
1667
+ },
1668
+ unsetTextTransform: () => ({ commands }) => commands.unsetMark(this.name),
1669
+ toggleTextTransform: (value) => ({ editor, commands }) => {
1670
+ if (!isValidTextTransform(value, this.options.allowedValues)) return false;
1671
+ const isActive = editor.isActive(this.name, { textTransform: value });
1672
+ return isActive ? commands.unsetTextTransform() : commands.setTextTransform(value);
1673
+ }
1674
+ };
1675
+ }
1676
+ });
1677
+ function Editor({
1678
+ sx,
1679
+ error,
1680
+ onChange,
1681
+ slotProps,
1682
+ helperText,
1683
+ resetValue,
1684
+ className,
1685
+ toolbar: toolbarConfig,
1686
+ bubbleMenu: bubbleMenuProp,
1687
+ format = "json",
1688
+ minHeight = 160,
1689
+ maxHeight,
1690
+ editable = true,
1691
+ extraExtensions,
1692
+ placeholder = "Write something...",
1693
+ ref: contentRef,
1694
+ value: initialContent = "",
1695
+ ...other
1696
+ }) {
1697
+ const [fullscreen, setFullscreen] = useState(false);
1698
+ const [rerenderKey, setRerenderKey] = useState(0);
1699
+ const resolvedToolbar = useMemo(() => resolveToolbar(toolbarConfig), [toolbarConfig]);
1700
+ const showBubbleMenu = bubbleMenuProp ?? resolvedToolbar.bubbleMenu;
1701
+ const showToolbar = resolvedToolbar.items.size > 0;
1702
+ const lowlight = useMemo(() => createLowlight(common), []);
1703
+ const parsedContent = useMemo(() => {
1704
+ if (!initialContent) return "";
1705
+ if (format === "json" && initialContent.startsWith("{")) {
1706
+ try {
1707
+ return JSON.parse(initialContent);
1708
+ } catch {
1709
+ return initialContent;
1710
+ }
1711
+ }
1712
+ return initialContent;
1713
+ }, [initialContent, format]);
1714
+ const debouncedOnChange = useMemo(() => {
1715
+ let timer;
1716
+ return (editor2) => {
1717
+ clearTimeout(timer);
1718
+ timer = setTimeout(() => {
1719
+ if (format === "json") {
1720
+ onChange?.(JSON.stringify(editor2.getJSON()));
1721
+ } else {
1722
+ onChange?.(editor2.getHTML());
1723
+ }
1724
+ }, 200);
1725
+ };
1726
+ }, [onChange, format]);
1727
+ const extensions = useMemo(() => {
1728
+ const has = (item) => resolvedToolbar.items.has(item);
1729
+ const exts = [
1730
+ StarterKitExtension.configure({
1731
+ codeBlock: false,
1732
+ // Underline and Link are registered separately (below) to allow per-preset control
1733
+ underline: false,
1734
+ link: false,
1735
+ code: has("code") ? { HTMLAttributes: { class: editorClasses.content.codeInline } } : false,
1736
+ heading: has("heading") ? { HTMLAttributes: { class: editorClasses.content.heading } } : false,
1737
+ horizontalRule: has("horizontalRule") ? { HTMLAttributes: { class: editorClasses.content.hr } } : false,
1738
+ listItem: { HTMLAttributes: { class: editorClasses.content.listItem } },
1739
+ blockquote: has("blockquote") ? { HTMLAttributes: { class: editorClasses.content.blockquote } } : false,
1740
+ bulletList: has("bulletList") ? { HTMLAttributes: { class: editorClasses.content.bulletList } } : false,
1741
+ orderedList: has("orderedList") ? { HTMLAttributes: { class: editorClasses.content.orderedList } } : false
1742
+ }),
1743
+ PlaceholderExtension.configure({
1744
+ placeholder,
1745
+ emptyEditorClass: editorClasses.content.placeholder
1746
+ }),
1747
+ ClearFormat,
1748
+ TextTransform
1749
+ ];
1750
+ if (has("underline")) {
1751
+ exts.push(UnderlineExtension);
1752
+ }
1753
+ if (has("alignLeft") || has("alignCenter") || has("alignRight") || has("alignJustify")) {
1754
+ exts.push(TextAlignExtension.configure({ types: ["heading", "paragraph"] }));
1755
+ }
1756
+ if (has("image")) {
1757
+ exts.push(ImageExtension.configure({ HTMLAttributes: { class: editorClasses.content.image } }));
1758
+ }
1759
+ if (has("link")) {
1760
+ exts.push(
1761
+ LinkExtension.configure({
1762
+ openOnClick: false,
1763
+ HTMLAttributes: { class: editorClasses.content.link }
1764
+ })
1765
+ );
1766
+ }
1767
+ if (has("codeBlock")) {
1768
+ exts.push(
1769
+ CodeBlockLowlightExtension.extend({
1770
+ addNodeView: () => ReactNodeViewRenderer(CodeHighlightBlock)
1771
+ }).configure({ lowlight })
1772
+ );
1773
+ }
1774
+ if (has("taskList")) {
1775
+ exts.push(
1776
+ TaskListExtension.configure({ HTMLAttributes: { class: editorClasses.content.taskList } }),
1777
+ TaskItemExtension.configure({
1778
+ nested: true,
1779
+ HTMLAttributes: { class: editorClasses.content.taskItem }
1780
+ })
1781
+ );
1782
+ }
1783
+ if (extraExtensions) {
1784
+ exts.push(...extraExtensions);
1785
+ }
1786
+ return exts;
1787
+ }, [resolvedToolbar, placeholder, lowlight, extraExtensions]);
1788
+ const editor = useEditor({
1789
+ editable,
1790
+ immediatelyRender: false,
1791
+ content: parsedContent,
1792
+ shouldRerenderOnTransaction: !!rerenderKey,
1793
+ onUpdate: (ctx) => {
1794
+ debouncedOnChange(ctx.editor);
1795
+ },
1796
+ extensions,
1797
+ ...other
1798
+ });
1799
+ const handleToggleFullscreen = useCallback(() => {
1800
+ editor?.unmount();
1801
+ setFullscreen((prev) => !prev);
1802
+ setRerenderKey((prev) => prev + 1);
1803
+ }, [editor]);
1804
+ const handleExitFullscreen = useCallback(
1805
+ (event) => {
1806
+ if (event.key === "Escape") {
1807
+ editor?.unmount();
1808
+ setFullscreen(false);
1809
+ setRerenderKey((prev) => prev + 1);
1810
+ }
1811
+ },
1812
+ [editor]
1813
+ );
1814
+ useEffect(() => {
1815
+ const timer = setTimeout(() => {
1816
+ if (!editor?.isDestroyed && editor?.isEmpty && parsedContent && parsedContent !== "<p></p>") {
1817
+ editor?.commands.setContent(parsedContent);
1818
+ }
1819
+ }, 200);
1820
+ return () => clearTimeout(timer);
1821
+ }, [parsedContent, editor]);
1822
+ useEffect(() => {
1823
+ if (resetValue && !initialContent) {
1824
+ editor?.commands.clearContent();
1825
+ }
1826
+ }, [initialContent, resetValue, editor]);
1827
+ useEffect(() => {
1828
+ if (!fullscreen) return void 0;
1829
+ document.body.style.overflow = "hidden";
1830
+ window.addEventListener("keydown", handleExitFullscreen);
1831
+ return () => {
1832
+ document.body.style.overflow = "";
1833
+ window.removeEventListener("keydown", handleExitFullscreen);
1834
+ };
1835
+ }, [fullscreen, handleExitFullscreen]);
1836
+ const rootClassName = [
1837
+ editorClasses.root,
1838
+ className,
1839
+ error && editorClasses.state.error,
1840
+ !editable && editorClasses.state.disabled,
1841
+ fullscreen && editorClasses.state.fullscreen
1842
+ ].filter(Boolean).join(" ");
1843
+ return /* @__PURE__ */ jsxs(Portal, { disablePortal: !fullscreen, children: [
1844
+ fullscreen && /* @__PURE__ */ jsx(Backdrop, { open: true, sx: (theme) => ({ zIndex: theme.zIndex.modal - 1 }) }),
1845
+ /* @__PURE__ */ jsxs(
1846
+ Box,
1847
+ {
1848
+ ...slotProps?.wrapper,
1849
+ sx: [
1850
+ { display: "flex", flexDirection: "column" },
1851
+ ...Array.isArray(slotProps?.wrapper?.sx) ? slotProps.wrapper.sx : [slotProps?.wrapper?.sx]
1852
+ ],
1853
+ children: [
1854
+ /* @__PURE__ */ jsx(EditorRoot, { className: rootClassName, sx: [{ minHeight }, ...Array.isArray(sx) ? sx : [sx]], children: editor && !editor.isDestroyed && /* @__PURE__ */ jsxs(Fragment, { children: [
1855
+ showToolbar && /* @__PURE__ */ jsx(
1856
+ Toolbar,
1857
+ {
1858
+ editor,
1859
+ toolbar: resolvedToolbar,
1860
+ fullscreen,
1861
+ onToggleFullscreen: handleToggleFullscreen
1862
+ }
1863
+ ),
1864
+ showBubbleMenu && /* @__PURE__ */ jsx(BubbleToolbar, { editor }),
1865
+ /* @__PURE__ */ jsx(
1866
+ EditorContent,
1867
+ {
1868
+ ref: contentRef,
1869
+ spellCheck: false,
1870
+ autoComplete: "off",
1871
+ autoCapitalize: "off",
1872
+ editor,
1873
+ className: editorClasses.content.root,
1874
+ style: maxHeight ? { maxHeight, overflowY: "auto" } : void 0
1875
+ }
1876
+ )
1877
+ ] }) }),
1878
+ helperText && /* @__PURE__ */ jsx(FormHelperText, { error: !!error, children: helperText })
1879
+ ]
1880
+ }
1881
+ )
1882
+ ] });
1883
+ }
1884
+
1885
+ export { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, BoldIcon, BubbleToolbar, BulletListIcon, CheckListIcon, ClearFormat, ClearMarksIcon, CodeBlockIcon, CodeHighlightBlock, Editor, ExitFullscreenIcon, FullscreenIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, H6Icon, HardBreakIcon, HeadingBlock, HorizontalRuleIcon, ImageBlock, ImageIcon, InlineCodeIcon, ItalicIcon, LinkBlock, LinkIcon, OrderedListIcon, ParagraphIcon, QuoteIcon, RedoIcon, StrikeIcon, TableIcon, TextTransform, Toolbar, ToolbarItem, UnderlineIcon, UndoIcon, UnlinkIcon, editorClasses, resolveToolbar, useToolbarState };
1886
+ //# sourceMappingURL=chunk-YJMAQL3S.js.map
1887
+ //# sourceMappingURL=chunk-YJMAQL3S.js.map