@primeui/texteditor-core 0.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +1 -0
  3. package/dist/chunk-22B454VC.mjs +83 -0
  4. package/dist/chunk-22B454VC.mjs.map +1 -0
  5. package/dist/chunk-3RKMABZR.mjs +320 -0
  6. package/dist/chunk-3RKMABZR.mjs.map +1 -0
  7. package/dist/chunk-6GY64GPU.mjs +18 -0
  8. package/dist/chunk-6GY64GPU.mjs.map +1 -0
  9. package/dist/chunk-6YDCG63C.mjs +833 -0
  10. package/dist/chunk-6YDCG63C.mjs.map +1 -0
  11. package/dist/chunk-6ZN5XRH2.mjs +45 -0
  12. package/dist/chunk-6ZN5XRH2.mjs.map +1 -0
  13. package/dist/chunk-72T5I4O4.mjs +76 -0
  14. package/dist/chunk-72T5I4O4.mjs.map +1 -0
  15. package/dist/chunk-7QCHSEN2.mjs +16 -0
  16. package/dist/chunk-7QCHSEN2.mjs.map +1 -0
  17. package/dist/chunk-AJOKUIQD.mjs +33 -0
  18. package/dist/chunk-AJOKUIQD.mjs.map +1 -0
  19. package/dist/chunk-AUTGNC2Q.mjs +197 -0
  20. package/dist/chunk-AUTGNC2Q.mjs.map +1 -0
  21. package/dist/chunk-CRAB2MFE.mjs +19 -0
  22. package/dist/chunk-CRAB2MFE.mjs.map +1 -0
  23. package/dist/chunk-DXPG5XMX.mjs +18 -0
  24. package/dist/chunk-DXPG5XMX.mjs.map +1 -0
  25. package/dist/chunk-E2KXUP3F.mjs +9 -0
  26. package/dist/chunk-E2KXUP3F.mjs.map +1 -0
  27. package/dist/chunk-EA2YI7LA.mjs +23 -0
  28. package/dist/chunk-EA2YI7LA.mjs.map +1 -0
  29. package/dist/chunk-F7BJWPT6.mjs +401 -0
  30. package/dist/chunk-F7BJWPT6.mjs.map +1 -0
  31. package/dist/chunk-FFCQLWS5.mjs +32 -0
  32. package/dist/chunk-FFCQLWS5.mjs.map +1 -0
  33. package/dist/chunk-GG56GLXC.mjs +42 -0
  34. package/dist/chunk-GG56GLXC.mjs.map +1 -0
  35. package/dist/chunk-GGPBV4BM.mjs +37 -0
  36. package/dist/chunk-GGPBV4BM.mjs.map +1 -0
  37. package/dist/chunk-H3RFOYCT.mjs +27 -0
  38. package/dist/chunk-H3RFOYCT.mjs.map +1 -0
  39. package/dist/chunk-IUQKSDKG.mjs +23 -0
  40. package/dist/chunk-IUQKSDKG.mjs.map +1 -0
  41. package/dist/chunk-J5LGTIGS.mjs +9 -0
  42. package/dist/chunk-J5LGTIGS.mjs.map +1 -0
  43. package/dist/chunk-KNZAMA6H.mjs +198 -0
  44. package/dist/chunk-KNZAMA6H.mjs.map +1 -0
  45. package/dist/chunk-MNKMKFLQ.mjs +27 -0
  46. package/dist/chunk-MNKMKFLQ.mjs.map +1 -0
  47. package/dist/chunk-MWT5PK3Z.mjs +52 -0
  48. package/dist/chunk-MWT5PK3Z.mjs.map +1 -0
  49. package/dist/chunk-NWRVBNBW.mjs +65 -0
  50. package/dist/chunk-NWRVBNBW.mjs.map +1 -0
  51. package/dist/chunk-OGEMGWLR.mjs +180 -0
  52. package/dist/chunk-OGEMGWLR.mjs.map +1 -0
  53. package/dist/chunk-PRFYR67X.mjs +60 -0
  54. package/dist/chunk-PRFYR67X.mjs.map +1 -0
  55. package/dist/chunk-PT2O4RV7.mjs +143 -0
  56. package/dist/chunk-PT2O4RV7.mjs.map +1 -0
  57. package/dist/chunk-PT5V6UYE.mjs +10 -0
  58. package/dist/chunk-PT5V6UYE.mjs.map +1 -0
  59. package/dist/chunk-RH45QRSV.mjs +26 -0
  60. package/dist/chunk-RH45QRSV.mjs.map +1 -0
  61. package/dist/chunk-RQ2HHNI6.mjs +55 -0
  62. package/dist/chunk-RQ2HHNI6.mjs.map +1 -0
  63. package/dist/chunk-TB7ZSSR2.mjs +6 -0
  64. package/dist/chunk-TB7ZSSR2.mjs.map +1 -0
  65. package/dist/chunk-TBQVZVKA.mjs +1891 -0
  66. package/dist/chunk-TBQVZVKA.mjs.map +1 -0
  67. package/dist/chunk-VWGQMUPD.mjs +182 -0
  68. package/dist/chunk-VWGQMUPD.mjs.map +1 -0
  69. package/dist/chunk-XKY2VYPW.mjs +26 -0
  70. package/dist/chunk-XKY2VYPW.mjs.map +1 -0
  71. package/dist/chunk-XSVIGDQR.mjs +22 -0
  72. package/dist/chunk-XSVIGDQR.mjs.map +1 -0
  73. package/dist/chunk-YHMP6AN3.mjs +231 -0
  74. package/dist/chunk-YHMP6AN3.mjs.map +1 -0
  75. package/dist/commands/index.d.mts +13 -0
  76. package/dist/commands/index.mjs +13 -0
  77. package/dist/commands/index.mjs.map +1 -0
  78. package/dist/createTextEditor.d.mts +7 -0
  79. package/dist/createTextEditor.mjs +31 -0
  80. package/dist/createTextEditor.mjs.map +1 -0
  81. package/dist/index.d.mts +17 -0
  82. package/dist/index.mjs +45 -0
  83. package/dist/index.mjs.map +1 -0
  84. package/dist/plugins/columnWidthPin.d.mts +5 -0
  85. package/dist/plugins/columnWidthPin.mjs +4 -0
  86. package/dist/plugins/columnWidthPin.mjs.map +1 -0
  87. package/dist/plugins/contextToolbar.d.mts +9 -0
  88. package/dist/plugins/contextToolbar.mjs +5 -0
  89. package/dist/plugins/contextToolbar.mjs.map +1 -0
  90. package/dist/plugins/defineTextEditorPlugin.d.mts +20 -0
  91. package/dist/plugins/defineTextEditorPlugin.mjs +4 -0
  92. package/dist/plugins/defineTextEditorPlugin.mjs.map +1 -0
  93. package/dist/plugins/inputRules.d.mts +14 -0
  94. package/dist/plugins/inputRules.mjs +8 -0
  95. package/dist/plugins/inputRules.mjs.map +1 -0
  96. package/dist/plugins/keymap.d.mts +16 -0
  97. package/dist/plugins/keymap.mjs +6 -0
  98. package/dist/plugins/keymap.mjs.map +1 -0
  99. package/dist/plugins/mention.d.mts +24 -0
  100. package/dist/plugins/mention.mjs +5 -0
  101. package/dist/plugins/mention.mjs.map +1 -0
  102. package/dist/plugins/mentionController.d.mts +16 -0
  103. package/dist/plugins/mentionController.mjs +4 -0
  104. package/dist/plugins/mentionController.mjs.map +1 -0
  105. package/dist/plugins/placeholder.d.mts +9 -0
  106. package/dist/plugins/placeholder.mjs +5 -0
  107. package/dist/plugins/placeholder.mjs.map +1 -0
  108. package/dist/plugins/registry.d.mts +7 -0
  109. package/dist/plugins/registry.mjs +4 -0
  110. package/dist/plugins/registry.mjs.map +1 -0
  111. package/dist/plugins/selectionHighlight.d.mts +14 -0
  112. package/dist/plugins/selectionHighlight.mjs +5 -0
  113. package/dist/plugins/selectionHighlight.mjs.map +1 -0
  114. package/dist/plugins/slashCommands.d.mts +28 -0
  115. package/dist/plugins/slashCommands.mjs +5 -0
  116. package/dist/plugins/slashCommands.mjs.map +1 -0
  117. package/dist/plugins/tableOverlay.d.mts +15 -0
  118. package/dist/plugins/tableOverlay.mjs +6 -0
  119. package/dist/plugins/tableOverlay.mjs.map +1 -0
  120. package/dist/plugins/trailingNode.d.mts +6 -0
  121. package/dist/plugins/trailingNode.mjs +4 -0
  122. package/dist/plugins/trailingNode.mjs.map +1 -0
  123. package/dist/position-DbkbTrFL.d.mts +50 -0
  124. package/dist/schema/index.d.mts +89 -0
  125. package/dist/schema/index.mjs +8 -0
  126. package/dist/schema/index.mjs.map +1 -0
  127. package/dist/serialization/index.d.mts +8 -0
  128. package/dist/serialization/index.mjs +5 -0
  129. package/dist/serialization/index.mjs.map +1 -0
  130. package/dist/texteditor.classes.d.mts +34 -0
  131. package/dist/texteditor.classes.mjs +4 -0
  132. package/dist/texteditor.classes.mjs.map +1 -0
  133. package/dist/texteditor.constants.d.mts +36 -0
  134. package/dist/texteditor.constants.mjs +4 -0
  135. package/dist/texteditor.constants.mjs.map +1 -0
  136. package/dist/texteditor.props.d.mts +5 -0
  137. package/dist/texteditor.props.mjs +4 -0
  138. package/dist/texteditor.props.mjs.map +1 -0
  139. package/dist/texteditor.refs.d.mts +5 -0
  140. package/dist/texteditor.refs.mjs +4 -0
  141. package/dist/texteditor.refs.mjs.map +1 -0
  142. package/dist/texteditor.state.d.mts +5 -0
  143. package/dist/texteditor.state.mjs +4 -0
  144. package/dist/texteditor.state.mjs.map +1 -0
  145. package/dist/ui/focus.d.mts +5 -0
  146. package/dist/ui/focus.mjs +4 -0
  147. package/dist/ui/focus.mjs.map +1 -0
  148. package/dist/ui/index.d.mts +6 -0
  149. package/dist/ui/index.mjs +9 -0
  150. package/dist/ui/index.mjs.map +1 -0
  151. package/dist/ui/keyboard.d.mts +4 -0
  152. package/dist/ui/keyboard.mjs +4 -0
  153. package/dist/ui/keyboard.mjs.map +1 -0
  154. package/dist/ui/menu.d.mts +10 -0
  155. package/dist/ui/menu.mjs +4 -0
  156. package/dist/ui/menu.mjs.map +1 -0
  157. package/dist/ui/positioning.d.mts +30 -0
  158. package/dist/ui/positioning.mjs +5 -0
  159. package/dist/ui/positioning.mjs.map +1 -0
  160. package/dist/ui/scroll.d.mts +6 -0
  161. package/dist/ui/scroll.mjs +4 -0
  162. package/dist/ui/scroll.mjs.map +1 -0
  163. package/dist/utils/index.d.mts +18 -0
  164. package/dist/utils/index.mjs +18 -0
  165. package/dist/utils/index.mjs.map +1 -0
  166. package/package.json +73 -0
