@notectl/core 1.7.0 → 1.7.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 (195) hide show
  1. package/README.md +2 -2
  2. package/dist/chunks/{AttrRegistry-I-VdmRnN.mjs → AttrRegistry-Ci0qAvtS.mjs} +2 -2
  3. package/dist/chunks/{AttrRegistry-I-VdmRnN.mjs.map → AttrRegistry-Ci0qAvtS.mjs.map} +1 -1
  4. package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs +58 -0
  5. package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs.map +1 -0
  6. package/dist/chunks/{CaretNavigation-CAJXoaae.mjs → CaretNavigation-qLfeL0So.mjs} +56 -56
  7. package/dist/chunks/{CaretNavigation-CAJXoaae.mjs.map → CaretNavigation-qLfeL0So.mjs.map} +1 -1
  8. package/dist/chunks/ColorGrid-BBkN0AOb.mjs +80 -0
  9. package/dist/chunks/ColorGrid-BBkN0AOb.mjs.map +1 -0
  10. package/dist/chunks/ColorPickerPopup-D3ysvOH-.mjs +37 -0
  11. package/dist/chunks/ColorPickerPopup-D3ysvOH-.mjs.map +1 -0
  12. package/dist/chunks/ColorValidation-CV4f1wu6.mjs +39 -0
  13. package/dist/chunks/ColorValidation-CV4f1wu6.mjs.map +1 -0
  14. package/dist/chunks/{Document-CuwE73FF.mjs → Document-DfZ1NOjs.mjs} +15 -15
  15. package/dist/chunks/{Document-CuwE73FF.mjs.map → Document-DfZ1NOjs.mjs.map} +1 -1
  16. package/dist/chunks/MarkCommands-uybmkw9l.mjs +94 -0
  17. package/dist/chunks/MarkCommands-uybmkw9l.mjs.map +1 -0
  18. package/dist/chunks/{NavigationUtils-CyW0Vo8A.mjs → NavigationUtils-Cspt2ZrK.mjs} +3 -3
  19. package/dist/chunks/{NavigationUtils-CyW0Vo8A.mjs.map → NavigationUtils-Cspt2ZrK.mjs.map} +1 -1
  20. package/dist/chunks/{NodeResolver-B-wzthAQ.mjs → NodeResolver-CzLmmrph.mjs} +2 -2
  21. package/dist/chunks/{NodeResolver-B-wzthAQ.mjs.map → NodeResolver-CzLmmrph.mjs.map} +1 -1
  22. package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs +30 -0
  23. package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs.map +1 -0
  24. package/dist/chunks/RangeIterator-Bye0UtbY.mjs +16 -0
  25. package/dist/chunks/RangeIterator-Bye0UtbY.mjs.map +1 -0
  26. package/dist/chunks/{Selection-DmFDwiPJ.mjs → Selection-BRTab5hO.mjs} +7 -7
  27. package/dist/chunks/{Selection-DmFDwiPJ.mjs.map → Selection-BRTab5hO.mjs.map} +1 -1
  28. package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -1
  29. package/dist/chunks/{ToolbarKeyboardNav-B32OMv8r.mjs → ToolbarKeyboardNav-DhpL8zNV.mjs} +3 -3
  30. package/dist/chunks/{ToolbarKeyboardNav-B32OMv8r.mjs.map → ToolbarKeyboardNav-DhpL8zNV.mjs.map} +1 -1
  31. package/dist/chunks/{ToolbarPlugin-B6JETWaw.mjs → ToolbarPlugin-B7oJRzpl.mjs} +339 -127
  32. package/dist/chunks/ToolbarPlugin-B7oJRzpl.mjs.map +1 -0
  33. package/dist/chunks/{index-CAV2N-fF.mjs → index-Bt_d4IqB.mjs} +8 -8
  34. package/dist/chunks/{index-CAV2N-fF.mjs.map → index-Bt_d4IqB.mjs.map} +1 -1
  35. package/dist/chunks/{index-pxbbDHVH.mjs → index-CFJFD4lF.mjs} +3 -3
  36. package/dist/chunks/{index-pxbbDHVH.mjs.map → index-CFJFD4lF.mjs.map} +1 -1
  37. package/dist/chunks/{index-C0cEs7Jc.mjs → index-CFPP456m.mjs} +10 -10
  38. package/dist/chunks/{index-C0cEs7Jc.mjs.map → index-CFPP456m.mjs.map} +1 -1
  39. package/dist/chunks/{index-FlTg80Pk.mjs → index-CH1r7DL-.mjs} +257 -298
  40. package/dist/chunks/index-CH1r7DL-.mjs.map +1 -0
  41. package/dist/chunks/{index-D0s0Q8Wc.mjs → index-CfyS_pgH.mjs} +25 -18
  42. package/dist/chunks/index-CfyS_pgH.mjs.map +1 -0
  43. package/dist/chunks/{index-CflvcXSd.mjs → index-Ckzqtn5D.mjs} +17 -14
  44. package/dist/chunks/{index-CflvcXSd.mjs.map → index-Ckzqtn5D.mjs.map} +1 -1
  45. package/dist/chunks/{index-C9gc3Bws.mjs → index-CrKz_IEn.mjs} +32 -32
  46. package/dist/chunks/{index-C9gc3Bws.mjs.map → index-CrKz_IEn.mjs.map} +1 -1
  47. package/dist/chunks/{index-DMt3ojrY.mjs → index-DGKQhSAl.mjs} +2 -2
  48. package/dist/chunks/{index-DMt3ojrY.mjs.map → index-DGKQhSAl.mjs.map} +1 -1
  49. package/dist/chunks/{index-CoeD4T9-.mjs → index-DIvHQtE2.mjs} +10 -7
  50. package/dist/chunks/{index-CoeD4T9-.mjs.map → index-DIvHQtE2.mjs.map} +1 -1
  51. package/dist/chunks/index-DayTn6Re.mjs +166 -0
  52. package/dist/chunks/index-DayTn6Re.mjs.map +1 -0
  53. package/dist/chunks/index-Deag_lVi.mjs +121 -0
  54. package/dist/chunks/index-Deag_lVi.mjs.map +1 -0
  55. package/dist/chunks/{index--z_Txzej.mjs → index-DmuuFS5D.mjs} +6 -6
  56. package/dist/chunks/{index--z_Txzej.mjs.map → index-DmuuFS5D.mjs.map} +1 -1
  57. package/dist/chunks/{index-B9GkDVsx.mjs → index-DoCvDkfj.mjs} +77 -94
  58. package/dist/chunks/index-DoCvDkfj.mjs.map +1 -0
  59. package/dist/chunks/index-DuRNETFv.mjs +296 -0
  60. package/dist/chunks/index-DuRNETFv.mjs.map +1 -0
  61. package/dist/chunks/{index-B-NSeaM4.mjs → index-Dum8yE_t.mjs} +12 -12
  62. package/dist/chunks/{index-B-NSeaM4.mjs.map → index-Dum8yE_t.mjs.map} +1 -1
  63. package/dist/chunks/{index-CNs4QQ8l.mjs → index-Dy6SllXW.mjs} +52 -64
  64. package/dist/chunks/index-Dy6SllXW.mjs.map +1 -0
  65. package/dist/chunks/{index-D8tbbW97.mjs → index-E7OgN7hM.mjs} +2 -2
  66. package/dist/chunks/{index-D8tbbW97.mjs.map → index-E7OgN7hM.mjs.map} +1 -1
  67. package/dist/chunks/{index-DyIwN_67.mjs → index-yhz2qeeh.mjs} +220 -218
  68. package/dist/chunks/index-yhz2qeeh.mjs.map +1 -0
  69. package/dist/commands/AttributedMarkCommands.d.ts +46 -0
  70. package/dist/commands/AttributedMarkCommands.d.ts.map +1 -0
  71. package/dist/commands/CommandHelpers.d.ts +21 -0
  72. package/dist/commands/CommandHelpers.d.ts.map +1 -0
  73. package/dist/commands/Commands.d.ts +2 -8
  74. package/dist/commands/Commands.d.ts.map +1 -1
  75. package/dist/commands/DeleteCommands.d.ts.map +1 -1
  76. package/dist/commands/GapCursorCommands.d.ts.map +1 -1
  77. package/dist/commands/NodeSelectionCommands.d.ts.map +1 -1
  78. package/dist/commands/PasteCommand.d.ts.map +1 -1
  79. package/dist/commands/RangeIterator.d.ts +10 -0
  80. package/dist/commands/RangeIterator.d.ts.map +1 -0
  81. package/dist/editor/DocumentParser.d.ts.map +1 -1
  82. package/dist/editor/DocumentSerializer.d.ts +2 -0
  83. package/dist/editor/DocumentSerializer.d.ts.map +1 -1
  84. package/dist/editor/MarkSerializer.d.ts +11 -0
  85. package/dist/editor/MarkSerializer.d.ts.map +1 -0
  86. package/dist/editor/NotectlEditor.d.ts +6 -3
  87. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  88. package/dist/editor/PaperLayoutController.d.ts +2 -0
  89. package/dist/editor/PaperLayoutController.d.ts.map +1 -1
  90. package/dist/editor/styles/font-select.d.ts +1 -1
  91. package/dist/editor/styles/font-select.d.ts.map +1 -1
  92. package/dist/editor/styles/font-size-select.d.ts +1 -1
  93. package/dist/editor/styles/font-size-select.d.ts.map +1 -1
  94. package/dist/editor/styles/heading-select.d.ts +1 -1
  95. package/dist/editor/styles/heading-select.d.ts.map +1 -1
  96. package/dist/editor/styles/toolbar.d.ts +1 -1
  97. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  98. package/dist/index.d.ts +8 -2
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/input/ClipboardHandler.d.ts +0 -2
  101. package/dist/input/ClipboardHandler.d.ts.map +1 -1
  102. package/dist/model/MarkSpec.d.ts +6 -0
  103. package/dist/model/MarkSpec.d.ts.map +1 -1
  104. package/dist/notectl-core.mjs +2227 -2090
  105. package/dist/notectl-core.mjs.map +1 -1
  106. package/dist/notectl-core.umd.js +2527 -2337
  107. package/dist/notectl-core.umd.js.map +1 -1
  108. package/dist/plugins/PluginManager.d.ts +2 -0
  109. package/dist/plugins/PluginManager.d.ts.map +1 -1
  110. package/dist/plugins/alignment.mjs +1 -1
  111. package/dist/plugins/blockquote.mjs +1 -1
  112. package/dist/plugins/caret-navigation.mjs +1 -1
  113. package/dist/plugins/code-block.mjs +1 -1
  114. package/dist/plugins/font/FontPlugin.d.ts +0 -6
  115. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  116. package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
  117. package/dist/plugins/font-size/FontSizePlugin.d.ts +0 -5
  118. package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
  119. package/dist/plugins/font-size.mjs +1 -1
  120. package/dist/plugins/font.mjs +1 -1
  121. package/dist/plugins/gap-cursor.mjs +7 -7
  122. package/dist/plugins/hard-break.mjs +2 -25
  123. package/dist/plugins/hard-break.mjs.map +1 -1
  124. package/dist/plugins/heading/HeadingBlockTypePicker.d.ts +1 -7
  125. package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -1
  126. package/dist/plugins/heading/HeadingPlugin.d.ts +0 -6
  127. package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
  128. package/dist/plugins/heading.mjs +1 -1
  129. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
  130. package/dist/plugins/highlight.mjs +1 -1
  131. package/dist/plugins/horizontal-rule.mjs +1 -1
  132. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  133. package/dist/plugins/image.mjs +1 -1
  134. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  135. package/dist/plugins/link.mjs +1 -1
  136. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  137. package/dist/plugins/list.mjs +1 -1
  138. package/dist/plugins/shared/ColorGrid.d.ts +25 -0
  139. package/dist/plugins/shared/ColorGrid.d.ts.map +1 -0
  140. package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -1
  141. package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
  142. package/dist/plugins/shared/ColorValidation.d.ts +13 -2
  143. package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
  144. package/dist/plugins/shared/PopupKeyboardPatterns.d.ts +43 -0
  145. package/dist/plugins/shared/PopupKeyboardPatterns.d.ts.map +1 -0
  146. package/dist/plugins/shared/PopupManager.d.ts +45 -0
  147. package/dist/plugins/shared/PopupManager.d.ts.map +1 -0
  148. package/dist/plugins/shared/PopupPositioning.d.ts +21 -0
  149. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -0
  150. package/dist/plugins/strikethrough.mjs +1 -1
  151. package/dist/plugins/super-sub.mjs +1 -1
  152. package/dist/plugins/table/TableBorderColor.d.ts.map +1 -1
  153. package/dist/plugins/table/TableContextMenu.d.ts +2 -1
  154. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  155. package/dist/plugins/table.mjs +1 -1
  156. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
  157. package/dist/plugins/text-color.mjs +1 -1
  158. package/dist/plugins/text-formatting.mjs +1 -1
  159. package/dist/plugins/toolbar/ToolbarItem.d.ts +11 -2
  160. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
  161. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +5 -1
  162. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  163. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +1 -0
  164. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  165. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +9 -1
  166. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  167. package/dist/plugins/toolbar/index.d.ts +1 -1
  168. package/dist/plugins/toolbar/index.d.ts.map +1 -1
  169. package/dist/plugins/toolbar.mjs +1 -1
  170. package/dist/state/BlockTreeOps.d.ts +21 -0
  171. package/dist/state/BlockTreeOps.d.ts.map +1 -0
  172. package/dist/state/InlineContentOps.d.ts +37 -0
  173. package/dist/state/InlineContentOps.d.ts.map +1 -0
  174. package/dist/state/StepApplication.d.ts.map +1 -1
  175. package/dist/test/PluginTestUtils.d.ts +4 -0
  176. package/dist/test/PluginTestUtils.d.ts.map +1 -1
  177. package/package.json +2 -2
  178. package/dist/chunks/ColorNames-BdsHwA2f.mjs +0 -59
  179. package/dist/chunks/ColorNames-BdsHwA2f.mjs.map +0 -1
  180. package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs +0 -125
  181. package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs.map +0 -1
  182. package/dist/chunks/Commands-CicwYoTQ.mjs +0 -286
  183. package/dist/chunks/Commands-CicwYoTQ.mjs.map +0 -1
  184. package/dist/chunks/MarkCommands-CC37WA7Z.mjs +0 -94
  185. package/dist/chunks/MarkCommands-CC37WA7Z.mjs.map +0 -1
  186. package/dist/chunks/ToolbarPlugin-B6JETWaw.mjs.map +0 -1
  187. package/dist/chunks/index-B9GkDVsx.mjs.map +0 -1
  188. package/dist/chunks/index-CKPrAOr6.mjs +0 -209
  189. package/dist/chunks/index-CKPrAOr6.mjs.map +0 -1
  190. package/dist/chunks/index-CNs4QQ8l.mjs.map +0 -1
  191. package/dist/chunks/index-D0s0Q8Wc.mjs.map +0 -1
  192. package/dist/chunks/index-DfzCof6H.mjs +0 -191
  193. package/dist/chunks/index-DfzCof6H.mjs.map +0 -1
  194. package/dist/chunks/index-DyIwN_67.mjs.map +0 -1
  195. package/dist/chunks/index-FlTg80Pk.mjs.map +0 -1
