@dooherceg/tiptap-controlled-editor-with-table 0.0.9 → 0.0.11

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 (125) hide show
  1. package/dist/Combination-CO0ZtURs.js +1333 -0
  2. package/dist/assets/{components/tiptap-ui-primitive/badge/badge-colors.css → badge.css} +1 -1
  3. package/dist/assets/{components/tiptap-ui-primitive/button/button-colors.css → button.css} +1 -1
  4. package/dist/assets/simple-editor.css +1 -0
  5. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +58 -6
  6. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -5
  7. package/dist/components/tiptap-templates/simple/simple-editor.d.ts +3 -1
  8. package/dist/components/tiptap-templates/simple/simple-editor.js +1970 -201
  9. package/dist/components/tiptap-templates/simple/theme-toggle.js +7 -7
  10. package/dist/components/tiptap-ui/blockquote-button/blockquote-button.js +10 -10
  11. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +5 -6
  12. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  13. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +16 -16
  14. package/dist/components/tiptap-ui/heading-button/heading-button.js +9 -9
  15. package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js +37 -29
  16. package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.js +14 -13
  17. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  18. package/dist/components/tiptap-ui/insert-table-button/insert-table-button.js +9 -9
  19. package/dist/components/tiptap-ui/link-popover/link-popover.js +13 -13
  20. package/dist/components/tiptap-ui/list-button/list-button.js +7 -7
  21. package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.js +24 -20
  22. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +6 -5
  23. package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.js +28 -28
  24. package/dist/components/tiptap-ui-primitive/badge/badge.js +16 -19
  25. package/dist/components/tiptap-ui-primitive/button/button.js +19 -22
  26. package/dist/components/tiptap-ui-primitive/card/card.js +12 -13
  27. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +1012 -39
  28. package/dist/components/tiptap-ui-primitive/input/input.js +6 -7
  29. package/dist/components/tiptap-ui-primitive/popover/popover.js +233 -24
  30. package/dist/components/tiptap-ui-primitive/separator/separator.js +8 -9
  31. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +7 -8
  32. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +1330 -84
  33. package/dist/floating-ui.react-dom-DgOuULHo.js +1334 -0
  34. package/dist/hooks/use-throttled-callback.js +108 -13
  35. package/dist/{node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js → index-Bqw9S4qP.js} +55 -57
  36. package/package.json +1 -1
  37. package/dist/_virtual/_commonjsHelpers.js +0 -8
  38. package/dist/_virtual/index.js +0 -7
  39. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +0 -1
  40. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +0 -1
  41. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +0 -1
  42. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +0 -1
  43. package/dist/assets/components/tiptap-node/image-node/image-node.css +0 -1
  44. package/dist/assets/components/tiptap-node/list-node/list-node.css +0 -1
  45. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +0 -1
  46. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +0 -1
  47. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +0 -1
  48. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +0 -1
  49. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +0 -1
  50. package/dist/assets/components/tiptap-ui-primitive/button/button.css +0 -1
  51. package/dist/assets/styles/_keyframe-animations.css +0 -1
  52. package/dist/assets/styles/_variables.css +0 -1
  53. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -527
  54. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -402
  55. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +0 -932
  56. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +0 -185
  57. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -208
  58. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -136
  59. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -130
  60. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -9
  61. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -24
  62. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -48
  63. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -29
  64. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -53
  65. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -10
  66. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -127
  67. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -221
  68. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -17
  69. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -136
  70. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -13
  71. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -636
  72. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -239
  73. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -219
  74. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -15
  75. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -70
  76. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -36
  77. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -183
  78. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -49
  79. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -10
  80. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -52
  81. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -14
  82. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -6
  83. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -27
  84. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +0 -84
  85. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -57
  86. package/dist/node_modules/@tiptap/extension-image/dist/index.js +0 -128
  87. package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -713
  88. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +0 -40
  89. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +0 -40
  90. package/dist/node_modules/@tiptap/extension-table/dist/index.js +0 -380
  91. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +0 -46
  92. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +0 -125
  93. package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -288
  94. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -52
  95. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -7
  96. package/dist/node_modules/lodash.throttle/index.js +0 -95
  97. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -11
  98. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -112
  99. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -31
  100. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -16
  101. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -68
  102. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  103. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  104. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -71
  105. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -7
  106. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -25
  107. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -11
  108. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -15
  109. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -30
  110. package/dist/node_modules/tabbable/dist/index.esm.js +0 -197
  111. package/dist/node_modules/tslib/tslib.es6.js +0 -27
  112. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -6
  113. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -26
  114. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -25
  115. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -18
  116. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -67
  117. /package/dist/assets/{components/tiptap-ui-primitive/card/card.css → card.css} +0 -0
  118. /package/dist/assets/{components/tiptap-ui/color-highlight-button/color-highlight-button.css → color-highlight-button.css} +0 -0
  119. /package/dist/assets/{components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css → dropdown-menu.css} +0 -0
  120. /package/dist/assets/{components/tiptap-node/image-upload-node/image-upload-node.css → image-upload-node.css} +0 -0
  121. /package/dist/assets/{components/tiptap-ui-primitive/input/input.css → input.css} +0 -0
  122. /package/dist/assets/{components/tiptap-ui-primitive/popover/popover.css → popover.css} +0 -0
  123. /package/dist/assets/{components/tiptap-ui-primitive/separator/separator.css → separator.css} +0 -0
  124. /package/dist/assets/{components/tiptap-ui-primitive/toolbar/toolbar.css → toolbar.css} +0 -0
  125. /package/dist/assets/{components/tiptap-ui-primitive/tooltip/tooltip.css → tooltip.css} +0 -0
