@kopexa/tiptap 1.0.0 → 2.0.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 (213) hide show
  1. package/dist/{chunk-AASYBJDX.mjs → chunk-2SI7MRAE.mjs} +1 -1
  2. package/dist/{chunk-6W7J7PHZ.mjs → chunk-B2DHYFSH.mjs} +6 -7
  3. package/dist/{chunk-RQPJU4UB.mjs → chunk-B7WJOQ3X.mjs} +1 -1
  4. package/dist/{chunk-ACWAVTTK.mjs → chunk-BEV5U2DK.mjs} +6 -6
  5. package/dist/{chunk-TGQP45HH.mjs → chunk-EHY2NAW7.mjs} +1 -3
  6. package/dist/{chunk-O5P45H3I.mjs → chunk-GYIYX2JH.mjs} +1 -1
  7. package/dist/{chunk-QCULSZRZ.mjs → chunk-IOB3REX6.mjs} +1 -3
  8. package/dist/{chunk-ILPDDC4W.mjs → chunk-IQERE7KP.mjs} +1 -4
  9. package/dist/{chunk-6SS62RYU.mjs → chunk-JNL4KY45.mjs} +1 -3
  10. package/dist/{chunk-R2RRQUU5.mjs → chunk-LHXRE26G.mjs} +2 -2
  11. package/dist/{chunk-F2HHFSM4.mjs → chunk-LNVWG34E.mjs} +1 -4
  12. package/dist/chunk-NUCXXNTA.mjs +131 -0
  13. package/dist/{chunk-GLQRF7PR.mjs → chunk-OEVR5N7X.mjs} +2 -10
  14. package/dist/{chunk-YYHNT322.mjs → chunk-OZWCQMRA.mjs} +27 -19
  15. package/dist/{chunk-OX2A52WL.mjs → chunk-Q7DFJ5NI.mjs} +2 -4
  16. package/dist/{chunk-ODBSAQ5V.mjs → chunk-QF3YHPWM.mjs} +2 -4
  17. package/dist/{chunk-R5AMMJTQ.mjs → chunk-REJEJXOZ.mjs} +3 -3
  18. package/dist/chunk-TZQQ6C2Q.mjs +101 -0
  19. package/dist/{chunk-KI3YOPAA.mjs → chunk-UJ4BNZ63.mjs} +1 -4
  20. package/dist/{chunk-4LAWYE7B.mjs → chunk-V6TAZMQN.mjs} +2 -4
  21. package/dist/{chunk-QP2LCU5N.mjs → chunk-VX3HSJ76.mjs} +2 -2
  22. package/dist/{chunk-WCBSINO5.mjs → chunk-W2FLOOJ6.mjs} +1 -1
  23. package/dist/{chunk-JHMEXFB3.mjs → chunk-WHJ4B43N.mjs} +1 -1
  24. package/dist/{chunk-YD56B5SG.mjs → chunk-WPRDVMPN.mjs} +19 -18
  25. package/dist/{chunk-44V2Y6IU.mjs → chunk-XL5FS7LN.mjs} +3 -3
  26. package/dist/{chunk-ZSYXHD7D.mjs → chunk-YJAHZXLG.mjs} +1 -4
  27. package/dist/{chunk-T7LL5ZSR.mjs → chunk-ZVTJ6XD7.mjs} +1 -3
  28. package/dist/{chunk-I7WKP3OM.mjs → chunk-ZZ4OU46C.mjs} +6 -6
  29. package/dist/context/editor-context.d.mts +4 -4
  30. package/dist/context/editor-context.d.ts +4 -4
  31. package/dist/context/editor-context.js +5 -5
  32. package/dist/context/editor-context.mjs +5 -6
  33. package/dist/extensions/link/index.mjs +0 -1
  34. package/dist/extensions/selection/index.mjs +0 -1
  35. package/dist/extensions/trailing-node/index.mjs +0 -1
  36. package/dist/extensions/ui-state/index.mjs +0 -1
  37. package/dist/hooks/use-create-editor.d.mts +16 -5
  38. package/dist/hooks/use-create-editor.d.ts +16 -5
  39. package/dist/hooks/use-create-editor.js +84 -1062
  40. package/dist/hooks/use-create-editor.mjs +5 -18
  41. package/dist/hooks/use-cursor-visibility.mjs +0 -1
  42. package/dist/hooks/use-floating-element.mjs +0 -1
  43. package/dist/hooks/use-floating-toolbar-visibility.mjs +0 -1
  44. package/dist/hooks/use-menu-navigation.mjs +0 -1
  45. package/dist/hooks/use-tiptap-editor.mjs +0 -1
  46. package/dist/hooks/use-ui-editor-state.mjs +0 -1
  47. package/dist/hooks/use-window-size.mjs +0 -1
  48. package/dist/index.d.mts +6 -5
  49. package/dist/index.d.ts +6 -5
  50. package/dist/index.js +483 -1584
  51. package/dist/index.mjs +39 -60
  52. package/dist/presets/basic/editor-header.js +112 -167
  53. package/dist/presets/basic/editor-header.mjs +25 -25
  54. package/dist/presets/basic/index.d.mts +6 -3
  55. package/dist/presets/basic/index.d.ts +6 -3
  56. package/dist/presets/basic/index.js +386 -1468
  57. package/dist/presets/basic/index.mjs +32 -46
  58. package/dist/ui/blockquote-button/blockquote-button.js +12 -67
  59. package/dist/ui/blockquote-button/blockquote-button.mjs +2 -4
  60. package/dist/ui/blockquote-button/index.js +12 -67
  61. package/dist/ui/blockquote-button/index.mjs +2 -4
  62. package/dist/ui/blockquote-button/use-blockquote.js +12 -65
  63. package/dist/ui/blockquote-button/use-blockquote.mjs +1 -3
  64. package/dist/ui/codeblock-button/code-block-button.js +13 -76
  65. package/dist/ui/codeblock-button/code-block-button.mjs +2 -4
  66. package/dist/ui/codeblock-button/index.js +13 -76
  67. package/dist/ui/codeblock-button/index.mjs +2 -4
  68. package/dist/ui/codeblock-button/use-code-block.js +12 -65
  69. package/dist/ui/codeblock-button/use-code-block.mjs +1 -3
  70. package/dist/ui/color-highlight-button/color-highlight-button.js +3 -23
  71. package/dist/ui/color-highlight-button/color-highlight-button.mjs +2 -4
  72. package/dist/ui/color-highlight-button/index.js +3 -23
  73. package/dist/ui/color-highlight-button/index.mjs +2 -4
  74. package/dist/ui/color-highlight-button/use-color-highlight.js +3 -21
  75. package/dist/ui/color-highlight-button/use-color-highlight.mjs +1 -3
  76. package/dist/ui/color-highlight-popover/color-highlight-popover.js +4 -24
  77. package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +3 -5
  78. package/dist/ui/color-highlight-popover/index.js +4 -24
  79. package/dist/ui/color-highlight-popover/index.mjs +3 -5
  80. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.js +2 -18
  81. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +1 -3
  82. package/dist/ui/heading-button/index.js +2 -9
  83. package/dist/ui/heading-button/index.mjs +1 -3
  84. package/dist/ui/heading-button/utils.mjs +0 -1
  85. package/dist/ui/heading-dropdown-menu/index.js +4 -10
  86. package/dist/ui/heading-dropdown-menu/index.mjs +2 -4
  87. package/dist/ui/link-popover/index.js +2 -6
  88. package/dist/ui/link-popover/index.mjs +3 -4
  89. package/dist/ui/link-popover/link-popover.js +2 -6
  90. package/dist/ui/link-popover/link-popover.mjs +3 -4
  91. package/dist/ui/link-popover/use-link-popover.js +2 -6
  92. package/dist/ui/link-popover/use-link-popover.mjs +2 -3
  93. package/dist/ui/list-button/index.js +2 -9
  94. package/dist/ui/list-button/index.mjs +1 -3
  95. package/dist/ui/list-dropdown-menu/index.js +4 -10
  96. package/dist/ui/list-dropdown-menu/index.mjs +2 -4
  97. package/dist/ui/mark-button/index.js +3 -21
  98. package/dist/ui/mark-button/index.mjs +1 -3
  99. package/dist/ui/reset-all-formatting-button/index.mjs +0 -1
  100. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.mjs +0 -1
  101. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.mjs +0 -1
  102. package/dist/ui/slash-dropdown-menu/index.js +27 -129
  103. package/dist/ui/slash-dropdown-menu/index.mjs +3 -5
  104. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +27 -129
  105. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +3 -5
  106. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +23 -116
  107. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +2 -4
  108. package/dist/ui/suggestion-menu/index.mjs +0 -1
  109. package/dist/ui/suggestion-menu/suggestion-menu-utils.mjs +0 -1
  110. package/dist/ui/suggestion-menu/suggestion-menu.mjs +0 -1
  111. package/dist/ui/table-button/index.js +4 -24
  112. package/dist/ui/table-button/index.mjs +2 -4
  113. package/dist/ui/table-button/use-table.js +3 -21
  114. package/dist/ui/table-button/use-table.mjs +1 -3
  115. package/dist/ui/text-align-button/index.js +3 -32
  116. package/dist/ui/text-align-button/index.mjs +2 -4
  117. package/dist/ui/text-align-button/text-align-button.js +3 -32
  118. package/dist/ui/text-align-button/text-align-button.mjs +2 -4
  119. package/dist/ui/text-align-button/use-text-align.js +3 -30
  120. package/dist/ui/text-align-button/use-text-align.mjs +1 -3
  121. package/dist/ui/undo-redo-button/index.js +2 -18
  122. package/dist/ui/undo-redo-button/index.mjs +2 -4
  123. package/dist/ui/undo-redo-button/undo-redo-button.js +2 -18
  124. package/dist/ui/undo-redo-button/undo-redo-button.mjs +2 -4
  125. package/dist/ui/undo-redo-button/use-undo-redo.js +2 -16
  126. package/dist/ui/undo-redo-button/use-undo-redo.mjs +1 -3
  127. package/dist/utils/index.d.mts +1 -101
  128. package/dist/utils/index.d.ts +1 -101
  129. package/dist/utils/index.js +0 -166
  130. package/dist/utils/index.mjs +1 -28
  131. package/dist/utils/safe-parse.mjs +0 -1
  132. package/package.json +36 -30
  133. package/dist/chunk-4HTILXJM.mjs +0 -104
  134. package/dist/chunk-4IIGLBTD.mjs +0 -81
  135. package/dist/chunk-574UV65T.mjs +0 -111
  136. package/dist/chunk-7HC7D256.mjs +0 -91
  137. package/dist/chunk-AC22DSDA.mjs +0 -540
  138. package/dist/chunk-AGOMESFC.mjs +0 -1
  139. package/dist/chunk-BXPGSCTT.mjs +0 -39
  140. package/dist/chunk-C6M3CDOK.mjs +0 -254
  141. package/dist/chunk-EN3J5AMF.mjs +0 -12
  142. package/dist/chunk-HYDS6H67.mjs +0 -58
  143. package/dist/chunk-KRLE4MMD.mjs +0 -116
  144. package/dist/chunk-LKOQAQPZ.mjs +0 -13
  145. package/dist/chunk-LXZ53XU7.mjs +0 -1
  146. package/dist/chunk-T6P7CS4F.mjs +0 -42
  147. package/dist/chunk-TVFWG7IC.mjs +0 -43
  148. package/dist/chunk-VULWMVYS.mjs +0 -11
  149. package/dist/chunk-WKV76XOR.mjs +0 -8
  150. package/dist/extensions/table/index.d.mts +0 -8
  151. package/dist/extensions/table/index.d.ts +0 -8
  152. package/dist/extensions/table/index.js +0 -1044
  153. package/dist/extensions/table/index.mjs +0 -33
  154. package/dist/extensions/table/kit.d.mts +0 -30
  155. package/dist/extensions/table/kit.d.ts +0 -30
  156. package/dist/extensions/table/kit.js +0 -1034
  157. package/dist/extensions/table/kit.mjs +0 -20
  158. package/dist/extensions/table/table/icons.d.mts +0 -13
  159. package/dist/extensions/table/table/icons.d.ts +0 -13
  160. package/dist/extensions/table/table/icons.js +0 -81
  161. package/dist/extensions/table/table/icons.mjs +0 -8
  162. package/dist/extensions/table/table/index.d.mts +0 -3
  163. package/dist/extensions/table/table/index.d.ts +0 -3
  164. package/dist/extensions/table/table/index.js +0 -818
  165. package/dist/extensions/table/table/index.mjs +0 -16
  166. package/dist/extensions/table/table/table-controls.d.mts +0 -10
  167. package/dist/extensions/table/table/table-controls.d.ts +0 -10
  168. package/dist/extensions/table/table/table-controls.js +0 -129
  169. package/dist/extensions/table/table/table-controls.mjs +0 -8
  170. package/dist/extensions/table/table/table-view.d.mts +0 -43
  171. package/dist/extensions/table/table/table-view.d.ts +0 -43
  172. package/dist/extensions/table/table/table-view.js +0 -610
  173. package/dist/extensions/table/table/table-view.mjs +0 -12
  174. package/dist/extensions/table/table/table.d.mts +0 -17
  175. package/dist/extensions/table/table/table.d.ts +0 -17
  176. package/dist/extensions/table/table/table.js +0 -816
  177. package/dist/extensions/table/table/table.mjs +0 -15
  178. package/dist/extensions/table/table/utilities/col-style.d.mts +0 -3
  179. package/dist/extensions/table/table/utilities/col-style.d.ts +0 -3
  180. package/dist/extensions/table/table/utilities/col-style.js +0 -36
  181. package/dist/extensions/table/table/utilities/col-style.mjs +0 -8
  182. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.d.mts +0 -5
  183. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.d.ts +0 -5
  184. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.js +0 -66
  185. package/dist/extensions/table/table/utilities/delete-table-when-all-cells-selected.mjs +0 -40
  186. package/dist/extensions/table/table/utilities/get-table-node-types.d.mts +0 -7
  187. package/dist/extensions/table/table/utilities/get-table-node-types.d.ts +0 -7
  188. package/dist/extensions/table/table/utilities/get-table-node-types.js +0 -44
  189. package/dist/extensions/table/table/utilities/get-table-node-types.mjs +0 -21
  190. package/dist/extensions/table/table/utilities/insert-line-above-table-action.d.mts +0 -5
  191. package/dist/extensions/table/table/utilities/insert-line-above-table-action.d.ts +0 -5
  192. package/dist/extensions/table/table/utilities/insert-line-above-table-action.js +0 -80
  193. package/dist/extensions/table/table/utilities/insert-line-above-table-action.mjs +0 -9
  194. package/dist/extensions/table/table/utilities/insert-line-below-table-action.d.mts +0 -5
  195. package/dist/extensions/table/table/utilities/insert-line-below-table-action.d.ts +0 -5
  196. package/dist/extensions/table/table/utilities/insert-line-below-table-action.js +0 -79
  197. package/dist/extensions/table/table/utilities/insert-line-below-table-action.mjs +0 -9
  198. package/dist/extensions/table/table/utilities/is-cell-selection.d.mts +0 -5
  199. package/dist/extensions/table/table/utilities/is-cell-selection.d.ts +0 -5
  200. package/dist/extensions/table/table/utilities/is-cell-selection.js +0 -34
  201. package/dist/extensions/table/table/utilities/is-cell-selection.mjs +0 -8
  202. package/dist/extensions/table/table-cell.d.mts +0 -8
  203. package/dist/extensions/table/table-cell.d.ts +0 -8
  204. package/dist/extensions/table/table-cell.js +0 -139
  205. package/dist/extensions/table/table-cell.mjs +0 -8
  206. package/dist/extensions/table/table-header.d.mts +0 -6
  207. package/dist/extensions/table/table-header.d.ts +0 -6
  208. package/dist/extensions/table/table-header.js +0 -104
  209. package/dist/extensions/table/table-header.mjs +0 -8
  210. package/dist/extensions/table/table-row.d.mts +0 -6
  211. package/dist/extensions/table/table-row.d.ts +0 -6
  212. package/dist/extensions/table/table-row.js +0 -35
  213. package/dist/extensions/table/table-row.mjs +0 -8