@@ -0,0 +1,833 @@
1
+ import { createBlockCommands, wrapInBlockquoteNormalized, wrapInListNormalized } from './chunk-VWGQMUPD.mjs';
2
+ import { DEFAULT_HIGHLIGHT_COLOR } from './chunk-TB7ZSSR2.mjs';
3
+ import { getMarkAttrs } from './chunk-72T5I4O4.mjs';
4
+ import { preserveSelection } from './chunk-RQ2HHNI6.mjs';
5
+ import { docToHtml } from './chunk-6ZN5XRH2.mjs';
6
+ import { parseDimension } from './chunk-F7BJWPT6.mjs';
7
+ import { sanitizeImageUrl, sanitizeTextAttr, sanitizeUrl } from './chunk-MNKMKFLQ.mjs';
8
+ import { setBlockType, toggleMark } from 'prosemirror-commands';
9
+ import { TableMap, CellSelection, toggleHeaderCell, splitCell, mergeCells, toggleHeaderColumn, deleteColumn, addColumnAfter, addColumnBefore, toggleHeaderRow, deleteTable, deleteRow, addRowAfter, addRowBefore } from 'prosemirror-tables';
10
+ import { TextSelection } from 'prosemirror-state';
11
+ import { liftListItem } from 'prosemirror-schema-list';
12
+ import { redo, undo } from 'prosemirror-history';
13
+
14
+ function toggleMarkCommand(view, markType) {
15
+ toggleMark(markType)(view.state, view.dispatch);
16
+ view.focus();
17
+ }
18
+ function applyStyleToRange(tr, markType, attr, value, from, to) {
19
+ const ranges = [];
20
+ tr.doc.nodesBetween(from, to, (node, pos) => {
21
+ if (!node.isText) return;
22
+ const existingMark = markType.isInSet(node.marks);
23
+ const existingAttrs = existingMark ? { ...existingMark.attrs } : {};
24
+ const mergedAttrs = { ...existingAttrs, [attr]: value || null };
25
+ ranges.push({ from: Math.max(pos, from), to: Math.min(pos + node.nodeSize, to), attrs: mergedAttrs });
26
+ });
27
+ tr.removeMark(from, to, markType);
28
+ for (const range of ranges) {
29
+ if (Object.values(range.attrs).some((v) => v != null)) {
30
+ tr.addMark(range.from, range.to, markType.create(range.attrs));
31
+ }
32
+ }
33
+ if (ranges.length === 0 && value) {
34
+ tr.addMark(from, to, markType.create({ [attr]: value }));
35
+ }
36
+ }
37
+ function applyTextStyle(view, schema, attr, value) {
38
+ const markType = schema.marks.textStyle;
39
+ const { selection } = view.state;
40
+ const { empty } = selection;
41
+ if (empty) {
42
+ const currentAttrs = getMarkAttrs(view.state, markType) || {};
43
+ const newAttrs = { ...currentAttrs, [attr]: value || null };
44
+ const hasValue = Object.values(newAttrs).some((v) => v != null);
45
+ const tr2 = hasValue ? view.state.tr.addStoredMark(markType.create(newAttrs)) : view.state.tr.removeStoredMark(markType);
46
+ view.dispatch(tr2);
47
+ view.focus();
48
+ return;
49
+ }
50
+ const tr = view.state.tr;
51
+ if (selection instanceof CellSelection) {
52
+ selection.forEachCell((cell, pos) => {
53
+ applyStyleToRange(tr, markType, attr, value, pos + 1, pos + cell.nodeSize - 1);
54
+ });
55
+ } else {
56
+ applyStyleToRange(tr, markType, attr, value, selection.from, selection.to);
57
+ }
58
+ view.dispatch(tr);
59
+ view.focus();
60
+ }
61
+ function isHighlightActive(view, schema) {
62
+ const attrs = getMarkAttrs(view.state, schema.marks.textStyle);
63
+ return !!attrs?.backgroundColor;
64
+ }
65
+ function createFormattingCommands(view, schema, options) {
66
+ const highlightColor = options?.highlightColor || DEFAULT_HIGHLIGHT_COLOR;
67
+ return {
68
+ bold: () => toggleMarkCommand(view, schema.marks.bold),
69
+ italic: () => toggleMarkCommand(view, schema.marks.italic),
70
+ underline: () => toggleMarkCommand(view, schema.marks.underline),
71
+ strikethrough: () => toggleMarkCommand(view, schema.marks.strikethrough),
72
+ subscript: () => toggleMarkCommand(view, schema.marks.subscript),
73
+ superscript: () => toggleMarkCommand(view, schema.marks.superscript),
74
+ code: () => toggleMarkCommand(view, schema.marks.code),
75
+ fontFamily: (family) => applyTextStyle(view, schema, "fontFamily", family),
76
+ fontSize: (size) => applyTextStyle(view, schema, "fontSize", size),
77
+ foregroundColor: (color) => applyTextStyle(view, schema, "color", color),
78
+ backgroundColor: (color) => applyTextStyle(view, schema, "backgroundColor", color),
79
+ highlight: () => applyTextStyle(view, schema, "backgroundColor", isHighlightActive(view, schema) ? null : highlightColor)
80
+ };
81
+ }
82
+ function currentListItemType(view, schema) {
83
+ const { $from } = view.state.selection;
84
+ for (let depth = $from.depth; depth > 0; depth--) {
85
+ const node = $from.node(depth);
86
+ if (node.type === schema.nodes.list_item) return schema.nodes.list_item;
87
+ if (node.type === schema.nodes.check_list_item) return schema.nodes.check_list_item;
88
+ }
89
+ return null;
90
+ }
91
+ function findList(view, schema) {
92
+ const { $from } = view.state.selection;
93
+ const listTypes = [schema.nodes.bullet_list, schema.nodes.ordered_list, schema.nodes.check_list];
94
+ for (let depth = $from.depth; depth > 0; depth--) {
95
+ const node = $from.node(depth);
96
+ if (listTypes.includes(node.type)) {
97
+ return { pos: $from.before(depth), node, depth };
98
+ }
99
+ }
100
+ const { from, to } = view.state.selection;
101
+ let found = null;
102
+ view.state.doc.nodesBetween(from, to, (node, pos) => {
103
+ if (found) return false;
104
+ if (listTypes.includes(node.type)) {
105
+ const $pos = view.state.doc.resolve(pos);
106
+ found = { pos, node, depth: $pos.depth };
107
+ return false;
108
+ }
109
+ return void 0;
110
+ });
111
+ return found;
112
+ }
113
+ function convertNode(node, targetListType, targetItemType, schema) {
114
+ const listTypes = [schema.nodes.bullet_list, schema.nodes.ordered_list, schema.nodes.check_list];
115
+ const itemTypes = [schema.nodes.list_item, schema.nodes.check_list_item];
116
+ if (listTypes.includes(node.type)) {
117
+ const children = [];
118
+ node.content.forEach((child) => children.push(convertNode(child, targetListType, targetItemType, schema)));
119
+ return targetListType.create(null, children);
120
+ }
121
+ if (itemTypes.includes(node.type)) {
122
+ const inner = [];
123
+ node.content.forEach((child) => inner.push(convertNode(child, targetListType, targetItemType, schema)));
124
+ const attrs = targetItemType === schema.nodes.check_list_item ? { checked: false } : null;
125
+ return targetItemType.create(attrs, inner, node.marks);
126
+ }
127
+ return node;
128
+ }
129
+ function convertItems(content, targetListType, targetItemType, schema) {
130
+ const items = [];
131
+ content.forEach((child) => items.push(convertNode(child, targetListType, targetItemType, schema)));
132
+ return items;
133
+ }
134
+ function findAllLists(view, schema) {
135
+ const { from, to } = view.state.selection;
136
+ const listTypes = [schema.nodes.bullet_list, schema.nodes.ordered_list, schema.nodes.check_list];
137
+ const results = [];
138
+ view.state.doc.nodesBetween(from, to, (node, pos) => {
139
+ if (listTypes.includes(node.type)) {
140
+ const $pos = view.state.doc.resolve(pos);
141
+ results.push({ pos, node, depth: $pos.depth });
142
+ return false;
143
+ }
144
+ return void 0;
145
+ });
146
+ return results;
147
+ }
148
+ function toggleList(view, schema, targetListType, targetItemType) {
149
+ const existing = findList(view, schema);
150
+ if (existing && existing.node.type === targetListType) {
151
+ const itemType = currentListItemType(view, schema) || targetItemType;
152
+ liftListItem(itemType)(view.state, view.dispatch);
153
+ view.focus();
154
+ return;
155
+ }
156
+ if (existing) {
157
+ const allLists = findAllLists(view, schema);
158
+ if (allLists.length > 0) {
159
+ const tr = view.state.tr;
160
+ const { anchor, head } = view.state.selection;
161
+ for (let i = allLists.length - 1; i >= 0; i--) {
162
+ const list = allLists[i];
163
+ const newList = targetListType.create(null, convertItems(list.node.content, targetListType, targetItemType, schema));
164
+ tr.replaceWith(list.pos, list.pos + list.node.nodeSize, newList);
165
+ }
166
+ try {
167
+ tr.setSelection(TextSelection.between(tr.doc.resolve(anchor), tr.doc.resolve(head)));
168
+ } catch {
169
+ }
170
+ view.dispatch(tr.scrollIntoView());
171
+ view.focus();
172
+ return;
173
+ }
174
+ }
175
+ wrapInListNormalized(view, schema, targetListType);
176
+ view.focus();
177
+ }
178
+ function createListCommands(view, schema) {
179
+ return {
180
+ bulletList: () => toggleList(view, schema, schema.nodes.bullet_list, schema.nodes.list_item),
181
+ orderedList: () => toggleList(view, schema, schema.nodes.ordered_list, schema.nodes.list_item),
182
+ checkList: () => toggleList(view, schema, schema.nodes.check_list, schema.nodes.check_list_item)
183
+ };
184
+ }
185
+ function findTable(view) {
186
+ const { $from } = view.state.selection;
187
+ for (let depth = $from.depth; depth > 0; depth--) {
188
+ if ($from.node(depth).type.name === "table") {
189
+ return { node: $from.node(depth), start: $from.before(depth) + 1 };
190
+ }
191
+ }
192
+ return null;
193
+ }
194
+ function selectColumn(view, colIndex) {
195
+ const table = findTable(view);
196
+ if (!table) return;
197
+ const map = TableMap.get(table.node);
198
+ if (colIndex >= map.width) return;
199
+ const firstCellPos = table.start + map.map[colIndex];
200
+ const lastCellPos = table.start + map.map[(map.height - 1) * map.width + colIndex];
201
+ const $first = view.state.doc.resolve(firstCellPos);
202
+ const $last = view.state.doc.resolve(lastCellPos);
203
+ view.dispatch(view.state.tr.setSelection(CellSelection.create(view.state.doc, $first.pos, $last.pos)));
204
+ }
205
+ function selectRow(view, rowIndex) {
206
+ const table = findTable(view);
207
+ if (!table) return;
208
+ const map = TableMap.get(table.node);
209
+ if (rowIndex >= map.height) return;
210
+ const firstCellPos = table.start + map.map[rowIndex * map.width];
211
+ const lastCellPos = table.start + map.map[rowIndex * map.width + (map.width - 1)];
212
+ const $first = view.state.doc.resolve(firstCellPos);
213
+ const $last = view.state.doc.resolve(lastCellPos);
214
+ view.dispatch(view.state.tr.setSelection(CellSelection.create(view.state.doc, $first.pos, $last.pos)));
215
+ }
216
+ function moveColumn(view, colIndex, direction) {
217
+ const table = findTable(view);
218
+ if (!table) return;
219
+ const map = TableMap.get(table.node);
220
+ const targetCol = colIndex + direction;
221
+ if (targetCol < 0 || targetCol >= map.width) return;
222
+ const tr = view.state.tr;
223
+ for (let row = map.height - 1; row >= 0; row--) {
224
+ const fromCellPos = table.start + map.map[row * map.width + colIndex];
225
+ const toCellPos = table.start + map.map[row * map.width + targetCol];
226
+ const fromCell = view.state.doc.nodeAt(fromCellPos);
227
+ const toCell = view.state.doc.nodeAt(toCellPos);
228
+ if (!fromCell || !toCell) return;
229
+ if ((fromCell.attrs.colspan ?? 1) > 1 || (toCell.attrs.colspan ?? 1) > 1 || (fromCell.attrs.rowspan ?? 1) > 1 || (toCell.attrs.rowspan ?? 1) > 1) return;
230
+ const [firstPos, firstCell, secondPos, secondCell] = fromCellPos < toCellPos ? [fromCellPos, fromCell, toCellPos, toCell] : [toCellPos, toCell, fromCellPos, fromCell];
231
+ tr.replaceWith(tr.mapping.map(secondPos), tr.mapping.map(secondPos + secondCell.nodeSize), firstCell.copy(firstCell.content));
232
+ tr.replaceWith(tr.mapping.map(firstPos), tr.mapping.map(firstPos + firstCell.nodeSize), secondCell.copy(secondCell.content));
233
+ }
234
+ if (tr.docChanged) {
235
+ view.dispatch(tr);
236
+ view.focus();
237
+ }
238
+ }
239
+ function moveRow(view, rowIndex, direction) {
240
+ const table = findTable(view);
241
+ if (!table) return;
242
+ const targetRow = rowIndex + direction;
243
+ if (targetRow < 0 || targetRow >= table.node.childCount) return;
244
+ const fromRow = table.node.child(rowIndex);
245
+ const toRow = table.node.child(targetRow);
246
+ if (fromRow.childCount !== toRow.childCount) return;
247
+ for (let col = 0; col < fromRow.childCount; col++) {
248
+ const a = fromRow.child(col);
249
+ const b = toRow.child(col);
250
+ if ((a.attrs.rowspan ?? 1) > 1 || (b.attrs.rowspan ?? 1) > 1 || (a.attrs.colspan ?? 1) > 1 || (b.attrs.colspan ?? 1) > 1) return;
251
+ }
252
+ let fromRowPos = table.start;
253
+ for (let i = 0; i < rowIndex; i++) {
254
+ fromRowPos += table.node.child(i).nodeSize;
255
+ }
256
+ let toRowPos = table.start;
257
+ for (let i = 0; i < targetRow; i++) {
258
+ toRowPos += table.node.child(i).nodeSize;
259
+ }
260
+ const tr = view.state.tr;
261
+ const [firstPos, firstRow, secondPos, secondRow] = fromRowPos < toRowPos ? [fromRowPos, fromRow, toRowPos, toRow] : [toRowPos, toRow, fromRowPos, fromRow];
262
+ tr.replaceWith(secondPos, secondPos + secondRow.nodeSize, firstRow.copy(firstRow.content));
263
+ tr.replaceWith(firstPos, firstPos + firstRow.nodeSize, secondRow.copy(secondRow.content));
264
+ if (tr.docChanged) {
265
+ view.dispatch(tr);
266
+ view.focus();
267
+ }
268
+ }
269
+ function alignCell(tr, cellPos, doc, alignment) {
270
+ const cell = doc.nodeAt(cellPos);
271
+ if (!cell) return;
272
+ cell.forEach((child, offset) => {
273
+ if (child.type.name === "paragraph" || child.type.name === "heading") {
274
+ const pos = cellPos + 1 + offset;
275
+ tr.setNodeMarkup(tr.mapping.map(pos), null, { ...child.attrs, textAlign: alignment === "left" ? null : alignment });
276
+ }
277
+ });
278
+ }
279
+ function alignColumn(view, colIndex, alignment) {
280
+ const table = findTable(view);
281
+ if (!table) return;
282
+ const map = TableMap.get(table.node);
283
+ const tr = view.state.tr;
284
+ for (let row = 0; row < map.height; row++) {
285
+ const cellPos = table.start + map.map[row * map.width + colIndex];
286
+ alignCell(tr, cellPos, view.state.doc, alignment);
287
+ }
288
+ if (tr.docChanged) {
289
+ view.dispatch(tr);
290
+ view.focus();
291
+ }
292
+ }
293
+ function alignRow(view, rowIndex, alignment) {
294
+ const table = findTable(view);
295
+ if (!table) return;
296
+ const map = TableMap.get(table.node);
297
+ const tr = view.state.tr;
298
+ for (let col = 0; col < map.width; col++) {
299
+ const cellPos = table.start + map.map[rowIndex * map.width + col];
300
+ alignCell(tr, cellPos, view.state.doc, alignment);
301
+ }
302
+ if (tr.docChanged) {
303
+ view.dispatch(tr);
304
+ view.focus();
305
+ }
306
+ }
307
+ function alignCurrentCell(view, alignment) {
308
+ const { $from } = view.state.selection;
309
+ for (let depth = $from.depth; depth > 0; depth--) {
310
+ const node = $from.node(depth);
311
+ if (node.type.name === "table_cell" || node.type.name === "table_header") {
312
+ const cellPos = $from.before(depth);
313
+ const tr = view.state.tr;
314
+ alignCell(tr, cellPos, view.state.doc, alignment);
315
+ if (tr.docChanged) {
316
+ view.dispatch(tr);
317
+ view.focus();
318
+ }
319
+ return;
320
+ }
321
+ }
322
+ }
323
+ function setCellBackgroundColor(tr, cellPos, color) {
324
+ const cell = tr.doc.nodeAt(tr.mapping.map(cellPos));
325
+ if (!cell) return;
326
+ tr.setNodeMarkup(tr.mapping.map(cellPos), null, { ...cell.attrs, backgroundColor: color });
327
+ }
328
+ function setCellForegroundColor(view, cellPos, color) {
329
+ const cell = view.state.doc.nodeAt(cellPos);
330
+ if (!cell) return;
331
+ const from = cellPos + 1;
332
+ const to = cellPos + cell.nodeSize - 1;
333
+ const textStyleType = view.state.schema.marks.textStyle;
334
+ if (!textStyleType) return;
335
+ const tr = view.state.tr;
336
+ if (color) {
337
+ tr.addMark(from, to, textStyleType.create({ color }));
338
+ } else {
339
+ tr.removeMark(from, to, textStyleType);
340
+ }
341
+ view.dispatch(tr);
342
+ }
343
+ function colorColumn(view, colIndex, color, property) {
344
+ const table = findTable(view);
345
+ if (!table) return;
346
+ const map = TableMap.get(table.node);
347
+ if (property === "backgroundColor") {
348
+ const tr = view.state.tr;
349
+ for (let row = 0; row < map.height; row++) {
350
+ setCellBackgroundColor(tr, table.start + map.map[row * map.width + colIndex], color || null);
351
+ }
352
+ if (tr.docChanged) view.dispatch(tr);
353
+ } else {
354
+ for (let row = 0; row < map.height; row++) {
355
+ setCellForegroundColor(view, table.start + map.map[row * map.width + colIndex], color);
356
+ }
357
+ }
358
+ view.focus();
359
+ }
360
+ function colorRow(view, rowIndex, color, property) {
361
+ const table = findTable(view);
362
+ if (!table) return;
363
+ const map = TableMap.get(table.node);
364
+ if (property === "backgroundColor") {
365
+ const tr = view.state.tr;
366
+ for (let col = 0; col < map.width; col++) {
367
+ setCellBackgroundColor(tr, table.start + map.map[rowIndex * map.width + col], color || null);
368
+ }
369
+ if (tr.docChanged) view.dispatch(tr);
370
+ } else {
371
+ for (let col = 0; col < map.width; col++) {
372
+ setCellForegroundColor(view, table.start + map.map[rowIndex * map.width + col], color);
373
+ }
374
+ }
375
+ view.focus();
376
+ }
377
+ function colorCurrentCell(view, color, property) {
378
+ const { $from } = view.state.selection;
379
+ for (let depth = $from.depth; depth > 0; depth--) {
380
+ const node = $from.node(depth);
381
+ if (node.type.name === "table_cell" || node.type.name === "table_header") {
382
+ const cellPos = $from.before(depth);
383
+ if (property === "backgroundColor") {
384
+ const tr = view.state.tr;
385
+ setCellBackgroundColor(tr, cellPos, color || null);
386
+ if (tr.docChanged) view.dispatch(tr);
387
+ } else {
388
+ setCellForegroundColor(view, cellPos, color);
389
+ }
390
+ view.focus();
391
+ return;
392
+ }
393
+ }
394
+ }
395
+ function duplicateColumn(view, colIndex) {
396
+ const source = findTable(view);
397
+ if (!source) return;
398
+ const sourceMap = TableMap.get(source.node);
399
+ for (let row = 0; row < sourceMap.height; row++) {
400
+ const cell = view.state.doc.nodeAt(source.start + sourceMap.map[row * sourceMap.width + colIndex]);
401
+ if (cell && ((cell.attrs.colspan ?? 1) > 1 || (cell.attrs.rowspan ?? 1) > 1)) return;
402
+ }
403
+ addColumnAfter(view.state, view.dispatch);
404
+ const table = findTable(view);
405
+ if (!table) return;
406
+ const map = TableMap.get(table.node);
407
+ const tr = view.state.tr;
408
+ for (let row = 0; row < map.height; row++) {
409
+ const sourceCellPos = table.start + map.map[row * map.width + colIndex];
410
+ const targetCellPos = table.start + map.map[row * map.width + colIndex + 1];
411
+ const sourceCell = view.state.doc.nodeAt(sourceCellPos);
412
+ const targetCell = view.state.doc.nodeAt(targetCellPos);
413
+ if (!sourceCell || !targetCell) continue;
414
+ tr.replaceWith(tr.mapping.map(targetCellPos + 1), tr.mapping.map(targetCellPos + targetCell.nodeSize - 1), sourceCell.content);
415
+ }
416
+ if (tr.docChanged) {
417
+ view.dispatch(tr);
418
+ }
419
+ view.focus();
420
+ }
421
+ function duplicateRow(view, rowIndex) {
422
+ const table = findTable(view);
423
+ if (!table) return;
424
+ const row = table.node.child(rowIndex);
425
+ let rowEndPos = table.start;
426
+ for (let i = 0; i <= rowIndex; i++) {
427
+ rowEndPos += table.node.child(i).nodeSize;
428
+ }
429
+ const tr = view.state.tr.insert(rowEndPos, row.copy(row.content));
430
+ view.dispatch(tr);
431
+ view.focus();
432
+ }
433
+
434
+ // src/commands/tables.ts
435
+ function insertTable(view, schema, rows = 3, cols = 3, defaultCellWidth) {
436
+ const cells = [];
437
+ const cellAttrs = defaultCellWidth ? { colwidth: [defaultCellWidth] } : null;
438
+ for (let i = 0; i < cols; i++) {
439
+ cells.push(schema.nodes.table_cell.create(cellAttrs, schema.nodes.paragraph.create()));
440
+ }
441
+ const tableRows = [];
442
+ for (let i = 0; i < rows; i++) {
443
+ const rowCells = cells.map((cell) => cell.copy(cell.content));
444
+ tableRows.push(schema.nodes.table_row.create(null, rowCells));
445
+ }
446
+ const table = schema.nodes.table.create(null, tableRows);
447
+ const $from = view.state.selection.$from;
448
+ const parent = $from.node($from.depth);
449
+ const tr = view.state.tr;
450
+ let tablePos;
451
+ if (parent.isTextblock && parent.content.size === 0) {
452
+ tablePos = $from.before($from.depth);
453
+ tr.replaceWith(tablePos, tablePos + parent.nodeSize, table);
454
+ } else {
455
+ tablePos = $from.after(1);
456
+ tr.insert(tablePos, table);
457
+ }
458
+ const cellParagraphPos = tablePos + 3;
459
+ const selection = TextSelection.findFrom(tr.doc.resolve(cellParagraphPos), 1, true);
460
+ if (selection) tr.setSelection(selection);
461
+ view.dispatch(tr.scrollIntoView());
462
+ view.focus();
463
+ }
464
+ function createTableColumnCommands(view, schema, _colIndex, onDismiss) {
465
+ const run = (cmd) => {
466
+ cmd(view.state, view.dispatch);
467
+ view.focus();
468
+ onDismiss();
469
+ };
470
+ return {
471
+ insertBefore: () => run(addColumnBefore),
472
+ insertAfter: () => run(addColumnAfter),
473
+ delete: () => run(deleteColumn),
474
+ moveLeft: () => {
475
+ moveColumn(view, _colIndex, -1);
476
+ selectColumn(view, _colIndex - 1);
477
+ onDismiss();
478
+ },
479
+ moveRight: () => {
480
+ moveColumn(view, _colIndex, 1);
481
+ selectColumn(view, _colIndex + 1);
482
+ onDismiss();
483
+ },
484
+ duplicate: () => {
485
+ duplicateColumn(view, _colIndex);
486
+ onDismiss();
487
+ },
488
+ align: (value) => {
489
+ alignColumn(view, _colIndex, value);
490
+ onDismiss();
491
+ },
492
+ toggleHeader: () => run(toggleHeaderColumn),
493
+ foregroundColor: (color) => {
494
+ colorColumn(view, _colIndex, color, "color");
495
+ onDismiss();
496
+ },
497
+ backgroundColor: (color) => {
498
+ colorColumn(view, _colIndex, color, "backgroundColor");
499
+ onDismiss();
500
+ }
501
+ };
502
+ }
503
+ function createTableRowCommands(view, schema, _rowIndex, onDismiss) {
504
+ const run = (cmd) => {
505
+ cmd(view.state, view.dispatch);
506
+ view.focus();
507
+ onDismiss();
508
+ };
509
+ return {
510
+ insertBefore: () => run(addRowBefore),
511
+ insertAfter: () => run(addRowAfter),
512
+ delete: () => run(deleteRow),
513
+ moveUp: () => {
514
+ moveRow(view, _rowIndex, -1);
515
+ selectRow(view, _rowIndex - 1);
516
+ onDismiss();
517
+ },
518
+ moveDown: () => {
519
+ moveRow(view, _rowIndex, 1);
520
+ selectRow(view, _rowIndex + 1);
521
+ onDismiss();
522
+ },
523
+ duplicate: () => {
524
+ duplicateRow(view, _rowIndex);
525
+ onDismiss();
526
+ },
527
+ deleteTable: () => run(deleteTable),
528
+ align: (value) => {
529
+ alignRow(view, _rowIndex, value);
530
+ onDismiss();
531
+ },
532
+ toggleHeader: () => run(toggleHeaderRow),
533
+ foregroundColor: (color) => {
534
+ colorRow(view, _rowIndex, color, "color");
535
+ onDismiss();
536
+ },
537
+ backgroundColor: (color) => {
538
+ colorRow(view, _rowIndex, color, "backgroundColor");
539
+ onDismiss();
540
+ }
541
+ };
542
+ }
543
+ function createTableCellCommands(view, schema, onDismiss) {
544
+ return {
545
+ clearContents: () => {
546
+ const { $from } = view.state.selection;
547
+ for (let depth = $from.depth; depth > 0; depth--) {
548
+ if ($from.node(depth).type === schema.nodes.table_cell || $from.node(depth).type === schema.nodes.table_header) {
549
+ const cellStart = $from.start(depth);
550
+ const cellEnd = $from.end(depth);
551
+ const tr = view.state.tr.replaceWith(cellStart, cellEnd, schema.nodes.paragraph.create());
552
+ view.dispatch(tr);
553
+ break;
554
+ }
555
+ }
556
+ view.focus();
557
+ onDismiss();
558
+ },
559
+ align: (value) => {
560
+ alignCurrentCell(view, value);
561
+ onDismiss();
562
+ },
563
+ mergeCells: () => {
564
+ mergeCells(view.state, view.dispatch);
565
+ view.focus();
566
+ onDismiss();
567
+ },
568
+ splitCell: () => {
569
+ splitCell(view.state, view.dispatch);
570
+ view.focus();
571
+ onDismiss();
572
+ },
573
+ toggleHeader: () => {
574
+ toggleHeaderCell(view.state, view.dispatch);
575
+ view.focus();
576
+ onDismiss();
577
+ },
578
+ foregroundColor: (color) => {
579
+ colorCurrentCell(view, color, "color");
580
+ onDismiss();
581
+ },
582
+ backgroundColor: (color) => {
583
+ colorCurrentCell(view, color, "backgroundColor");
584
+ onDismiss();
585
+ }
586
+ };
587
+ }
588
+
589
+ // src/commands/markRange.ts
590
+ function findMarkRange(doc, pos, markType) {
591
+ const $pos = doc.resolve(pos);
592
+ const parent = $pos.parent;
593
+ const parentStart = $pos.start();
594
+ const markAt = (i) => i >= 0 && i < parent.childCount ? markType.isInSet(parent.child(i).marks) || null : null;
595
+ let index = $pos.index();
596
+ let anchor = markAt(index);
597
+ if (!anchor && markAt(index - 1)) {
598
+ index -= 1;
599
+ anchor = markAt(index);
600
+ }
601
+ if (!anchor) return null;
602
+ const sameMark = (i) => {
603
+ const m = markAt(i);
604
+ return !!m && m.eq(anchor);
605
+ };
606
+ let start = index;
607
+ let end = index;
608
+ while (start > 0 && sameMark(start - 1)) start--;
609
+ while (end < parent.childCount - 1 && sameMark(end + 1)) end++;
610
+ let from = parentStart;
611
+ for (let i = 0; i < start; i++) from += parent.child(i).nodeSize;
612
+ let to = from;
613
+ for (let i = start; i <= end; i++) to += parent.child(i).nodeSize;
614
+ return { from, to };
615
+ }
616
+
617
+ // src/commands/content.ts
618
+ function createContentCommands(view, schema) {
619
+ const getLinkRange = () => {
620
+ const { from, to, empty } = view.state.selection;
621
+ if (!empty) return { from, to };
622
+ return findMarkRange(view.state.doc, from, schema.marks.link) ?? { from, to };
623
+ };
624
+ return {
625
+ insertLink: (url, text) => {
626
+ const href = sanitizeUrl(url);
627
+ if (href == null) return;
628
+ const { from, to, empty } = view.state.selection;
629
+ const linkMark = schema.marks.link.create({ href });
630
+ if (empty && text) {
631
+ const textNode = schema.text(text, [linkMark]);
632
+ view.dispatch(view.state.tr.replaceSelectionWith(textNode, false));
633
+ } else if (empty) {
634
+ const displayText = href;
635
+ const textNode = schema.text(displayText, [linkMark]);
636
+ view.dispatch(view.state.tr.replaceSelectionWith(textNode, false));
637
+ } else {
638
+ view.dispatch(view.state.tr.addMark(from, to, linkMark));
639
+ }
640
+ view.focus();
641
+ },
642
+ updateLink: (url) => {
643
+ const href = sanitizeUrl(url);
644
+ if (href == null) return;
645
+ const { from, to } = getLinkRange();
646
+ const tr = view.state.tr;
647
+ tr.removeMark(from, to, schema.marks.link);
648
+ tr.addMark(from, to, schema.marks.link.create({ href }));
649
+ view.dispatch(tr);
650
+ view.focus();
651
+ },
652
+ removeLink: () => {
653
+ const { from, to } = getLinkRange();
654
+ view.dispatch(view.state.tr.removeMark(from, to, schema.marks.link));
655
+ view.focus();
656
+ },
657
+ openLink: () => {
658
+ const { $from } = view.state.selection;
659
+ const linkMark = schema.marks.link.isInSet($from.marks()) ?? schema.marks.link.isInSet(view.state.doc.resolve(Math.max(0, $from.pos - 1)).marks());
660
+ const href = linkMark?.attrs.href ? sanitizeUrl(linkMark.attrs.href) : null;
661
+ if (href) window.open(href, "_blank", "noopener,noreferrer");
662
+ },
663
+ insertImage: (src, attrs) => {
664
+ const safeSrc = sanitizeImageUrl(src);
665
+ if (safeSrc == null) return;
666
+ const imageNode = schema.nodes.image.create({
667
+ src: safeSrc,
668
+ alt: sanitizeTextAttr(attrs?.alt) || null,
669
+ width: parseDimension(attrs?.width == null ? null : String(attrs.width)),
670
+ height: parseDimension(attrs?.height == null ? null : String(attrs.height))
671
+ });
672
+ view.dispatch(view.state.tr.replaceSelectionWith(imageNode));
673
+ view.focus();
674
+ }
675
+ };
676
+ }
677
+ function createEditorCommands(view, schema, callbacks) {
678
+ const insertUploadPlaceholder = (placeholderType, onInsert) => {
679
+ let exists = false;
680
+ view.state.doc.descendants((node) => {
681
+ if (node.type === placeholderType) exists = true;
682
+ });
683
+ if (exists) return;
684
+ view.dispatch(view.state.tr.replaceSelectionWith(placeholderType.create()).scrollIntoView());
685
+ onInsert?.();
686
+ };
687
+ return {
688
+ clearFormatting: () => {
689
+ const { from, to, empty } = view.state.selection;
690
+ if (empty) return;
691
+ const tr = view.state.tr;
692
+ for (const markType of Object.values(schema.marks)) {
693
+ tr.removeMark(from, to, markType);
694
+ }
695
+ view.state.doc.nodesBetween(from, to, (node, pos) => {
696
+ if (node.isTextblock && node.type !== schema.nodes.paragraph && node.type !== schema.nodes.code_block) {
697
+ tr.setNodeMarkup(pos, schema.nodes.paragraph);
698
+ }
699
+ });
700
+ view.dispatch(tr);
701
+ view.focus();
702
+ },
703
+ print: () => {
704
+ const content = docToHtml(view.state.doc, schema);
705
+ const iframe = document.createElement("iframe");
706
+ iframe.setAttribute("sandbox", "allow-modals allow-same-origin");
707
+ iframe.style.position = "fixed";
708
+ iframe.style.inset = "0";
709
+ iframe.style.width = "0";
710
+ iframe.style.height = "0";
711
+ iframe.style.border = "none";
712
+ document.body.appendChild(iframe);
713
+ const doc = iframe.contentDocument;
714
+ if (doc) {
715
+ doc.open();
716
+ doc.write(
717
+ `<!DOCTYPE html><html><head><style>body { font-family: system-ui, sans-serif; padding: 2rem; line-height: 1.6; } img { max-width: 100%; } table { border-collapse: collapse; width: 100%; } td, th { border: 1px solid #ccc; padding: 0.5rem; }</style></head><body>${content}</body></html>`
718
+ );
719
+ doc.close();
720
+ iframe.contentWindow?.focus();
721
+ iframe.contentWindow?.print();
722
+ }
723
+ setTimeout(() => iframe.remove(), 1e3);
724
+ },
725
+ uploadImages: () => insertUploadPlaceholder(schema.nodes.image_upload_placeholder, callbacks?.onUploadImages),
726
+ uploadDocuments: () => insertUploadPlaceholder(schema.nodes.document_upload_placeholder, callbacks?.onUploadDocuments),
727
+ undo: () => {
728
+ undo(view.state, view.dispatch);
729
+ view.focus();
730
+ },
731
+ redo: () => {
732
+ redo(view.state, view.dispatch);
733
+ view.focus();
734
+ }
735
+ };
736
+ }
737
+
738
+ // src/commands/index.ts
739
+ function createCommands(view, schema, callbacks, options) {
740
+ const formatting = createFormattingCommands(view, schema, { highlightColor: options?.highlightColor });
741
+ const blocks = createBlockCommands(view, schema);
742
+ const lists = createListCommands(view, schema);
743
+ const content = createContentCommands(view, schema);
744
+ const editorCmds = createEditorCommands(view, schema, callbacks);
745
+ return {
746
+ // Formatting marks
747
+ bold: formatting.bold,
748
+ italic: formatting.italic,
749
+ underline: formatting.underline,
750
+ strikethrough: formatting.strikethrough,
751
+ subscript: formatting.subscript,
752
+ superscript: formatting.superscript,
753
+ code: formatting.code,
754
+ highlight: formatting.highlight,
755
+ clearFormatting: editorCmds.clearFormatting,
756
+ // Block types
757
+ heading: blocks.heading,
758
+ paragraph: blocks.paragraph,
759
+ codeBlock: blocks.codeBlock,
760
+ blockquote: blocks.blockquote,
761
+ insertHorizontalRule: blocks.insertHorizontalRule,
762
+ textAlign: blocks.textAlign,
763
+ // Formatting styles
764
+ fontFamily: formatting.fontFamily,
765
+ fontSize: formatting.fontSize,
766
+ foregroundColor: formatting.foregroundColor,
767
+ backgroundColor: formatting.backgroundColor,
768
+ // Lists
769
+ bulletList: lists.bulletList,
770
+ orderedList: lists.orderedList,
771
+ checkList: lists.checkList,
772
+ // Content
773
+ insertLink: content.insertLink,
774
+ updateLink: content.updateLink,
775
+ removeLink: content.removeLink,
776
+ openLink: content.openLink,
777
+ insertImage: content.insertImage,
778
+ // Table
779
+ table: (rows, cols) => insertTable(view, schema, rows || 3, cols || 3, options?.defaultCellWidth),
780
+ // Features
781
+ print: editorCmds.print,
782
+ uploadImages: editorCmds.uploadImages,
783
+ uploadDocuments: editorCmds.uploadDocuments,
784
+ // History
785
+ undo: editorCmds.undo,
786
+ redo: editorCmds.redo,
787
+ // Selection highlight
788
+ preserveSelection: () => preserveSelection(view),
789
+ // Turn into (non-toggle: always sets the type)
790
+ turnInto: {
791
+ text: () => {
792
+ setBlockType(schema.nodes.paragraph)(view.state, view.dispatch);
793
+ view.focus();
794
+ },
795
+ heading1: () => {
796
+ setBlockType(schema.nodes.heading, { level: 1 })(view.state, view.dispatch);
797
+ view.focus();
798
+ },
799
+ heading2: () => {
800
+ setBlockType(schema.nodes.heading, { level: 2 })(view.state, view.dispatch);
801
+ view.focus();
802
+ },
803
+ heading3: () => {
804
+ setBlockType(schema.nodes.heading, { level: 3 })(view.state, view.dispatch);
805
+ view.focus();
806
+ },
807
+ bulletList: () => {
808
+ wrapInListNormalized(view, schema, schema.nodes.bullet_list);
809
+ view.focus();
810
+ },
811
+ orderedList: () => {
812
+ wrapInListNormalized(view, schema, schema.nodes.ordered_list);
813
+ view.focus();
814
+ },
815
+ checkList: () => {
816
+ wrapInListNormalized(view, schema, schema.nodes.check_list);
817
+ view.focus();
818
+ },
819
+ blockquote: () => {
820
+ wrapInBlockquoteNormalized(view, schema);
821
+ view.focus();
822
+ },
823
+ codeBlock: () => {
824
+ setBlockType(schema.nodes.code_block)(view.state, view.dispatch);
825
+ view.focus();
826
+ }
827
+ }
828
+ };
829
+ }
830
+
831
+ export { createCommands, createTableCellCommands, createTableColumnCommands, createTableRowCommands, selectColumn, selectRow };
832
+ //# sourceMappingURL=chunk-6YDCG63C.mjs.map
833
+ //# sourceMappingURL=chunk-6YDCG63C.mjs.map