@@ -1,220 +1,1989 @@
1
- import { jsx as o, jsxs as e, Fragment as y } from "react/jsx-runtime";
2
- import { useEditor as E, EditorContext as H, EditorContent as S } from "@tiptap/react";
3
- import { forwardRef as v, useState as x, useRef as C, useEffect as h, useImperativeHandle as w } from "react";
4
- import '../../../assets/components/tiptap-templates/simple/simple-editor.css';import '../../../assets/components/tiptap-node/paragraph-node/paragraph-node.css';import '../../../assets/components/tiptap-node/list-node/list-node.css';import '../../../assets/components/tiptap-node/image-node/image-node.css';import '../../../assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css';import '../../../assets/components/tiptap-node/heading-node/heading-node.css';import '../../../assets/components/tiptap-node/code-block-node/code-block-node.css';import '../../../assets/components/tiptap-node/blockquote-node/blockquote-node.css';import '../../../assets/styles/_variables.css';import '../../../assets/styles/_keyframe-animations.css';/* empty css */
5
- /* empty css */
6
- import { Highlight as R } from "../../../node_modules/@tiptap/extension-highlight/dist/index.js";
7
- import { Image as P } from "../../../node_modules/@tiptap/extension-image/dist/index.js";
8
- import { TaskList as M, TaskItem as U } from "../../../node_modules/@tiptap/extension-list/dist/index.js";
9
- import { Subscript as z } from "../../../node_modules/@tiptap/extension-subscript/dist/index.js";
10
- import { Superscript as N } from "../../../node_modules/@tiptap/extension-superscript/dist/index.js";
11
- import { TextAlign as A } from "../../../node_modules/@tiptap/extension-text-align/dist/index.js";
12
- import { Typography as j } from "../../../node_modules/@tiptap/extension-typography/dist/index.js";
13
- import { Selection as F, Placeholder as V } from "../../../node_modules/@tiptap/extensions/dist/index.js";
14
- import { StarterKit as D } from "@tiptap/starter-kit";
15
- /* empty css */
16
- /* empty css */
17
- /* empty css */
18
- import { HorizontalRule as K } from "../../tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js";
19
- /* empty css */
20
- /* empty css */
21
- import { ImageUploadNode as O } from "../../tiptap-node/image-upload-node/image-upload-node-extension.js";
22
- /* empty css */
23
- /* empty css */
24
- import { ArrowLeftIcon as _ } from "../../tiptap-icons/arrow-left-icon.js";
25
- import { HighlighterIcon as q } from "../../tiptap-icons/highlighter-icon.js";
26
- import { LinkIcon as G } from "../../tiptap-icons/link-icon.js";
27
- import { useCursorVisibility as W } from "../../../hooks/use-cursor-visibility.js";
28
- import { useIsMobile as X } from "../../../hooks/use-mobile.js";
29
- import { useWindowSize as Z } from "../../../hooks/use-window-size.js";
30
- import { handleImageUpload as $, MAX_FILE_SIZE as J } from "../../../lib/tiptap-utils.js";
31
- /* empty css */
32
- import { InsertTableButton as Q } from "../../tiptap-ui/insert-table-button/insert-table-button.js";
33
- import Y from "../../tiptap-ui/table-actions-toolbar/table-actions-toolbar.js";
34
- import { useTiptapEditor as oo } from "../../../hooks/use-tiptap-editor.js";
35
- import { TableKit as to } from "../../../node_modules/@tiptap/extension-table/dist/index.js";
36
- import { Toolbar as ro, ToolbarGroup as n, ToolbarSeparator as l } from "../../tiptap-ui-primitive/toolbar/toolbar.js";
37
- import { UndoRedoButton as T } from "../../tiptap-ui/undo-redo-button/undo-redo-button.js";
38
- import { HeadingDropdownMenu as eo } from "../../tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js";
39
- import { ListDropdownMenu as io } from "../../tiptap-ui/list-dropdown-menu/list-dropdown-menu.js";
40
- import { BlockquoteButton as no } from "../../tiptap-ui/blockquote-button/blockquote-button.js";
41
- import { CodeBlockButton as lo } from "../../tiptap-ui/code-block-button/code-block-button.js";
42
- import { MarkButton as i } from "../../tiptap-ui/mark-button/mark-button.js";
43
- import { ColorHighlightPopover as mo, ColorHighlightPopoverButton as ao, ColorHighlightPopoverContent as po } from "../../tiptap-ui/color-highlight-popover/color-highlight-popover.js";
44
- import { LinkPopover as co, LinkButton as so, LinkContent as uo } from "../../tiptap-ui/link-popover/link-popover.js";
45
- import { TextAlignButton as d } from "../../tiptap-ui/text-align-button/text-align-button.js";
46
- import { Button as fo } from "../../tiptap-ui-primitive/button/button.js";
47
- const go = ({
48
- onHighlighterClick: a,
49
- onLinkClick: m,
50
- isMobile: t
1
+ import { jsx as p, jsxs as w, Fragment as at } from "react/jsx-runtime";
2
+ import { useEditor as Ct, EditorContext as Lt, EditorContent as wt } from "@tiptap/react";
3
+ import { useState as vt, useRef as q, useEffect as D, useImperativeHandle as Mt } from "react";
4
+ import { Mark as Q, markPasteRule as xt, markInputRule as At, mergeAttributes as k, Node as L, nodeInputRule as It, ResizableNodeView as St, wrappingInputRule as S, renderNestedMarkdownContent as lt, Extension as C, parseIndentedBlocks as F, isNodeActive as _, isAtStartOfNode as Ht, isAtEndOfNode as Et, getNodeType as ut, getNodeAtPosition as $t, textInputRule as y, callOrReturn as dt, getExtensionField as ct, isNodeEmpty as Nt, isNodeSelection as Rt, findParentNodeClosestToPos as Pt } from "@tiptap/core";
5
+ import { Plugin as H, PluginKey as E, TextSelection as Bt } from "prosemirror-state";
6
+ import { dropCursor as Ot } from "prosemirror-dropcursor";
7
+ import { DecorationSet as B, Decoration as K } from "prosemirror-view";
8
+ import { gapCursor as Dt } from "prosemirror-gapcursor";
9
+ import { history as _t, redo as zt, undo as Wt } from "prosemirror-history";
10
+ import { StarterKit as jt } from "@tiptap/starter-kit";
11
+ import { Button as Qt } from "../../tiptap-ui-primitive/button/button.js";
12
+ import { Toolbar as Kt, ToolbarGroup as x, ToolbarSeparator as A } from "../../tiptap-ui-primitive/toolbar/toolbar.js";
13
+ import { HorizontalRule as Vt } from "../../tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js";
14
+ import { ImageUploadNode as qt } from "../../tiptap-node/image-upload-node/image-upload-node-extension.js";
15
+ import { BlockquoteButton as Ft } from "../../tiptap-ui/blockquote-button/blockquote-button.js";
16
+ import { useTiptapEditor as Ut } from "../../../hooks/use-tiptap-editor.js";
17
+ import "../../tiptap-icons/blockquote-icon.js";
18
+ import { handleImageUpload as Gt, MAX_FILE_SIZE as Xt } from "../../../lib/tiptap-utils.js";
19
+ import { CodeBlockButton as Yt } from "../../tiptap-ui/code-block-button/code-block-button.js";
20
+ import "../../tiptap-icons/code-block-icon.js";
21
+ import { ColorHighlightPopover as Zt, ColorHighlightPopoverButton as Jt, ColorHighlightPopoverContent as te } from "../../tiptap-ui/color-highlight-popover/color-highlight-popover.js";
22
+ import { HeadingDropdownMenu as ee } from "../../tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js";
23
+ import "../../tiptap-icons/heading-icon.js";
24
+ import "../../tiptap-ui/heading-button/heading-button.js";
25
+ import "../../tiptap-icons/heading-one-icon.js";
26
+ import "../../tiptap-icons/heading-two-icon.js";
27
+ import "../../tiptap-icons/heading-three-icon.js";
28
+ import "../../tiptap-icons/heading-four-icon.js";
29
+ import "../../tiptap-icons/heading-five-icon.js";
30
+ import "../../tiptap-icons/heading-six-icon.js";
31
+ import { LinkPopover as re, LinkButton as ne, LinkContent as se } from "../../tiptap-ui/link-popover/link-popover.js";
32
+ import { LinkIcon as ie } from "../../tiptap-icons/link-icon.js";
33
+ import { ListDropdownMenu as oe } from "../../tiptap-ui/list-dropdown-menu/list-dropdown-menu.js";
34
+ import { MarkButton as M } from "../../tiptap-ui/mark-button/mark-button.js";
35
+ import "../../tiptap-icons/bold-icon.js";
36
+ import "../../tiptap-icons/code2-icon.js";
37
+ import "../../tiptap-icons/italic-icon.js";
38
+ import "../../tiptap-icons/strike-icon.js";
39
+ import "../../tiptap-icons/subscript-icon.js";
40
+ import "../../tiptap-icons/superscript-icon.js";
41
+ import "../../tiptap-icons/underline-icon.js";
42
+ import { TextAlignButton as R } from "../../tiptap-ui/text-align-button/text-align-button.js";
43
+ import "../../tiptap-icons/align-center-icon.js";
44
+ import "../../tiptap-icons/align-justify-icon.js";
45
+ import "../../tiptap-icons/align-left-icon.js";
46
+ import "../../tiptap-icons/align-right-icon.js";
47
+ import { UndoRedoButton as U } from "../../tiptap-ui/undo-redo-button/undo-redo-button.js";
48
+ import "../../tiptap-icons/redo2-icon.js";
49
+ import "../../tiptap-icons/undo2-icon.js";
50
+ import { ArrowLeftIcon as ae } from "../../tiptap-icons/arrow-left-icon.js";
51
+ import { HighlighterIcon as le } from "../../tiptap-icons/highlighter-icon.js";
52
+ import { useCursorVisibility as ue } from "../../../hooks/use-cursor-visibility.js";
53
+ import { useIsMobile as de } from "../../../hooks/use-mobile.js";
54
+ import { useWindowSize as ce } from "../../../hooks/use-window-size.js";
55
+ import { InsertTableButton as pe } from "../../tiptap-ui/insert-table-button/insert-table-button.js";
56
+ import he from "../../tiptap-ui/table-actions-toolbar/table-actions-toolbar.js";
57
+ import { columnResizing as fe, tableEditing as me, CellSelection as pt, fixTables as ge, goToNextCell as G, setCellAttr as be, mergeCells as X, splitCell as Y, toggleHeaderCell as ye, toggleHeader as Z, deleteTable as ke, deleteRow as Te, addRowAfter as Ce, addRowBefore as Le, deleteColumn as we, addColumnAfter as ve, addColumnBefore as Me } from "prosemirror-tables";
58
+ import '../../../assets/simple-editor.css';var xe = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Ae = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, Ie = Q.create({
59
+ name: "highlight",
60
+ addOptions() {
61
+ return {
62
+ multicolor: !1,
63
+ HTMLAttributes: {}
64
+ };
65
+ },
66
+ addAttributes() {
67
+ return this.options.multicolor ? {
68
+ color: {
69
+ default: null,
70
+ parseHTML: (t) => t.getAttribute("data-color") || t.style.backgroundColor,
71
+ renderHTML: (t) => t.color ? {
72
+ "data-color": t.color,
73
+ style: `background-color: ${t.color}; color: inherit`
74
+ } : {}
75
+ }
76
+ } : {};
77
+ },
78
+ parseHTML() {
79
+ return [
80
+ {
81
+ tag: "mark"
82
+ }
83
+ ];
84
+ },
85
+ renderHTML({ HTMLAttributes: t }) {
86
+ return ["mark", k(this.options.HTMLAttributes, t), 0];
87
+ },
88
+ renderMarkdown: (t, e) => `==${e.renderChildren(t)}==`,
89
+ parseMarkdown: (t, e) => e.applyMark("highlight", e.parseInline(t.tokens || [])),
90
+ markdownTokenizer: {
91
+ name: "highlight",
92
+ level: "inline",
93
+ start: (t) => t.indexOf("=="),
94
+ tokenize(t, e, r) {
95
+ const s = /^(==)([^=]+)(==)/.exec(t);
96
+ if (s) {
97
+ const i = s[2].trim(), a = r.inlineTokens(i);
98
+ return {
99
+ type: "highlight",
100
+ raw: s[0],
101
+ text: i,
102
+ tokens: a
103
+ };
104
+ }
105
+ }
106
+ },
107
+ addCommands() {
108
+ return {
109
+ setHighlight: (t) => ({ commands: e }) => e.setMark(this.name, t),
110
+ toggleHighlight: (t) => ({ commands: e }) => e.toggleMark(this.name, t),
111
+ unsetHighlight: () => ({ commands: t }) => t.unsetMark(this.name)
112
+ };
113
+ },
114
+ addKeyboardShortcuts() {
115
+ return {
116
+ "Mod-Shift-h": () => this.editor.commands.toggleHighlight()
117
+ };
118
+ },
119
+ addInputRules() {
120
+ return [
121
+ At({
122
+ find: xe,
123
+ type: this.type
124
+ })
125
+ ];
126
+ },
127
+ addPasteRules() {
128
+ return [
129
+ xt({
130
+ find: Ae,
131
+ type: this.type
132
+ })
133
+ ];
134
+ }
135
+ }), Se = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, He = L.create({
136
+ name: "image",
137
+ addOptions() {
138
+ return {
139
+ inline: !1,
140
+ allowBase64: !1,
141
+ HTMLAttributes: {},
142
+ resize: !1
143
+ };
144
+ },
145
+ inline() {
146
+ return this.options.inline;
147
+ },
148
+ group() {
149
+ return this.options.inline ? "inline" : "block";
150
+ },
151
+ draggable: !0,
152
+ addAttributes() {
153
+ return {
154
+ src: {
155
+ default: null
156
+ },
157
+ alt: {
158
+ default: null
159
+ },
160
+ title: {
161
+ default: null
162
+ },
163
+ width: {
164
+ default: null
165
+ },
166
+ height: {
167
+ default: null
168
+ }
169
+ };
170
+ },
171
+ parseHTML() {
172
+ return [
173
+ {
174
+ tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
175
+ }
176
+ ];
177
+ },
178
+ renderHTML({ HTMLAttributes: t }) {
179
+ return ["img", k(this.options.HTMLAttributes, t)];
180
+ },
181
+ parseMarkdown: (t, e) => e.createNode("image", {
182
+ src: t.href,
183
+ title: t.title,
184
+ alt: t.text
185
+ }),
186
+ renderMarkdown: (t) => {
187
+ var e, r, n, s, i, a;
188
+ const o = (r = (e = t.attrs) == null ? void 0 : e.src) != null ? r : "", c = (s = (n = t.attrs) == null ? void 0 : n.alt) != null ? s : "", l = (a = (i = t.attrs) == null ? void 0 : i.title) != null ? a : "";
189
+ return l ? `![${c}](${o} "${l}")` : `![${c}](${o})`;
190
+ },
191
+ addNodeView() {
192
+ if (!this.options.resize || !this.options.resize.enabled || typeof document > "u" || !this.editor.isEditable)
193
+ return null;
194
+ const { directions: t, minWidth: e, minHeight: r, alwaysPreserveAspectRatio: n } = this.options.resize;
195
+ return ({ node: s, getPos: i, HTMLAttributes: a }) => {
196
+ const o = document.createElement("img");
197
+ Object.entries(a).forEach(([d, u]) => {
198
+ if (u != null)
199
+ switch (d) {
200
+ case "width":
201
+ case "height":
202
+ break;
203
+ default:
204
+ o.setAttribute(d, u);
205
+ break;
206
+ }
207
+ }), o.src = a.src;
208
+ const c = new St({
209
+ element: o,
210
+ node: s,
211
+ getPos: i,
212
+ onResize: (d, u) => {
213
+ o.style.width = `${d}px`, o.style.height = `${u}px`;
214
+ },
215
+ onCommit: (d, u) => {
216
+ const h = i();
217
+ h !== void 0 && this.editor.chain().setNodeSelection(h).updateAttributes(this.name, {
218
+ width: d,
219
+ height: u
220
+ }).run();
221
+ },
222
+ onUpdate: (d, u, h) => d.type === s.type,
223
+ options: {
224
+ directions: t,
225
+ min: {
226
+ width: e,
227
+ height: r
228
+ },
229
+ preserveAspectRatio: n === !0
230
+ }
231
+ }), l = c.dom;
232
+ return l.style.visibility = "hidden", l.style.pointerEvents = "none", o.onload = () => {
233
+ l.style.visibility = "", l.style.pointerEvents = "";
234
+ }, c;
235
+ };
236
+ },
237
+ addCommands() {
238
+ return {
239
+ setImage: (t) => ({ commands: e }) => e.insertContent({
240
+ type: this.name,
241
+ attrs: t
242
+ })
243
+ };
244
+ },
245
+ addInputRules() {
246
+ return [
247
+ It({
248
+ find: Se,
249
+ type: this.type,
250
+ getAttributes: (t) => {
251
+ const [, , e, r, n] = t;
252
+ return { src: r, alt: e, title: n };
253
+ }
254
+ })
255
+ ];
256
+ }
257
+ }), Ee = Object.defineProperty, $e = (t, e) => {
258
+ for (var r in e)
259
+ Ee(t, r, { get: e[r], enumerable: !0 });
260
+ }, Ne = "listItem", J = "textStyle", tt = /^\s*([-+*])\s$/, Re = L.create({
261
+ name: "bulletList",
262
+ addOptions() {
263
+ return {
264
+ itemTypeName: "listItem",
265
+ HTMLAttributes: {},
266
+ keepMarks: !1,
267
+ keepAttributes: !1
268
+ };
269
+ },
270
+ group: "block list",
271
+ content() {
272
+ return `${this.options.itemTypeName}+`;
273
+ },
274
+ parseHTML() {
275
+ return [{ tag: "ul" }];
276
+ },
277
+ renderHTML({ HTMLAttributes: t }) {
278
+ return ["ul", k(this.options.HTMLAttributes, t), 0];
279
+ },
280
+ markdownTokenName: "list",
281
+ parseMarkdown: (t, e) => t.type !== "list" || t.ordered ? [] : {
282
+ type: "bulletList",
283
+ content: t.items ? e.parseChildren(t.items) : []
284
+ },
285
+ renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
286
+ `) : "",
287
+ markdownOptions: {
288
+ indentsContent: !0
289
+ },
290
+ addCommands() {
291
+ return {
292
+ toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ne, this.editor.getAttributes(J)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
293
+ };
294
+ },
295
+ addKeyboardShortcuts() {
296
+ return {
297
+ "Mod-Shift-8": () => this.editor.commands.toggleBulletList()
298
+ };
299
+ },
300
+ addInputRules() {
301
+ let t = S({
302
+ find: tt,
303
+ type: this.type
304
+ });
305
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = S({
306
+ find: tt,
307
+ type: this.type,
308
+ keepMarks: this.options.keepMarks,
309
+ keepAttributes: this.options.keepAttributes,
310
+ getAttributes: () => this.editor.getAttributes(J),
311
+ editor: this.editor
312
+ })), [t];
313
+ }
314
+ }), Pe = L.create({
315
+ name: "listItem",
316
+ addOptions() {
317
+ return {
318
+ HTMLAttributes: {},
319
+ bulletListTypeName: "bulletList",
320
+ orderedListTypeName: "orderedList"
321
+ };
322
+ },
323
+ content: "paragraph block*",
324
+ defining: !0,
325
+ parseHTML() {
326
+ return [
327
+ {
328
+ tag: "li"
329
+ }
330
+ ];
331
+ },
332
+ renderHTML({ HTMLAttributes: t }) {
333
+ return ["li", k(this.options.HTMLAttributes, t), 0];
334
+ },
335
+ markdownTokenName: "list_item",
336
+ parseMarkdown: (t, e) => {
337
+ if (t.type !== "list_item")
338
+ return [];
339
+ let r = [];
340
+ if (t.tokens && t.tokens.length > 0)
341
+ if (t.tokens.some((s) => s.type === "paragraph"))
342
+ r = e.parseChildren(t.tokens);
343
+ else {
344
+ const s = t.tokens[0];
345
+ if (s && s.type === "text" && s.tokens && s.tokens.length > 0) {
346
+ if (r = [
347
+ {
348
+ type: "paragraph",
349
+ content: e.parseInline(s.tokens)
350
+ }
351
+ ], t.tokens.length > 1) {
352
+ const a = t.tokens.slice(1), o = e.parseChildren(a);
353
+ r.push(...o);
354
+ }
355
+ } else
356
+ r = e.parseChildren(t.tokens);
357
+ }
358
+ return r.length === 0 && (r = [
359
+ {
360
+ type: "paragraph",
361
+ content: []
362
+ }
363
+ ]), {
364
+ type: "listItem",
365
+ content: r
366
+ };
367
+ },
368
+ renderMarkdown: (t, e, r) => lt(
369
+ t,
370
+ e,
371
+ (n) => n.parentType === "bulletList" ? "- " : n.parentType === "orderedList" ? `${n.index + 1}. ` : "- ",
372
+ r
373
+ ),
374
+ addKeyboardShortcuts() {
375
+ return {
376
+ Enter: () => this.editor.commands.splitListItem(this.name),
377
+ Tab: () => this.editor.commands.sinkListItem(this.name),
378
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
379
+ };
380
+ }
381
+ }), Be = {};
382
+ $e(Be, {
383
+ findListItemPos: () => $,
384
+ getNextListDepth: () => V,
385
+ handleBackspace: () => z,
386
+ handleDelete: () => W,
387
+ hasListBefore: () => ht,
388
+ hasListItemAfter: () => Oe,
389
+ hasListItemBefore: () => ft,
390
+ listItemHasSubList: () => mt,
391
+ nextListIsDeeper: () => gt,
392
+ nextListIsHigher: () => bt
393
+ });
394
+ var $ = (t, e) => {
395
+ const { $from: r } = e.selection, n = ut(t, e.schema);
396
+ let s = null, i = r.depth, a = r.pos, o = null;
397
+ for (; i > 0 && o === null; )
398
+ s = r.node(i), s.type === n ? o = i : (i -= 1, a -= 1);
399
+ return o === null ? null : { $pos: e.doc.resolve(a), depth: o };
400
+ }, V = (t, e) => {
401
+ const r = $(t, e);
402
+ if (!r)
403
+ return !1;
404
+ const [, n] = $t(e, t, r.$pos.pos + 4);
405
+ return n;
406
+ }, ht = (t, e, r) => {
407
+ const { $anchor: n } = t.selection, s = Math.max(0, n.pos - 2), i = t.doc.resolve(s).node();
408
+ return !(!i || !r.includes(i.type.name));
409
+ }, ft = (t, e) => {
410
+ var r;
411
+ const { $anchor: n } = e.selection, s = e.doc.resolve(n.pos - 2);
412
+ return !(s.index() === 0 || ((r = s.nodeBefore) == null ? void 0 : r.type.name) !== t);
413
+ }, mt = (t, e, r) => {
414
+ if (!r)
415
+ return !1;
416
+ const n = ut(t, e.schema);
417
+ let s = !1;
418
+ return r.descendants((i) => {
419
+ i.type === n && (s = !0);
420
+ }), s;
421
+ }, z = (t, e, r) => {
422
+ if (t.commands.undoInputRule())
423
+ return !0;
424
+ if (t.state.selection.from !== t.state.selection.to)
425
+ return !1;
426
+ if (!_(t.state, e) && ht(t.state, e, r)) {
427
+ const { $anchor: o } = t.state.selection, c = t.state.doc.resolve(o.before() - 1), l = [];
428
+ c.node().descendants((h, m) => {
429
+ h.type.name === e && l.push({ node: h, pos: m });
430
+ });
431
+ const d = l.at(-1);
432
+ if (!d)
433
+ return !1;
434
+ const u = t.state.doc.resolve(c.start() + d.pos + 1);
435
+ return t.chain().cut({ from: o.start() - 1, to: o.end() + 1 }, u.end()).joinForward().run();
436
+ }
437
+ if (!_(t.state, e) || !Ht(t.state))
438
+ return !1;
439
+ const n = $(e, t.state);
440
+ if (!n)
441
+ return !1;
442
+ const i = t.state.doc.resolve(n.$pos.pos - 2).node(n.depth), a = mt(e, t.state, i);
443
+ return ft(e, t.state) && !a ? t.commands.joinItemBackward() : t.chain().liftListItem(e).run();
444
+ }, gt = (t, e) => {
445
+ const r = V(t, e), n = $(t, e);
446
+ return !n || !r ? !1 : r > n.depth;
447
+ }, bt = (t, e) => {
448
+ const r = V(t, e), n = $(t, e);
449
+ return !n || !r ? !1 : r < n.depth;
450
+ }, W = (t, e) => {
451
+ if (!_(t.state, e) || !Et(t.state, e))
452
+ return !1;
453
+ const { selection: r } = t.state, { $from: n, $to: s } = r;
454
+ return !r.empty && n.sameParent(s) ? !1 : gt(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : bt(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
455
+ }, Oe = (t, e) => {
456
+ var r;
457
+ const { $anchor: n } = e.selection, s = e.doc.resolve(n.pos - n.parentOffset - 2);
458
+ return !(s.index() === s.parent.childCount - 1 || ((r = s.nodeAfter) == null ? void 0 : r.type.name) !== t);
459
+ }, De = C.create({
460
+ name: "listKeymap",
461
+ addOptions() {
462
+ return {
463
+ listTypes: [
464
+ {
465
+ itemName: "listItem",
466
+ wrapperNames: ["bulletList", "orderedList"]
467
+ },
468
+ {
469
+ itemName: "taskItem",
470
+ wrapperNames: ["taskList"]
471
+ }
472
+ ]
473
+ };
474
+ },
475
+ addKeyboardShortcuts() {
476
+ return {
477
+ Delete: ({ editor: t }) => {
478
+ let e = !1;
479
+ return this.options.listTypes.forEach(({ itemName: r }) => {
480
+ t.state.schema.nodes[r] !== void 0 && W(t, r) && (e = !0);
481
+ }), e;
482
+ },
483
+ "Mod-Delete": ({ editor: t }) => {
484
+ let e = !1;
485
+ return this.options.listTypes.forEach(({ itemName: r }) => {
486
+ t.state.schema.nodes[r] !== void 0 && W(t, r) && (e = !0);
487
+ }), e;
488
+ },
489
+ Backspace: ({ editor: t }) => {
490
+ let e = !1;
491
+ return this.options.listTypes.forEach(({ itemName: r, wrapperNames: n }) => {
492
+ t.state.schema.nodes[r] !== void 0 && z(t, r, n) && (e = !0);
493
+ }), e;
494
+ },
495
+ "Mod-Backspace": ({ editor: t }) => {
496
+ let e = !1;
497
+ return this.options.listTypes.forEach(({ itemName: r, wrapperNames: n }) => {
498
+ t.state.schema.nodes[r] !== void 0 && z(t, r, n) && (e = !0);
499
+ }), e;
500
+ }
501
+ };
502
+ }
503
+ }), et = /^(\s*)(\d+)\.\s+(.*)$/, _e = /^\s/;
504
+ function ze(t) {
505
+ const e = [];
506
+ let r = 0, n = 0;
507
+ for (; r < t.length; ) {
508
+ const s = t[r], i = s.match(et);
509
+ if (!i)
510
+ break;
511
+ const [, a, o, c] = i, l = a.length;
512
+ let d = c, u = r + 1;
513
+ const h = [s];
514
+ for (; u < t.length; ) {
515
+ const m = t[u];
516
+ if (m.match(et))
517
+ break;
518
+ if (m.trim() === "")
519
+ h.push(m), d += `
520
+ `, u += 1;
521
+ else if (m.match(_e))
522
+ h.push(m), d += `
523
+ ${m.slice(l + 2)}`, u += 1;
524
+ else
525
+ break;
526
+ }
527
+ e.push({
528
+ indent: l,
529
+ number: parseInt(o, 10),
530
+ content: d.trim(),
531
+ raw: h.join(`
532
+ `)
533
+ }), n = u, r = u;
534
+ }
535
+ return [e, n];
536
+ }
537
+ function yt(t, e, r) {
538
+ var n;
539
+ const s = [];
540
+ let i = 0;
541
+ for (; i < t.length; ) {
542
+ const a = t[i];
543
+ if (a.indent === e) {
544
+ const o = a.content.split(`
545
+ `), c = ((n = o[0]) == null ? void 0 : n.trim()) || "", l = [];
546
+ c && l.push({
547
+ type: "paragraph",
548
+ raw: c,
549
+ tokens: r.inlineTokens(c)
550
+ });
551
+ const d = o.slice(1).join(`
552
+ `).trim();
553
+ if (d) {
554
+ const m = r.blockTokens(d);
555
+ l.push(...m);
556
+ }
557
+ let u = i + 1;
558
+ const h = [];
559
+ for (; u < t.length && t[u].indent > e; )
560
+ h.push(t[u]), u += 1;
561
+ if (h.length > 0) {
562
+ const m = Math.min(...h.map((b) => b.indent)), f = yt(h, m, r);
563
+ l.push({
564
+ type: "list",
565
+ ordered: !0,
566
+ start: h[0].number,
567
+ items: f,
568
+ raw: h.map((b) => b.raw).join(`
569
+ `)
570
+ });
571
+ }
572
+ s.push({
573
+ type: "list_item",
574
+ raw: a.raw,
575
+ tokens: l
576
+ }), i = u;
577
+ } else
578
+ i += 1;
579
+ }
580
+ return s;
581
+ }
582
+ function We(t, e) {
583
+ return t.map((r) => {
584
+ if (r.type !== "list_item")
585
+ return e.parseChildren([r])[0];
586
+ const n = [];
587
+ return r.tokens && r.tokens.length > 0 && r.tokens.forEach((s) => {
588
+ if (s.type === "paragraph" || s.type === "list" || s.type === "blockquote" || s.type === "code")
589
+ n.push(...e.parseChildren([s]));
590
+ else if (s.type === "text" && s.tokens) {
591
+ const i = e.parseChildren([s]);
592
+ n.push({
593
+ type: "paragraph",
594
+ content: i
595
+ });
596
+ } else {
597
+ const i = e.parseChildren([s]);
598
+ i.length > 0 && n.push(...i);
599
+ }
600
+ }), {
601
+ type: "listItem",
602
+ content: n
603
+ };
604
+ });
605
+ }
606
+ var je = "listItem", rt = "textStyle", nt = /^(\d+)\.\s$/, Qe = L.create({
607
+ name: "orderedList",
608
+ addOptions() {
609
+ return {
610
+ itemTypeName: "listItem",
611
+ HTMLAttributes: {},
612
+ keepMarks: !1,
613
+ keepAttributes: !1
614
+ };
615
+ },
616
+ group: "block list",
617
+ content() {
618
+ return `${this.options.itemTypeName}+`;
619
+ },
620
+ addAttributes() {
621
+ return {
622
+ start: {
623
+ default: 1,
624
+ parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
625
+ },
626
+ type: {
627
+ default: null,
628
+ parseHTML: (t) => t.getAttribute("type")
629
+ }
630
+ };
631
+ },
632
+ parseHTML() {
633
+ return [
634
+ {
635
+ tag: "ol"
636
+ }
637
+ ];
638
+ },
639
+ renderHTML({ HTMLAttributes: t }) {
640
+ const { start: e, ...r } = t;
641
+ return e === 1 ? ["ol", k(this.options.HTMLAttributes, r), 0] : ["ol", k(this.options.HTMLAttributes, t), 0];
642
+ },
643
+ markdownTokenName: "list",
644
+ parseMarkdown: (t, e) => {
645
+ if (t.type !== "list" || !t.ordered)
646
+ return [];
647
+ const r = t.start || 1, n = t.items ? We(t.items, e) : [];
648
+ return r !== 1 ? {
649
+ type: "orderedList",
650
+ attrs: { start: r },
651
+ content: n
652
+ } : {
653
+ type: "orderedList",
654
+ content: n
655
+ };
656
+ },
657
+ renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
658
+ `) : "",
659
+ markdownTokenizer: {
660
+ name: "orderedList",
661
+ level: "block",
662
+ start: (t) => {
663
+ const e = t.match(/^(\s*)(\d+)\.\s+/), r = e?.index;
664
+ return r !== void 0 ? r : -1;
665
+ },
666
+ tokenize: (t, e, r) => {
667
+ var n;
668
+ const s = t.split(`
669
+ `), [i, a] = ze(s);
670
+ if (i.length === 0)
671
+ return;
672
+ const o = yt(i, 0, r);
673
+ return o.length === 0 ? void 0 : {
674
+ type: "list",
675
+ ordered: !0,
676
+ start: ((n = i[0]) == null ? void 0 : n.number) || 1,
677
+ items: o,
678
+ raw: s.slice(0, a).join(`
679
+ `)
680
+ };
681
+ }
682
+ },
683
+ markdownOptions: {
684
+ indentsContent: !0
685
+ },
686
+ addCommands() {
687
+ return {
688
+ toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(je, this.editor.getAttributes(rt)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
689
+ };
690
+ },
691
+ addKeyboardShortcuts() {
692
+ return {
693
+ "Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
694
+ };
695
+ },
696
+ addInputRules() {
697
+ let t = S({
698
+ find: nt,
699
+ type: this.type,
700
+ getAttributes: (e) => ({ start: +e[1] }),
701
+ joinPredicate: (e, r) => r.childCount + r.attrs.start === +e[1]
702
+ });
703
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = S({
704
+ find: nt,
705
+ type: this.type,
706
+ keepMarks: this.options.keepMarks,
707
+ keepAttributes: this.options.keepAttributes,
708
+ getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(rt) }),
709
+ joinPredicate: (e, r) => r.childCount + r.attrs.start === +e[1],
710
+ editor: this.editor
711
+ })), [t];
712
+ }
713
+ }), Ke = /^\s*(\[([( |x])?\])\s$/, kt = L.create({
714
+ name: "taskItem",
715
+ addOptions() {
716
+ return {
717
+ nested: !1,
718
+ HTMLAttributes: {},
719
+ taskListTypeName: "taskList",
720
+ a11y: void 0
721
+ };
722
+ },
723
+ content() {
724
+ return this.options.nested ? "paragraph block*" : "paragraph+";
725
+ },
726
+ defining: !0,
727
+ addAttributes() {
728
+ return {
729
+ checked: {
730
+ default: !1,
731
+ keepOnSplit: !1,
732
+ parseHTML: (t) => {
733
+ const e = t.getAttribute("data-checked");
734
+ return e === "" || e === "true";
735
+ },
736
+ renderHTML: (t) => ({
737
+ "data-checked": t.checked
738
+ })
739
+ }
740
+ };
741
+ },
742
+ parseHTML() {
743
+ return [
744
+ {
745
+ tag: `li[data-type="${this.name}"]`,
746
+ priority: 51
747
+ }
748
+ ];
749
+ },
750
+ renderHTML({ node: t, HTMLAttributes: e }) {
751
+ return [
752
+ "li",
753
+ k(this.options.HTMLAttributes, e, {
754
+ "data-type": this.name
755
+ }),
756
+ [
757
+ "label",
758
+ [
759
+ "input",
760
+ {
761
+ type: "checkbox",
762
+ checked: t.attrs.checked ? "checked" : null
763
+ }
764
+ ],
765
+ ["span"]
766
+ ],
767
+ ["div", 0]
768
+ ];
769
+ },
770
+ parseMarkdown: (t, e) => {
771
+ const r = [];
772
+ if (t.tokens && t.tokens.length > 0 ? r.push(e.createNode("paragraph", {}, e.parseInline(t.tokens))) : t.text ? r.push(e.createNode("paragraph", {}, [e.createNode("text", { text: t.text })])) : r.push(e.createNode("paragraph", {}, [])), t.nestedTokens && t.nestedTokens.length > 0) {
773
+ const n = e.parseChildren(t.nestedTokens);
774
+ r.push(...n);
775
+ }
776
+ return e.createNode("taskItem", { checked: t.checked || !1 }, r);
777
+ },
778
+ renderMarkdown: (t, e) => {
779
+ var r;
780
+ const s = `- [${(r = t.attrs) != null && r.checked ? "x" : " "}] `;
781
+ return lt(t, e, s);
782
+ },
783
+ addKeyboardShortcuts() {
784
+ const t = {
785
+ Enter: () => this.editor.commands.splitListItem(this.name),
786
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
787
+ };
788
+ return this.options.nested ? {
789
+ ...t,
790
+ Tab: () => this.editor.commands.sinkListItem(this.name)
791
+ } : t;
792
+ },
793
+ addNodeView() {
794
+ return ({ node: t, HTMLAttributes: e, getPos: r, editor: n }) => {
795
+ const s = document.createElement("li"), i = document.createElement("label"), a = document.createElement("span"), o = document.createElement("input"), c = document.createElement("div"), l = (d) => {
796
+ var u, h;
797
+ o.ariaLabel = ((h = (u = this.options.a11y) == null ? void 0 : u.checkboxLabel) == null ? void 0 : h.call(u, d, o.checked)) || `Task item checkbox for ${d.textContent || "empty task item"}`;
798
+ };
799
+ return l(t), i.contentEditable = "false", o.type = "checkbox", o.addEventListener("mousedown", (d) => d.preventDefault()), o.addEventListener("change", (d) => {
800
+ if (!n.isEditable && !this.options.onReadOnlyChecked) {
801
+ o.checked = !o.checked;
802
+ return;
803
+ }
804
+ const { checked: u } = d.target;
805
+ n.isEditable && typeof r == "function" && n.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: h }) => {
806
+ const m = r();
807
+ if (typeof m != "number")
808
+ return !1;
809
+ const f = h.doc.nodeAt(m);
810
+ return h.setNodeMarkup(m, void 0, {
811
+ ...f?.attrs,
812
+ checked: u
813
+ }), !0;
814
+ }).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, u) || (o.checked = !o.checked));
815
+ }), Object.entries(this.options.HTMLAttributes).forEach(([d, u]) => {
816
+ s.setAttribute(d, u);
817
+ }), s.dataset.checked = t.attrs.checked, o.checked = t.attrs.checked, i.append(o, a), s.append(i, c), Object.entries(e).forEach(([d, u]) => {
818
+ s.setAttribute(d, u);
819
+ }), {
820
+ dom: s,
821
+ contentDOM: c,
822
+ update: (d) => d.type !== this.type ? !1 : (s.dataset.checked = d.attrs.checked, o.checked = d.attrs.checked, l(d), !0)
823
+ };
824
+ };
825
+ },
826
+ addInputRules() {
827
+ return [
828
+ S({
829
+ find: Ke,
830
+ type: this.type,
831
+ getAttributes: (t) => ({
832
+ checked: t[t.length - 1] === "x"
833
+ })
834
+ })
835
+ ];
836
+ }
837
+ }), Tt = L.create({
838
+ name: "taskList",
839
+ addOptions() {
840
+ return {
841
+ itemTypeName: "taskItem",
842
+ HTMLAttributes: {}
843
+ };
844
+ },
845
+ group: "block list",
846
+ content() {
847
+ return `${this.options.itemTypeName}+`;
848
+ },
849
+ parseHTML() {
850
+ return [
851
+ {
852
+ tag: `ul[data-type="${this.name}"]`,
853
+ priority: 51
854
+ }
855
+ ];
856
+ },
857
+ renderHTML({ HTMLAttributes: t }) {
858
+ return ["ul", k(this.options.HTMLAttributes, t, { "data-type": this.name }), 0];
859
+ },
860
+ parseMarkdown: (t, e) => e.createNode("taskList", {}, e.parseChildren(t.items || [])),
861
+ renderMarkdown: (t, e) => t.content ? e.renderChildren(t.content, `
862
+ `) : "",
863
+ markdownTokenizer: {
864
+ name: "taskList",
865
+ level: "block",
866
+ start(t) {
867
+ var e;
868
+ const r = (e = t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : e.index;
869
+ return r !== void 0 ? r : -1;
870
+ },
871
+ tokenize(t, e, r) {
872
+ const n = (i) => {
873
+ const a = F(
874
+ i,
875
+ {
876
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
877
+ extractItemData: (o) => ({
878
+ indentLevel: o[1].length,
879
+ mainContent: o[4],
880
+ checked: o[3].toLowerCase() === "x"
881
+ }),
882
+ createToken: (o, c) => ({
883
+ type: "taskItem",
884
+ raw: "",
885
+ mainContent: o.mainContent,
886
+ indentLevel: o.indentLevel,
887
+ checked: o.checked,
888
+ text: o.mainContent,
889
+ tokens: r.inlineTokens(o.mainContent),
890
+ nestedTokens: c
891
+ }),
892
+ // Allow recursive nesting
893
+ customNestedParser: n
894
+ },
895
+ r
896
+ );
897
+ return a ? [
898
+ {
899
+ type: "taskList",
900
+ raw: a.raw,
901
+ items: a.items
902
+ }
903
+ ] : r.blockTokens(i);
904
+ }, s = F(
905
+ t,
906
+ {
907
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
908
+ extractItemData: (i) => ({
909
+ indentLevel: i[1].length,
910
+ mainContent: i[4],
911
+ checked: i[3].toLowerCase() === "x"
912
+ }),
913
+ createToken: (i, a) => ({
914
+ type: "taskItem",
915
+ raw: "",
916
+ mainContent: i.mainContent,
917
+ indentLevel: i.indentLevel,
918
+ checked: i.checked,
919
+ text: i.mainContent,
920
+ tokens: r.inlineTokens(i.mainContent),
921
+ nestedTokens: a
922
+ }),
923
+ // Use the recursive parser for nested content
924
+ customNestedParser: n
925
+ },
926
+ r
927
+ );
928
+ if (s)
929
+ return {
930
+ type: "taskList",
931
+ raw: s.raw,
932
+ items: s.items
933
+ };
934
+ }
935
+ },
936
+ markdownOptions: {
937
+ indentsContent: !0
938
+ },
939
+ addCommands() {
940
+ return {
941
+ toggleTaskList: () => ({ commands: t }) => t.toggleList(this.name, this.options.itemTypeName)
942
+ };
943
+ },
944
+ addKeyboardShortcuts() {
945
+ return {
946
+ "Mod-Shift-9": () => this.editor.commands.toggleTaskList()
947
+ };
948
+ }
949
+ });
950
+ C.create({
951
+ name: "listKit",
952
+ addExtensions() {
953
+ const t = [];
954
+ return this.options.bulletList !== !1 && t.push(Re.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(Pe.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(De.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(Qe.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(kt.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(Tt.configure(this.options.taskList)), t;
955
+ }
956
+ });
957
+ var Ve = Q.create({
958
+ name: "subscript",
959
+ addOptions() {
960
+ return {
961
+ HTMLAttributes: {}
962
+ };
963
+ },
964
+ parseHTML() {
965
+ return [
966
+ {
967
+ tag: "sub"
968
+ },
969
+ {
970
+ style: "vertical-align",
971
+ getAttrs(t) {
972
+ return t !== "sub" ? !1 : null;
973
+ }
974
+ }
975
+ ];
976
+ },
977
+ renderHTML({ HTMLAttributes: t }) {
978
+ return ["sub", k(this.options.HTMLAttributes, t), 0];
979
+ },
980
+ addCommands() {
981
+ return {
982
+ setSubscript: () => ({ commands: t }) => t.setMark(this.name),
983
+ toggleSubscript: () => ({ commands: t }) => t.toggleMark(this.name),
984
+ unsetSubscript: () => ({ commands: t }) => t.unsetMark(this.name)
985
+ };
986
+ },
987
+ addKeyboardShortcuts() {
988
+ return {
989
+ "Mod-,": () => this.editor.commands.toggleSubscript()
990
+ };
991
+ }
992
+ }), qe = Q.create({
993
+ name: "superscript",
994
+ addOptions() {
995
+ return {
996
+ HTMLAttributes: {}
997
+ };
998
+ },
999
+ parseHTML() {
1000
+ return [
1001
+ {
1002
+ tag: "sup"
1003
+ },
1004
+ {
1005
+ style: "vertical-align",
1006
+ getAttrs(t) {
1007
+ return t !== "super" ? !1 : null;
1008
+ }
1009
+ }
1010
+ ];
1011
+ },
1012
+ renderHTML({ HTMLAttributes: t }) {
1013
+ return ["sup", k(this.options.HTMLAttributes, t), 0];
1014
+ },
1015
+ addCommands() {
1016
+ return {
1017
+ setSuperscript: () => ({ commands: t }) => t.setMark(this.name),
1018
+ toggleSuperscript: () => ({ commands: t }) => t.toggleMark(this.name),
1019
+ unsetSuperscript: () => ({ commands: t }) => t.unsetMark(this.name)
1020
+ };
1021
+ },
1022
+ addKeyboardShortcuts() {
1023
+ return {
1024
+ "Mod-.": () => this.editor.commands.toggleSuperscript()
1025
+ };
1026
+ }
1027
+ }), Fe = C.create({
1028
+ name: "textAlign",
1029
+ addOptions() {
1030
+ return {
1031
+ types: [],
1032
+ alignments: ["left", "center", "right", "justify"],
1033
+ defaultAlignment: null
1034
+ };
1035
+ },
1036
+ addGlobalAttributes() {
1037
+ return [
1038
+ {
1039
+ types: this.options.types,
1040
+ attributes: {
1041
+ textAlign: {
1042
+ default: this.options.defaultAlignment,
1043
+ parseHTML: (t) => {
1044
+ const e = t.style.textAlign;
1045
+ return this.options.alignments.includes(e) ? e : this.options.defaultAlignment;
1046
+ },
1047
+ renderHTML: (t) => t.textAlign ? { style: `text-align: ${t.textAlign}` } : {}
1048
+ }
1049
+ }
1050
+ }
1051
+ ];
1052
+ },
1053
+ addCommands() {
1054
+ return {
1055
+ setTextAlign: (t) => ({ commands: e }) => this.options.alignments.includes(t) ? this.options.types.map((r) => e.updateAttributes(r, { textAlign: t })).every((r) => r) : !1,
1056
+ unsetTextAlign: () => ({ commands: t }) => this.options.types.map((e) => t.resetAttributes(e, "textAlign")).every((e) => e),
1057
+ toggleTextAlign: (t) => ({ editor: e, commands: r }) => this.options.alignments.includes(t) ? e.isActive({ textAlign: t }) ? r.unsetTextAlign() : r.setTextAlign(t) : !1
1058
+ };
1059
+ },
1060
+ addKeyboardShortcuts() {
1061
+ return {
1062
+ "Mod-Shift-l": () => this.editor.commands.setTextAlign("left"),
1063
+ "Mod-Shift-e": () => this.editor.commands.setTextAlign("center"),
1064
+ "Mod-Shift-r": () => this.editor.commands.setTextAlign("right"),
1065
+ "Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
1066
+ };
1067
+ }
1068
+ }), Ue = (t) => y({
1069
+ find: /--$/,
1070
+ replace: t ?? "—"
1071
+ }), Ge = (t) => y({
1072
+ find: /\.\.\.$/,
1073
+ replace: t ?? "…"
1074
+ }), Xe = (t) => y({
1075
+ find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
1076
+ replace: t ?? "“"
1077
+ }), Ye = (t) => y({
1078
+ find: /"$/,
1079
+ replace: t ?? "”"
1080
+ }), Ze = (t) => y({
1081
+ find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
1082
+ replace: t ?? "‘"
1083
+ }), Je = (t) => y({
1084
+ find: /'$/,
1085
+ replace: t ?? "’"
1086
+ }), tr = (t) => y({
1087
+ find: /<-$/,
1088
+ replace: t ?? "←"
1089
+ }), er = (t) => y({
1090
+ find: /->$/,
1091
+ replace: t ?? "→"
1092
+ }), rr = (t) => y({
1093
+ find: /\(c\)$/,
1094
+ replace: t ?? "©"
1095
+ }), nr = (t) => y({
1096
+ find: /\(tm\)$/,
1097
+ replace: t ?? "™"
1098
+ }), sr = (t) => y({
1099
+ find: /\(sm\)$/,
1100
+ replace: t ?? "℠"
1101
+ }), ir = (t) => y({
1102
+ find: /\(r\)$/,
1103
+ replace: t ?? "®"
1104
+ }), or = (t) => y({
1105
+ find: /(?:^|\s)(1\/2)\s$/,
1106
+ replace: t ?? "½"
1107
+ }), ar = (t) => y({
1108
+ find: /\+\/-$/,
1109
+ replace: t ?? "±"
1110
+ }), lr = (t) => y({
1111
+ find: /!=$/,
1112
+ replace: t ?? "≠"
1113
+ }), ur = (t) => y({
1114
+ find: /<<$/,
1115
+ replace: t ?? "«"
1116
+ }), dr = (t) => y({
1117
+ find: />>$/,
1118
+ replace: t ?? "»"
1119
+ }), cr = (t) => y({
1120
+ find: /\d+\s?([*x])\s?\d+$/,
1121
+ replace: t ?? "×"
1122
+ }), pr = (t) => y({
1123
+ find: /\^2$/,
1124
+ replace: t ?? "²"
1125
+ }), hr = (t) => y({
1126
+ find: /\^3$/,
1127
+ replace: t ?? "³"
1128
+ }), fr = (t) => y({
1129
+ find: /(?:^|\s)(1\/4)\s$/,
1130
+ replace: t ?? "¼"
1131
+ }), mr = (t) => y({
1132
+ find: /(?:^|\s)(3\/4)\s$/,
1133
+ replace: t ?? "¾"
1134
+ }), gr = C.create({
1135
+ name: "typography",
1136
+ addOptions() {
1137
+ return {
1138
+ closeDoubleQuote: "”",
1139
+ closeSingleQuote: "’",
1140
+ copyright: "©",
1141
+ ellipsis: "…",
1142
+ emDash: "—",
1143
+ laquo: "«",
1144
+ leftArrow: "←",
1145
+ multiplication: "×",
1146
+ notEqual: "≠",
1147
+ oneHalf: "½",
1148
+ oneQuarter: "¼",
1149
+ openDoubleQuote: "“",
1150
+ openSingleQuote: "‘",
1151
+ plusMinus: "±",
1152
+ raquo: "»",
1153
+ registeredTrademark: "®",
1154
+ rightArrow: "→",
1155
+ servicemark: "℠",
1156
+ superscriptThree: "³",
1157
+ superscriptTwo: "²",
1158
+ threeQuarters: "¾",
1159
+ trademark: "™"
1160
+ };
1161
+ },
1162
+ addInputRules() {
1163
+ const t = [];
1164
+ return this.options.emDash !== !1 && t.push(Ue(this.options.emDash)), this.options.ellipsis !== !1 && t.push(Ge(this.options.ellipsis)), this.options.openDoubleQuote !== !1 && t.push(Xe(this.options.openDoubleQuote)), this.options.closeDoubleQuote !== !1 && t.push(Ye(this.options.closeDoubleQuote)), this.options.openSingleQuote !== !1 && t.push(Ze(this.options.openSingleQuote)), this.options.closeSingleQuote !== !1 && t.push(Je(this.options.closeSingleQuote)), this.options.leftArrow !== !1 && t.push(tr(this.options.leftArrow)), this.options.rightArrow !== !1 && t.push(er(this.options.rightArrow)), this.options.copyright !== !1 && t.push(rr(this.options.copyright)), this.options.trademark !== !1 && t.push(nr(this.options.trademark)), this.options.servicemark !== !1 && t.push(sr(this.options.servicemark)), this.options.registeredTrademark !== !1 && t.push(ir(this.options.registeredTrademark)), this.options.oneHalf !== !1 && t.push(or(this.options.oneHalf)), this.options.plusMinus !== !1 && t.push(ar(this.options.plusMinus)), this.options.notEqual !== !1 && t.push(lr(this.options.notEqual)), this.options.laquo !== !1 && t.push(ur(this.options.laquo)), this.options.raquo !== !1 && t.push(dr(this.options.raquo)), this.options.multiplication !== !1 && t.push(cr(this.options.multiplication)), this.options.superscriptTwo !== !1 && t.push(pr(this.options.superscriptTwo)), this.options.superscriptThree !== !1 && t.push(hr(this.options.superscriptThree)), this.options.oneQuarter !== !1 && t.push(fr(this.options.oneQuarter)), this.options.threeQuarters !== !1 && t.push(mr(this.options.threeQuarters)), t;
1165
+ }
1166
+ });
1167
+ C.create({
1168
+ name: "characterCount",
1169
+ addOptions() {
1170
+ return {
1171
+ limit: null,
1172
+ mode: "textSize",
1173
+ textCounter: (t) => t.length,
1174
+ wordCounter: (t) => t.split(" ").filter((e) => e !== "").length
1175
+ };
1176
+ },
1177
+ addStorage() {
1178
+ return {
1179
+ characters: () => 0,
1180
+ words: () => 0
1181
+ };
1182
+ },
1183
+ onBeforeCreate() {
1184
+ this.storage.characters = (t) => {
1185
+ const e = t?.node || this.editor.state.doc;
1186
+ if ((t?.mode || this.options.mode) === "textSize") {
1187
+ const n = e.textBetween(0, e.content.size, void 0, " ");
1188
+ return this.options.textCounter(n);
1189
+ }
1190
+ return e.nodeSize;
1191
+ }, this.storage.words = (t) => {
1192
+ const e = t?.node || this.editor.state.doc, r = e.textBetween(0, e.content.size, " ", " ");
1193
+ return this.options.wordCounter(r);
1194
+ };
1195
+ },
1196
+ addProseMirrorPlugins() {
1197
+ let t = !1;
1198
+ return [
1199
+ new H({
1200
+ key: new E("characterCount"),
1201
+ appendTransaction: (e, r, n) => {
1202
+ if (t)
1203
+ return;
1204
+ const s = this.options.limit;
1205
+ if (s == null || s === 0) {
1206
+ t = !0;
1207
+ return;
1208
+ }
1209
+ const i = this.storage.characters({ node: n.doc });
1210
+ if (i > s) {
1211
+ const a = i - s, o = 0, c = a;
1212
+ console.warn(
1213
+ `[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`
1214
+ );
1215
+ const l = n.tr.deleteRange(o, c);
1216
+ return t = !0, l;
1217
+ }
1218
+ t = !0;
1219
+ },
1220
+ filterTransaction: (e, r) => {
1221
+ const n = this.options.limit;
1222
+ if (!e.docChanged || n === 0 || n === null || n === void 0)
1223
+ return !0;
1224
+ const s = this.storage.characters({ node: r.doc }), i = this.storage.characters({ node: e.doc });
1225
+ if (i <= n || s > n && i > n && i <= s)
1226
+ return !0;
1227
+ if (s > n && i > n && i > s || !e.getMeta("paste"))
1228
+ return !1;
1229
+ const o = e.selection.$head.pos, c = i - n, l = o - c, d = o;
1230
+ return e.deleteRange(l, d), !(this.storage.characters({ node: e.doc }) > n);
1231
+ }
1232
+ })
1233
+ ];
1234
+ }
1235
+ });
1236
+ C.create({
1237
+ name: "dropCursor",
1238
+ addOptions() {
1239
+ return {
1240
+ color: "currentColor",
1241
+ width: 1,
1242
+ class: void 0
1243
+ };
1244
+ },
1245
+ addProseMirrorPlugins() {
1246
+ return [Ot(this.options)];
1247
+ }
1248
+ });
1249
+ C.create({
1250
+ name: "focus",
1251
+ addOptions() {
1252
+ return {
1253
+ className: "has-focus",
1254
+ mode: "all"
1255
+ };
1256
+ },
1257
+ addProseMirrorPlugins() {
1258
+ return [
1259
+ new H({
1260
+ key: new E("focus"),
1261
+ props: {
1262
+ decorations: ({ doc: t, selection: e }) => {
1263
+ const { isEditable: r, isFocused: n } = this.editor, { anchor: s } = e, i = [];
1264
+ if (!r || !n)
1265
+ return B.create(t, []);
1266
+ let a = 0;
1267
+ this.options.mode === "deepest" && t.descendants((c, l) => {
1268
+ if (c.isText)
1269
+ return;
1270
+ if (!(s >= l && s <= l + c.nodeSize - 1))
1271
+ return !1;
1272
+ a += 1;
1273
+ });
1274
+ let o = 0;
1275
+ return t.descendants((c, l) => {
1276
+ if (c.isText || !(s >= l && s <= l + c.nodeSize - 1))
1277
+ return !1;
1278
+ if (o += 1, this.options.mode === "deepest" && a - o > 0 || this.options.mode === "shallowest" && o > 1)
1279
+ return this.options.mode === "deepest";
1280
+ i.push(
1281
+ K.node(l, l + c.nodeSize, {
1282
+ class: this.options.className
1283
+ })
1284
+ );
1285
+ }), B.create(t, i);
1286
+ }
1287
+ }
1288
+ })
1289
+ ];
1290
+ }
1291
+ });
1292
+ C.create({
1293
+ name: "gapCursor",
1294
+ addProseMirrorPlugins() {
1295
+ return [Dt()];
1296
+ },
1297
+ extendNodeSchema(t) {
1298
+ var e;
1299
+ const r = {
1300
+ name: t.name,
1301
+ options: t.options,
1302
+ storage: t.storage
1303
+ };
1304
+ return {
1305
+ allowGapCursor: (e = dt(ct(t, "allowGapCursor", r))) != null ? e : null
1306
+ };
1307
+ }
1308
+ });
1309
+ var br = C.create({
1310
+ name: "placeholder",
1311
+ addOptions() {
1312
+ return {
1313
+ emptyEditorClass: "is-editor-empty",
1314
+ emptyNodeClass: "is-empty",
1315
+ placeholder: "Write something …",
1316
+ showOnlyWhenEditable: !0,
1317
+ showOnlyCurrent: !0,
1318
+ includeChildren: !1
1319
+ };
1320
+ },
1321
+ addProseMirrorPlugins() {
1322
+ return [
1323
+ new H({
1324
+ key: new E("placeholder"),
1325
+ props: {
1326
+ decorations: ({ doc: t, selection: e }) => {
1327
+ const r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: n } = e, s = [];
1328
+ if (!r)
1329
+ return null;
1330
+ const i = this.editor.isEmpty;
1331
+ return t.descendants((a, o) => {
1332
+ const c = n >= o && n <= o + a.nodeSize, l = !a.isLeaf && Nt(a);
1333
+ if ((c || !this.options.showOnlyCurrent) && l) {
1334
+ const d = [this.options.emptyNodeClass];
1335
+ i && d.push(this.options.emptyEditorClass);
1336
+ const u = K.node(o, o + a.nodeSize, {
1337
+ class: d.join(" "),
1338
+ "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
1339
+ editor: this.editor,
1340
+ node: a,
1341
+ pos: o,
1342
+ hasAnchor: c
1343
+ }) : this.options.placeholder
1344
+ });
1345
+ s.push(u);
1346
+ }
1347
+ return this.options.includeChildren;
1348
+ }), B.create(t, s);
1349
+ }
1350
+ }
1351
+ })
1352
+ ];
1353
+ }
1354
+ }), yr = C.create({
1355
+ name: "selection",
1356
+ addOptions() {
1357
+ return {
1358
+ className: "selection"
1359
+ };
1360
+ },
1361
+ addProseMirrorPlugins() {
1362
+ const { editor: t, options: e } = this;
1363
+ return [
1364
+ new H({
1365
+ key: new E("selection"),
1366
+ props: {
1367
+ decorations(r) {
1368
+ return r.selection.empty || t.isFocused || !t.isEditable || Rt(r.selection) || t.view.dragging ? null : B.create(r.doc, [
1369
+ K.inline(r.selection.from, r.selection.to, {
1370
+ class: e.className
1371
+ })
1372
+ ]);
1373
+ }
1374
+ }
1375
+ })
1376
+ ];
1377
+ }
1378
+ });
1379
+ function st({ types: t, node: e }) {
1380
+ return e && Array.isArray(t) && t.includes(e.type) || e?.type === t;
1381
+ }
1382
+ C.create({
1383
+ name: "trailingNode",
1384
+ addOptions() {
1385
+ return {
1386
+ node: void 0,
1387
+ notAfter: []
1388
+ };
1389
+ },
1390
+ addProseMirrorPlugins() {
1391
+ var t;
1392
+ const e = new E(this.name), r = ((t = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : t.name) || this.options.node || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, s]) => s).filter((s) => (this.options.notAfter || []).concat(r).includes(s.name));
1393
+ return [
1394
+ new H({
1395
+ key: e,
1396
+ appendTransaction: (s, i, a) => {
1397
+ const { doc: o, tr: c, schema: l } = a, d = e.getState(a), u = o.content.size, h = l.nodes[r];
1398
+ if (d)
1399
+ return c.insert(u, h.create());
1400
+ },
1401
+ state: {
1402
+ init: (s, i) => {
1403
+ const a = i.tr.doc.lastChild;
1404
+ return !st({ node: a, types: n });
1405
+ },
1406
+ apply: (s, i) => {
1407
+ if (!s.docChanged || s.getMeta("__uniqueIDTransaction"))
1408
+ return i;
1409
+ const a = s.doc.lastChild;
1410
+ return !st({ node: a, types: n });
1411
+ }
1412
+ }
1413
+ })
1414
+ ];
1415
+ }
1416
+ });
1417
+ C.create({
1418
+ name: "undoRedo",
1419
+ addOptions() {
1420
+ return {
1421
+ depth: 100,
1422
+ newGroupDelay: 500
1423
+ };
1424
+ },
1425
+ addCommands() {
1426
+ return {
1427
+ undo: () => ({ state: t, dispatch: e }) => Wt(t, e),
1428
+ redo: () => ({ state: t, dispatch: e }) => zt(t, e)
1429
+ };
1430
+ },
1431
+ addProseMirrorPlugins() {
1432
+ return [_t(this.options)];
1433
+ },
1434
+ addKeyboardShortcuts() {
1435
+ return {
1436
+ "Mod-z": () => this.editor.commands.undo(),
1437
+ "Shift-Mod-z": () => this.editor.commands.redo(),
1438
+ "Mod-y": () => this.editor.commands.redo(),
1439
+ // Russian keyboard layouts
1440
+ "Mod-я": () => this.editor.commands.undo(),
1441
+ "Shift-Mod-я": () => this.editor.commands.redo()
1442
+ };
1443
+ }
1444
+ });
1445
+ var kr = L.create({
1446
+ name: "tableCell",
1447
+ addOptions() {
1448
+ return {
1449
+ HTMLAttributes: {}
1450
+ };
1451
+ },
1452
+ content: "block+",
1453
+ addAttributes() {
1454
+ return {
1455
+ colspan: {
1456
+ default: 1
1457
+ },
1458
+ rowspan: {
1459
+ default: 1
1460
+ },
1461
+ colwidth: {
1462
+ default: null,
1463
+ parseHTML: (t) => {
1464
+ var e, r;
1465
+ const n = t.getAttribute("colwidth"), s = n ? n.split(",").map((i) => parseInt(i, 10)) : null;
1466
+ if (!s) {
1467
+ const i = (e = t.closest("table")) == null ? void 0 : e.querySelectorAll("colgroup > col"), a = Array.from(((r = t.parentElement) == null ? void 0 : r.children) || []).indexOf(t);
1468
+ if (a && a > -1 && i && i[a]) {
1469
+ const o = i[a].getAttribute("width");
1470
+ return o ? [parseInt(o, 10)] : null;
1471
+ }
1472
+ }
1473
+ return s;
1474
+ }
1475
+ }
1476
+ };
1477
+ },
1478
+ tableRole: "cell",
1479
+ isolating: !0,
1480
+ parseHTML() {
1481
+ return [{ tag: "td" }];
1482
+ },
1483
+ renderHTML({ HTMLAttributes: t }) {
1484
+ return ["td", k(this.options.HTMLAttributes, t), 0];
1485
+ }
1486
+ }), Tr = L.create({
1487
+ name: "tableHeader",
1488
+ addOptions() {
1489
+ return {
1490
+ HTMLAttributes: {}
1491
+ };
1492
+ },
1493
+ content: "block+",
1494
+ addAttributes() {
1495
+ return {
1496
+ colspan: {
1497
+ default: 1
1498
+ },
1499
+ rowspan: {
1500
+ default: 1
1501
+ },
1502
+ colwidth: {
1503
+ default: null,
1504
+ parseHTML: (t) => {
1505
+ const e = t.getAttribute("colwidth");
1506
+ return e ? e.split(",").map((n) => parseInt(n, 10)) : null;
1507
+ }
1508
+ }
1509
+ };
1510
+ },
1511
+ tableRole: "header_cell",
1512
+ isolating: !0,
1513
+ parseHTML() {
1514
+ return [{ tag: "th" }];
1515
+ },
1516
+ renderHTML({ HTMLAttributes: t }) {
1517
+ return ["th", k(this.options.HTMLAttributes, t), 0];
1518
+ }
1519
+ }), Cr = L.create({
1520
+ name: "tableRow",
1521
+ addOptions() {
1522
+ return {
1523
+ HTMLAttributes: {}
1524
+ };
1525
+ },
1526
+ content: "(tableCell | tableHeader)*",
1527
+ tableRole: "row",
1528
+ parseHTML() {
1529
+ return [{ tag: "tr" }];
1530
+ },
1531
+ renderHTML({ HTMLAttributes: t }) {
1532
+ return ["tr", k(this.options.HTMLAttributes, t), 0];
1533
+ }
1534
+ });
1535
+ function j(t, e) {
1536
+ return e ? ["width", `${Math.max(e, t)}px`] : ["min-width", `${t}px`];
1537
+ }
1538
+ function it(t, e, r, n, s, i) {
1539
+ var a;
1540
+ let o = 0, c = !0, l = e.firstChild;
1541
+ const d = t.firstChild;
1542
+ if (d !== null)
1543
+ for (let h = 0, m = 0; h < d.childCount; h += 1) {
1544
+ const { colspan: f, colwidth: b } = d.child(h).attrs;
1545
+ for (let g = 0; g < f; g += 1, m += 1) {
1546
+ const T = s === m ? i : b && b[g], v = T ? `${T}px` : "";
1547
+ if (o += T || n, T || (c = !1), l) {
1548
+ if (l.style.width !== v) {
1549
+ const [I, N] = j(n, T);
1550
+ l.style.setProperty(I, N);
1551
+ }
1552
+ l = l.nextSibling;
1553
+ } else {
1554
+ const I = document.createElement("col"), [N, O] = j(n, T);
1555
+ I.style.setProperty(N, O), e.appendChild(I);
1556
+ }
1557
+ }
1558
+ }
1559
+ for (; l; ) {
1560
+ const h = l.nextSibling;
1561
+ (a = l.parentNode) == null || a.removeChild(l), l = h;
1562
+ }
1563
+ const u = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
1564
+ c && !u ? (r.style.width = `${o}px`, r.style.minWidth = "") : (r.style.width = "", r.style.minWidth = `${o}px`);
1565
+ }
1566
+ var Lr = class {
1567
+ constructor(t, e) {
1568
+ this.node = t, this.cellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), t.attrs.style && (this.table.style.cssText = t.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), it(t, this.colgroup, this.table, e), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
1569
+ }
1570
+ update(t) {
1571
+ return t.type !== this.node.type ? !1 : (this.node = t, it(t, this.colgroup, this.table, this.cellMinWidth), !0);
1572
+ }
1573
+ ignoreMutation(t) {
1574
+ const e = t.target, r = this.dom.contains(e), n = this.contentDOM.contains(e);
1575
+ return !!(r && !n && (t.type === "attributes" || t.type === "childList" || t.type === "characterData"));
1576
+ }
1577
+ };
1578
+ function wr(t, e, r, n) {
1579
+ let s = 0, i = !0;
1580
+ const a = [], o = t.firstChild;
1581
+ if (!o)
1582
+ return {};
1583
+ for (let u = 0, h = 0; u < o.childCount; u += 1) {
1584
+ const { colspan: m, colwidth: f } = o.child(u).attrs;
1585
+ for (let b = 0; b < m; b += 1, h += 1) {
1586
+ const g = r === h ? n : f && f[b];
1587
+ s += g || e, g || (i = !1);
1588
+ const [T, v] = j(e, g);
1589
+ a.push(["col", { style: `${T}: ${v}` }]);
1590
+ }
1591
+ }
1592
+ const c = i ? `${s}px` : "", l = i ? "" : `${s}px`;
1593
+ return { colgroup: ["colgroup", {}, ...a], tableWidth: c, tableMinWidth: l };
1594
+ }
1595
+ function ot(t, e) {
1596
+ return t.createAndFill();
1597
+ }
1598
+ function vr(t) {
1599
+ if (t.cached.tableNodeTypes)
1600
+ return t.cached.tableNodeTypes;
1601
+ const e = {};
1602
+ return Object.keys(t.nodes).forEach((r) => {
1603
+ const n = t.nodes[r];
1604
+ n.spec.tableRole && (e[n.spec.tableRole] = n);
1605
+ }), t.cached.tableNodeTypes = e, e;
1606
+ }
1607
+ function Mr(t, e, r, n, s) {
1608
+ const i = vr(t), a = [], o = [];
1609
+ for (let l = 0; l < r; l += 1) {
1610
+ const d = ot(i.cell);
1611
+ if (d && o.push(d), n) {
1612
+ const u = ot(i.header_cell);
1613
+ u && a.push(u);
1614
+ }
1615
+ }
1616
+ const c = [];
1617
+ for (let l = 0; l < e; l += 1)
1618
+ c.push(i.row.createChecked(null, n && l === 0 ? a : o));
1619
+ return i.table.createChecked(null, c);
1620
+ }
1621
+ function xr(t) {
1622
+ return t instanceof pt;
1623
+ }
1624
+ var P = ({ editor: t }) => {
1625
+ const { selection: e } = t.state;
1626
+ if (!xr(e))
1627
+ return !1;
1628
+ let r = 0;
1629
+ const n = Pt(e.ranges[0].$from, (i) => i.type.name === "table");
1630
+ return n?.node.descendants((i) => {
1631
+ if (i.type.name === "table")
1632
+ return !1;
1633
+ ["tableCell", "tableHeader"].includes(i.type.name) && (r += 1);
1634
+ }), r === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
1635
+ }, Ar = "";
1636
+ function Ir(t) {
1637
+ return (t || "").replace(/\s+/g, " ").trim();
1638
+ }
1639
+ function Sr(t, e, r = {}) {
1640
+ var n;
1641
+ const s = (n = r.cellLineSeparator) != null ? n : Ar;
1642
+ if (!t || !t.content || t.content.length === 0)
1643
+ return "";
1644
+ const i = [];
1645
+ t.content.forEach((f) => {
1646
+ const b = [];
1647
+ f.content && f.content.forEach((g) => {
1648
+ let T = "";
1649
+ g.content && Array.isArray(g.content) && g.content.length > 1 ? T = g.content.map((O) => e.renderChildren(O)).join(s) : T = g.content ? e.renderChildren(g.content) : "";
1650
+ const v = Ir(T), I = g.type === "tableHeader";
1651
+ b.push({ text: v, isHeader: I });
1652
+ }), i.push(b);
1653
+ });
1654
+ const a = i.reduce((f, b) => Math.max(f, b.length), 0);
1655
+ if (a === 0)
1656
+ return "";
1657
+ const o = new Array(a).fill(0);
1658
+ i.forEach((f) => {
1659
+ var b;
1660
+ for (let g = 0; g < a; g += 1) {
1661
+ const v = (((b = f[g]) == null ? void 0 : b.text) || "").length;
1662
+ v > o[g] && (o[g] = v), o[g] < 3 && (o[g] = 3);
1663
+ }
1664
+ });
1665
+ const c = (f, b) => f + " ".repeat(Math.max(0, b - f.length)), l = i[0], d = l.some((f) => f.isHeader);
1666
+ let u = `
1667
+ `;
1668
+ const h = new Array(a).fill(0).map((f, b) => d && l[b] && l[b].text || "");
1669
+ return u += `| ${h.map((f, b) => c(f, o[b])).join(" | ")} |
1670
+ `, u += `| ${o.map((f) => "-".repeat(Math.max(3, f))).join(" | ")} |
1671
+ `, (d ? i.slice(1) : i).forEach((f) => {
1672
+ u += `| ${new Array(a).fill(0).map((b, g) => c(f[g] && f[g].text || "", o[g])).join(" | ")} |
1673
+ `;
1674
+ }), u;
1675
+ }
1676
+ var Hr = Sr, Er = L.create({
1677
+ name: "table",
1678
+ // @ts-ignore
1679
+ addOptions() {
1680
+ return {
1681
+ HTMLAttributes: {},
1682
+ resizable: !1,
1683
+ renderWrapper: !1,
1684
+ handleWidth: 5,
1685
+ cellMinWidth: 25,
1686
+ // TODO: fix
1687
+ View: Lr,
1688
+ lastColumnResizable: !0,
1689
+ allowTableNodeSelection: !1
1690
+ };
1691
+ },
1692
+ content: "tableRow+",
1693
+ tableRole: "table",
1694
+ isolating: !0,
1695
+ group: "block",
1696
+ parseHTML() {
1697
+ return [{ tag: "table" }];
1698
+ },
1699
+ renderHTML({ node: t, HTMLAttributes: e }) {
1700
+ const { colgroup: r, tableWidth: n, tableMinWidth: s } = wr(t, this.options.cellMinWidth), i = e.style;
1701
+ function a() {
1702
+ return i || (n ? `width: ${n}` : `min-width: ${s}`);
1703
+ }
1704
+ const o = [
1705
+ "table",
1706
+ k(this.options.HTMLAttributes, e, {
1707
+ style: a()
1708
+ }),
1709
+ r,
1710
+ ["tbody", 0]
1711
+ ];
1712
+ return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, o] : o;
1713
+ },
1714
+ parseMarkdown: (t, e) => {
1715
+ const r = [];
1716
+ if (t.header) {
1717
+ const n = [];
1718
+ t.header.forEach((s) => {
1719
+ n.push(e.createNode("tableHeader", {}, [{ type: "paragraph", content: e.parseInline(s.tokens) }]));
1720
+ }), r.push(e.createNode("tableRow", {}, n));
1721
+ }
1722
+ return t.rows && t.rows.forEach((n) => {
1723
+ const s = [];
1724
+ n.forEach((i) => {
1725
+ s.push(e.createNode("tableCell", {}, [{ type: "paragraph", content: e.parseInline(i.tokens) }]));
1726
+ }), r.push(e.createNode("tableRow", {}, s));
1727
+ }), e.createNode("table", void 0, r);
1728
+ },
1729
+ renderMarkdown: (t, e) => Hr(t, e),
1730
+ addCommands() {
1731
+ return {
1732
+ insertTable: ({ rows: t = 3, cols: e = 3, withHeaderRow: r = !0 } = {}) => ({ tr: n, dispatch: s, editor: i }) => {
1733
+ const a = Mr(i.schema, t, e, r);
1734
+ if (s) {
1735
+ const o = n.selection.from + 1;
1736
+ n.replaceSelectionWith(a).scrollIntoView().setSelection(Bt.near(n.doc.resolve(o)));
1737
+ }
1738
+ return !0;
1739
+ },
1740
+ addColumnBefore: () => ({ state: t, dispatch: e }) => Me(t, e),
1741
+ addColumnAfter: () => ({ state: t, dispatch: e }) => ve(t, e),
1742
+ deleteColumn: () => ({ state: t, dispatch: e }) => we(t, e),
1743
+ addRowBefore: () => ({ state: t, dispatch: e }) => Le(t, e),
1744
+ addRowAfter: () => ({ state: t, dispatch: e }) => Ce(t, e),
1745
+ deleteRow: () => ({ state: t, dispatch: e }) => Te(t, e),
1746
+ deleteTable: () => ({ state: t, dispatch: e }) => ke(t, e),
1747
+ mergeCells: () => ({ state: t, dispatch: e }) => X(t, e),
1748
+ splitCell: () => ({ state: t, dispatch: e }) => Y(t, e),
1749
+ toggleHeaderColumn: () => ({ state: t, dispatch: e }) => Z("column")(t, e),
1750
+ toggleHeaderRow: () => ({ state: t, dispatch: e }) => Z("row")(t, e),
1751
+ toggleHeaderCell: () => ({ state: t, dispatch: e }) => ye(t, e),
1752
+ mergeOrSplit: () => ({ state: t, dispatch: e }) => X(t, e) ? !0 : Y(t, e),
1753
+ setCellAttribute: (t, e) => ({ state: r, dispatch: n }) => be(t, e)(r, n),
1754
+ goToNextCell: () => ({ state: t, dispatch: e }) => G(1)(t, e),
1755
+ goToPreviousCell: () => ({ state: t, dispatch: e }) => G(-1)(t, e),
1756
+ fixTables: () => ({ state: t, dispatch: e }) => (e && ge(t), !0),
1757
+ setCellSelection: (t) => ({ tr: e, dispatch: r }) => {
1758
+ if (r) {
1759
+ const n = pt.create(e.doc, t.anchorCell, t.headCell);
1760
+ e.setSelection(n);
1761
+ }
1762
+ return !0;
1763
+ }
1764
+ };
1765
+ },
1766
+ addKeyboardShortcuts() {
1767
+ return {
1768
+ Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
1769
+ "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
1770
+ Backspace: P,
1771
+ "Mod-Backspace": P,
1772
+ Delete: P,
1773
+ "Mod-Delete": P
1774
+ };
1775
+ },
1776
+ addProseMirrorPlugins() {
1777
+ return [
1778
+ ...this.options.resizable && this.editor.isEditable ? [
1779
+ fe({
1780
+ handleWidth: this.options.handleWidth,
1781
+ cellMinWidth: this.options.cellMinWidth,
1782
+ defaultCellMinWidth: this.options.cellMinWidth,
1783
+ View: this.options.View,
1784
+ lastColumnResizable: this.options.lastColumnResizable
1785
+ })
1786
+ ] : [],
1787
+ me({
1788
+ allowTableNodeSelection: this.options.allowTableNodeSelection
1789
+ })
1790
+ ];
1791
+ },
1792
+ extendNodeSchema(t) {
1793
+ const e = {
1794
+ name: t.name,
1795
+ options: t.options,
1796
+ storage: t.storage
1797
+ };
1798
+ return {
1799
+ tableRole: dt(ct(t, "tableRole", e))
1800
+ };
1801
+ }
1802
+ }), $r = C.create({
1803
+ name: "tableKit",
1804
+ addExtensions() {
1805
+ const t = [];
1806
+ return this.options.table !== !1 && t.push(Er.configure(this.options.table)), this.options.tableCell !== !1 && t.push(kr.configure(this.options.tableCell)), this.options.tableHeader !== !1 && t.push(Tr.configure(this.options.tableHeader)), this.options.tableRow !== !1 && t.push(Cr.configure(this.options.tableRow)), t;
1807
+ }
1808
+ });
1809
+ const Nr = ({
1810
+ onHighlighterClick: t,
1811
+ onLinkClick: e,
1812
+ isMobile: r
51
1813
  }) => {
52
- const { editor: p } = oo();
53
- return /* @__PURE__ */ e(y, { children: [
54
- /* @__PURE__ */ e(n, { children: [
55
- /* @__PURE__ */ o(T, { action: "undo" }),
56
- /* @__PURE__ */ o(T, { action: "redo" })
1814
+ const { editor: n } = Ut();
1815
+ return /* @__PURE__ */ w(at, { children: [
1816
+ /* @__PURE__ */ w(x, { children: [
1817
+ /* @__PURE__ */ p(U, { action: "undo" }),
1818
+ /* @__PURE__ */ p(U, { action: "redo" })
57
1819
  ] }),
58
- /* @__PURE__ */ o(l, {}),
59
- /* @__PURE__ */ e(n, { children: [
60
- /* @__PURE__ */ o(eo, { levels: [1, 2, 3, 4], portal: t }),
61
- /* @__PURE__ */ o(
62
- io,
1820
+ /* @__PURE__ */ p(A, {}),
1821
+ /* @__PURE__ */ w(x, { children: [
1822
+ /* @__PURE__ */ p(ee, { levels: [1, 2, 3, 4], portal: r }),
1823
+ /* @__PURE__ */ p(
1824
+ oe,
63
1825
  {
64
1826
  types: ["bulletList", "orderedList", "taskList"],
65
- portal: t
1827
+ portal: r
66
1828
  }
67
1829
  ),
68
- /* @__PURE__ */ o(no, {}),
69
- /* @__PURE__ */ o(lo, {})
1830
+ /* @__PURE__ */ p(Ft, {}),
1831
+ /* @__PURE__ */ p(Yt, {})
70
1832
  ] }),
71
- /* @__PURE__ */ o(l, {}),
72
- /* @__PURE__ */ e(n, { children: [
73
- /* @__PURE__ */ o(i, { type: "bold" }),
74
- /* @__PURE__ */ o(i, { type: "italic" }),
75
- /* @__PURE__ */ o(i, { type: "strike" }),
76
- /* @__PURE__ */ o(i, { type: "code" }),
77
- /* @__PURE__ */ o(i, { type: "underline" }),
78
- t ? /* @__PURE__ */ o(ao, { onClick: a }) : /* @__PURE__ */ o(mo, {}),
79
- t ? /* @__PURE__ */ o(so, { onClick: m }) : /* @__PURE__ */ o(co, {})
1833
+ /* @__PURE__ */ p(A, {}),
1834
+ /* @__PURE__ */ w(x, { children: [
1835
+ /* @__PURE__ */ p(M, { type: "bold" }),
1836
+ /* @__PURE__ */ p(M, { type: "italic" }),
1837
+ /* @__PURE__ */ p(M, { type: "strike" }),
1838
+ /* @__PURE__ */ p(M, { type: "code" }),
1839
+ /* @__PURE__ */ p(M, { type: "underline" }),
1840
+ r ? /* @__PURE__ */ p(Jt, { onClick: t }) : /* @__PURE__ */ p(Zt, {}),
1841
+ r ? /* @__PURE__ */ p(ne, { onClick: e }) : /* @__PURE__ */ p(re, {})
80
1842
  ] }),
81
- /* @__PURE__ */ o(l, {}),
82
- /* @__PURE__ */ e(n, { children: [
83
- /* @__PURE__ */ o(i, { type: "superscript" }),
84
- /* @__PURE__ */ o(i, { type: "subscript" })
1843
+ /* @__PURE__ */ p(A, {}),
1844
+ /* @__PURE__ */ w(x, { children: [
1845
+ /* @__PURE__ */ p(M, { type: "superscript" }),
1846
+ /* @__PURE__ */ p(M, { type: "subscript" })
85
1847
  ] }),
86
- /* @__PURE__ */ o(l, {}),
87
- /* @__PURE__ */ e(n, { children: [
88
- /* @__PURE__ */ o(d, { align: "left" }),
89
- /* @__PURE__ */ o(d, { align: "center" }),
90
- /* @__PURE__ */ o(d, { align: "right" }),
91
- /* @__PURE__ */ o(d, { align: "justify" })
1848
+ /* @__PURE__ */ p(A, {}),
1849
+ /* @__PURE__ */ w(x, { children: [
1850
+ /* @__PURE__ */ p(R, { align: "left" }),
1851
+ /* @__PURE__ */ p(R, { align: "center" }),
1852
+ /* @__PURE__ */ p(R, { align: "right" }),
1853
+ /* @__PURE__ */ p(R, { align: "justify" })
92
1854
  ] }),
93
- /* @__PURE__ */ o(l, {}),
94
- /* @__PURE__ */ o(n, { children: /* @__PURE__ */ o(Q, { onClick: () => {
95
- p && p.chain().focus().insertTable({ rows: 3, cols: 3 }).run();
1855
+ /* @__PURE__ */ p(A, {}),
1856
+ /* @__PURE__ */ p(x, { children: /* @__PURE__ */ p(pe, { onClick: () => {
1857
+ n && n.chain().focus().insertTable({ rows: 3, cols: 3 }).run();
96
1858
  } }) }),
97
- t && /* @__PURE__ */ o(l, {})
1859
+ r && /* @__PURE__ */ p(A, {})
98
1860
  ] });
99
- }, ho = ({
100
- type: a,
101
- onBack: m
102
- }) => /* @__PURE__ */ e(y, { children: [
103
- /* @__PURE__ */ o(n, { children: /* @__PURE__ */ e(fo, { "data-style": "ghost", onClick: m, children: [
104
- /* @__PURE__ */ o(_, { className: "tiptap-button-icon" }),
105
- a === "highlighter" ? /* @__PURE__ */ o(q, { className: "tiptap-button-icon" }) : /* @__PURE__ */ o(G, { className: "tiptap-button-icon" })
1861
+ }, Rr = ({
1862
+ type: t,
1863
+ onBack: e
1864
+ }) => /* @__PURE__ */ w(at, { children: [
1865
+ /* @__PURE__ */ p(x, { children: /* @__PURE__ */ w(Qt, { "data-style": "ghost", onClick: e, children: [
1866
+ /* @__PURE__ */ p(ae, { className: "tiptap-button-icon" }),
1867
+ t === "highlighter" ? /* @__PURE__ */ p(le, { className: "tiptap-button-icon" }) : /* @__PURE__ */ p(ie, { className: "tiptap-button-icon" })
106
1868
  ] }) }),
107
- /* @__PURE__ */ o(l, {}),
108
- a === "highlighter" ? /* @__PURE__ */ o(po, {}) : /* @__PURE__ */ o(uo, {})
109
- ] }), pt = v(
110
- function({
111
- themeMode: m,
112
- content: t,
113
- onContentChange: p,
114
- placeholder: b = ""
115
- }, L) {
116
- const c = X(), { height: I } = Z(), [s, u] = x("main"), k = C(null), g = C(!1), r = E({
117
- immediatelyRender: !0,
118
- shouldRerenderOnTransaction: !1,
119
- editorProps: {
120
- attributes: {
121
- autocomplete: "off",
122
- autocorrect: "off",
123
- autocapitalize: "off",
124
- "aria-label": "Main content area, start typing to enter text.",
125
- class: "simple-editor"
1869
+ /* @__PURE__ */ p(A, {}),
1870
+ t === "highlighter" ? /* @__PURE__ */ p(te, {}) : /* @__PURE__ */ p(se, {})
1871
+ ] });
1872
+ function _n({
1873
+ themeMode: t,
1874
+ content: e,
1875
+ onContentChange: r,
1876
+ placeholder: n = "",
1877
+ ref: s
1878
+ }) {
1879
+ const i = de(), { height: a } = ce(), [o, c] = vt(
1880
+ "main"
1881
+ ), l = q(null), d = q(!1), u = Ct({
1882
+ immediatelyRender: !1,
1883
+ shouldRerenderOnTransaction: !1,
1884
+ editorProps: {
1885
+ attributes: {
1886
+ autocomplete: "off",
1887
+ autocorrect: "off",
1888
+ autocapitalize: "off",
1889
+ "aria-label": "Main content area, start typing to enter text.",
1890
+ class: "simple-editor"
1891
+ }
1892
+ },
1893
+ extensions: [
1894
+ jt.configure({
1895
+ horizontalRule: !1,
1896
+ link: {
1897
+ openOnClick: !1,
1898
+ enableClickSelection: !0
126
1899
  }
127
- },
128
- extensions: [
129
- D.configure({
130
- horizontalRule: !1,
131
- link: {
132
- openOnClick: !1,
133
- enableClickSelection: !0
1900
+ }),
1901
+ Vt,
1902
+ Fe.configure({ types: ["heading", "paragraph"] }),
1903
+ Tt,
1904
+ kt.configure({ nested: !0 }),
1905
+ Ie.configure({ multicolor: !0 }),
1906
+ He,
1907
+ gr,
1908
+ qe,
1909
+ Ve,
1910
+ yr,
1911
+ qt.configure({
1912
+ accept: "image/*",
1913
+ maxSize: Xt,
1914
+ limit: 3,
1915
+ upload: Gt,
1916
+ onError: (m) => console.error("Upload failed:", m)
1917
+ }),
1918
+ $r.configure({
1919
+ table: {
1920
+ resizable: !0
1921
+ }
1922
+ }),
1923
+ br.configure({
1924
+ placeholder: n
1925
+ })
1926
+ ],
1927
+ content: e,
1928
+ onUpdate: ({ editor: m }) => {
1929
+ if (!d.current && r) {
1930
+ const f = m.getHTML();
1931
+ r(f);
1932
+ }
1933
+ }
1934
+ }), h = ue({
1935
+ editor: u,
1936
+ overlayHeight: l.current?.getBoundingClientRect().height ?? 0
1937
+ });
1938
+ return D(() => {
1939
+ !i && o !== "main" && c("main");
1940
+ }, [i, o]), D(() => {
1941
+ u && e !== void 0 && u.getHTML() !== e && (d.current = !0, u.commands.setContent(e, { emitUpdate: !1 }), d.current = !1);
1942
+ }, [e, u]), D(() => {
1943
+ document.documentElement.classList.toggle("dark", t === "dark");
1944
+ }, [t]), Mt(
1945
+ s,
1946
+ () => ({
1947
+ getEditor: () => u
1948
+ }),
1949
+ [u]
1950
+ ), u ? /* @__PURE__ */ p("div", { className: "simple-editor-wrapper", children: /* @__PURE__ */ w(Lt.Provider, { value: { editor: u }, children: [
1951
+ /* @__PURE__ */ p(
1952
+ Kt,
1953
+ {
1954
+ ref: l,
1955
+ style: {
1956
+ ...i ? {
1957
+ bottom: `calc(100% - ${a - h.y}px)`
1958
+ } : {}
1959
+ },
1960
+ children: o === "main" ? /* @__PURE__ */ p(
1961
+ Nr,
1962
+ {
1963
+ onHighlighterClick: () => c("highlighter"),
1964
+ onLinkClick: () => c("link"),
1965
+ isMobile: i
134
1966
  }
135
- }),
136
- K,
137
- A.configure({ types: ["heading", "paragraph"] }),
138
- M,
139
- U.configure({ nested: !0 }),
140
- R.configure({ multicolor: !0 }),
141
- P,
142
- j,
143
- N,
144
- z,
145
- F,
146
- O.configure({
147
- accept: "image/*",
148
- maxSize: J,
149
- limit: 3,
150
- upload: $,
151
- onError: (f) => console.error("Upload failed:", f)
152
- }),
153
- to.configure({
154
- table: {
155
- resizable: !0
1967
+ ) : /* @__PURE__ */ p(
1968
+ Rr,
1969
+ {
1970
+ type: o === "highlighter" ? "highlighter" : "link",
1971
+ onBack: () => c("main")
156
1972
  }
157
- }),
158
- V.configure({
159
- placeholder: b
160
- })
161
- ],
162
- content: t,
163
- onUpdate: ({ editor: f }) => {
164
- !g.current && p && p(f.getHTML());
1973
+ )
165
1974
  }
166
- }), B = W({
167
- editor: r,
168
- overlayHeight: k.current?.getBoundingClientRect().height ?? 0
169
- });
170
- return h(() => {
171
- !c && s !== "main" && u("main");
172
- }, [c, s]), h(() => {
173
- r && t !== void 0 && r.getHTML() !== t && (g.current = !0, r.commands.setContent(t, { emitUpdate: !1 }), g.current = !1);
174
- }, [t, r]), h(() => {
175
- document.documentElement.classList.toggle("dark", m === "dark");
176
- }, [m]), w(
177
- L,
178
- () => ({
179
- getEditor: () => r
180
- }),
181
- [r]
182
- ), r ? /* @__PURE__ */ o("div", { className: "simple-editor-wrapper", children: /* @__PURE__ */ e(H.Provider, { value: { editor: r }, children: [
183
- /* @__PURE__ */ o(
184
- ro,
185
- {
186
- ref: k,
187
- style: {
188
- ...c ? { bottom: `calc(100% - ${I - B.y}px)` } : {}
189
- },
190
- children: s === "main" ? /* @__PURE__ */ o(
191
- go,
192
- {
193
- onHighlighterClick: () => u("highlighter"),
194
- onLinkClick: () => u("link"),
195
- isMobile: c
196
- }
197
- ) : /* @__PURE__ */ o(
198
- ho,
199
- {
200
- type: s === "highlighter" ? "highlighter" : "link",
201
- onBack: () => u("main")
202
- }
203
- )
204
- }
205
- ),
206
- /* @__PURE__ */ o(Y, {}),
207
- /* @__PURE__ */ o(
208
- S,
209
- {
210
- editor: r,
211
- role: "presentation",
212
- className: "simple-editor-content"
213
- }
214
- )
215
- ] }) }) : null;
216
- }
217
- );
1975
+ ),
1976
+ /* @__PURE__ */ p(he, {}),
1977
+ /* @__PURE__ */ p(
1978
+ wt,
1979
+ {
1980
+ editor: u,
1981
+ role: "presentation",
1982
+ className: "simple-editor-content"
1983
+ }
1984
+ )
1985
+ ] }) }) : null;
1986
+ }
218
1987
  export {
219
- pt as SimpleEditor
1988
+ _n as SimpleEditor
220
1989
  };