@@ -35,110 +35,18 @@ __export(use_slash_dropdown_menu_exports, {
35
35
  useSlashDropdownMenu: () => useSlashDropdownMenu
36
36
  });
37
37
  module.exports = __toCommonJS(use_slash_dropdown_menu_exports);
38
+ var import_editor_utils2 = require("@kopexa/editor-utils");
38
39
  var import_icons2 = require("@kopexa/icons");
39
40
  var React = __toESM(require("react"));
40
41
 
41
- // src/utils/index.ts
42
- var import_state = require("@tiptap/pm/state");
43
- var MAX_FILE_SIZE = 5 * 1024 * 1024;
44
- var isNodeInSchema = (nodeName, editor) => {
45
- if (!(editor == null ? void 0 : editor.schema)) return false;
46
- return editor.schema.spec.nodes.get(nodeName) !== void 0;
47
- };
48
- function findNodePosition(props) {
49
- var _a;
50
- const { editor, node, nodePos } = props;
51
- if (!editor || !((_a = editor.state) == null ? void 0 : _a.doc)) return null;
52
- const hasValidNode = node !== void 0 && node !== null;
53
- const hasValidPos = nodePos !== void 0 && nodePos !== null;
54
- if (!hasValidNode && !hasValidPos) {
55
- return null;
56
- }
57
- if (hasValidPos) {
58
- try {
59
- const nodeAtPos = editor.state.doc.nodeAt(nodePos);
60
- if (nodeAtPos) {
61
- return { pos: nodePos, node: nodeAtPos };
62
- }
63
- } catch (error) {
64
- console.error("Error checking node at position:", error);
65
- return null;
66
- }
67
- }
68
- let foundPos = -1;
69
- let foundNode = null;
70
- editor.state.doc.descendants((currentNode, pos) => {
71
- if (currentNode === node) {
72
- foundPos = pos;
73
- foundNode = currentNode;
74
- return false;
75
- }
76
- return true;
77
- });
78
- return foundPos !== -1 && foundNode !== null ? { pos: foundPos, node: foundNode } : null;
79
- }
80
- function isNodeTypeSelected(editor, types = []) {
81
- if (!editor || !editor.state.selection) return false;
82
- const { state } = editor;
83
- const { selection } = state;
84
- if (selection.empty) return false;
85
- if (selection instanceof import_state.NodeSelection) {
86
- const node = selection.node;
87
- return node ? types.includes(node.type.name) : false;
88
- }
89
- return false;
90
- }
91
- function isExtensionAvailable(editor, extensionNames) {
92
- if (!editor) return false;
93
- const names = Array.isArray(extensionNames) ? extensionNames : [extensionNames];
94
- const found = names.some(
95
- (name) => editor.extensionManager.extensions.some((ext) => ext.name === name)
96
- );
97
- if (!found) {
98
- console.warn(
99
- `None of the extensions [${names.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`
100
- );
101
- }
102
- return found;
103
- }
104
- function hasContentAbove(editor) {
105
- if (!editor) return { hasContent: false, content: "" };
106
- const { state } = editor;
107
- const { $from } = state.selection;
108
- for (let i = $from.index(0) - 1; i >= 0; i--) {
109
- const node = state.doc.child(i);
110
- const content = node.textContent.trim();
111
- if (content) {
112
- return { hasContent: true, content };
113
- }
114
- }
115
- return { hasContent: false, content: "" };
116
- }
117
- function findSelectionPosition(params) {
118
- const { editor, node, nodePos } = params;
119
- if (isValidPosition(nodePos)) return nodePos;
120
- if (node) {
121
- const found = findNodePosition({ editor, node });
122
- if (found) return found.pos;
123
- }
124
- const { selection } = editor.state;
125
- if (!selection.empty) return null;
126
- const resolvedPos = selection.$anchor;
127
- const nodeDepth = 1;
128
- const selectedNode = resolvedPos.node(nodeDepth);
129
- return selectedNode ? resolvedPos.before(nodeDepth) : null;
130
- }
131
- function isValidPosition(pos) {
132
- return typeof pos === "number" && pos >= 0;
133
- }
134
-
135
42
  // src/ui/table-button/use-table.ts