@@ -0,0 +1,296 @@
1
+ import { k as t, f as n, u as e, b as o, a as r, t as i, g as c } from "./Document-DfZ1NOjs.mjs";
2
+ import { i as s, b as l, s as d, a as u } from "./NavigationUtils-Cspt2ZrK.mjs";
3
+ import { f } from "./NodeResolver-CzLmmrph.mjs";
4
+ import { b as a, s as b, d as k, i as g, a as I, j as h, e as m, c as p } from "./Selection-BRTab5hO.mjs";
5
+ import { n as S, i as B } from "./TypeBrands-C09nE2qO.mjs";
6
+ function x(t2, n2) {
7
+ if (0 === n2.length) return t2.doc.children;
8
+ const e2 = t2.getBlock(n2[n2.length - 1]);
9
+ return e2 ? e2.children : [];
10
+ }
11
+ function O(e2) {
12
+ return t(S("paragraph"), [n("")], e2);
13
+ }
14
+ function N(t2, n2) {
15
+ if (a(t2)) return { blockId: t2.anchor.blockId, offset: t2.anchor.offset };
16
+ const e2 = b(t2, n2);
17
+ return { blockId: e2.from.blockId, offset: e2.from.offset };
18
+ }
19
+ function T(t2, n2) {
20
+ const i2 = f(t2.doc, n2.nodeId);
21
+ if (!i2) return null;
22
+ const c2 = i2.length > 1 ? i2.slice(0, -1) : [], s2 = x(t2, c2), l2 = s2.findIndex((t3) => "id" in t3 && t3.id === n2.nodeId);
23
+ if (l2 < 0) return null;
24
+ const d2 = t2.transaction("input");
25
+ if (1 === s2.length && 0 === c2.length) {
26
+ const t3 = e();
27
+ return d2.insertNode(c2, 0, O(t3)), d2.removeNode(c2, 1), d2.setSelection(k(t3, 0)), d2.build();
28
+ }
29
+ d2.removeNode(c2, l2);
30
+ const u2 = s2[l2 - 1];
31
+ if (u2 && o(u2)) {
32
+ const n3 = (function(t3) {
33
+ let n4 = t3;
34
+ for (; ; ) {
35
+ let t4;
36
+ for (let e2 = n4.children.length - 1; e2 >= 0; e2--) {
37
+ const r2 = n4.children[e2];
38
+ if (r2 && o(r2)) {
39
+ t4 = r2;
40
+ break;
41
+ }
42
+ }
43
+ if (!t4) return n4.id;
44
+ n4 = t4;
45
+ }
46
+ })(u2);
47
+ if (n3) {
48
+ const e2 = t2.getBlock(n3), o2 = e2 ? r(e2) : 0;
49
+ d2.setSelection(k(n3, o2));
50
+ }
51
+ } else {
52
+ const t3 = s2[l2 + 1];
53
+ if (t3 && o(t3)) {
54
+ const n3 = (function(t4) {
55
+ let n4 = t4;
56
+ for (; ; ) {
57
+ const t5 = n4.children.find((t6) => o(t6));
58
+ if (!t5) return n4.id;
59
+ n4 = t5;
60
+ }
61
+ })(t3);
62
+ n3 && d2.setSelection(k(n3, 0));
63
+ }
64
+ }
65
+ return d2.build();
66
+ }
67
+ function A(t2, n2) {
68
+ const e2 = t2.selection, o2 = t2.getBlockOrder();
69
+ return g(e2) ? (function(t3, n3, e3, o3) {
70
+ const i2 = o3.indexOf(n3.nodeId), c2 = f(t3.doc, n3.nodeId) ?? [];
71
+ if ("left" === e3 || "up" === e3) {
72
+ if (i2 > 0) {
73
+ const e4 = o3[i2 - 1];
74
+ if (!e4) return null;
75
+ if (s(t3, e4)) return t3.transaction("input").setSelection(h(n3.nodeId, "before", c2)).build();
76
+ const l2 = t3.getBlock(e4), d2 = l2 ? r(l2) : 0;
77
+ return t3.transaction("input").setSelection(k(e4, d2)).build();
78
+ }
79
+ return t3.transaction("input").setSelection(h(n3.nodeId, "before", c2)).build();
80
+ }
81
+ if (i2 < o3.length - 1) {
82
+ const e4 = o3[i2 + 1];
83
+ return e4 ? s(t3, e4) ? t3.transaction("input").setSelection(h(n3.nodeId, "after", c2)).build() : t3.transaction("input").setSelection(k(e4, 0)).build() : null;
84
+ }
85
+ return t3.transaction("input").setSelection(h(n3.nodeId, "after", c2)).build();
86
+ })(t2, e2, n2, o2) : I(e2) ? null : a(e2) ? (function(t3, n3, e3, o3) {
87
+ const i2 = o3.indexOf(n3.anchor.blockId), c2 = t3.getBlock(n3.anchor.blockId);
88
+ if (!c2) return null;
89
+ const l2 = r(c2);
90
+ if (("right" === e3 || "down" === e3) && n3.anchor.offset === l2 && i2 < o3.length - 1) {
91
+ const n4 = o3[i2 + 1];
92
+ if (n4 && s(t3, n4)) {
93
+ const e4 = f(t3.doc, n4) ?? [];
94
+ return t3.transaction("input").setSelection(m(n4, e4)).build();
95
+ }
96
+ }
97
+ if (("left" === e3 || "up" === e3) && 0 === n3.anchor.offset && i2 > 0) {
98
+ const n4 = o3[i2 - 1];
99
+ if (n4 && s(t3, n4)) {
100
+ const e4 = f(t3.doc, n4) ?? [];
101
+ return t3.transaction("input").setSelection(m(n4, e4)).build();
102
+ }
103
+ }
104
+ return null;
105
+ })(t2, e2, n2, o2) : null;
106
+ }
107
+ function j(t2, n2) {
108
+ if ("after" === n2.side) return M(t2, n2);
109
+ const e2 = t2.getBlockOrder(), o2 = e2.indexOf(n2.blockId);
110
+ if (o2 <= 0) return null;
111
+ const i2 = e2[o2 - 1];
112
+ if (!i2) return null;
113
+ if (s(t2, i2)) {
114
+ const n3 = f(t2.doc, i2) ?? [];
115
+ return t2.transaction("input").setSelection(m(i2, n3)).build();
116
+ }
117
+ const c2 = t2.getBlock(i2);
118
+ if (!c2) return null;
119
+ const l2 = r(c2);
120
+ return t2.transaction("input").setSelection(k(i2, l2)).build();
121
+ }
122
+ function y(t2, n2) {
123
+ if ("before" === n2.side) return M(t2, n2);
124
+ const e2 = t2.getBlockOrder(), o2 = e2.indexOf(n2.blockId);
125
+ if (o2 >= e2.length - 1) return null;
126
+ const r2 = e2[o2 + 1];
127
+ if (!r2) return null;
128
+ if (s(t2, r2)) {
129
+ const n3 = f(t2.doc, r2) ?? [];
130
+ return t2.transaction("input").setSelection(m(r2, n3)).build();
131
+ }
132
+ return t2.transaction("input").setSelection(k(r2, 0)).build();
133
+ }
134
+ function M(t2, n2) {
135
+ const e2 = f(t2.doc, n2.blockId) ?? [];
136
+ return T(t2, m(n2.blockId, e2));
137
+ }
138
+ function H(t2, n2, o2 = "input") {
139
+ const r2 = t2.selection;
140
+ if (g(r2)) return (function(t3, n3, o3, r3) {
141
+ const i3 = f(t3.doc, n3.nodeId), c2 = i3 && i3.length > 1 ? i3.slice(0, -1) : [], s3 = x(t3, c2), l3 = s3.findIndex((t4) => "id" in t4 && t4.id === n3.nodeId), d3 = e(), u2 = t3.transaction(r3), a2 = l3 >= 0 ? l3 + 1 : s3.length;
142
+ return u2.insertNode(c2, a2, O(d3)), u2.insertText(d3, 0, o3, []), u2.setSelection(k(d3, o3.length)), u2.build();
143
+ })(t2, r2, n2, o2);
144
+ if (I(r2)) return (function(t3, n3, o3, r3) {
145
+ const i3 = f(t3.doc, n3.blockId), c2 = i3 && i3.length > 1 ? i3.slice(0, -1) : [], s3 = x(t3, c2), l3 = s3.findIndex((t4) => "id" in t4 && t4.id === n3.blockId), d3 = "before" === n3.side ? Math.max(l3, 0) : l3 >= 0 ? l3 + 1 : s3.length, u2 = e(), a2 = t3.transaction(r3);
146
+ return a2.insertNode(c2, d3, O(u2)), a2.insertText(u2, 0, o3, []), a2.setSelection(k(u2, o3.length)), a2.build();
147
+ })(t2, r2, n2, o2);
148
+ const i2 = t2.transaction(o2), s2 = (function(t3) {
149
+ if (t3.storedMarks) return t3.storedMarks;
150
+ if (g(t3.selection) || I(t3.selection)) return [];
151
+ const n3 = t3.getBlock(t3.selection.anchor.blockId);
152
+ return n3 ? c(n3, t3.selection.anchor.offset) : [];
153
+ })(t2);
154
+ a(r2) || _(t2, i2);
155
+ const { blockId: l2, offset: d2 } = N(r2, t2.getBlockOrder());
156
+ return i2.insertText(l2, d2, n2, s2), i2.setSelection(k(l2, d2 + n2.length)), i2.build();
157
+ }
158
+ function v(t2) {
159
+ if (g(t2.selection)) return T(t2, t2.selection);
160
+ if (I(t2.selection)) return null;
161
+ if (a(t2.selection)) return null;
162
+ const n2 = t2.transaction("input");
163
+ _(t2, n2);
164
+ const e2 = b(t2.selection, t2.getBlockOrder());
165
+ return n2.setSelection(k(e2.from.blockId, e2.from.offset)), n2.build();
166
+ }
167
+ function C(t2) {
168
+ const n2 = t2.selection;
169
+ if (g(n2)) return (function(t3, n3) {
170
+ const o3 = f(t3.doc, n3.nodeId);
171
+ if (!o3) return null;
172
+ const r3 = o3.length > 1 ? o3.slice(0, -1) : [], i3 = x(t3, r3).findIndex((t4) => "id" in t4 && t4.id === n3.nodeId);
173
+ if (i3 < 0) return null;
174
+ const c3 = e(), s2 = t3.transaction("input");
175
+ return s2.insertNode(r3, i3 + 1, O(c3)), s2.setSelection(k(c3, 0)), s2.build();
176
+ })(t2, n2);
177
+ if (I(n2)) return (function(t3, n3) {
178
+ const o3 = f(t3.doc, n3.blockId);
179
+ if (!o3) return null;
180
+ const r3 = o3.length > 1 ? o3.slice(0, -1) : [], i3 = x(t3, r3).findIndex((t4) => "id" in t4 && t4.id === n3.blockId);
181
+ if (i3 < 0) return null;
182
+ const c3 = "before" === n3.side ? i3 : i3 + 1, s2 = e(), l2 = t3.transaction("input");
183
+ return l2.insertNode(r3, c3, O(s2)), l2.setSelection(k(s2, 0)), l2.build();
184
+ })(t2, n2);
185
+ const o2 = t2.transaction("input");
186
+ a(n2) || _(t2, o2);
187
+ const { blockId: r2, offset: i2 } = N(n2, t2.getBlockOrder()), c2 = e();
188
+ return o2.splitBlock(r2, i2, c2), o2.setSelection(k(c2, 0)), o2.build();
189
+ }
190
+ function K(t2) {
191
+ const n2 = t2.selection;
192
+ if (g(n2) || I(n2)) return null;
193
+ const e2 = t2.transaction("input");
194
+ a(n2) || _(t2, e2);
195
+ const { blockId: o2, offset: r2 } = N(n2, t2.getBlockOrder()), c2 = i(B("hard_break"));
196
+ return e2.insertInlineNode(o2, r2, c2), e2.setSelection(k(o2, r2 + 1)), e2.build();
197
+ }
198
+ function D(t2) {
199
+ const n2 = t2.selection;
200
+ if (g(n2) || I(n2)) return null;
201
+ const e2 = t2.getBlockOrder(), o2 = e2.indexOf(n2.anchor.blockId);
202
+ if (o2 <= 0) return null;
203
+ const i2 = e2[o2 - 1];
204
+ if (!i2) return null;
205
+ if (l(t2, n2.anchor.blockId) || l(t2, i2)) return null;
206
+ if (!d(t2, n2.anchor.blockId, i2) && u(t2, n2.anchor.blockId)) return null;
207
+ if (s(t2, i2)) {
208
+ const n3 = f(t2.doc, i2) ?? [];
209
+ return t2.transaction("input").setSelection(m(i2, n3)).build();
210
+ }
211
+ const c2 = t2.getBlock(i2);
212
+ if (!c2) return null;
213
+ const a2 = r(c2);
214
+ return t2.transaction("input").mergeBlocksAt(i2, n2.anchor.blockId).setSelection(k(i2, a2)).build();
215
+ }
216
+ function E(t2) {
217
+ const n2 = t2.selection;
218
+ if (g(n2) || I(n2)) return null;
219
+ const e2 = t2.getBlockOrder(), o2 = e2.indexOf(n2.anchor.blockId);
220
+ if (o2 >= e2.length - 1) return null;
221
+ const r2 = e2[o2 + 1];
222
+ if (!r2) return null;
223
+ if (l(t2, n2.anchor.blockId) || l(t2, r2)) return null;
224
+ if (!d(t2, n2.anchor.blockId, r2) && u(t2, n2.anchor.blockId)) return null;
225
+ if (s(t2, r2)) {
226
+ const n3 = f(t2.doc, r2) ?? [];
227
+ return t2.transaction("input").setSelection(m(r2, n3)).build();
228
+ }
229
+ return t2.transaction("input").mergeBlocksAt(n2.anchor.blockId, r2).setSelection(k(n2.anchor.blockId, n2.anchor.offset)).build();
230
+ }
231
+ function L(t2) {
232
+ const n2 = t2.doc.children, e2 = n2[0], o2 = n2[n2.length - 1];
233
+ if (!e2 || !o2) return t2.transaction("command").setSelection(t2.selection).build();
234
+ const i2 = r(o2);
235
+ return t2.transaction("command").setSelection(p({ blockId: e2.id, offset: 0 }, { blockId: o2.id, offset: i2 })).build();
236
+ }
237
+ function _(t2, n2) {
238
+ if (g(t2.selection) || I(t2.selection)) return;
239
+ const e2 = t2.getBlockOrder(), o2 = b(t2.selection, e2), i2 = e2.indexOf(o2.from.blockId), c2 = e2.indexOf(o2.to.blockId);
240
+ if (i2 === c2) n2.deleteTextAt(o2.from.blockId, o2.from.offset, o2.to.offset);
241
+ else {
242
+ const s2 = t2.getBlock(o2.from.blockId);
243
+ if (!s2) return;
244
+ const l2 = r(s2);
245
+ o2.from.offset < l2 && n2.deleteTextAt(o2.from.blockId, o2.from.offset, l2), o2.to.offset > 0 && n2.deleteTextAt(o2.to.blockId, 0, o2.to.offset);
246
+ for (let s3 = i2 + 1; s3 < c2; s3++) {
247
+ const i3 = e2[s3];
248
+ if (!i3) continue;
249
+ const c3 = t2.getBlock(i3);
250
+ if (!c3) continue;
251
+ const l3 = r(c3);
252
+ l3 > 0 && n2.deleteTextAt(i3, 0, l3), n2.mergeBlocksAt(o2.from.blockId, i3);
253
+ }
254
+ n2.mergeBlocksAt(o2.from.blockId, o2.to.blockId);
255
+ }
256
+ }
257
+ class w {
258
+ id = "hard-break";
259
+ name = "Hard Break";
260
+ priority = 10;
261
+ init(t2) {
262
+ this.registerInlineNodeSpec(t2), this.registerCommands(t2), this.registerKeymap(t2);
263
+ }
264
+ registerInlineNodeSpec(t2) {
265
+ t2.registerInlineNodeSpec({ type: "hard_break", toDOM: () => document.createElement("br"), toHTMLString: () => "<br>", parseHTML: [{ tag: "br" }], sanitize: { tags: ["br"] } });
266
+ }
267
+ registerCommands(t2) {
268
+ t2.registerCommand("insertHardBreak", () => {
269
+ const n2 = K(t2.getState());
270
+ return !!n2 && (t2.dispatch(n2), true);
271
+ });
272
+ }
273
+ registerKeymap(t2) {
274
+ t2.registerKeymap({ "Shift-Enter": () => {
275
+ const n2 = K(t2.getState());
276
+ return !!n2 && (t2.dispatch(n2), true);
277
+ } });
278
+ }
279
+ }
280
+ export {
281
+ w as H,
282
+ v as a,
283
+ D as b,
284
+ C as c,
285
+ T as d,
286
+ j as e,
287
+ y as f,
288
+ K as g,
289
+ _ as h,
290
+ H as i,
291
+ E as m,
292
+ A as n,
293
+ N as r,
294
+ L as s
295
+ };
296
+ //# sourceMappingURL=index-DuRNETFv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DuRNETFv.mjs","sources":["../../src/commands/CommandHelpers.ts","../../src/commands/NodeSelectionCommands.ts","../../src/commands/GapCursorCommands.ts","../../src/commands/Commands.ts","../../src/plugins/hard-break/HardBreakPlugin.ts"],"sourcesContent":["/**\n * Shared helpers used across multiple command modules.\n *\n * - {@link getSiblings} — resolves a parent path to its child list\n * - {@link createEmptyParagraph} — builds an empty paragraph BlockNode\n * - {@link resolveInsertPoint} — normalizes a text selection to a single insert position\n */\n\nimport type { BlockNode, ChildNode } from '../model/Document.js';\nimport { createBlockNode, createTextNode } from '../model/Document.js';\nimport { isCollapsed, selectionRange } from '../model/Selection.js';\nimport type { Selection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { nodeType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\n\n/** The resolved insert position within a single block. */\nexport interface InsertPoint {\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/** Resolves the children of a parent path: doc root or a nested block. */\nexport function getSiblings(\n\tstate: EditorState,\n\tparentPath: readonly BlockId[],\n): readonly ChildNode[] {\n\tif (parentPath.length === 0) return state.doc.children;\n\tconst parent: BlockNode | undefined = state.getBlock(\n\t\tparentPath[parentPath.length - 1] as BlockId,\n\t);\n\treturn parent ? parent.children : [];\n}\n\n/** Creates an empty paragraph block node with the given ID. */\nexport function createEmptyParagraph(id: BlockId): BlockNode {\n\treturn createBlockNode(nodeType('paragraph'), [createTextNode('')], id);\n}\n\n/**\n * Normalizes a text selection to a single insert point.\n *\n * - Collapsed selection → anchor position.\n * - Range selection → normalized `from` position (document-order start).\n */\nexport function resolveInsertPoint(sel: Selection, blockOrder: readonly BlockId[]): InsertPoint {\n\tif (isCollapsed(sel)) {\n\t\treturn { blockId: sel.anchor.blockId, offset: sel.anchor.offset };\n\t}\n\tconst range = selectionRange(sel, blockOrder);\n\treturn { blockId: range.from.blockId, offset: range.from.offset };\n}\n","/**\n * Commands for NodeSelection: deleting void blocks, inserting paragraphs\n * after void blocks, and navigating arrow keys into/out of void blocks.\n */\n\nimport { type BlockNode, generateBlockId, getBlockLength, isBlockNode } from '../model/Document.js';\nimport { isVoidBlock } from '../model/NavigationUtils.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { NodeSelection } from '../model/Selection.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateGapCursor,\n\tcreateNodeSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { createEmptyParagraph, getSiblings } from './CommandHelpers.js';\n\n/**\n * Deletes the void block targeted by a NodeSelection and places cursor\n * on the adjacent block. If it's the only block, replaces with empty paragraph.\n */\nexport function deleteNodeSelection(state: EditorState, sel: NodeSelection): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.nodeId);\n\tif (index < 0) return null;\n\n\tconst builder = state.transaction('input');\n\n\t// If this is the only block in the document, insert empty paragraph first\n\tif (siblings.length === 1 && parentPath.length === 0) {\n\t\tconst newId = generateBlockId();\n\t\tbuilder.insertNode(parentPath, 0, createEmptyParagraph(newId));\n\t\tbuilder.removeNode(parentPath, 1);\n\t\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\t\treturn builder.build();\n\t}\n\n\tbuilder.removeNode(parentPath, index);\n\n\t// Find where to place cursor: prefer previous sibling leaf, else next sibling leaf.\n\tconst prevSibling = siblings[index - 1];\n\tif (prevSibling && isBlockNode(prevSibling)) {\n\t\tconst prevLeafId = findLastLeafBlockId(prevSibling);\n\t\tif (prevLeafId) {\n\t\t\tconst prevLeaf = state.getBlock(prevLeafId);\n\t\t\tconst prevLen = prevLeaf ? getBlockLength(prevLeaf) : 0;\n\t\t\tbuilder.setSelection(createCollapsedSelection(prevLeafId, prevLen));\n\t\t}\n\t} else {\n\t\tconst nextSibling = siblings[index + 1];\n\t\tif (nextSibling && isBlockNode(nextSibling)) {\n\t\t\tconst nextLeafId = findFirstLeafBlockId(nextSibling);\n\t\t\tif (nextLeafId) {\n\t\t\t\tbuilder.setSelection(createCollapsedSelection(nextLeafId, 0));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn builder.build();\n}\n\n/** Inserts a new paragraph after a NodeSelection-targeted void block. */\nexport function insertParagraphAfterNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.nodeId);\n\tif (index < 0) return null;\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tbuilder.insertNode(parentPath, index + 1, createEmptyParagraph(newId));\n\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\treturn builder.build();\n}\n\n/** Inserts text in a new paragraph after a NodeSelection-targeted void block. */\nexport function insertTextAfterNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n\ttext: string,\n\torigin: 'input' | 'paste',\n): Transaction {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tconst parentPath: BlockId[] = path && path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.nodeId);\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction(origin);\n\n\tconst insertIdx = index >= 0 ? index + 1 : siblings.length;\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.insertText(newId, 0, text, []);\n\tbuilder.setSelection(createCollapsedSelection(newId, text.length));\n\treturn builder.build();\n}\n\n/**\n * Navigates arrow keys into/out of void blocks.\n * Returns a transaction if navigation should create a NodeSelection, or null.\n */\nexport function navigateArrowIntoVoid(\n\tstate: EditorState,\n\tdirection: 'left' | 'right' | 'up' | 'down',\n): Transaction | null {\n\tconst sel = state.selection;\n\tconst blockOrder = state.getBlockOrder();\n\n\t// If currently on a NodeSelection, navigate away from it\n\tif (isNodeSelection(sel)) {\n\t\treturn navigateAwayFromNodeSelection(state, sel, direction, blockOrder);\n\t}\n\n\t// GapCursor is handled by navigateFromGapCursor in CaretNavigation\n\tif (isGapCursor(sel)) return null;\n\n\t// Text selection: check if navigating into a void block\n\tif (!isCollapsed(sel)) return null;\n\n\treturn navigateIntoVoid(state, sel, direction, blockOrder);\n}\n\n/** Finds the first leaf (deepest-first-child) block ID in a subtree. */\nexport function findFirstLeafBlockId(node: BlockNode): BlockId {\n\tlet current: BlockNode = node;\n\twhile (true) {\n\t\tconst firstBlockChild = current.children.find((child): child is BlockNode =>\n\t\t\tisBlockNode(child),\n\t\t);\n\t\tif (!firstBlockChild) return current.id;\n\t\tcurrent = firstBlockChild;\n\t}\n}\n\n/** Finds the last leaf (deepest-last-child) block ID in a subtree. */\nexport function findLastLeafBlockId(node: BlockNode): BlockId {\n\tlet current: BlockNode = node;\n\twhile (true) {\n\t\tlet lastBlockChild: BlockNode | undefined;\n\t\tfor (let i = current.children.length - 1; i >= 0; i--) {\n\t\t\tconst child = current.children[i];\n\t\t\tif (child && isBlockNode(child)) {\n\t\t\t\tlastBlockChild = child;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!lastBlockChild) return current.id;\n\t\tcurrent = lastBlockChild;\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Handles navigation away from a NodeSelection (arrow keys while void is selected). */\nfunction navigateAwayFromNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tblockOrder: readonly BlockId[],\n): Transaction | null {\n\tconst nodeIdx = blockOrder.indexOf(sel.nodeId);\n\tconst nodePath = (findNodePath(state.doc, sel.nodeId) ?? []) as BlockId[];\n\n\tif (direction === 'left' || direction === 'up') {\n\t\tif (nodeIdx > 0) {\n\t\t\tconst prevId = blockOrder[nodeIdx - 1];\n\t\t\tif (!prevId) return null;\n\t\t\tif (isVoidBlock(state, prevId)) {\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createGapCursor(sel.nodeId, 'before', nodePath))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t\tconst prevBlock = state.getBlock(prevId);\n\t\t\tconst prevLen = prevBlock ? getBlockLength(prevBlock) : 0;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setSelection(createCollapsedSelection(prevId, prevLen))\n\t\t\t\t.build();\n\t\t}\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createGapCursor(sel.nodeId, 'before', nodePath))\n\t\t\t.build();\n\t}\n\n\t// right or down\n\tif (nodeIdx < blockOrder.length - 1) {\n\t\tconst nextId = blockOrder[nodeIdx + 1];\n\t\tif (!nextId) return null;\n\t\tif (isVoidBlock(state, nextId)) {\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setSelection(createGapCursor(sel.nodeId, 'after', nodePath))\n\t\t\t\t.build();\n\t\t}\n\t\treturn state.transaction('input').setSelection(createCollapsedSelection(nextId, 0)).build();\n\t}\n\treturn state\n\t\t.transaction('input')\n\t\t.setSelection(createGapCursor(sel.nodeId, 'after', nodePath))\n\t\t.build();\n}\n\n/** Handles text selection navigating into an adjacent void block. */\nfunction navigateIntoVoid(\n\tstate: EditorState,\n\tsel: { readonly anchor: { readonly blockId: BlockId; readonly offset: number } },\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tblockOrder: readonly BlockId[],\n): Transaction | null {\n\tconst blockIdx = blockOrder.indexOf(sel.anchor.blockId);\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tconst blockLen = getBlockLength(block);\n\n\tif (direction === 'right' || direction === 'down') {\n\t\tif (sel.anchor.offset === blockLen && blockIdx < blockOrder.length - 1) {\n\t\t\tconst nextId = blockOrder[blockIdx + 1];\n\t\t\tif (nextId && isVoidBlock(state, nextId)) {\n\t\t\t\tconst path = findNodePath(state.doc, nextId) ?? [];\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createNodeSelection(nextId, path as BlockId[]))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (direction === 'left' || direction === 'up') {\n\t\tif (sel.anchor.offset === 0 && blockIdx > 0) {\n\t\t\tconst prevId = blockOrder[blockIdx - 1];\n\t\t\tif (prevId && isVoidBlock(state, prevId)) {\n\t\t\t\tconst path = findNodePath(state.doc, prevId) ?? [];\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createNodeSelection(prevId, path as BlockId[]))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n","/**\n * Commands for GapCursor: deleting void blocks adjacent to gap cursors\n * and inserting paragraphs at gap positions.\n */\n\nimport { generateBlockId, getBlockLength } from '../model/Document.js';\nimport { isVoidBlock } from '../model/NavigationUtils.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { GapCursorSelection, NodeSelection } from '../model/Selection.js';\nimport { createCollapsedSelection, createNodeSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { createEmptyParagraph, getSiblings } from './CommandHelpers.js';\nimport { deleteNodeSelection } from './NodeSelectionCommands.js';\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Backspace.\n *\n * - `side === 'after'` → void block is behind the cursor → delete it.\n * - `side === 'before'` → void block is ahead → navigate backward (to previous block).\n * - At document start with `side === 'before'` → `null` (no-op).\n */\nexport function deleteBackwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'after') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'before': navigate to previous block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx <= 0) return null;\n\n\tconst prevId: BlockId | undefined = blockOrder[blockIdx - 1];\n\tif (!prevId) return null;\n\n\tif (isVoidBlock(state, prevId)) {\n\t\tconst path = findNodePath(state.doc, prevId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(prevId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\tconst prevLen: number = getBlockLength(prevBlock);\n\treturn state.transaction('input').setSelection(createCollapsedSelection(prevId, prevLen)).build();\n}\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Delete.\n *\n * - `side === 'before'` → void block is ahead of the cursor → delete it.\n * - `side === 'after'` → void block is behind → navigate forward (to next block).\n * - At document end with `side === 'after'` → `null` (no-op).\n */\nexport function deleteForwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'before') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'after': navigate to next block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx >= blockOrder.length - 1) return null;\n\n\tconst nextId: BlockId | undefined = blockOrder[blockIdx + 1];\n\tif (!nextId) return null;\n\n\tif (isVoidBlock(state, nextId)) {\n\t\tconst path = findNodePath(state.doc, nextId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(nextId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\treturn state.transaction('input').setSelection(createCollapsedSelection(nextId, 0)).build();\n}\n\n/** Deletes the void block that the GapCursor is adjacent to, delegating to deleteNodeSelection. */\nfunction deleteVoidAtGap(state: EditorState, sel: GapCursorSelection): Transaction | null {\n\tconst path = (findNodePath(state.doc, sel.blockId) ?? []) as BlockId[];\n\tconst nodeSel: NodeSelection = createNodeSelection(sel.blockId, path);\n\treturn deleteNodeSelection(state, nodeSel);\n}\n\n/** Inserts a new paragraph at a GapCursor position (before or after the void block). */\nexport function insertParagraphAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.blockId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.blockId);\n\tif (index < 0) return null;\n\n\tconst insertIdx: number = sel.side === 'before' ? index : index + 1;\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\treturn builder.build();\n}\n\n/** Inserts text in a new paragraph at a GapCursor position. */\nexport function insertTextAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n\ttext: string,\n\torigin: 'input' | 'paste',\n): Transaction {\n\tconst path = findNodePath(state.doc, sel.blockId);\n\tconst parentPath: BlockId[] = path && path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.blockId);\n\tconst insertIdx: number =\n\t\tsel.side === 'before' ? Math.max(index, 0) : index >= 0 ? index + 1 : siblings.length;\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction(origin);\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.insertText(newId, 0, text, []);\n\tbuilder.setSelection(createCollapsedSelection(newId, text.length));\n\treturn builder.build();\n}\n","/**\n * Core editor commands and barrel re-exports from submodules.\n *\n * This module contains text insertion, block splitting, block merging,\n * selection deletion, and select-all. Mark, delete, gap-cursor, node-selection,\n * and word-boundary commands are re-exported from their respective modules.\n */\n\nimport {\n\ttype Mark,\n\tcreateInlineNode,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tgetBlockMarksAtOffset,\n} from '../model/Document.js';\nimport {\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../model/NavigationUtils.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tcreateSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n\tselectionRange,\n} from '../model/Selection.js';\nimport { type BlockId, inlineType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\nimport { resolveInsertPoint } from './CommandHelpers.js';\nimport { insertParagraphAtGap, insertTextAtGap } from './GapCursorCommands.js';\nimport {\n\tdeleteNodeSelection,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n} from './NodeSelectionCommands.js';\n\n// --- Re-exports from submodules ---\n\nexport {\n\tcanCrossBlockBoundary,\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../model/NavigationUtils.js';\n\nexport type { FeatureConfig } from './MarkCommands.js';\nexport {\n\tisMarkActive,\n\ttoggleBold,\n\ttoggleItalic,\n\ttoggleMark,\n\ttoggleUnderline,\n} from './MarkCommands.js';\n\nexport {\n\tdeleteBackward,\n\tdeleteForward,\n\tdeleteSoftLineBackward,\n\tdeleteSoftLineForward,\n\tdeleteWordBackward,\n\tdeleteWordForward,\n} from './DeleteCommands.js';\n\nexport {\n\tdeleteNodeSelection,\n\tfindFirstLeafBlockId,\n\tfindLastLeafBlockId,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n\tnavigateArrowIntoVoid,\n} from './NodeSelectionCommands.js';\n\nexport {\n\tdeleteBackwardAtGap,\n\tdeleteForwardAtGap,\n\tinsertParagraphAtGap,\n\tinsertTextAtGap,\n} from './GapCursorCommands.js';\n\nexport {\n\tfindWordBoundaryBackward,\n\tfindWordBoundaryForward,\n} from './WordBoundary.js';\n\nexport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from './AttributedMarkCommands.js';\n\nexport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Text Commands ---\n\n/** Inserts text at the current selection, replacing any selected range. */\nexport function insertTextCommand(\n\tstate: EditorState,\n\ttext: string,\n\torigin: 'input' | 'paste' = 'input',\n): Transaction {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert paragraph after void block with the text\n\tif (isNodeSelection(sel)) {\n\t\treturn insertTextAfterNodeSelection(state, sel, text, origin);\n\t}\n\n\t// GapCursor: insert paragraph at the gap position with the text\n\tif (isGapCursor(sel)) {\n\t\treturn insertTextAtGap(state, sel, text, origin);\n\t}\n\n\tconst builder = state.transaction(origin);\n\tconst marks = resolveActiveMarks(state);\n\n\tif (!isCollapsed(sel)) {\n\t\taddDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst { blockId: insertBlockId, offset: insertOffset } = resolveInsertPoint(\n\t\tsel,\n\t\tstate.getBlockOrder(),\n\t);\n\n\tbuilder.insertText(insertBlockId, insertOffset, text, marks);\n\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + text.length));\n\n\treturn builder.build();\n}\n\n/** Deletes the current selection. */\nexport function deleteSelectionCommand(state: EditorState): Transaction | null {\n\tif (isNodeSelection(state.selection)) {\n\t\treturn deleteNodeSelection(state, state.selection);\n\t}\n\tif (isGapCursor(state.selection)) return null;\n\tif (isCollapsed(state.selection)) return null;\n\n\tconst builder = state.transaction('input');\n\taddDeleteSelectionSteps(state, builder);\n\n\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\tbuilder.setSelection(createCollapsedSelection(range.from.blockId, range.from.offset));\n\n\treturn builder.build();\n}\n\n/** Splits the current block at the cursor position (Enter key). */\nexport function splitBlockCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert empty paragraph after the void block\n\tif (isNodeSelection(sel)) {\n\t\treturn insertParagraphAfterNodeSelection(state, sel);\n\t}\n\n\t// GapCursor: insert empty paragraph at the gap position\n\tif (isGapCursor(sel)) {\n\t\treturn insertParagraphAtGap(state, sel);\n\t}\n\n\tconst builder = state.transaction('input');\n\n\tif (!isCollapsed(sel)) {\n\t\taddDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst { blockId, offset } = resolveInsertPoint(sel, state.getBlockOrder());\n\tconst newBlockId = generateBlockId();\n\n\t// splitBlock operates at the same level in the tree — the StepApplication\n\t// handles this correctly because it looks up the block by ID recursively.\n\tbuilder.splitBlock(blockId, offset, newBlockId);\n\tbuilder.setSelection(createCollapsedSelection(newBlockId, 0));\n\n\treturn builder.build();\n}\n\n/** Inserts a hard line break (InlineNode) at the current cursor position. */\nexport function insertHardBreakCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tconst builder = state.transaction('input');\n\n\tif (!isCollapsed(sel)) {\n\t\taddDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst { blockId: insertBlockId, offset: insertOffset } = resolveInsertPoint(\n\t\tsel,\n\t\tstate.getBlockOrder(),\n\t);\n\n\tconst hardBreak = createInlineNode(inlineType('hard_break'));\n\tbuilder.insertInlineNode(insertBlockId, insertOffset, hardBreak);\n\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + 1));\n\n\treturn builder.build();\n}\n\n/**\n * Merges the current block with the previous block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockBackward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\tconst blockOrder = state.getBlockOrder();\n\tconst blockIdx = blockOrder.indexOf(sel.anchor.blockId);\n\n\tif (blockIdx <= 0) return null;\n\n\tconst prevBlockId = blockOrder[blockIdx - 1];\n\tif (!prevBlockId) return null;\n\n\t// Never merge isolating blocks directly (e.g. table cells).\n\tif (isIsolatingBlock(state, sel.anchor.blockId) || isIsolatingBlock(state, prevBlockId)) {\n\t\treturn null;\n\t}\n\n\t// Prevent merge across isolating boundaries\n\tif (!sharesParent(state, sel.anchor.blockId, prevBlockId)) {\n\t\tif (isInsideIsolating(state, sel.anchor.blockId)) return null;\n\t}\n\n\t// If previous block is void, select it instead of merging\n\tif (isVoidBlock(state, prevBlockId)) {\n\t\tconst path = findNodePath(state.doc, prevBlockId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(prevBlockId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tconst prevBlock = state.getBlock(prevBlockId);\n\tif (!prevBlock) return null;\n\tconst prevLen = getBlockLength(prevBlock);\n\n\treturn state\n\t\t.transaction('input')\n\t\t.mergeBlocksAt(prevBlockId, sel.anchor.blockId)\n\t\t.setSelection(createCollapsedSelection(prevBlockId, prevLen))\n\t\t.build();\n}\n\n/**\n * Merges the next block into the current block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockForward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\tconst blockOrder = state.getBlockOrder();\n\tconst blockIdx = blockOrder.indexOf(sel.anchor.blockId);\n\n\tif (blockIdx >= blockOrder.length - 1) return null;\n\n\tconst nextBlockId = blockOrder[blockIdx + 1];\n\tif (!nextBlockId) return null;\n\n\t// Never merge isolating blocks directly (e.g. table cells).\n\tif (isIsolatingBlock(state, sel.anchor.blockId) || isIsolatingBlock(state, nextBlockId)) {\n\t\treturn null;\n\t}\n\n\t// Prevent merge across isolating boundaries\n\tif (!sharesParent(state, sel.anchor.blockId, nextBlockId)) {\n\t\tif (isInsideIsolating(state, sel.anchor.blockId)) return null;\n\t}\n\n\t// If next block is void, select it instead of merging\n\tif (isVoidBlock(state, nextBlockId)) {\n\t\tconst path = findNodePath(state.doc, nextBlockId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(nextBlockId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\treturn state\n\t\t.transaction('input')\n\t\t.mergeBlocksAt(sel.anchor.blockId, nextBlockId)\n\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, sel.anchor.offset))\n\t\t.build();\n}\n\n/** Selects all content in the editor. */\nexport function selectAll(state: EditorState): Transaction {\n\tconst blocks = state.doc.children;\n\tconst firstBlock = blocks[0];\n\tconst lastBlock = blocks[blocks.length - 1];\n\tif (!firstBlock || !lastBlock)\n\t\treturn state.transaction('command').setSelection(state.selection).build();\n\tconst lastBlockLen = getBlockLength(lastBlock);\n\n\treturn state\n\t\t.transaction('command')\n\t\t.setSelection(\n\t\t\tcreateSelection(\n\t\t\t\t{ blockId: firstBlock.id, offset: 0 },\n\t\t\t\t{ blockId: lastBlock.id, offset: lastBlockLen },\n\t\t\t),\n\t\t)\n\t\t.build();\n}\n\n// --- Internal Helpers ---\n\nfunction resolveActiveMarks(state: EditorState): readonly Mark[] {\n\tif (state.storedMarks) return state.storedMarks;\n\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return [];\n\n\tconst block = state.getBlock(state.selection.anchor.blockId);\n\tif (!block) return [];\n\n\treturn getBlockMarksAtOffset(block, state.selection.anchor.offset);\n}\n\nexport function addDeleteSelectionSteps(state: EditorState, builder: TransactionBuilder): void {\n\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(state.selection, blockOrder);\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tif (fromIdx === toIdx) {\n\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, range.to.offset);\n\t} else {\n\t\tconst firstBlock = state.getBlock(range.from.blockId);\n\t\tif (!firstBlock) return;\n\t\tconst firstLen = getBlockLength(firstBlock);\n\n\t\t// Delete from the end of first block\n\t\tif (range.from.offset < firstLen) {\n\t\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, firstLen);\n\t\t}\n\n\t\t// Delete from start of last block\n\t\tif (range.to.offset > 0) {\n\t\t\tbuilder.deleteTextAt(range.to.blockId, 0, range.to.offset);\n\t\t}\n\n\t\t// Delete middle blocks entirely and merge last into first\n\t\tfor (let i = fromIdx + 1; i < toIdx; i++) {\n\t\t\tconst midBlockId = blockOrder[i];\n\t\t\tif (!midBlockId) continue;\n\t\t\tconst midBlock = state.getBlock(midBlockId);\n\t\t\tif (!midBlock) continue;\n\t\t\tconst midLen = getBlockLength(midBlock);\n\t\t\tif (midLen > 0) {\n\t\t\t\tbuilder.deleteTextAt(midBlockId, 0, midLen);\n\t\t\t}\n\t\t\tbuilder.mergeBlocksAt(range.from.blockId, midBlockId);\n\t\t}\n\n\t\t// Merge last block into first\n\t\tbuilder.mergeBlocksAt(range.from.blockId, range.to.blockId);\n\t}\n}\n","/**\n * HardBreakPlugin: registers a hard line break (Shift+Enter → `<br>`)\n * as an InlineNode, with command and keymap bindings.\n */\n\nimport { insertHardBreakCommand } from '../../commands/Commands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface InlineNodeAttrRegistry {\n\t\thard_break: Record<string, never>;\n\t}\n}\n\n// --- Plugin ---\n\nexport class HardBreakPlugin implements Plugin {\n\treadonly id = 'hard-break';\n\treadonly name = 'Hard Break';\n\treadonly priority = 10;\n\n\tinit(context: PluginContext): void {\n\t\tthis.registerInlineNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t}\n\n\tprivate registerInlineNodeSpec(context: PluginContext): void {\n\t\tcontext.registerInlineNodeSpec({\n\t\t\ttype: 'hard_break',\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement('br');\n\t\t\t},\n\t\t\ttoHTMLString() {\n\t\t\t\treturn '<br>';\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'br' }],\n\t\t\tsanitize: { tags: ['br'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('insertHardBreak', () => {\n\t\t\tconst state = context.getState();\n\t\t\tconst tr = insertHardBreakCommand(state);\n\t\t\tif (!tr) return false;\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Shift-Enter': () => {\n\t\t\t\tconst state = context.getState();\n\t\t\t\tconst tr = insertHardBreakCommand(state);\n\t\t\t\tif (!tr) return false;\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\t}\n}\n"],"names":["getSiblings","state","parentPath","length","doc","children","parent","getBlock","createEmptyParagraph","id","createBlockNode","nodeType","createTextNode","resolveInsertPoint","sel","blockOrder","isCollapsed","blockId","anchor","offset","range","selectionRange","from","deleteNodeSelection","path","findNodePath","nodeId","slice","siblings","index","findIndex","c","builder","transaction","newId","generateBlockId","insertNode","removeNode","setSelection","createCollapsedSelection","build","prevSibling","isBlockNode","prevLeafId","node","current","lastBlockChild","i","child","prevLeaf","prevLen","getBlockLength","nextSibling","nextLeafId","firstBlockChild","find","navigateArrowIntoVoid","direction","selection","getBlockOrder","isNodeSelection","nodeIdx","indexOf","nodePath","prevId","isVoidBlock","createGapCursor","prevBlock","nextId","isGapCursor","blockIdx","block","blockLen","createNodeSelection","deleteBackwardAtGap","side","deleteVoidAtGap","deleteForwardAtGap","insertTextCommand","text","origin","insertIdx","insertText","Math","max","marks","storedMarks","getBlockMarksAtOffset","addDeleteSelectionSteps","insertBlockId","insertOffset","deleteSelectionCommand","splitBlockCommand","newBlockId","splitBlock","insertHardBreakCommand","hardBreak","createInlineNode","inlineType","insertInlineNode","mergeBlockBackward","prevBlockId","isIsolatingBlock","sharesParent","isInsideIsolating","mergeBlocksAt","mergeBlockForward","nextBlockId","selectAll","blocks","firstBlock","lastBlock","lastBlockLen","createSelection","fromIdx","toIdx","to","deleteTextAt","firstLen","midBlockId","midBlock","midLen","HardBreakPlugin","name","priority","context","this","registerInlineNodeSpec","registerCommands","registerKeymap","type","toDOM","document","createElement","toHTMLString","parseHTML","tag","sanitize","tags","registerCommand","tr","getState","dispatch"],"mappings":";;;;;AAuBO,SAASA,EACfC,IACAC,IAAAA;AAEA,MAA0B,MAAtBA,GAAWC,OAAc,QAAOF,GAAMG,IAAIC;AAC9C,QAAMC,KAAgCL,GAAMM,SAC3CL,GAAWA,GAAWC,SAAS,CAAA,CAAA;AAEhC,SAAOG,KAASA,GAAOD,WAAW,CAAA;AACnC;AAGO,SAASG,EAAqBC;AACpC,SAAOC,EAAgBC,EAAS,WAAA,GAAc,CAACC,EAAe,MAAMH,EAAAA;AACrE;AAQO,SAASI,EAAmBC,IAAgBC,IAAAA;AAClD,MAAIC,EAAYF,EAAAA,EACf,QAAO,EAAEG,SAASH,GAAII,OAAOD,SAASE,QAAQL,GAAII,OAAOC,OAAAA;AAE1D,QAAMC,KAAQC,EAAeP,IAAKC,EAAAA;AAClC,SAAO,EAAEE,SAASG,GAAME,KAAKL,SAASE,QAAQC,GAAME,KAAKH,OAAAA;AAC1D;ACzBO,SAASI,EAAoBtB,IAAoBa,IAAAA;AACvD,QAAMU,KAAOC,EAAaxB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,GAAQc,gBAAgB,mBAAmB,MAAA;AAC1C,YACMC,KAAK7C,EADG8B,GAAQgB,SAAAA,CAAAA;AAEtB,aAAA,CAAA,CAAKD,OACLf,GAAQiB,SAASF,EAAAA,GAAAA;AAAAA;EAGnB;AAAA,EAEQ,eAAef,IAAAA;AACtBA,IAAAA,GAAQI,eAAe,EACtB,eAAe,MAAA;AACd,YACMW,KAAK7C,EADG8B,GAAQgB;AAEtB,aAAA,CAAA,CAAKD,OACLf,GAAQiB,SAASF,EAAAA,GAAAA;AAAAA,IACV,EAAA,CAAA;AAAA,EAGV;;"}
@@ -1,9 +1,9 @@
1
1
  import { r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
2
2
  import { c as e } from "./NodeSpec-NZVvcCuH.mjs";
3
- import { i as o, a as l, b as r } from "./Selection-DmFDwiPJ.mjs";
3
+ import { i as o, a as l, b as r } from "./Selection-BRTab5hO.mjs";
4
4
  import { n as i } from "./TypeBrands-C09nE2qO.mjs";
5
- import { f as c } from "./ToolbarItem-BpZggUGo.mjs";
6
- const s = { label: "Blockquote", tooltip: (t2) => `Blockquote (${t2})` }, a = { en: s, de: { label: "Zitat", tooltip: (t2) => `Zitat (${t2})` }, es: { label: "Cita", tooltip: (t2) => `Cita (${t2})` }, fr: { label: "Citation", tooltip: (t2) => `Citation (${t2})` }, zh: { label: "引用", tooltip: (t2) => `引用 (${t2})` }, ru: { label: "Цитата", tooltip: (t2) => `Цитата (${t2})` }, ar: { label: "اقتباس", tooltip: (t2) => `اقتباس (${t2})` }, hi: { label: "उद्धरण", tooltip: (t2) => `उद्धरण (${t2})` } }, n = {};
5
+ import { f as s } from "./ToolbarItem-BpZggUGo.mjs";
6
+ const c = { label: "Blockquote", tooltip: (t2) => `Blockquote (${t2})` }, a = { en: c, de: { label: "Zitat", tooltip: (t2) => `Zitat (${t2})` }, es: { label: "Cita", tooltip: (t2) => `Cita (${t2})` }, fr: { label: "Citation", tooltip: (t2) => `Citation (${t2})` }, zh: { label: "引用", tooltip: (t2) => `引用 (${t2})` }, ru: { label: "Цитата", tooltip: (t2) => `Цитата (${t2})` }, ar: { label: "اقتباس", tooltip: (t2) => `اقتباس (${t2})` }, hi: { label: "उद्धरण", tooltip: (t2) => `उद्धरण (${t2})` } }, n = {};
7
7
  class p {
8
8
  id = "blockquote";
9
9
  name = "Blockquote";
@@ -26,16 +26,16 @@ class p {
26
26
  t2.registerKeymap({ "Mod-Shift->": () => t2.executeCommand("toggleBlockquote") });
27
27
  }
28
28
  registerInputRule(t2) {
29
- t2.registerInputRule({ pattern: /^> $/, handler(t3, e2, c2, s2) {
29
+ t2.registerInputRule({ pattern: /^> $/, handler(t3, e2, s2, c2) {
30
30
  const a2 = t3.selection;
31
31
  if (o(a2) || l(a2)) return null;
32
32
  if (!r(a2)) return null;
33
33
  const n2 = t3.getBlock(a2.anchor.blockId);
34
- return n2 && "paragraph" === n2.type ? t3.transaction("input").deleteTextAt(a2.anchor.blockId, c2, c2 + 2).setBlockType(a2.anchor.blockId, i("blockquote")).setSelection(a2).build() : null;
34
+ return n2 && "paragraph" === n2.type ? t3.transaction("input").deleteTextAt(a2.anchor.blockId, s2, s2 + 2).setBlockType(a2.anchor.blockId, i("blockquote")).setSelection(a2).build() : null;
35
35
  } });
36
36
  }
37
37
  registerToolbarItem(t2) {
38
- t2.registerToolbarItem({ id: "blockquote", group: "block", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>', label: this.locale.label, tooltip: this.locale.tooltip(c("Mod-Shift->")), command: "toggleBlockquote", priority: 55, separatorAfter: this.config.separatorAfter, isActive: (t3) => {
38
+ t2.registerToolbarItem({ id: "blockquote", group: "block", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>', label: this.locale.label, tooltip: this.locale.tooltip(s("Mod-Shift->")), command: "toggleBlockquote", priority: 55, separatorAfter: this.config.separatorAfter, isActive: (t3) => {
39
39
  if (o(t3.selection) || l(t3.selection)) return false;
40
40
  const e2 = t3.getBlock(t3.selection.anchor.blockId);
41
41
  return "blockquote" === e2?.type;
@@ -48,15 +48,15 @@ class p {
48
48
  return !!r2 && ("blockquote" === r2.type ? this.setBlockType(t2, i("paragraph")) : this.setBlockType(t2, i("blockquote")));
49
49
  }
50
50
  setBlockType(t2, e2, r2) {
51
- const i2 = t2.getState(), c2 = i2.selection;
52
- if (o(c2) || l(c2)) return false;
53
- const s2 = i2.transaction("command").setBlockType(c2.anchor.blockId, e2, r2).setSelection(c2).build();
54
- return t2.dispatch(s2), true;
51
+ const i2 = t2.getState(), s2 = i2.selection;
52
+ if (o(s2) || l(s2)) return false;
53
+ const c2 = i2.transaction("command").setBlockType(s2.anchor.blockId, e2, r2).setSelection(s2).build();
54
+ return t2.dispatch(c2), true;
55
55
  }
56
56
  }
57
57
  export {
58
58
  p as B,
59
59
  a,
60
- s as b
60
+ c as b
61
61
  };
62
- //# sourceMappingURL=index-B-NSeaM4.mjs.map
62
+ //# sourceMappingURL=index-Dum8yE_t.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-B-NSeaM4.mjs","sources":["../../src/plugins/blockquote/BlockquoteLocale.ts","../../src/plugins/blockquote/BlockquotePlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the BlockquotePlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface BlockquoteLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const BLOCKQUOTE_LOCALE_EN: BlockquoteLocale = {\n\tlabel: 'Blockquote',\n\ttooltip: (shortcut: string) => `Blockquote (${shortcut})`,\n};\n\n// --- German Locale ---\n\nexport const BLOCKQUOTE_LOCALE_DE: BlockquoteLocale = {\n\tlabel: 'Zitat',\n\ttooltip: (shortcut: string) => `Zitat (${shortcut})`,\n};\n\n// --- Spanish Locale ---\n\nexport const BLOCKQUOTE_LOCALE_ES: BlockquoteLocale = {\n\tlabel: 'Cita',\n\ttooltip: (shortcut: string) => `Cita (${shortcut})`,\n};\n\n// --- French Locale ---\n\nexport const BLOCKQUOTE_LOCALE_FR: BlockquoteLocale = {\n\tlabel: 'Citation',\n\ttooltip: (shortcut: string) => `Citation (${shortcut})`,\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const BLOCKQUOTE_LOCALE_ZH: BlockquoteLocale = {\n\tlabel: '引用',\n\ttooltip: (shortcut: string) => `引用 (${shortcut})`,\n};\n\n// --- Russian Locale ---\n\nexport const BLOCKQUOTE_LOCALE_RU: BlockquoteLocale = {\n\tlabel: 'Цитата',\n\ttooltip: (shortcut: string) => `Цитата (${shortcut})`,\n};\n\n// --- Arabic Locale ---\n\nexport const BLOCKQUOTE_LOCALE_AR: BlockquoteLocale = {\n\tlabel: 'اقتباس',\n\ttooltip: (shortcut: string) => `اقتباس (${shortcut})`,\n};\n\n// --- Hindi Locale ---\n\nexport const BLOCKQUOTE_LOCALE_HI: BlockquoteLocale = {\n\tlabel: 'उद्धरण',\n\ttooltip: (shortcut: string) => `उद्धरण (${shortcut})`,\n};\n\n// --- Locale Map ---\n\nexport const BLOCKQUOTE_LOCALES: Record<string, BlockquoteLocale> = {\n\ten: BLOCKQUOTE_LOCALE_EN,\n\tde: BLOCKQUOTE_LOCALE_DE,\n\tes: BLOCKQUOTE_LOCALE_ES,\n\tfr: BLOCKQUOTE_LOCALE_FR,\n\tzh: BLOCKQUOTE_LOCALE_ZH,\n\tru: BLOCKQUOTE_LOCALE_RU,\n\tar: BLOCKQUOTE_LOCALE_AR,\n\thi: BLOCKQUOTE_LOCALE_HI,\n};\n","/**\n * BlockquotePlugin: registers a blockquote block type with NodeSpec,\n * toggle command, keyboard shortcut, input rule, and a toolbar button.\n */\n\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { createBlockElement } from '../../model/NodeSpec.js';\nimport { isCollapsed, isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport { type NodeTypeName, nodeType } from '../../model/TypeBrands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\nimport { BLOCKQUOTE_LOCALES, type BlockquoteLocale } from './BlockquoteLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tblockquote: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface BlockquoteConfig {\n\t/** When true, a separator is rendered after the blockquote toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: BlockquoteLocale;\n}\n\nconst DEFAULT_CONFIG: BlockquoteConfig = {};\n\n// --- Plugin ---\n\nexport class BlockquotePlugin implements Plugin {\n\treadonly id = 'blockquote';\n\treadonly name = 'Blockquote';\n\treadonly priority = 35;\n\n\tprivate readonly config: BlockquoteConfig;\n\tprivate locale!: BlockquoteLocale;\n\n\tconstructor(config?: Partial<BlockquoteConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(BLOCKQUOTE_LOCALES, context, this.config.locale);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerInputRule(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\ttoDOM(node) {\n\t\t\t\treturn createBlockElement('blockquote', node.id);\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<blockquote>${content || '<br>'}</blockquote>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'blockquote' }],\n\t\t\tsanitize: { tags: ['blockquote'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleBlockquote', () => {\n\t\t\treturn this.toggleBlockquote(context);\n\t\t});\n\n\t\tcontext.registerCommand('setBlockquote', () => {\n\t\t\treturn this.setBlockType(context, nodeType('blockquote'));\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift->': () => context.executeCommand('toggleBlockquote'),\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: /^> $/,\n\t\t\thandler(state, _match, start, _end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + 2)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('blockquote'))\n\t\t\t\t\t.setSelection(sel)\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift->')),\n\t\t\tcommand: 'toggleBlockquote',\n\t\t\tpriority: 55,\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\tisActive: (state) => {\n\t\t\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\t\treturn block?.type === 'blockquote';\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Toggles between blockquote and paragraph.\n\t * If the block is already a blockquote, resets to paragraph.\n\t */\n\tprivate toggleBlockquote(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block) return false;\n\n\t\tif (block.type === 'blockquote') {\n\t\t\treturn this.setBlockType(context, nodeType('paragraph'));\n\t\t}\n\n\t\treturn this.setBlockType(context, nodeType('blockquote'));\n\t}\n\n\tprivate setBlockType(\n\t\tcontext: PluginContext,\n\t\ttype: NodeTypeName,\n\t\tattrs?: Record<string, string | number | boolean>,\n\t): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(sel.anchor.blockId, type, attrs)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n}\n"],"names":["BLOCKQUOTE_LOCALE_EN","label","tooltip","shortcut","BLOCKQUOTE_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","BlockquotePlugin","id","name","priority","config","locale","this","context","resolvePluginLocale","registerNodeSpec","registerCommands","registerKeymap","registerInputRule","registerToolbarItem","type","group","content","allow","toDOM","node","createBlockElement","toHTML","_node","parseHTML","tag","sanitize","tags","registerCommand","toggleBlockquote","setBlockType","nodeType","executeCommand","pattern","state","_match","start","_end","sel","selection","isNodeSelection","isGapCursor","isCollapsed","block","getBlock","anchor","blockId","transaction","deleteTextAt","setSelection","build","icon","formatShortcut","command","separatorAfter","isActive","getState","attrs","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SAASkB,KAAKD,OAAOjB,QAAQ+D,EAAe,aAAA,CAAA,GAC5CC,SAAS,oBACTjD,UAAU,IACVkD,gBAAgB/C,KAAKF,OAAOiD,gBAC5BC,UAAWrB,CAAAA,OAAAA;AACV,UAAIM,EAAgBN,GAAMK,cAAcE,EAAYP,GAAMK,WAAY,QAAA;AACtE,YAAMI,KAAQT,GAAMU,SAASV,GAAMK,UAAUM,OAAOC,OAAAA;AACpD,aAAuB,iBAAhBH,IAAO5B;AAAAA,IAAAA,EAAAA,CAAAA;AAAAA,EAGjB;AAAA,EAMQ,iBAAiBP,IAAAA;AACxB,UAAM0B,KAAQ1B,GAAQgD;AACtB,QAAIhB,EAAgBN,GAAMK,SAAAA,KAAcE,EAAYP,GAAMK,SAAAA,EAAY,QAAA;AACtE,UAAMI,KAAQT,GAAMU,SAASV,GAAMK,UAAUM,OAAOC,OAAAA;AACpD,aAAKH,OAEc,iBAAfA,GAAM5B,OACFR,KAAKuB,aAAatB,IAASuB,EAAS,WAAA,CAAA,IAGrCxB,KAAKuB,aAAatB,IAASuB,EAAS,YAAA,CAAA;AAAA,EAC5C;AAAA,EAEQ,aACPvB,IACAO,IACA0C,IAAAA;AAEA,UAAMvB,KAAQ1B,GAAQgD,SAAAA,GAChBlB,KAAMJ,GAAMK;AAClB,QAAIC,EAAgBF,EAAAA,KAAQG,EAAYH,IAAM,QAAA;AAE9C,UAAMoB,KAAKxB,GACTa,YAAY,SAAA,EACZjB,aAAaQ,GAAIO,OAAOC,SAAS/B,IAAM0C,IACvCR,aAAaX,EAAAA,EACbY;AAGF,WADA1C,GAAQmD,SAASD,EAAAA,GAAAA;AAAAA,EAElB;AAAA;"}
1
+ {"version":3,"file":"index-Dum8yE_t.mjs","sources":["../../src/plugins/blockquote/BlockquoteLocale.ts","../../src/plugins/blockquote/BlockquotePlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the BlockquotePlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface BlockquoteLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const BLOCKQUOTE_LOCALE_EN: BlockquoteLocale = {\n\tlabel: 'Blockquote',\n\ttooltip: (shortcut: string) => `Blockquote (${shortcut})`,\n};\n\n// --- German Locale ---\n\nexport const BLOCKQUOTE_LOCALE_DE: BlockquoteLocale = {\n\tlabel: 'Zitat',\n\ttooltip: (shortcut: string) => `Zitat (${shortcut})`,\n};\n\n// --- Spanish Locale ---\n\nexport const BLOCKQUOTE_LOCALE_ES: BlockquoteLocale = {\n\tlabel: 'Cita',\n\ttooltip: (shortcut: string) => `Cita (${shortcut})`,\n};\n\n// --- French Locale ---\n\nexport const BLOCKQUOTE_LOCALE_FR: BlockquoteLocale = {\n\tlabel: 'Citation',\n\ttooltip: (shortcut: string) => `Citation (${shortcut})`,\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const BLOCKQUOTE_LOCALE_ZH: BlockquoteLocale = {\n\tlabel: '引用',\n\ttooltip: (shortcut: string) => `引用 (${shortcut})`,\n};\n\n// --- Russian Locale ---\n\nexport const BLOCKQUOTE_LOCALE_RU: BlockquoteLocale = {\n\tlabel: 'Цитата',\n\ttooltip: (shortcut: string) => `Цитата (${shortcut})`,\n};\n\n// --- Arabic Locale ---\n\nexport const BLOCKQUOTE_LOCALE_AR: BlockquoteLocale = {\n\tlabel: 'اقتباس',\n\ttooltip: (shortcut: string) => `اقتباس (${shortcut})`,\n};\n\n// --- Hindi Locale ---\n\nexport const BLOCKQUOTE_LOCALE_HI: BlockquoteLocale = {\n\tlabel: 'उद्धरण',\n\ttooltip: (shortcut: string) => `उद्धरण (${shortcut})`,\n};\n\n// --- Locale Map ---\n\nexport const BLOCKQUOTE_LOCALES: Record<string, BlockquoteLocale> = {\n\ten: BLOCKQUOTE_LOCALE_EN,\n\tde: BLOCKQUOTE_LOCALE_DE,\n\tes: BLOCKQUOTE_LOCALE_ES,\n\tfr: BLOCKQUOTE_LOCALE_FR,\n\tzh: BLOCKQUOTE_LOCALE_ZH,\n\tru: BLOCKQUOTE_LOCALE_RU,\n\tar: BLOCKQUOTE_LOCALE_AR,\n\thi: BLOCKQUOTE_LOCALE_HI,\n};\n","/**\n * BlockquotePlugin: registers a blockquote block type with NodeSpec,\n * toggle command, keyboard shortcut, input rule, and a toolbar button.\n */\n\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { createBlockElement } from '../../model/NodeSpec.js';\nimport { isCollapsed, isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport { type NodeTypeName, nodeType } from '../../model/TypeBrands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\nimport { BLOCKQUOTE_LOCALES, type BlockquoteLocale } from './BlockquoteLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tblockquote: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface BlockquoteConfig {\n\t/** When true, a separator is rendered after the blockquote toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: BlockquoteLocale;\n}\n\nconst DEFAULT_CONFIG: BlockquoteConfig = {};\n\n// --- Plugin ---\n\nexport class BlockquotePlugin implements Plugin {\n\treadonly id = 'blockquote';\n\treadonly name = 'Blockquote';\n\treadonly priority = 35;\n\n\tprivate readonly config: BlockquoteConfig;\n\tprivate locale!: BlockquoteLocale;\n\n\tconstructor(config?: Partial<BlockquoteConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(BLOCKQUOTE_LOCALES, context, this.config.locale);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerInputRule(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\ttoDOM(node) {\n\t\t\t\treturn createBlockElement('blockquote', node.id);\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<blockquote>${content || '<br>'}</blockquote>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'blockquote' }],\n\t\t\tsanitize: { tags: ['blockquote'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleBlockquote', () => {\n\t\t\treturn this.toggleBlockquote(context);\n\t\t});\n\n\t\tcontext.registerCommand('setBlockquote', () => {\n\t\t\treturn this.setBlockType(context, nodeType('blockquote'));\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift->': () => context.executeCommand('toggleBlockquote'),\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: /^> $/,\n\t\t\thandler(state, _match, start, _end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + 2)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('blockquote'))\n\t\t\t\t\t.setSelection(sel)\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift->')),\n\t\t\tcommand: 'toggleBlockquote',\n\t\t\tpriority: 55,\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\tisActive: (state) => {\n\t\t\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\t\treturn block?.type === 'blockquote';\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Toggles between blockquote and paragraph.\n\t * If the block is already a blockquote, resets to paragraph.\n\t */\n\tprivate toggleBlockquote(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block) return false;\n\n\t\tif (block.type === 'blockquote') {\n\t\t\treturn this.setBlockType(context, nodeType('paragraph'));\n\t\t}\n\n\t\treturn this.setBlockType(context, nodeType('blockquote'));\n\t}\n\n\tprivate setBlockType(\n\t\tcontext: PluginContext,\n\t\ttype: NodeTypeName,\n\t\tattrs?: Record<string, string | number | boolean>,\n\t): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(sel.anchor.blockId, type, attrs)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n}\n"],"names":["BLOCKQUOTE_LOCALE_EN","label","tooltip","shortcut","BLOCKQUOTE_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","BlockquotePlugin","id","name","priority","config","locale","this","context","resolvePluginLocale","registerNodeSpec","registerCommands","registerKeymap","registerInputRule","registerToolbarItem","type","group","content","allow","toDOM","node","createBlockElement","toHTML","_node","parseHTML","tag","sanitize","tags","registerCommand","toggleBlockquote","setBlockType","nodeType","executeCommand","pattern","state","_match","start","_end","sel","selection","isNodeSelection","isGapCursor","isCollapsed","block","getBlock","anchor","blockId","transaction","deleteTextAt","setSelection","build","icon","formatShortcut","command","separatorAfter","isActive","getState","attrs","tr","dispatch"],"mappings":";;;;;AAaO,MAAMA,IAAyC,EACrDC,OAAO,cACPC,SAAUC,CAAAA,OAAqB,eAAeA,EAAAA,IAAAA,GAsDlCC,IAAuD,EACnEC,IAAIL,GACJM,IAnDqD,EACrDL,OAAO,SACPC,SAAUC,CAAAA,OAAqB,UAAUA,EAAAA,IAAAA,GAkDzCI,IA7CqD,EACrDN,OAAO,QACPC,SAAUC,CAAAA,OAAqB,SAASA,EAAAA,IAAAA,GA4CxCK,IAvCqD,EACrDP,OAAO,YACPC,SAAUC,CAAAA,OAAqB,aAAaA,EAAAA,IAAAA,GAsC5CM,IAjCqD,EACrDR,OAAO,MACPC,SAAUC,CAAAA,OAAqB,OAAOA,EAAAA,IAAAA,GAgCtCO,IA3BqD,EACrDT,OAAO,UACPC,SAAUC,CAAAA,OAAqB,WAAWA,SA0B1CQ,IArBqD,EACrDV,OAAO,UACPC,SAAUC,CAAAA,OAAqB,WAAWA,EAAAA,IAAAA,GAoB1CS,IAfqD,EACrDX,OAAO,UACPC,SAAUC,CAAAA,OAAqB,WAAWA,WCnCrCU,IAAmC,CAAA;AAIlC,MAAMC,EAAAA;AAAAA,EACHC,KAAK;AAAA,EACLC,OAAO;AAAA,EACPC,WAAW;AAAA,EAEHC;AAAAA,EACTC;AAAAA,EAER,YAAYD,IAAAA;AACXE,SAAKF,SAAS,KAAKL,GAAAA,GAAmBK,GAAAA;AAAAA,EACvC;AAAA,EAEA,KAAKG;AACJD,SAAKD,SAASG,EAAoBlB,GAAoBiB,IAASD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