43
+ var import_editor_utils = require("@kopexa/editor-utils");
136
44
  var import_icons = require("@kopexa/icons");
137
45
  var import_react = require("@tiptap/react");
138
46
  var import_react2 = require("react");
139
47
  function canToggle(editor) {
140
48
  if (!editor || !editor.isEditable) return false;
141
- if (!isNodeInSchema("table", editor) || isNodeTypeSelected(editor, ["image"])) {
49
+ if (!(0, import_editor_utils.isNodeInSchema)("table", editor) || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"])) {
142
50
  return false;
143
51
  }
144
52
  try {
@@ -301,8 +209,8 @@ var getItemImplementations = () => {
301
209
  // AI
302
210
  continue_writing: {
303
211
  check: (editor) => {
304
- const { hasContent } = hasContentAbove(editor);
305
- const extensionsReady = isExtensionAvailable(editor, [
212
+ const { hasContent } = (0, import_editor_utils2.hasContentAbove)(editor);
213
+ const extensionsReady = (0, import_editor_utils2.isExtensionAvailable)(editor, [
306
214
  "ai",
307
215
  "aiAdvanced"
308
216
  ]);
@@ -310,14 +218,14 @@ var getItemImplementations = () => {
310
218
  },
311
219
  action: ({ editor }) => {
312
220
  const editorChain = editor.chain().focus();
313
- const nodeSelectionPosition = findSelectionPosition({ editor });
221
+ const nodeSelectionPosition = (0, import_editor_utils2.findSelectionPosition)({ editor });
314
222
  if (nodeSelectionPosition !== null) {
315
223
  editorChain.setNodeSelection(nodeSelectionPosition);
316
224
  }
317
225
  editorChain.run();
318
226
  editor.chain().focus().aiGenerationShow().run();
319
227
  requestAnimationFrame(() => {
320
- const { hasContent, content } = hasContentAbove(editor);
228
+ const { hasContent, content } = (0, import_editor_utils2.hasContentAbove)(editor);
321
229
  const snippet = content.length > 500 ? `...${content.slice(-500)}` : content;
322
230
  const prompt = hasContent ? `Context: ${snippet}
323
231
 
@@ -331,10 +239,10 @@ Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT R
331
239
  }
332
240
  },
333
241
  ai_ask_button: {
334
- check: (editor) => isExtensionAvailable(editor, ["ai", "aiAdvanced"]),
242
+ check: (editor) => (0, import_editor_utils2.isExtensionAvailable)(editor, ["ai", "aiAdvanced"]),
335
243
  action: ({ editor }) => {
336
244
  const editorChain = editor.chain().focus();
337
- const nodeSelectionPosition = findSelectionPosition({ editor });
245
+ const nodeSelectionPosition = (0, import_editor_utils2.findSelectionPosition)({ editor });
338
246
  if (nodeSelectionPosition !== null) {
339
247
  editorChain.setNodeSelection(nodeSelectionPosition);
340
248
  }
@@ -344,55 +252,55 @@ Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT R
344
252
  },
345
253
  // Style
346
254
  text: {
347
- check: (editor) => isNodeInSchema("paragraph", editor),
255
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("paragraph", editor),
348
256
  action: ({ editor }) => {
349
257
  editor.chain().focus().setParagraph().run();
350
258
  }
351
259
  },
352
260
  heading_1: {
353
- check: (editor) => isNodeInSchema("heading", editor),
261
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
354
262
  action: ({ editor }) => {
355
263
  editor.chain().focus().toggleHeading({ level: 1 }).run();
356
264
  }
357
265
  },
358
266
  heading_2: {
359
- check: (editor) => isNodeInSchema("heading", editor),
267
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
360
268
  action: ({ editor }) => {
361
269
  editor.chain().focus().toggleHeading({ level: 2 }).run();
362
270
  }
363
271
  },
364
272
  heading_3: {
365
- check: (editor) => isNodeInSchema("heading", editor),
273
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
366
274
  action: ({ editor }) => {
367
275
  editor.chain().focus().toggleHeading({ level: 3 }).run();
368
276
  }
369
277
  },
370
278
  bullet_list: {
371
- check: (editor) => isNodeInSchema("bulletList", editor),
279
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("bulletList", editor),
372
280
  action: ({ editor }) => {
373
281
  editor.chain().focus().toggleBulletList().run();
374
282
  }
375
283
  },
376
284
  ordered_list: {
377
- check: (editor) => isNodeInSchema("orderedList", editor),
285
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("orderedList", editor),
378
286
  action: ({ editor }) => {
379
287
  editor.chain().focus().toggleOrderedList().run();
380
288
  }
381
289
  },
382
290
  task_list: {
383
- check: (editor) => isNodeInSchema("taskList", editor),
291
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("taskList", editor),
384
292
  action: ({ editor }) => {
385
293
  editor.chain().focus().toggleTaskList().run();
386
294
  }
387
295
  },
388
296
  quote: {
389
- check: (editor) => isNodeInSchema("blockquote", editor),
297
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("blockquote", editor),
390
298
  action: ({ editor }) => {
391
299
  editor.chain().focus().toggleBlockquote().run();
392
300
  }
393
301
  },
394
302
  code_block: {
395
- check: (editor) => isNodeInSchema("codeBlock", editor),
303
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("codeBlock", editor),
396
304
  action: ({ editor }) => {
397
305
  editor.chain().focus().toggleNode("codeBlock", "paragraph").run();
398
306
  }
@@ -409,21 +317,20 @@ Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT R
409
317
  // action: ({ editor }: { editor: Editor }) => addEmojiTrigger(editor),
410
318
  // },
411
319
  divider: {
412
- check: (editor) => isNodeInSchema("horizontalRule", editor),
320
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("horizontalRule", editor),
413
321
  action: ({ editor }) => {
414
322
  editor.chain().focus().setHorizontalRule().run();
415
323
  }
416
324
  },
417
325
  table: {
418
- check: (editor) => isNodeInSchema("table", editor),
326
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("table", editor),
419
327
  action: ({ editor }) => toggleTable(editor, { rows: 3, cols: 3, withHeaderRow: true })
420
328
  },
421
329
  control: {
422
- check: (editor) => isNodeInSchema("controlRef", editor),
330
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("controlBlock", editor),
423
331
  action: ({ editor }) => {
424
- console.log("hoho");
425
332
  try {
426
- return editor.chain().focus().insertControlRef().run();
333
+ return editor.chain().focus().insertControlBlock().run();
427
334
  } catch (e) {
428
335
  console.error(e);
429
336
  }
@@ -431,7 +338,7 @@ Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT R
431
338
  },
432
339
  // Upload
433
340
  image: {
434
- check: (editor) => isNodeInSchema("image", editor),
341
+ check: (editor) => (0, import_editor_utils2.isNodeInSchema)("image", editor),
435
342
  action: ({ editor }) => {
436
343
  editor.chain().focus().insertContent({
437
344
  type: "imageUpload"
@@ -2,11 +2,9 @@
2
2
  "use client";
3
3
  import {
4
4
  useSlashDropdownMenu
5
- } from "../../chunk-6W7J7PHZ.mjs";
6
- import "../../chunk-ZSYXHD7D.mjs";
7
- import "../../chunk-C6M3CDOK.mjs";
5
+ } from "../../chunk-B2DHYFSH.mjs";
6
+ import "../../chunk-YJAHZXLG.mjs";
8
7
  import "../../chunk-P55PLOHR.mjs";
9
- import "../../chunk-WKV76XOR.mjs";
10
8
  export {
11
9
  useSlashDropdownMenu
12
10
  };
@@ -10,7 +10,6 @@ import {
10
10
  import "../../chunk-KK4K43WM.mjs";
11
11
  import "../../chunk-42HKGCOO.mjs";
12
12
  import "../../chunk-P55PLOHR.mjs";
13
- import "../../chunk-WKV76XOR.mjs";
14
13
  export {
15
14
  SuggestionMenu,
16
15
  calculateStartPosition,
@@ -3,7 +3,6 @@ import {
3
3
  calculateStartPosition,
4
4
  filterSuggestionItems
5
5
  } from "../../chunk-CNVACBGT.mjs";
6
- import "../../chunk-WKV76XOR.mjs";
7
6
  export {
8
7
  calculateStartPosition,
9
8
  filterSuggestionItems
@@ -7,7 +7,6 @@ import "../../chunk-CNVACBGT.mjs";
7
7
  import "../../chunk-KK4K43WM.mjs";
8
8
  import "../../chunk-42HKGCOO.mjs";
9
9
  import "../../chunk-P55PLOHR.mjs";
10
- import "../../chunk-WKV76XOR.mjs";
11
10
  export {
12
11
  SuggestionMenu
13
12
  };
@@ -57,33 +57,13 @@ function useTiptapEditor(providedEditor) {
57
57
  }
58
58
 
59
59
  // src/ui/table-button/use-table.ts
60
+ var import_editor_utils = require("@kopexa/editor-utils");
60
61
  var import_icons = require("@kopexa/icons");
61
62
  var import_react3 = require("@tiptap/react");
62
63
  var import_react4 = require("react");
63
-
64
- // src/utils/index.ts
65
- var import_state = require("@tiptap/pm/state");
66
- var MAX_FILE_SIZE = 5 * 1024 * 1024;
67
- var isNodeInSchema = (nodeName, editor) => {
68
- if (!(editor == null ? void 0 : editor.schema)) return false;
69
- return editor.schema.spec.nodes.get(nodeName) !== void 0;
70
- };
71
- function isNodeTypeSelected(editor, types = []) {
72
- if (!editor || !editor.state.selection) return false;
73
- const { state } = editor;
74
- const { selection } = state;
75
- if (selection.empty) return false;
76
- if (selection instanceof import_state.NodeSelection) {
77
- const node = selection.node;
78
- return node ? types.includes(node.type.name) : false;
79
- }
80
- return false;
81
- }
82
-
83
- // src/ui/table-button/use-table.ts
84
64
  function canToggle(editor) {
85
65
  if (!editor || !editor.isEditable) return false;
86
- if (!isNodeInSchema("table", editor) || isNodeTypeSelected(editor, ["image"])) {
66
+ if (!(0, import_editor_utils.isNodeInSchema)("table", editor) || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"])) {
87
67
  return false;
88
68
  }
89
69
  try {
@@ -109,7 +89,7 @@ function toggleTable(editor, config) {
109
89
  function shouldShowButton(props) {
110
90
  const { editor, hideWhenUnavailable } = props;
111
91
  if (!editor || !editor.isEditable) return false;
112
- if (!isNodeInSchema("table", editor)) return false;
92
+ if (!(0, import_editor_utils.isNodeInSchema)("table", editor)) return false;
113
93
  if (hideWhenUnavailable) {
114
94
  if ((0, import_react3.isNodeSelection)(editor.state.selection) || !canToggle) {
115
95
  return false;
@@ -205,7 +185,7 @@ var TableButton = ({
205
185
  tabIndex: -1,
206
186
  "aria-label": label,
207
187
  "aria-pressed": isActive,
208
- tooltip: label,
188
+ title: label,
209
189
  onClick: handleClick,
210
190
  isIconOnly: !text && !children,
211
191
  ...buttonProps,
@@ -1,11 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  TableButton
4
- } from "../../chunk-QP2LCU5N.mjs";
5
- import "../../chunk-ZSYXHD7D.mjs";
6
- import "../../chunk-C6M3CDOK.mjs";
4
+ } from "../../chunk-VX3HSJ76.mjs";
5
+ import "../../chunk-YJAHZXLG.mjs";
7
6
  import "../../chunk-P55PLOHR.mjs";
8
- import "../../chunk-WKV76XOR.mjs";
9
7
  export {
10
8
  TableButton
11
9
  };
@@ -27,6 +27,7 @@ __export(use_table_exports, {
27
27
  useTableBlock: () => useTableBlock
28
28
  });
29
29
  module.exports = __toCommonJS(use_table_exports);
30
+ var import_editor_utils = require("@kopexa/editor-utils");
30
31
  var import_icons = require("@kopexa/icons");
31
32
  var import_react3 = require("@tiptap/react");
32
33
  var import_react4 = require("react");
@@ -60,29 +61,10 @@ function useTiptapEditor(providedEditor) {
60
61
  return editorState || { editor: null };
61
62
  }
62
63
 
63
- // src/utils/index.ts
64
- var import_state = require("@tiptap/pm/state");
65
- var MAX_FILE_SIZE = 5 * 1024 * 1024;
66
- var isNodeInSchema = (nodeName, editor) => {
67
- if (!(editor == null ? void 0 : editor.schema)) return false;
68
- return editor.schema.spec.nodes.get(nodeName) !== void 0;
69
- };
70
- function isNodeTypeSelected(editor, types = []) {
71
- if (!editor || !editor.state.selection) return false;
72
- const { state } = editor;
73
- const { selection } = state;
74
- if (selection.empty) return false;
75
- if (selection instanceof import_state.NodeSelection) {
76
- const node = selection.node;
77
- return node ? types.includes(node.type.name) : false;
78
- }
79
- return false;
80
- }
81
-
82
64
  // src/ui/table-button/use-table.ts
83
65
  function canToggle(editor) {
84
66
  if (!editor || !editor.isEditable) return false;
85
- if (!isNodeInSchema("table", editor) || isNodeTypeSelected(editor, ["image"])) {
67
+ if (!(0, import_editor_utils.isNodeInSchema)("table", editor) || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"])) {
86
68
  return false;
87
69
  }
88
70
  try {
@@ -108,7 +90,7 @@ function toggleTable(editor, config) {
108
90
  function shouldShowButton(props) {
109
91
  const { editor, hideWhenUnavailable } = props;
110
92
  if (!editor || !editor.isEditable) return false;
111
- if (!isNodeInSchema("table", editor)) return false;
93
+ if (!(0, import_editor_utils.isNodeInSchema)("table", editor)) return false;
112
94
  if (hideWhenUnavailable) {
113
95
  if ((0, import_react3.isNodeSelection)(editor.state.selection) || !canToggle) {
114
96
  return false;
@@ -4,10 +4,8 @@ import {
4
4
  shouldShowButton,
5
5
  toggleTable,
6
6
  useTableBlock
7
- } from "../../chunk-ZSYXHD7D.mjs";
8
- import "../../chunk-C6M3CDOK.mjs";
7
+ } from "../../chunk-YJAHZXLG.mjs";
9
8
  import "../../chunk-P55PLOHR.mjs";
10
- import "../../chunk-WKV76XOR.mjs";
11
9
  export {
12
10
  canToggle,
13
11
  shouldShowButton,
@@ -68,38 +68,9 @@ function useTiptapEditor(providedEditor) {
68
68
  }
69
69
 
70
70
  // src/ui/text-align-button/use-text-align.ts
71
+ var import_editor_utils = require("@kopexa/editor-utils");
71
72
  var import_icons = require("@kopexa/icons");
72
73
  var import_react3 = require("react");
73
-
74
- // src/utils/index.ts
75
- var import_state = require("@tiptap/pm/state");
76
- var MAX_FILE_SIZE = 5 * 1024 * 1024;
77
- function isNodeTypeSelected(editor, types = []) {
78
- if (!editor || !editor.state.selection) return false;
79
- const { state } = editor;
80
- const { selection } = state;
81
- if (selection.empty) return false;
82
- if (selection instanceof import_state.NodeSelection) {
83
- const node = selection.node;
84
- return node ? types.includes(node.type.name) : false;
85
- }
86
- return false;
87
- }
88
- function isExtensionAvailable(editor, extensionNames) {
89
- if (!editor) return false;
90
- const names = Array.isArray(extensionNames) ? extensionNames : [extensionNames];
91
- const found = names.some(
92
- (name) => editor.extensionManager.extensions.some((ext) => ext.name === name)
93
- );
94
- if (!found) {
95
- console.warn(
96
- `None of the extensions [${names.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`
97
- );
98
- }
99
- return found;
100
- }
101
-
102
- // src/ui/text-align-button/use-text-align.ts
103
74
  var TEXT_ALIGN_SHORTCUT_KEYS = {
104
75
  left: "mod+shift+l",
105
76
  center: "mod+shift+e",
@@ -120,7 +91,7 @@ var textAlignLabels = {
120
91
  };
121
92
  function canSetTextAlign(editor, align) {
122
93
  if (!editor || !editor.isEditable) return false;
123
- if (!isExtensionAvailable(editor, "textAlign") || isNodeTypeSelected(editor, ["image"]))
94
+ if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign") || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"]))
124
95
  return false;
125
96
  return editor.can().setTextAlign(align);
126
97
  }
@@ -143,7 +114,7 @@ function setTextAlign(editor, align) {
143
114
  function shouldShowButton(props) {
144
115
  const { editor, hideWhenUnavailable, align } = props;
145
116
  if (!editor || !editor.isEditable) return false;
146
- if (!isExtensionAvailable(editor, "textAlign")) return false;
117
+ if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign")) return false;
147
118
  if (hideWhenUnavailable && !editor.isActive("code")) {
148
119
  return canSetTextAlign(editor, align);
149
120
  }
@@ -2,7 +2,7 @@
2
2
  import "../../chunk-4ALV4UA5.mjs";
3
3
  import {
4
4
  TextAlignButton
5
- } from "../../chunk-O5P45H3I.mjs";
5
+ } from "../../chunk-GYIYX2JH.mjs";
6
6
  import {
7
7
  TEXT_ALIGN_SHORTCUT_KEYS,
8
8
  canSetTextAlign,
@@ -13,10 +13,8 @@ import {
13
13
  textAlignIcons,
14
14
  textAlignLabels,
15
15
  useTextAlign
16
- } from "../../chunk-ILPDDC4W.mjs";
17
- import "../../chunk-C6M3CDOK.mjs";
16
+ } from "../../chunk-IQERE7KP.mjs";
18
17
  import "../../chunk-P55PLOHR.mjs";
19
- import "../../chunk-WKV76XOR.mjs";
20
18
  export {
21
19
  TEXT_ALIGN_SHORTCUT_KEYS,
22
20
  TextAlignButton,
@@ -57,38 +57,9 @@ function useTiptapEditor(providedEditor) {
57
57
  }
58
58
 
59
59
  // src/ui/text-align-button/use-text-align.ts
60
+ var import_editor_utils = require("@kopexa/editor-utils");
60
61
  var import_icons = require("@kopexa/icons");
61
62
  var import_react3 = require("react");
62
-
63
- // src/utils/index.ts
64
- var import_state = require("@tiptap/pm/state");
65
- var MAX_FILE_SIZE = 5 * 1024 * 1024;
66
- function isNodeTypeSelected(editor, types = []) {
67
- if (!editor || !editor.state.selection) return false;
68
- const { state } = editor;
69
- const { selection } = state;
70
- if (selection.empty) return false;
71
- if (selection instanceof import_state.NodeSelection) {
72
- const node = selection.node;
73
- return node ? types.includes(node.type.name) : false;
74
- }
75
- return false;
76
- }
77
- function isExtensionAvailable(editor, extensionNames) {
78
- if (!editor) return false;
79
- const names = Array.isArray(extensionNames) ? extensionNames : [extensionNames];
80
- const found = names.some(
81
- (name) => editor.extensionManager.extensions.some((ext) => ext.name === name)
82
- );
83
- if (!found) {
84
- console.warn(
85
- `None of the extensions [${names.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`
86
- );
87
- }
88
- return found;
89
- }
90
-
91
- // src/ui/text-align-button/use-text-align.ts
92
63
  var TEXT_ALIGN_SHORTCUT_KEYS = {
93
64
  left: "mod+shift+l",
94
65
  center: "mod+shift+e",
@@ -109,7 +80,7 @@ var textAlignLabels = {
109
80
  };
110
81
  function canSetTextAlign(editor, align) {
111
82
  if (!editor || !editor.isEditable) return false;
112
- if (!isExtensionAvailable(editor, "textAlign") || isNodeTypeSelected(editor, ["image"]))
83
+ if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign") || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"]))
113
84
  return false;
114
85
  return editor.can().setTextAlign(align);
115
86
  }
@@ -132,7 +103,7 @@ function setTextAlign(editor, align) {
132
103
  function shouldShowButton(props) {
133
104
  const { editor, hideWhenUnavailable, align } = props;
134
105
  if (!editor || !editor.isEditable) return false;
135
- if (!isExtensionAvailable(editor, "textAlign")) return false;
106
+ if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign")) return false;
136
107
  if (hideWhenUnavailable && !editor.isActive("code")) {
137
108
  return canSetTextAlign(editor, align);
138
109
  }
@@ -1,11 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  TextAlignButton
4
- } from "../../chunk-O5P45H3I.mjs";
5
- import "../../chunk-ILPDDC4W.mjs";
6
- import "../../chunk-C6M3CDOK.mjs";
4
+ } from "../../chunk-GYIYX2JH.mjs";
5
+ import "../../chunk-IQERE7KP.mjs";
7
6
  import "../../chunk-P55PLOHR.mjs";
8
- import "../../chunk-WKV76XOR.mjs";
9
7
  export {
10
8
  TextAlignButton
11
9
  };
@@ -32,6 +32,7 @@ __export(use_text_align_exports, {
32
32
  useTextAlign: () => useTextAlign
33
33
  });
34
34
  module.exports = __toCommonJS(use_text_align_exports);
35
+ var import_editor_utils = require("@kopexa/editor-utils");
35
36
  var import_icons = require("@kopexa/icons");
36
37
  var import_react3 = require("react");
37
38
 
@@ -64,34 +65,6 @@ function useTiptapEditor(providedEditor) {
64
65
  return editorState || { editor: null };
65
66
  }
66
67
 
67
- // src/utils/index.ts
68
- var import_state = require("@tiptap/pm/state");
69
- var MAX_FILE_SIZE = 5 * 1024 * 1024;
70
- function isNodeTypeSelected(editor, types = []) {
71
- if (!editor || !editor.state.selection) return false;
72
- const { state } = editor;
73
- const { selection } = state;
74
- if (selection.empty) return false;
75
- if (selection instanceof import_state.NodeSelection) {
76
- const node = selection.node;
77
- return node ? types.includes(node.type.name) : false;
78
- }
79
- return false;
80
- }
81
- function isExtensionAvailable(editor, extensionNames) {
82
- if (!editor) return false;
83
- const names = Array.isArray(extensionNames) ? extensionNames : [extensionNames];
84
- const found = names.some(
85
- (name) => editor.extensionManager.extensions.some((ext) => ext.name === name)
86
- );
87
- if (!found) {
88
- console.warn(
89
- `None of the extensions [${names.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`
90
- );
91
- }
92
- return found;
93
- }
94
-
95
68
  // src/ui/text-align-button/use-text-align.ts
96
69
  var TEXT_ALIGN_SHORTCUT_KEYS = {
97
70
  left: "mod+shift+l",
@@ -113,7 +86,7 @@ var textAlignLabels = {
113
86
  };
114
87
  function canSetTextAlign(editor, align) {
115
88
  if (!editor || !editor.isEditable) return false;
116
- if (!isExtensionAvailable(editor, "textAlign") || isNodeTypeSelected(editor, ["image"]))
89
+ if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign") || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"]))
117
90
  return false;
118
91
  return editor.can().setTextAlign(align);
119
92
  }
@@ -136,7 +109,7 @@ function setTextAlign(editor, align) {
136
109
  function shouldShowButton(props) {
137
110
  const { editor, hideWhenUnavailable, align } = props;
138
111
  if (!editor || !editor.isEditable) return false;
139
- if (!isExtensionAvailable(editor, "textAlign")) return false;
112
+ if (!(0, import_editor_utils.isExtensionAvailable)(editor, "textAlign")) return false;
140
113
  if (hideWhenUnavailable && !editor.isActive("code")) {
141
114
  return canSetTextAlign(editor, align);
142
115
  }
@@ -9,10 +9,8 @@ import {
9
9
  textAlignIcons,
10
10
  textAlignLabels,
11
11
  useTextAlign
12
- } from "../../chunk-ILPDDC4W.mjs";
13
- import "../../chunk-C6M3CDOK.mjs";
12
+ } from "../../chunk-IQERE7KP.mjs";
14
13
  import "../../chunk-P55PLOHR.mjs";
15
- import "../../chunk-WKV76XOR.mjs";
16
14
  export {
17
15
  TEXT_ALIGN_SHORTCUT_KEYS,
18
16
  canSetTextAlign,