roosterjs-content-model-plugins 9.0.1 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +19 -4
  2. package/lib/autoFormat/AutoFormatPlugin.js +61 -6
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
  4. package/lib/autoFormat/hyphen/transformHyphen.d.ts +5 -0
  5. package/lib/autoFormat/hyphen/transformHyphen.js +35 -0
  6. package/lib/autoFormat/hyphen/transformHyphen.js.map +1 -0
  7. package/lib/autoFormat/link/createLink.js +8 -6
  8. package/lib/autoFormat/link/createLink.js.map +1 -1
  9. package/lib/autoFormat/link/createLinkAfterSpace.d.ts +2 -2
  10. package/lib/autoFormat/link/createLinkAfterSpace.js +17 -34
  11. package/lib/autoFormat/link/createLinkAfterSpace.js.map +1 -1
  12. package/lib/autoFormat/link/unlink.js +4 -5
  13. package/lib/autoFormat/link/unlink.js.map +1 -1
  14. package/lib/autoFormat/list/keyboardListTrigger.d.ts +2 -2
  15. package/lib/autoFormat/list/keyboardListTrigger.js +9 -19
  16. package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -1
  17. package/lib/autoFormat/numbers/transformFraction.d.ts +5 -0
  18. package/lib/autoFormat/numbers/transformFraction.js +27 -0
  19. package/lib/autoFormat/numbers/transformFraction.js.map +1 -0
  20. package/lib/autoFormat/numbers/transformOrdinals.d.ts +5 -0
  21. package/lib/autoFormat/numbers/transformOrdinals.js +32 -0
  22. package/lib/autoFormat/numbers/transformOrdinals.js.map +1 -0
  23. package/lib/customReplace/CustomReplacePlugin.d.ts +61 -0
  24. package/lib/customReplace/CustomReplacePlugin.js +87 -0
  25. package/lib/customReplace/CustomReplacePlugin.js.map +1 -0
  26. package/lib/edit/EditPlugin.js +19 -1
  27. package/lib/edit/EditPlugin.js.map +1 -1
  28. package/lib/edit/deleteSteps/deleteList.js +13 -7
  29. package/lib/edit/deleteSteps/deleteList.js.map +1 -1
  30. package/lib/edit/inputSteps/handleEnterOnList.js +9 -2
  31. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
  32. package/lib/edit/keyboardDelete.js +2 -2
  33. package/lib/edit/keyboardDelete.js.map +1 -1
  34. package/lib/edit/keyboardTab.js +28 -12
  35. package/lib/edit/keyboardTab.js.map +1 -1
  36. package/lib/edit/tabUtils/handleTabOnList.d.ts +2 -2
  37. package/lib/edit/tabUtils/handleTabOnList.js +3 -3
  38. package/lib/edit/tabUtils/handleTabOnList.js.map +1 -1
  39. package/lib/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
  40. package/lib/edit/tabUtils/handleTabOnParagraph.js +2 -2
  41. package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  42. package/lib/edit/tabUtils/handleTabOnTable.d.ts +6 -0
  43. package/lib/edit/tabUtils/handleTabOnTable.js +25 -0
  44. package/lib/edit/tabUtils/handleTabOnTable.js.map +1 -0
  45. package/lib/edit/tabUtils/handleTabOnTableCell.d.ts +6 -0
  46. package/lib/edit/tabUtils/handleTabOnTableCell.js +40 -0
  47. package/lib/edit/tabUtils/handleTabOnTableCell.js.map +1 -0
  48. package/lib/hyperlink/HyperlinkPlugin.d.ts +48 -0
  49. package/lib/hyperlink/HyperlinkPlugin.js +141 -0
  50. package/lib/hyperlink/HyperlinkPlugin.js.map +1 -0
  51. package/lib/hyperlink/HyperlinkToolTip.d.ts +7 -0
  52. package/lib/hyperlink/HyperlinkToolTip.js +3 -0
  53. package/lib/hyperlink/HyperlinkToolTip.js.map +1 -0
  54. package/lib/index.d.ts +9 -1
  55. package/lib/index.js +10 -1
  56. package/lib/index.js.map +1 -1
  57. package/lib/markdown/MarkdownPlugin.d.ts +13 -4
  58. package/lib/markdown/MarkdownPlugin.js +31 -12
  59. package/lib/markdown/MarkdownPlugin.js.map +1 -1
  60. package/lib/markdown/utils/setFormat.d.ts +2 -2
  61. package/lib/markdown/utils/setFormat.js +21 -29
  62. package/lib/markdown/utils/setFormat.js.map +1 -1
  63. package/lib/picker/PickerHandler.d.ts +112 -0
  64. package/lib/picker/PickerHandler.js +3 -0
  65. package/lib/picker/PickerHandler.js.map +1 -0
  66. package/lib/picker/PickerHelper.d.ts +22 -0
  67. package/lib/picker/PickerHelper.js +3 -0
  68. package/lib/picker/PickerHelper.js.map +1 -0
  69. package/lib/picker/PickerHelperImpl.d.ts +25 -0
  70. package/lib/picker/PickerHelperImpl.js +54 -0
  71. package/lib/picker/PickerHelperImpl.js.map +1 -0
  72. package/lib/picker/PickerPlugin.d.ts +54 -0
  73. package/lib/picker/PickerPlugin.js +217 -0
  74. package/lib/picker/PickerPlugin.js.map +1 -0
  75. package/lib/picker/getQueryString.d.ts +5 -0
  76. package/lib/picker/getQueryString.js +36 -0
  77. package/lib/picker/getQueryString.js.map +1 -0
  78. package/lib/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
  79. package/lib/pluginUtils/Rect/getDOMInsertPointRect.js +57 -0
  80. package/lib/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
  81. package/lib/shortcut/ShortcutPlugin.js +1 -0
  82. package/lib/shortcut/ShortcutPlugin.js.map +1 -1
  83. package/lib/shortcut/shortcuts.d.ts +10 -3
  84. package/lib/shortcut/shortcuts.js +21 -4
  85. package/lib/shortcut/shortcuts.js.map +1 -1
  86. package/lib/shortcut/utils/setShortcutIndentationCommand.js +2 -2
  87. package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
  88. package/lib/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
  89. package/lib/tableEdit/OnTableEditorCreatedCallback.js +3 -0
  90. package/lib/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
  91. package/lib/tableEdit/TableEditPlugin.d.ts +4 -1
  92. package/lib/tableEdit/TableEditPlugin.js +5 -2
  93. package/lib/tableEdit/TableEditPlugin.js.map +1 -1
  94. package/lib/tableEdit/editors/TableEditor.d.ts +4 -1
  95. package/lib/tableEdit/editors/TableEditor.js +23 -7
  96. package/lib/tableEdit/editors/TableEditor.js.map +1 -1
  97. package/lib/tableEdit/editors/features/TableEditFeature.js +3 -3
  98. package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -1
  99. package/lib/tableEdit/editors/features/TableInserter.d.ts +2 -1
  100. package/lib/tableEdit/editors/features/TableInserter.js +7 -9
  101. package/lib/tableEdit/editors/features/TableInserter.js.map +1 -1
  102. package/lib/tableEdit/editors/features/TableMover.d.ts +2 -1
  103. package/lib/tableEdit/editors/features/TableMover.js +8 -11
  104. package/lib/tableEdit/editors/features/TableMover.js.map +1 -1
  105. package/lib/tableEdit/editors/features/TableResizer.d.ts +2 -1
  106. package/lib/tableEdit/editors/features/TableResizer.js +19 -3
  107. package/lib/tableEdit/editors/features/TableResizer.js.map +1 -1
  108. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +19 -4
  109. package/lib-amd/autoFormat/AutoFormatPlugin.js +57 -7
  110. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
  111. package/lib-amd/autoFormat/hyphen/transformHyphen.d.ts +5 -0
  112. package/lib-amd/autoFormat/hyphen/transformHyphen.js +36 -0
  113. package/lib-amd/autoFormat/hyphen/transformHyphen.js.map +1 -0
  114. package/lib-amd/autoFormat/link/createLink.js +8 -6
  115. package/lib-amd/autoFormat/link/createLink.js.map +1 -1
  116. package/lib-amd/autoFormat/link/createLinkAfterSpace.d.ts +2 -2
  117. package/lib-amd/autoFormat/link/createLinkAfterSpace.js +18 -34
  118. package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -1
  119. package/lib-amd/autoFormat/link/unlink.js +4 -5
  120. package/lib-amd/autoFormat/link/unlink.js.map +1 -1
  121. package/lib-amd/autoFormat/list/keyboardListTrigger.d.ts +2 -2
  122. package/lib-amd/autoFormat/list/keyboardListTrigger.js +10 -19
  123. package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -1
  124. package/lib-amd/autoFormat/numbers/transformFraction.d.ts +5 -0
  125. package/lib-amd/autoFormat/numbers/transformFraction.js +28 -0
  126. package/lib-amd/autoFormat/numbers/transformFraction.js.map +1 -0
  127. package/lib-amd/autoFormat/numbers/transformOrdinals.d.ts +5 -0
  128. package/lib-amd/autoFormat/numbers/transformOrdinals.js +33 -0
  129. package/lib-amd/autoFormat/numbers/transformOrdinals.js.map +1 -0
  130. package/lib-amd/customReplace/CustomReplacePlugin.d.ts +61 -0
  131. package/lib-amd/customReplace/CustomReplacePlugin.js +88 -0
  132. package/lib-amd/customReplace/CustomReplacePlugin.js.map +1 -0
  133. package/lib-amd/edit/EditPlugin.js +19 -1
  134. package/lib-amd/edit/EditPlugin.js.map +1 -1
  135. package/lib-amd/edit/deleteSteps/deleteList.js +13 -7
  136. package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
  137. package/lib-amd/edit/inputSteps/handleEnterOnList.js +9 -3
  138. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
  139. package/lib-amd/edit/keyboardDelete.js +2 -2
  140. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  141. package/lib-amd/edit/keyboardTab.js +27 -13
  142. package/lib-amd/edit/keyboardTab.js.map +1 -1
  143. package/lib-amd/edit/tabUtils/handleTabOnList.d.ts +2 -2
  144. package/lib-amd/edit/tabUtils/handleTabOnList.js +3 -3
  145. package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -1
  146. package/lib-amd/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
  147. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +2 -2
  148. package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  149. package/lib-amd/edit/tabUtils/handleTabOnTable.d.ts +6 -0
  150. package/lib-amd/edit/tabUtils/handleTabOnTable.js +25 -0
  151. package/lib-amd/edit/tabUtils/handleTabOnTable.js.map +1 -0
  152. package/lib-amd/edit/tabUtils/handleTabOnTableCell.d.ts +6 -0
  153. package/lib-amd/edit/tabUtils/handleTabOnTableCell.js +40 -0
  154. package/lib-amd/edit/tabUtils/handleTabOnTableCell.js.map +1 -0
  155. package/lib-amd/hyperlink/HyperlinkPlugin.d.ts +48 -0
  156. package/lib-amd/hyperlink/HyperlinkPlugin.js +142 -0
  157. package/lib-amd/hyperlink/HyperlinkPlugin.js.map +1 -0
  158. package/lib-amd/hyperlink/HyperlinkToolTip.d.ts +7 -0
  159. package/lib-amd/hyperlink/HyperlinkToolTip.js +5 -0
  160. package/lib-amd/hyperlink/HyperlinkToolTip.js.map +1 -0
  161. package/lib-amd/index.d.ts +9 -1
  162. package/lib-amd/index.js +7 -2
  163. package/lib-amd/index.js.map +1 -1
  164. package/lib-amd/markdown/MarkdownPlugin.d.ts +13 -4
  165. package/lib-amd/markdown/MarkdownPlugin.js +31 -12
  166. package/lib-amd/markdown/MarkdownPlugin.js.map +1 -1
  167. package/lib-amd/markdown/utils/setFormat.d.ts +2 -2
  168. package/lib-amd/markdown/utils/setFormat.js +21 -29
  169. package/lib-amd/markdown/utils/setFormat.js.map +1 -1
  170. package/lib-amd/picker/PickerHandler.d.ts +112 -0
  171. package/lib-amd/picker/PickerHandler.js +5 -0
  172. package/lib-amd/picker/PickerHandler.js.map +1 -0
  173. package/lib-amd/picker/PickerHelper.d.ts +22 -0
  174. package/lib-amd/picker/PickerHelper.js +5 -0
  175. package/lib-amd/picker/PickerHelper.js.map +1 -0
  176. package/lib-amd/picker/PickerHelperImpl.d.ts +25 -0
  177. package/lib-amd/picker/PickerHelperImpl.js +53 -0
  178. package/lib-amd/picker/PickerHelperImpl.js.map +1 -0
  179. package/lib-amd/picker/PickerPlugin.d.ts +54 -0
  180. package/lib-amd/picker/PickerPlugin.js +215 -0
  181. package/lib-amd/picker/PickerPlugin.js.map +1 -0
  182. package/lib-amd/picker/getQueryString.d.ts +5 -0
  183. package/lib-amd/picker/getQueryString.js +37 -0
  184. package/lib-amd/picker/getQueryString.js.map +1 -0
  185. package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
  186. package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.js +58 -0
  187. package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
  188. package/lib-amd/shortcut/ShortcutPlugin.js +1 -0
  189. package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -1
  190. package/lib-amd/shortcut/shortcuts.d.ts +10 -3
  191. package/lib-amd/shortcut/shortcuts.js +21 -4
  192. package/lib-amd/shortcut/shortcuts.js.map +1 -1
  193. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +2 -2
  194. package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
  195. package/lib-amd/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
  196. package/lib-amd/tableEdit/OnTableEditorCreatedCallback.js +5 -0
  197. package/lib-amd/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
  198. package/lib-amd/tableEdit/TableEditPlugin.d.ts +4 -1
  199. package/lib-amd/tableEdit/TableEditPlugin.js +5 -2
  200. package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -1
  201. package/lib-amd/tableEdit/editors/TableEditor.d.ts +4 -1
  202. package/lib-amd/tableEdit/editors/TableEditor.js +23 -7
  203. package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -1
  204. package/lib-amd/tableEdit/editors/features/TableEditFeature.js +3 -3
  205. package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -1
  206. package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +2 -1
  207. package/lib-amd/tableEdit/editors/features/TableInserter.js +7 -9
  208. package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -1
  209. package/lib-amd/tableEdit/editors/features/TableMover.d.ts +2 -1
  210. package/lib-amd/tableEdit/editors/features/TableMover.js +8 -11
  211. package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -1
  212. package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +2 -1
  213. package/lib-amd/tableEdit/editors/features/TableResizer.js +19 -4
  214. package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -1
  215. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +19 -4
  216. package/lib-mjs/autoFormat/AutoFormatPlugin.js +61 -6
  217. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
  218. package/lib-mjs/autoFormat/hyphen/transformHyphen.d.ts +5 -0
  219. package/lib-mjs/autoFormat/hyphen/transformHyphen.js +31 -0
  220. package/lib-mjs/autoFormat/hyphen/transformHyphen.js.map +1 -0
  221. package/lib-mjs/autoFormat/link/createLink.js +9 -7
  222. package/lib-mjs/autoFormat/link/createLink.js.map +1 -1
  223. package/lib-mjs/autoFormat/link/createLinkAfterSpace.d.ts +2 -2
  224. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +17 -34
  225. package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -1
  226. package/lib-mjs/autoFormat/link/unlink.js +4 -5
  227. package/lib-mjs/autoFormat/link/unlink.js.map +1 -1
  228. package/lib-mjs/autoFormat/list/keyboardListTrigger.d.ts +2 -2
  229. package/lib-mjs/autoFormat/list/keyboardListTrigger.js +9 -19
  230. package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -1
  231. package/lib-mjs/autoFormat/numbers/transformFraction.d.ts +5 -0
  232. package/lib-mjs/autoFormat/numbers/transformFraction.js +23 -0
  233. package/lib-mjs/autoFormat/numbers/transformFraction.js.map +1 -0
  234. package/lib-mjs/autoFormat/numbers/transformOrdinals.d.ts +5 -0
  235. package/lib-mjs/autoFormat/numbers/transformOrdinals.js +28 -0
  236. package/lib-mjs/autoFormat/numbers/transformOrdinals.js.map +1 -0
  237. package/lib-mjs/customReplace/CustomReplacePlugin.d.ts +61 -0
  238. package/lib-mjs/customReplace/CustomReplacePlugin.js +84 -0
  239. package/lib-mjs/customReplace/CustomReplacePlugin.js.map +1 -0
  240. package/lib-mjs/edit/EditPlugin.js +19 -1
  241. package/lib-mjs/edit/EditPlugin.js.map +1 -1
  242. package/lib-mjs/edit/deleteSteps/deleteList.js +13 -7
  243. package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
  244. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +9 -2
  245. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
  246. package/lib-mjs/edit/keyboardDelete.js +2 -2
  247. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  248. package/lib-mjs/edit/keyboardTab.js +28 -12
  249. package/lib-mjs/edit/keyboardTab.js.map +1 -1
  250. package/lib-mjs/edit/tabUtils/handleTabOnList.d.ts +2 -2
  251. package/lib-mjs/edit/tabUtils/handleTabOnList.js +3 -3
  252. package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -1
  253. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
  254. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +2 -2
  255. package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
  256. package/lib-mjs/edit/tabUtils/handleTabOnTable.d.ts +6 -0
  257. package/lib-mjs/edit/tabUtils/handleTabOnTable.js +21 -0
  258. package/lib-mjs/edit/tabUtils/handleTabOnTable.js.map +1 -0
  259. package/lib-mjs/edit/tabUtils/handleTabOnTableCell.d.ts +6 -0
  260. package/lib-mjs/edit/tabUtils/handleTabOnTableCell.js +36 -0
  261. package/lib-mjs/edit/tabUtils/handleTabOnTableCell.js.map +1 -0
  262. package/lib-mjs/hyperlink/HyperlinkPlugin.d.ts +48 -0
  263. package/lib-mjs/hyperlink/HyperlinkPlugin.js +138 -0
  264. package/lib-mjs/hyperlink/HyperlinkPlugin.js.map +1 -0
  265. package/lib-mjs/hyperlink/HyperlinkToolTip.d.ts +7 -0
  266. package/lib-mjs/hyperlink/HyperlinkToolTip.js +2 -0
  267. package/lib-mjs/hyperlink/HyperlinkToolTip.js.map +1 -0
  268. package/lib-mjs/index.d.ts +9 -1
  269. package/lib-mjs/index.js +5 -1
  270. package/lib-mjs/index.js.map +1 -1
  271. package/lib-mjs/markdown/MarkdownPlugin.d.ts +13 -4
  272. package/lib-mjs/markdown/MarkdownPlugin.js +31 -12
  273. package/lib-mjs/markdown/MarkdownPlugin.js.map +1 -1
  274. package/lib-mjs/markdown/utils/setFormat.d.ts +2 -2
  275. package/lib-mjs/markdown/utils/setFormat.js +21 -29
  276. package/lib-mjs/markdown/utils/setFormat.js.map +1 -1
  277. package/lib-mjs/picker/PickerHandler.d.ts +112 -0
  278. package/lib-mjs/picker/PickerHandler.js +2 -0
  279. package/lib-mjs/picker/PickerHandler.js.map +1 -0
  280. package/lib-mjs/picker/PickerHelper.d.ts +22 -0
  281. package/lib-mjs/picker/PickerHelper.js +2 -0
  282. package/lib-mjs/picker/PickerHelper.js.map +1 -0
  283. package/lib-mjs/picker/PickerHelperImpl.d.ts +25 -0
  284. package/lib-mjs/picker/PickerHelperImpl.js +51 -0
  285. package/lib-mjs/picker/PickerHelperImpl.js.map +1 -0
  286. package/lib-mjs/picker/PickerPlugin.d.ts +54 -0
  287. package/lib-mjs/picker/PickerPlugin.js +214 -0
  288. package/lib-mjs/picker/PickerPlugin.js.map +1 -0
  289. package/lib-mjs/picker/getQueryString.d.ts +5 -0
  290. package/lib-mjs/picker/getQueryString.js +32 -0
  291. package/lib-mjs/picker/getQueryString.js.map +1 -0
  292. package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
  293. package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.js +53 -0
  294. package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
  295. package/lib-mjs/shortcut/ShortcutPlugin.js +2 -1
  296. package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -1
  297. package/lib-mjs/shortcut/shortcuts.d.ts +10 -3
  298. package/lib-mjs/shortcut/shortcuts.js +20 -3
  299. package/lib-mjs/shortcut/shortcuts.js.map +1 -1
  300. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +2 -2
  301. package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
  302. package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
  303. package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.js +2 -0
  304. package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
  305. package/lib-mjs/tableEdit/TableEditPlugin.d.ts +4 -1
  306. package/lib-mjs/tableEdit/TableEditPlugin.js +5 -2
  307. package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -1
  308. package/lib-mjs/tableEdit/editors/TableEditor.d.ts +4 -1
  309. package/lib-mjs/tableEdit/editors/TableEditor.js +24 -8
  310. package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -1
  311. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js +3 -3
  312. package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -1
  313. package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +2 -1
  314. package/lib-mjs/tableEdit/editors/features/TableInserter.js +7 -9
  315. package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -1
  316. package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +2 -1
  317. package/lib-mjs/tableEdit/editors/features/TableMover.js +8 -11
  318. package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -1
  319. package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +2 -1
  320. package/lib-mjs/tableEdit/editors/features/TableResizer.js +19 -3
  321. package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -1
  322. package/package.json +5 -5
  323. package/lib/autoFormat/link/getLinkSegment.d.ts +0 -5
  324. package/lib/autoFormat/link/getLinkSegment.js +0 -27
  325. package/lib/autoFormat/link/getLinkSegment.js.map +0 -1
  326. package/lib-amd/autoFormat/link/getLinkSegment.d.ts +0 -5
  327. package/lib-amd/autoFormat/link/getLinkSegment.js +0 -27
  328. package/lib-amd/autoFormat/link/getLinkSegment.js.map +0 -1
  329. package/lib-mjs/autoFormat/link/getLinkSegment.d.ts +0 -5
  330. package/lib-mjs/autoFormat/link/getLinkSegment.js +0 -23
  331. package/lib-mjs/autoFormat/link/getLinkSegment.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/list/keyboardListTrigger.ts"],"names":[],"mappings":";;;;IASA;;OAEG;IACH,SAAgB,mBAAmB,CAC/B,MAAe,EACf,qBAAqC,EACrC,wBAAwC;QADxC,sCAAA,EAAA,4BAAqC;QACrC,yCAAA,EAAA,+BAAwC;QAExC,IAAI,qBAAqB,IAAI,wBAAwB,EAAE;YACnD,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;gBACX,IAAM,aAAa,GAAG,IAAA,mCAAgB,EAClC,KAAK,EACL,qBAAqB,EACrB,wBAAwB,CAC3B,CAAC;gBACF,IAAI,aAAa,EAAE;oBACf,IAAM,qBAAqB,GAAG,IAAA,8DAAgC,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;oBAC7E,IAAI,qBAAqB,CAAC,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;wBACzD,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;qBACrD;oBACO,IAAA,QAAQ,GAAuB,aAAa,SAApC,EAAE,SAAS,GAAY,aAAa,UAAzB,EAAE,KAAK,GAAK,aAAa,MAAlB,CAAmB;oBACrD,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;oBAC/C,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;oBAElC,OAAO,IAAI,CAAC;iBACf;gBAED,OAAO,KAAK,CAAC;YACjB,CAAC,EACD;gBACI,OAAO,EAAE,gBAAgB;aAC5B,CACJ,CAAC;SACL;IACL,CAAC;IAhCD,kDAgCC;IAED,IAAM,WAAW,GAAG,UAChB,KAA2B,EAC3B,QAAqB,EACrB,SAAiB,EACjB,KAAc;QAEd,IAAA,yCAAW,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7B,IAAM,aAAa,GAAG,QAAQ,IAAI,IAAI,CAAC;QACvC,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,aAAa,EAAE;YACrC,IAAA,qDAAuB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,IAAA,+CAAiB,EACb,KAAK,EACL,aAAa;YACT,CAAC,CAAC;gBACI,gBAAgB,EAAE,SAAS;aAC9B;YACH,CAAC,CAAC;gBACI,kBAAkB,EAAE,SAAS;aAChC,CACV,CAAC;IACN,CAAC,CAAC","sourcesContent":["import { getListTypeStyle } from './getListTypeStyle';\nimport { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-dom';\nimport {\n setListType,\n setModelListStartNumber,\n setModelListStyle,\n} from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardListTrigger(\n editor: IEditor,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n) {\n if (shouldSearchForBullet || shouldSearchForNumbering) {\n editor.formatContentModel(\n (model, context) => {\n const listStyleType = getListTypeStyle(\n model,\n shouldSearchForBullet,\n shouldSearchForNumbering\n );\n if (listStyleType) {\n const segmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, false);\n if (segmentsAndParagraphs[0] && segmentsAndParagraphs[0][1]) {\n segmentsAndParagraphs[0][1].segments.splice(0, 1);\n }\n const { listType, styleType, index } = listStyleType;\n triggerList(model, listType, styleType, index);\n context.canUndoByBackspace = true;\n\n return true;\n }\n\n return false;\n },\n {\n apiName: 'autoToggleList',\n }\n );\n }\n}\n\nconst triggerList = (\n model: ContentModelDocument,\n listType: 'OL' | 'UL',\n styleType: number,\n index?: number\n) => {\n setListType(model, listType);\n const isOrderedList = listType == 'OL';\n if (index && index > 1 && isOrderedList) {\n setModelListStartNumber(model, index);\n }\n setModelListStyle(\n model,\n isOrderedList\n ? {\n orderedStyleType: styleType,\n }\n : {\n unorderedStyleType: styleType,\n }\n );\n};\n"]}
1
+ {"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/list/keyboardListTrigger.ts"],"names":[],"mappings":";;;;IAYA;;OAEG;IACH,SAAgB,mBAAmB,CAC/B,KAA2B,EAC3B,SAAgC,EAChC,OAAkC,EAClC,qBAAqC,EACrC,wBAAwC;QADxC,sCAAA,EAAA,4BAAqC;QACrC,yCAAA,EAAA,+BAAwC;QAExC,IAAM,aAAa,GAAG,IAAA,mCAAgB,EAAC,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,CAAC,CAAC;QAC/F,IAAI,aAAa,EAAE;YACf,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACxB,IAAA,QAAQ,GAAuB,aAAa,SAApC,EAAE,SAAS,GAAY,aAAa,UAAzB,EAAE,KAAK,GAAK,aAAa,MAAlB,CAAmB;YACrD,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAC/C,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAElC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAjBD,kDAiBC;IAED,IAAM,WAAW,GAAG,UAChB,KAA2B,EAC3B,QAAqB,EACrB,SAAiB,EACjB,KAAc;QAEd,IAAA,yCAAW,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7B,IAAM,aAAa,GAAG,QAAQ,IAAI,IAAI,CAAC;QACvC,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,aAAa,EAAE;YACrC,IAAA,qDAAuB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,IAAA,+CAAiB,EACb,KAAK,EACL,aAAa;YACT,CAAC,CAAC;gBACI,gBAAgB,EAAE,SAAS;aAC9B;YACH,CAAC,CAAC;gBACI,kBAAkB,EAAE,SAAS;aAChC,CACV,CAAC;IACN,CAAC,CAAC","sourcesContent":["import { getListTypeStyle } from './getListTypeStyle';\nimport {\n setListType,\n setModelListStartNumber,\n setModelListStyle,\n} from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n FormatContentModelContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardListTrigger(\n model: ContentModelDocument,\n paragraph: ContentModelParagraph,\n context: FormatContentModelContext,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n) {\n const listStyleType = getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering);\n if (listStyleType) {\n paragraph.segments.splice(0, 1);\n const { listType, styleType, index } = listStyleType;\n triggerList(model, listType, styleType, index);\n context.canUndoByBackspace = true;\n\n return true;\n }\n return false;\n}\n\nconst triggerList = (\n model: ContentModelDocument,\n listType: 'OL' | 'UL',\n styleType: number,\n index?: number\n) => {\n setListType(model, listType);\n const isOrderedList = listType == 'OL';\n if (index && index > 1 && isOrderedList) {\n setModelListStartNumber(model, index);\n }\n setModelListStyle(\n model,\n isOrderedList\n ? {\n orderedStyleType: styleType,\n }\n : {\n unorderedStyleType: styleType,\n }\n );\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import type { ContentModelParagraph, ContentModelText, FormatContentModelContext } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare function transformFraction(previousSegment: ContentModelText, paragraph: ContentModelParagraph, context: FormatContentModelContext): boolean;
@@ -0,0 +1,28 @@
1
+ define(["require", "exports", "../../pluginUtils/splitTextSegment"], function (require, exports, splitTextSegment_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.transformFraction = void 0;
5
+ var FRACTIONS = {
6
+ '1/2': '½',
7
+ '1/4': '¼',
8
+ '3/4': '¾',
9
+ };
10
+ /**
11
+ * @internal
12
+ */
13
+ function transformFraction(previousSegment, paragraph, context) {
14
+ var _a;
15
+ var fraction = (_a = previousSegment.text.split(' ').pop()) === null || _a === void 0 ? void 0 : _a.trim();
16
+ if (fraction && FRACTIONS[fraction]) {
17
+ var textLength = previousSegment.text.length - 1;
18
+ var textIndex = textLength - fraction.length;
19
+ var textSegment = (0, splitTextSegment_1.splitTextSegment)(previousSegment, paragraph, textIndex, textLength);
20
+ textSegment.text = FRACTIONS[fraction];
21
+ context.canUndoByBackspace = true;
22
+ return true;
23
+ }
24
+ return false;
25
+ }
26
+ exports.transformFraction = transformFraction;
27
+ });
28
+ //# sourceMappingURL=transformFraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformFraction.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/numbers/transformFraction.ts"],"names":[],"mappings":";;;;IAOA,IAAM,SAAS,GAA2B;QACtC,KAAK,EAAE,GAAG;QACV,KAAK,EAAE,GAAG;QACV,KAAK,EAAE,GAAG;KACb,CAAC;IAEF;;OAEG;IACH,SAAgB,iBAAiB,CAC7B,eAAiC,EACjC,SAAgC,EAChC,OAAkC;;QAElC,IAAM,QAAQ,GAAG,MAAA,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,0CAAE,IAAI,EAAE,CAAC;QAC/D,IAAI,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE;YACjC,IAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YACnD,IAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;YAC/C,IAAM,WAAW,GAAG,IAAA,mCAAgB,EAAC,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;YACxF,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;YAEvC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAClC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAjBD,8CAiBC","sourcesContent":["import { splitTextSegment } from '../../pluginUtils/splitTextSegment';\nimport type {\n ContentModelParagraph,\n ContentModelText,\n FormatContentModelContext,\n} from 'roosterjs-content-model-types';\n\nconst FRACTIONS: Record<string, string> = {\n '1/2': '½',\n '1/4': '¼',\n '3/4': '¾',\n};\n\n/**\n * @internal\n */\nexport function transformFraction(\n previousSegment: ContentModelText,\n paragraph: ContentModelParagraph,\n context: FormatContentModelContext\n): boolean {\n const fraction = previousSegment.text.split(' ').pop()?.trim();\n if (fraction && FRACTIONS[fraction]) {\n const textLength = previousSegment.text.length - 1;\n const textIndex = textLength - fraction.length;\n const textSegment = splitTextSegment(previousSegment, paragraph, textIndex, textLength);\n textSegment.text = FRACTIONS[fraction];\n\n context.canUndoByBackspace = true;\n return true;\n }\n\n return false;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { ContentModelParagraph, ContentModelText, FormatContentModelContext } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare function transformOrdinals(previousSegment: ContentModelText, paragraph: ContentModelParagraph, context: FormatContentModelContext): boolean;
@@ -0,0 +1,33 @@
1
+ define(["require", "exports", "../../pluginUtils/splitTextSegment"], function (require, exports, splitTextSegment_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.transformOrdinals = void 0;
5
+ var getOrdinal = function (value) {
6
+ var ORDINALS = {
7
+ 1: 'st',
8
+ 2: 'nd',
9
+ 3: 'rd',
10
+ };
11
+ return ORDINALS[value] || 'th';
12
+ };
13
+ /**
14
+ * @internal
15
+ */
16
+ function transformOrdinals(previousSegment, paragraph, context) {
17
+ var _a;
18
+ var value = (_a = previousSegment.text.split(' ').pop()) === null || _a === void 0 ? void 0 : _a.trim();
19
+ if (value) {
20
+ var ordinal = value.substring(value.length - 2);
21
+ var ordinalValue = parseInt(value);
22
+ if (ordinalValue && getOrdinal(ordinalValue) === ordinal) {
23
+ var ordinalSegment = (0, splitTextSegment_1.splitTextSegment)(previousSegment, paragraph, previousSegment.text.length - 3, previousSegment.text.length - 1);
24
+ ordinalSegment.format.superOrSubScriptSequence = 'super';
25
+ context.canUndoByBackspace = true;
26
+ return true;
27
+ }
28
+ }
29
+ return false;
30
+ }
31
+ exports.transformOrdinals = transformOrdinals;
32
+ });
33
+ //# sourceMappingURL=transformOrdinals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformOrdinals.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/numbers/transformOrdinals.ts"],"names":[],"mappings":";;;;IAOA,IAAM,UAAU,GAAG,UAAC,KAAa;QAC7B,IAAM,QAAQ,GAA2B;YACrC,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,IAAI;SACV,CAAC;QACF,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IACnC,CAAC,CAAC;IAEF;;OAEG;IACH,SAAgB,iBAAiB,CAC7B,eAAiC,EACjC,SAAgC,EAChC,OAAkC;;QAElC,IAAM,KAAK,GAAG,MAAA,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,0CAAE,IAAI,EAAE,CAAC;QAC5D,IAAI,KAAK,EAAE;YACP,IAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAClD,IAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC,KAAK,OAAO,EAAE;gBACtD,IAAM,cAAc,GAAG,IAAA,mCAAgB,EACnC,eAAe,EACf,SAAS,EACT,eAAe,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAC/B,eAAe,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAClC,CAAC;gBAEF,cAAc,CAAC,MAAM,CAAC,wBAAwB,GAAG,OAAO,CAAC;gBACzD,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAClC,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAvBD,8CAuBC","sourcesContent":["import { splitTextSegment } from '../../pluginUtils/splitTextSegment';\nimport type {\n ContentModelParagraph,\n ContentModelText,\n FormatContentModelContext,\n} from 'roosterjs-content-model-types';\n\nconst getOrdinal = (value: number) => {\n const ORDINALS: Record<number, string> = {\n 1: 'st',\n 2: 'nd',\n 3: 'rd',\n };\n return ORDINALS[value] || 'th';\n};\n\n/**\n * @internal\n */\nexport function transformOrdinals(\n previousSegment: ContentModelText,\n paragraph: ContentModelParagraph,\n context: FormatContentModelContext\n): boolean {\n const value = previousSegment.text.split(' ').pop()?.trim();\n if (value) {\n const ordinal = value.substring(value.length - 2);\n const ordinalValue = parseInt(value);\n if (ordinalValue && getOrdinal(ordinalValue) === ordinal) {\n const ordinalSegment = splitTextSegment(\n previousSegment,\n paragraph,\n previousSegment.text.length - 3,\n previousSegment.text.length - 1\n );\n\n ordinalSegment.format.superOrSubScriptSequence = 'super';\n context.canUndoByBackspace = true;\n return true;\n }\n }\n return false;\n}\n"]}
@@ -0,0 +1,61 @@
1
+ import type { ContentModelParagraph, ContentModelText, EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
2
+ /**
3
+ * The CustomReplace interface defines a custom replacement that can be used in CustomReplacePlugin.
4
+ */
5
+ export interface CustomReplace {
6
+ /**
7
+ * The string to replace in the editor.
8
+ */
9
+ stringToReplace: string;
10
+ /**
11
+ * The string to replace with.
12
+ */
13
+ replacementString: string;
14
+ /**
15
+ * The handler to replace the string.
16
+ * @param previousSegment The text segment to replace.
17
+ * @param stringToReplace The string to replace.
18
+ * @param replacementString The string to replace with.
19
+ * @param paragraph The paragraph that contains the text segment.
20
+ * @returns True if the string is replaced successfully, otherwise false.
21
+ */
22
+ replacementHandler: (previousSegment: ContentModelText, stringToReplace: string, replacementString: string, paragraph?: ContentModelParagraph) => boolean;
23
+ }
24
+ /**
25
+ * CustomReplacePlugin is a plugin that allows you to replace a string with another string in the editor.
26
+ */
27
+ export declare class CustomReplacePlugin implements EditorPlugin {
28
+ private customReplacements;
29
+ private editor;
30
+ private triggerKeys;
31
+ /**
32
+ * @param customReplacements Custom replacement rules.
33
+ * Ex: [{ stringToReplace: ':)', replacementString: '🙂', replacementHandler: replaceEmojis }]
34
+ */
35
+ constructor(customReplacements: CustomReplace[]);
36
+ /**
37
+ * Get name of this plugin
38
+ */
39
+ getName(): string;
40
+ /**
41
+ * The first method that editor will call to a plugin when editor is initializing.
42
+ * It will pass in the editor instance, plugin should take this chance to save the
43
+ * editor reference so that it can call to any editor method or format API later.
44
+ * @param editor The editor object
45
+ */
46
+ initialize(editor: IEditor): void;
47
+ /**
48
+ * The last method that editor will call to a plugin before it is disposed.
49
+ * Plugin can take this chance to clear the reference to editor. After this method is
50
+ * called, plugin should not call to any editor method since it will result in error.
51
+ */
52
+ dispose(): void;
53
+ /**
54
+ * Core method for a plugin. Once an event happens in editor, editor will call this
55
+ * method of each plugin to handle the event as long as the event is not handled
56
+ * exclusively by another plugin.
57
+ * @param event The event to handle:
58
+ */
59
+ onPluginEvent(event: PluginEvent): void;
60
+ private handleEditorInputEvent;
61
+ }
@@ -0,0 +1,88 @@
1
+ define(["require", "exports", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_api_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CustomReplacePlugin = void 0;
5
+ /**
6
+ * CustomReplacePlugin is a plugin that allows you to replace a string with another string in the editor.
7
+ */
8
+ var CustomReplacePlugin = /** @class */ (function () {
9
+ /**
10
+ * @param customReplacements Custom replacement rules.
11
+ * Ex: [{ stringToReplace: ':)', replacementString: '🙂', replacementHandler: replaceEmojis }]
12
+ */
13
+ function CustomReplacePlugin(customReplacements) {
14
+ this.customReplacements = customReplacements;
15
+ this.editor = null;
16
+ this.triggerKeys = [];
17
+ }
18
+ /**
19
+ * Get name of this plugin
20
+ */
21
+ CustomReplacePlugin.prototype.getName = function () {
22
+ return 'CustomReplace';
23
+ };
24
+ /**
25
+ * The first method that editor will call to a plugin when editor is initializing.
26
+ * It will pass in the editor instance, plugin should take this chance to save the
27
+ * editor reference so that it can call to any editor method or format API later.
28
+ * @param editor The editor object
29
+ */
30
+ CustomReplacePlugin.prototype.initialize = function (editor) {
31
+ this.editor = editor;
32
+ this.triggerKeys = this.customReplacements.map(function (replacement) {
33
+ return replacement.stringToReplace.slice(-1);
34
+ });
35
+ };
36
+ /**
37
+ * The last method that editor will call to a plugin before it is disposed.
38
+ * Plugin can take this chance to clear the reference to editor. After this method is
39
+ * called, plugin should not call to any editor method since it will result in error.
40
+ */
41
+ CustomReplacePlugin.prototype.dispose = function () {
42
+ this.editor = null;
43
+ };
44
+ /**
45
+ * Core method for a plugin. Once an event happens in editor, editor will call this
46
+ * method of each plugin to handle the event as long as the event is not handled
47
+ * exclusively by another plugin.
48
+ * @param event The event to handle:
49
+ */
50
+ CustomReplacePlugin.prototype.onPluginEvent = function (event) {
51
+ if (this.editor) {
52
+ switch (event.eventType) {
53
+ case 'input':
54
+ this.handleEditorInputEvent(this.editor, event);
55
+ break;
56
+ }
57
+ }
58
+ };
59
+ CustomReplacePlugin.prototype.handleEditorInputEvent = function (editor, event) {
60
+ var _this = this;
61
+ var rawEvent = event.rawEvent;
62
+ var selection = editor.getDOMSelection();
63
+ var key = rawEvent.data;
64
+ if (this.customReplacements.length > 0 &&
65
+ rawEvent.inputType === 'insertText' &&
66
+ selection &&
67
+ selection.type === 'range' &&
68
+ selection.range.collapsed &&
69
+ key &&
70
+ this.triggerKeys.indexOf(key) > -1) {
71
+ (0, roosterjs_content_model_api_1.formatTextSegmentBeforeSelectionMarker)(editor, function (_model, previousSegment, paragraph, _markerFormat, context) {
72
+ var replaced = _this.customReplacements.some(function (_a) {
73
+ var stringToReplace = _a.stringToReplace, replacementString = _a.replacementString, replacementHandler = _a.replacementHandler;
74
+ return replacementHandler(previousSegment, stringToReplace, replacementString, paragraph);
75
+ });
76
+ if (replaced) {
77
+ context.canUndoByBackspace = true;
78
+ return true;
79
+ }
80
+ return false;
81
+ });
82
+ }
83
+ };
84
+ return CustomReplacePlugin;
85
+ }());
86
+ exports.CustomReplacePlugin = CustomReplacePlugin;
87
+ });
88
+ //# sourceMappingURL=CustomReplacePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomReplacePlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/customReplace/CustomReplacePlugin.ts"],"names":[],"mappings":";;;;IAwCA;;OAEG;IACH;QAII;;;WAGG;QACH,6BAAoB,kBAAmC;YAAnC,uBAAkB,GAAlB,kBAAkB,CAAiB;YAP/C,WAAM,GAAmB,IAAI,CAAC;YAC9B,gBAAW,GAAa,EAAE,CAAC;QAMuB,CAAC;QAE3D;;WAEG;QACH,qCAAO,GAAP;YACI,OAAO,eAAe,CAAC;QAC3B,CAAC;QAED;;;;;WAKG;QACH,wCAAU,GAAV,UAAW,MAAe;YACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAA,WAAW;gBACtD,OAAA,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAArC,CAAqC,CACxC,CAAC;QACN,CAAC;QAED;;;;WAIG;QACH,qCAAO,GAAP;YACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACvB,CAAC;QAED;;;;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C;aACL;QACL,CAAC;QACL,0BAAC;IAAD,CAAC,AA1FD,IA0FC;IA1FY,kDAAmB","sourcesContent":["import { formatTextSegmentBeforeSelectionMarker } from 'roosterjs-content-model-api';\nimport type {\n ContentModelParagraph,\n ContentModelText,\n EditorInputEvent,\n EditorPlugin,\n IEditor,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\n/**\n * The CustomReplace interface defines a custom replacement that can be used in CustomReplacePlugin.\n */\nexport interface CustomReplace {\n /**\n * The string to replace in the editor.\n */\n stringToReplace: string;\n\n /**\n * The string to replace with.\n */\n replacementString: string;\n\n /**\n * The handler to replace the string.\n * @param previousSegment The text segment to replace.\n * @param stringToReplace The string to replace.\n * @param replacementString The string to replace with.\n * @param paragraph The paragraph that contains the text segment.\n * @returns True if the string is replaced successfully, otherwise false.\n */\n replacementHandler: (\n previousSegment: ContentModelText,\n stringToReplace: string,\n replacementString: string,\n paragraph?: ContentModelParagraph\n ) => boolean;\n}\n\n/**\n * CustomReplacePlugin is a plugin that allows you to replace a string with another string in the editor.\n */\nexport class CustomReplacePlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private triggerKeys: string[] = [];\n\n /**\n * @param customReplacements Custom replacement rules.\n * Ex: [{ stringToReplace: ':)', replacementString: '🙂', replacementHandler: replaceEmojis }]\n */\n constructor(private customReplacements: CustomReplace[]) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'CustomReplace';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.triggerKeys = this.customReplacements.map(replacement =>\n replacement.stringToReplace.slice(-1)\n );\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor) {\n switch (event.eventType) {\n case 'input':\n this.handleEditorInputEvent(this.editor, event);\n break;\n }\n }\n }\n\n private handleEditorInputEvent(editor: IEditor, event: EditorInputEvent) {\n const rawEvent = event.rawEvent;\n const selection = editor.getDOMSelection();\n const key = rawEvent.data;\n if (\n this.customReplacements.length > 0 &&\n rawEvent.inputType === 'insertText' &&\n selection &&\n selection.type === 'range' &&\n selection.range.collapsed &&\n key &&\n this.triggerKeys.indexOf(key) > -1\n ) {\n formatTextSegmentBeforeSelectionMarker(\n editor,\n (_model, previousSegment, paragraph, _markerFormat, context) => {\n const replaced = this.customReplacements.some(\n ({ stringToReplace, replacementString, replacementHandler }) => {\n return replacementHandler(\n previousSegment,\n stringToReplace,\n replacementString,\n paragraph\n );\n }\n );\n if (replaced) {\n context.canUndoByBackspace = true;\n return true;\n }\n return false;\n }\n );\n }\n }\n}\n"]}
@@ -71,11 +71,18 @@ define(["require", "exports", "./keyboardDelete", "./keyboardInput", "./keyboard
71
71
  if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {
72
72
  switch (rawEvent.key) {
73
73
  case 'Backspace':
74
- case 'Delete':
75
74
  // Use our API to handle BACKSPACE/DELETE key.
76
75
  // No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache
77
76
  (0, keyboardDelete_1.keyboardDelete)(editor, rawEvent);
78
77
  break;
78
+ case 'Delete':
79
+ // Use our API to handle BACKSPACE/DELETE key.
80
+ // No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache
81
+ // And leave it to browser when shift key is pressed so that browser will trigger cut event
82
+ if (!event.rawEvent.shiftKey) {
83
+ (0, keyboardDelete_1.keyboardDelete)(editor, rawEvent);
84
+ }
85
+ break;
79
86
  case 'Tab':
80
87
  (0, keyboardTab_1.keyboardTab)(editor, rawEvent);
81
88
  break;
@@ -92,6 +99,8 @@ define(["require", "exports", "./keyboardDelete", "./keyboardInput", "./keyboard
92
99
  }
93
100
  };
94
101
  EditPlugin.prototype.handleBeforeInputEvent = function (editor, rawEvent) {
102
+ var _this = this;
103
+ var _a, _b;
95
104
  // Some Android IMEs doesn't fire correct keydown event for BACKSPACE/DELETE key
96
105
  // Here we translate input event to BACKSPACE/DELETE keydown event to be compatible with existing logic
97
106
  if (!this.shouldHandleNextInputEvent ||
@@ -119,6 +128,15 @@ define(["require", "exports", "./keyboardDelete", "./keyboardInput", "./keyboard
119
128
  }
120
129
  if (handled) {
121
130
  rawEvent.preventDefault();
131
+ // Restore the selection to avoid the cursor jump issue
132
+ // See: https://issues.chromium.org/issues/330596261
133
+ var selection_1 = editor.getDOMSelection();
134
+ var doc = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getDocument();
135
+ (_b = doc === null || doc === void 0 ? void 0 : doc.defaultView) === null || _b === void 0 ? void 0 : _b.requestAnimationFrame(function () {
136
+ if (_this.editor) {
137
+ _this.editor.setDOMSelection(selection_1);
138
+ }
139
+ });
122
140
  }
123
141
  };
124
142
  return EditPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"EditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/EditPlugin.ts"],"names":[],"mappings":";;;;IAUA,IAAM,aAAa,GAAG,CAAC,CAAC;IACxB,IAAM,UAAU,GAAG,EAAE,CAAC;IAEtB;;;;;;OAMG;IACH;QAAA;YACY,WAAM,GAAmB,IAAI,CAAC;YAC9B,aAAQ,GAAwB,IAAI,CAAC;YACrC,+BAA0B,GAAG,KAAK,CAAC;QA0H/C,CAAC;QAxHG;;WAEG;QACH,4BAAO,GAAP;YACI,OAAO,MAAM,CAAC;QAClB,CAAC;QAED;;;;;WAKG;QACH,+BAAU,GAAV,UAAW,MAAe;YAA1B,iBASC;YARG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,MAAM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,SAAS,EAAE;4BACnC,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;yBAC1C;wBACD,MAAM;oBAEV,KAAK,OAAO,CAAC;oBACb;wBACI,IAAA,6BAAa,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;wBAChC,MAAM;iBACb;aACJ;QACL,CAAC;QAEO,2CAAsB,GAA9B,UAA+B,MAAe,EAAE,QAAe;YAC3D,gFAAgF;YAChF,uGAAuG;YACvG,IACI,CAAC,IAAI,CAAC,0BAA0B;gBAChC,CAAC,CAAC,QAAQ,YAAY,UAAU,CAAC;gBACjC,QAAQ,CAAC,gBAAgB,EAC3B;gBACE,OAAO;aACV;YACD,IAAI,CAAC,0BAA0B,GAAG,KAAK,CAAC;YAExC,IAAI,OAAO,GAAG,KAAK,CAAC;YACpB,QAAQ,QAAQ,CAAC,SAAS,EAAE;gBACxB,KAAK,uBAAuB;oBACxB,OAAO,GAAG,IAAA,+BAAc,EACpB,MAAM,EACN,IAAI,aAAa,CAAC,SAAS,EAAE;wBACzB,GAAG,EAAE,WAAW;wBAChB,OAAO,EAAE,aAAa;wBACtB,KAAK,EAAE,aAAa;qBACvB,CAAC,CACL,CAAC;oBACF,MAAM;gBACV,KAAK,sBAAsB;oBACvB,OAAO,GAAG,IAAA,+BAAc,EACpB,MAAM,EACN,IAAI,aAAa,CAAC,SAAS,EAAE;wBACzB,GAAG,EAAE,QAAQ;wBACb,OAAO,EAAE,UAAU;wBACnB,KAAK,EAAE,UAAU;qBACpB,CAAC,CACL,CAAC;oBACF,MAAM;aACb;YAED,IAAI,OAAO,EAAE;gBACT,QAAQ,CAAC,cAAc,EAAE,CAAC;aAC7B;QACL,CAAC;QACL,iBAAC;IAAD,CAAC,AA7HD,IA6HC;IA7HY,gCAAU","sourcesContent":["import { keyboardDelete } from './keyboardDelete';\nimport { keyboardInput } from './keyboardInput';\nimport { keyboardTab } from './keyboardTab';\nimport type {\n EditorPlugin,\n IEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst BACKSPACE_KEY = 8;\nconst DELETE_KEY = 46;\n\n/**\n * Edit plugins helps editor to do editing operation on top of content model.\n * This includes:\n * 1. Delete Key\n * 2. Backspace Key\n * 3. Tab Key\n */\nexport class EditPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private disposer: (() => void) | null = null;\n private shouldHandleNextInputEvent = false;\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'Edit';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n if (editor.getEnvironment().isAndroid) {\n this.disposer = this.editor.attachDomEvent({\n beforeinput: {\n beforeDispatch: e => this.handleBeforeInputEvent(editor, e),\n },\n });\n }\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n this.disposer?.();\n this.disposer = null;\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor) {\n switch (event.eventType) {\n case 'keyDown':\n this.handleKeyDownEvent(this.editor, event);\n break;\n }\n }\n }\n\n private handleKeyDownEvent(editor: IEditor, event: KeyDownEvent) {\n const rawEvent = event.rawEvent;\n\n if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {\n switch (rawEvent.key) {\n case 'Backspace':\n case 'Delete':\n // Use our API to handle BACKSPACE/DELETE key.\n // No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache\n keyboardDelete(editor, rawEvent);\n break;\n\n case 'Tab':\n keyboardTab(editor, rawEvent);\n break;\n case 'Unidentified':\n if (editor.getEnvironment().isAndroid) {\n this.shouldHandleNextInputEvent = true;\n }\n break;\n\n case 'Enter':\n default:\n keyboardInput(editor, rawEvent);\n break;\n }\n }\n }\n\n private handleBeforeInputEvent(editor: IEditor, rawEvent: Event) {\n // Some Android IMEs doesn't fire correct keydown event for BACKSPACE/DELETE key\n // Here we translate input event to BACKSPACE/DELETE keydown event to be compatible with existing logic\n if (\n !this.shouldHandleNextInputEvent ||\n !(rawEvent instanceof InputEvent) ||\n rawEvent.defaultPrevented\n ) {\n return;\n }\n this.shouldHandleNextInputEvent = false;\n\n let handled = false;\n switch (rawEvent.inputType) {\n case 'deleteContentBackward':\n handled = keyboardDelete(\n editor,\n new KeyboardEvent('keydown', {\n key: 'Backspace',\n keyCode: BACKSPACE_KEY,\n which: BACKSPACE_KEY,\n })\n );\n break;\n case 'deleteContentForward':\n handled = keyboardDelete(\n editor,\n new KeyboardEvent('keydown', {\n key: 'Delete',\n keyCode: DELETE_KEY,\n which: DELETE_KEY,\n })\n );\n break;\n }\n\n if (handled) {\n rawEvent.preventDefault();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"EditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/EditPlugin.ts"],"names":[],"mappings":";;;;IAUA,IAAM,aAAa,GAAG,CAAC,CAAC;IACxB,IAAM,UAAU,GAAG,EAAE,CAAC;IAEtB;;;;;;OAMG;IACH;QAAA;YACY,WAAM,GAAmB,IAAI,CAAC;YAC9B,aAAQ,GAAwB,IAAI,CAAC;YACrC,+BAA0B,GAAG,KAAK,CAAC;QA4I/C,CAAC;QA1IG;;WAEG;QACH,4BAAO,GAAP;YACI,OAAO,MAAM,CAAC;QAClB,CAAC;QAED;;;;;WAKG;QACH,+BAAU,GAAV,UAAW,MAAe;YAA1B,iBASC;YARG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC,SAAS,EAAE;gBACnC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,C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GAAG,GAAG,MAAA,IAAI,CAAC,MAAM,0CAAE,WAAW,EAAE,CAAC;gBACvC,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,0CAAE,qBAAqB,CAAC;oBACpC,IAAI,KAAI,CAAC,MAAM,EAAE;wBACb,KAAI,CAAC,MAAM,CAAC,eAAe,CAAC,WAAS,CAAC,CAAC;qBAC1C;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC;QACL,iBAAC;IAAD,CAAC,AA/ID,IA+IC;IA/IY,gCAAU","sourcesContent":["import { keyboardDelete } from './keyboardDelete';\nimport { keyboardInput } from './keyboardInput';\nimport { keyboardTab } from './keyboardTab';\nimport type {\n EditorPlugin,\n IEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst BACKSPACE_KEY = 8;\nconst DELETE_KEY = 46;\n\n/**\n * Edit plugins helps editor to do editing operation on top of content model.\n * This includes:\n * 1. Delete Key\n * 2. Backspace Key\n * 3. Tab Key\n */\nexport class EditPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private disposer: (() => void) | null = null;\n private shouldHandleNextInputEvent = false;\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'Edit';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n if (editor.getEnvironment().isAndroid) {\n this.disposer = this.editor.attachDomEvent({\n beforeinput: {\n beforeDispatch: e => this.handleBeforeInputEvent(editor, e),\n },\n });\n }\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n this.disposer?.();\n this.disposer = null;\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor) {\n switch (event.eventType) {\n case 'keyDown':\n this.handleKeyDownEvent(this.editor, event);\n break;\n }\n }\n }\n\n private handleKeyDownEvent(editor: IEditor, event: KeyDownEvent) {\n const rawEvent = event.rawEvent;\n\n if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {\n switch (rawEvent.key) {\n case 'Backspace':\n // Use our API to handle BACKSPACE/DELETE key.\n // No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache\n keyboardDelete(editor, rawEvent);\n break;\n\n case 'Delete':\n // Use our API to handle BACKSPACE/DELETE key.\n // No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache\n // And leave it to browser when shift key is pressed so that browser will trigger cut event\n if (!event.rawEvent.shiftKey) {\n keyboardDelete(editor, rawEvent);\n }\n break;\n\n case 'Tab':\n keyboardTab(editor, rawEvent);\n break;\n case 'Unidentified':\n if (editor.getEnvironment().isAndroid) {\n this.shouldHandleNextInputEvent = true;\n }\n break;\n\n case 'Enter':\n default:\n keyboardInput(editor, rawEvent);\n break;\n }\n }\n }\n\n private handleBeforeInputEvent(editor: IEditor, rawEvent: Event) {\n // Some Android IMEs doesn't fire correct keydown event for BACKSPACE/DELETE key\n // Here we translate input event to BACKSPACE/DELETE keydown event to be compatible with existing logic\n if (\n !this.shouldHandleNextInputEvent ||\n !(rawEvent instanceof InputEvent) ||\n rawEvent.defaultPrevented\n ) {\n return;\n }\n this.shouldHandleNextInputEvent = false;\n\n let handled = false;\n switch (rawEvent.inputType) {\n case 'deleteContentBackward':\n handled = keyboardDelete(\n editor,\n new KeyboardEvent('keydown', {\n key: 'Backspace',\n keyCode: BACKSPACE_KEY,\n which: BACKSPACE_KEY,\n })\n );\n break;\n case 'deleteContentForward':\n handled = keyboardDelete(\n editor,\n new KeyboardEvent('keydown', {\n key: 'Delete',\n keyCode: DELETE_KEY,\n which: DELETE_KEY,\n })\n );\n break;\n }\n\n if (handled) {\n rawEvent.preventDefault();\n\n // Restore the selection to avoid the cursor jump issue\n // See: https://issues.chromium.org/issues/330596261\n const selection = editor.getDOMSelection();\n const doc = this.editor?.getDocument();\n doc?.defaultView?.requestAnimationFrame(() => {\n if (this.editor) {\n this.editor.setDOMSelection(selection);\n }\n });\n }\n }\n}\n"]}
@@ -6,15 +6,21 @@ define(["require", "exports", "roosterjs-content-model-dom"], function (require,
6
6
  * @internal
7
7
  */
8
8
  var deleteList = function (context) {
9
+ if (context.deleteResult != 'notDeleted') {
10
+ return;
11
+ }
9
12
  var _a = context.insertPoint, paragraph = _a.paragraph, marker = _a.marker, path = _a.path;
10
- if (context.deleteResult == 'nothingToDelete' || context.deleteResult == 'notDeleted') {
11
- var index = (0, roosterjs_content_model_dom_1.getClosestAncestorBlockGroupIndex)(path, ['ListItem', 'TableCell']);
13
+ if (paragraph.segments[0] == marker) {
14
+ var index = (0, roosterjs_content_model_dom_1.getClosestAncestorBlockGroupIndex)(path, ['ListItem'], ['TableCell', 'FormatContainer']);
12
15
  var item = path[index];
13
- if (item &&
14
- index >= 0 &&
15
- paragraph.segments[0] == marker &&
16
- item.blockGroupType == 'ListItem') {
17
- item.levels = [];
16
+ var lastLevel = item === null || item === void 0 ? void 0 : item.levels[item.levels.length - 1];
17
+ if (lastLevel && (item === null || item === void 0 ? void 0 : item.blocks[0]) == paragraph) {
18
+ if (lastLevel.format.displayForDummyItem == 'block') {
19
+ item.levels.pop();
20
+ }
21
+ else {
22
+ lastLevel.format.displayForDummyItem = 'block';
23
+ }
18
24
  context.deleteResult = 'range';
19
25
  }
20
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deleteList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteList.ts"],"names":[],"mappings":";;;;IAGA;;OAEG;IACI,IAAM,UAAU,GAAwB,UAAA,OAAO;QAC5C,IAAA,KAA8B,OAAO,CAAC,WAAW,EAA/C,SAAS,eAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAwB,CAAC;QAExD,IAAI,OAAO,CAAC,YAAY,IAAI,iBAAiB,IAAI,OAAO,CAAC,YAAY,IAAI,YAAY,EAAE;YACnF,IAAM,KAAK,GAAG,IAAA,+DAAiC,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;YACjF,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,IACI,IAAI;gBACJ,KAAK,IAAI,CAAC;gBACV,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM;gBAC/B,IAAI,CAAC,cAAc,IAAI,UAAU,EACnC;gBACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;gBACjB,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;aAClC;SACJ;IACL,CAAC,CAAC;IAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["import { getClosestAncestorBlockGroupIndex } from 'roosterjs-content-model-dom';\nimport type { DeleteSelectionStep } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const deleteList: DeleteSelectionStep = context => {\n const { paragraph, marker, path } = context.insertPoint;\n\n if (context.deleteResult == 'nothingToDelete' || context.deleteResult == 'notDeleted') {\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem', 'TableCell']);\n const item = path[index];\n if (\n item &&\n index >= 0 &&\n paragraph.segments[0] == marker &&\n item.blockGroupType == 'ListItem'\n ) {\n item.levels = [];\n context.deleteResult = 'range';\n }\n }\n};\n"]}
1
+ {"version":3,"file":"deleteList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteList.ts"],"names":[],"mappings":";;;;IAGA;;OAEG;IACI,IAAM,UAAU,GAAwB,UAAA,OAAO;QAClD,IAAI,OAAO,CAAC,YAAY,IAAI,YAAY,EAAE;YACtC,OAAO;SACV;QAEK,IAAA,KAA8B,OAAO,CAAC,WAAW,EAA/C,SAAS,eAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAwB,CAAC;QAExD,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;YACjC,IAAM,KAAK,GAAG,IAAA,+DAAiC,EAC3C,IAAI,EACJ,CAAC,UAAU,CAAC,EACZ,CAAC,WAAW,EAAE,iBAAiB,CAAC,CACnC,CAAC;YACF,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAqC,CAAC;YAC7D,IAAM,SAAS,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAEvD,IAAI,SAAS,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,CAAC,CAAC,KAAI,SAAS,EAAE;gBAC3C,IAAI,SAAS,CAAC,MAAM,CAAC,mBAAmB,IAAI,OAAO,EAAE;oBACjD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;iBACrB;qBAAM;oBACH,SAAS,CAAC,MAAM,CAAC,mBAAmB,GAAG,OAAO,CAAC;iBAClD;gBAED,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;aAClC;SACJ;IACL,CAAC,CAAC;IA1BW,QAAA,UAAU,cA0BrB","sourcesContent":["import { getClosestAncestorBlockGroupIndex } from 'roosterjs-content-model-dom';\nimport type { DeleteSelectionStep, ContentModelListItem } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const deleteList: DeleteSelectionStep = context => {\n if (context.deleteResult != 'notDeleted') {\n return;\n }\n\n const { paragraph, marker, path } = context.insertPoint;\n\n if (paragraph.segments[0] == marker) {\n const index = getClosestAncestorBlockGroupIndex<ContentModelListItem>(\n path,\n ['ListItem'],\n ['TableCell', 'FormatContainer']\n );\n const item = path[index] as ContentModelListItem | undefined;\n const lastLevel = item?.levels[item.levels.length - 1];\n\n if (lastLevel && item?.blocks[0] == paragraph) {\n if (lastLevel.format.displayForDummyItem == 'block') {\n item.levels.pop();\n } else {\n lastLevel.format.displayForDummyItem = 'block';\n }\n\n context.deleteResult = 'range';\n }\n }\n};\n"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
1
+ define(["require", "exports", "tslib", "roosterjs-content-model-api", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_api_1, roosterjs_content_model_dom_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.handleEnterOnList = void 0;
@@ -47,7 +47,12 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function
47
47
  listItem_1.levels.pop();
48
48
  }
49
49
  else {
50
- createNewListItem(context, listItem_1, listParent);
50
+ var newListItem = createNewListItem(context, listItem_1, listParent);
51
+ if (context.formatContext) {
52
+ context.formatContext.announceData = (0, roosterjs_content_model_api_1.getListAnnounceData)((0, tslib_1.__spreadArray)([
53
+ newListItem
54
+ ], (0, tslib_1.__read)(path.slice(index + 1)), false));
55
+ }
51
56
  }
52
57
  }
53
58
  rawEvent === null || rawEvent === void 0 ? void 0 : rawEvent.preventDefault();
@@ -73,10 +78,11 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function
73
78
  insertPoint.paragraph = newParagraph;
74
79
  context.lastParagraph = newParagraph;
75
80
  listParent.blocks.splice(listIndex + 1, 0, newListItem);
81
+ return newListItem;
76
82
  };
77
83
  var createNewListLevel = function (listItem) {
78
84
  return listItem.levels.map(function (level) {
79
- return (0, roosterjs_content_model_dom_1.createListLevel)(level.listType, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, level.format), { startNumberOverride: undefined }), level.dataset);
85
+ return (0, roosterjs_content_model_dom_1.createListLevel)(level.listType, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, level.format), { startNumberOverride: undefined, displayForDummyItem: undefined }), level.dataset);
80
86
  });
81
87
  };
82
88
  var createNewParagraph = function (insertPoint) {
@@ -1 +1 @@
1
- {"version":3,"file":"handleEnterOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/inputSteps/handleEnterOnList.ts"],"names":[],"mappings":";;;;IAoBA;;OAEG;IACI,IAAM,iBAAiB,GAAwB,UAAA,OAAO;QACjD,IAAA,YAAY,GAAK,OAAO,aAAZ,CAAa;QACjC,IACI,YAAY,IAAI,iBAAiB;YACjC,YAAY,IAAI,YAAY;YAC5B,YAAY,IAAI,OAAO,EACzB;YACU,IAAA,WAAW,GAAoB,OAAO,YAA3B,EAAE,aAAa,GAAK,OAAO,cAAZ,CAAa;YACvC,IAAA,IAAI,GAAK,WAAW,KAAhB,CAAiB;YAC7B,IAAM,QAAQ,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,CAAC;YACzC,IAAM,KAAK,GAAG,IAAA,+DAAiC,EAAC,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;YAEnF,IAAM,UAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAEnC,IAAI,UAAQ,IAAI,UAAQ,CAAC,cAAc,KAAK,UAAU,IAAI,UAAU,EAAE;gBAClE,IAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAQ,CAAC,CAAC;gBACtD,IAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBACnD,IAAI,YAAY,IAAI,OAAO,IAAI,SAAS,EAAE;oBACtC,IAAA,mDAAqB,EAAC,UAAU,CAAC,CAAC;oBAClC,IAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;oBACtD,IACI,IAAA,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IACxB,CAAC,CAAC","sourcesContent":["import {\n createBr,\n createListItem,\n createListLevel,\n createParagraph,\n createSelectionMarker,\n normalizeContentModel,\n normalizeParagraph,\n setParagraphNotImplicit,\n getClosestAncestorBlockGroupIndex,\n isBlockGroupOfType,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockGroup,\n ContentModelListItem,\n DeleteSelectionStep,\n InsertPoint,\n ValidDeleteSelectionContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const handleEnterOnList: DeleteSelectionStep = context => {\n const { deleteResult } = context;\n if (\n deleteResult == 'nothingToDelete' ||\n deleteResult == 'notDeleted' ||\n deleteResult == 'range'\n ) {\n const { insertPoint, formatContext } = context;\n const { path } = insertPoint;\n const rawEvent = formatContext?.rawEvent;\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n\n const listItem = path[index];\n const listParent = path[index + 1];\n\n if (listItem && listItem.blockGroupType === 'ListItem' && listParent) {\n const listIndex = listParent.blocks.indexOf(listItem);\n const nextBlock = listParent.blocks[listIndex + 1];\n if (deleteResult == 'range' && nextBlock) {\n normalizeContentModel(listParent);\n const nextListItem = listParent.blocks[listIndex + 1];\n if (\n isBlockGroupOfType<ContentModelListItem>(nextListItem, 'ListItem') &&\n nextListItem.levels[0]\n ) {\n nextListItem.levels.forEach((level, index) => {\n level.format.startNumberOverride = undefined;\n level.dataset = listItem.levels[index]\n ? listItem.levels[index].dataset\n : {};\n });\n const lastParagraph = listItem.blocks[listItem.blocks.length - 1];\n const nextParagraph = nextListItem.blocks[0];\n if (\n nextParagraph.blockType === 'Paragraph' &&\n lastParagraph.blockType === 'Paragraph' &&\n lastParagraph.segments[lastParagraph.segments.length - 1].segmentType ===\n 'SelectionMarker'\n ) {\n lastParagraph.segments.pop();\n\n nextParagraph.segments.unshift(\n createSelectionMarker(insertPoint.marker.format)\n );\n }\n context.lastParagraph = undefined;\n }\n } else if (deleteResult !== 'range') {\n if (isEmptyListItem(listItem)) {\n listItem.levels.pop();\n } else {\n createNewListItem(context, listItem, listParent);\n }\n }\n rawEvent?.preventDefault();\n context.deleteResult = 'range';\n }\n }\n};\n\nconst isEmptyListItem = (listItem: ContentModelListItem) => {\n return (\n listItem.blocks.length === 1 &&\n listItem.blocks[0].blockType === 'Paragraph' &&\n listItem.blocks[0].segments.length === 2 &&\n listItem.blocks[0].segments[0].segmentType === 'SelectionMarker' &&\n listItem.blocks[0].segments[1].segmentType === 'Br'\n );\n};\n\nconst createNewListItem = (\n context: ValidDeleteSelectionContext,\n listItem: ContentModelListItem,\n listParent: ContentModelBlockGroup\n) => {\n const { insertPoint } = context;\n const listIndex = listParent.blocks.indexOf(listItem);\n const newParagraph = createNewParagraph(insertPoint);\n\n const levels = createNewListLevel(listItem);\n const newListItem = createListItem(levels, insertPoint.marker.format);\n newListItem.blocks.push(newParagraph);\n insertPoint.paragraph = newParagraph;\n context.lastParagraph = newParagraph;\n listParent.blocks.splice(listIndex + 1, 0, newListItem);\n};\n\nconst createNewListLevel = (listItem: ContentModelListItem) => {\n return listItem.levels.map(level => {\n return createListLevel(\n level.listType,\n {\n ...level.format,\n startNumberOverride: undefined,\n },\n level.dataset\n );\n });\n};\n\nconst createNewParagraph = (insertPoint: InsertPoint) => {\n const { paragraph, marker } = insertPoint;\n const newParagraph = createParagraph(\n false /*isImplicit*/,\n paragraph.format,\n paragraph.segmentFormat\n );\n\n const markerIndex = paragraph.segments.indexOf(marker);\n const segments = paragraph.segments.splice(\n markerIndex,\n paragraph.segments.length - markerIndex\n );\n\n newParagraph.segments.push(...segments);\n\n setParagraphNotImplicit(paragraph);\n\n if (paragraph.segments.every(x => x.segmentType == 'SelectionMarker')) {\n paragraph.segments.push(createBr(marker.format));\n }\n\n normalizeParagraph(newParagraph);\n\n return newParagraph;\n};\n"]}
1
+ {"version":3,"file":"handleEnterOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/inputSteps/handleEnterOnList.ts"],"names":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C;SACpD;QAED,IAAA,gDAAkB,EAAC,YAAY,CAAC,CAAC;QAEjC,OAAO,YAAY,CAAC;IACxB,CAAC,CAAC","sourcesContent":["import { getListAnnounceData } from 'roosterjs-content-model-api';\nimport {\n createBr,\n createListItem,\n createListLevel,\n createParagraph,\n createSelectionMarker,\n normalizeContentModel,\n normalizeParagraph,\n setParagraphNotImplicit,\n getClosestAncestorBlockGroupIndex,\n isBlockGroupOfType,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockGroup,\n ContentModelListItem,\n DeleteSelectionStep,\n InsertPoint,\n ValidDeleteSelectionContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const handleEnterOnList: DeleteSelectionStep = context => {\n const { deleteResult } = context;\n if (\n deleteResult == 'nothingToDelete' ||\n deleteResult == 'notDeleted' ||\n deleteResult == 'range'\n ) {\n const { insertPoint, formatContext } = context;\n const { path } = insertPoint;\n const rawEvent = formatContext?.rawEvent;\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n\n const listItem = path[index];\n const listParent = path[index + 1];\n\n if (listItem && listItem.blockGroupType === 'ListItem' && listParent) {\n const listIndex = listParent.blocks.indexOf(listItem);\n const nextBlock = listParent.blocks[listIndex + 1];\n\n if (deleteResult == 'range' && nextBlock) {\n normalizeContentModel(listParent);\n\n const nextListItem = listParent.blocks[listIndex + 1];\n\n if (\n isBlockGroupOfType<ContentModelListItem>(nextListItem, 'ListItem') &&\n nextListItem.levels[0]\n ) {\n nextListItem.levels.forEach((level, index) => {\n level.format.startNumberOverride = undefined;\n level.dataset = listItem.levels[index]\n ? listItem.levels[index].dataset\n : {};\n });\n\n const lastParagraph = listItem.blocks[listItem.blocks.length - 1];\n const nextParagraph = nextListItem.blocks[0];\n\n if (\n nextParagraph.blockType === 'Paragraph' &&\n lastParagraph.blockType === 'Paragraph' &&\n lastParagraph.segments[lastParagraph.segments.length - 1].segmentType ===\n 'SelectionMarker'\n ) {\n lastParagraph.segments.pop();\n\n nextParagraph.segments.unshift(\n createSelectionMarker(insertPoint.marker.format)\n );\n }\n\n context.lastParagraph = undefined;\n }\n } else if (deleteResult !== 'range') {\n if (isEmptyListItem(listItem)) {\n listItem.levels.pop();\n } else {\n const newListItem = createNewListItem(context, listItem, listParent);\n\n if (context.formatContext) {\n context.formatContext.announceData = getListAnnounceData([\n newListItem,\n ...path.slice(index + 1),\n ]);\n }\n }\n }\n\n rawEvent?.preventDefault();\n context.deleteResult = 'range';\n }\n }\n};\n\nconst isEmptyListItem = (listItem: ContentModelListItem) => {\n return (\n listItem.blocks.length === 1 &&\n listItem.blocks[0].blockType === 'Paragraph' &&\n listItem.blocks[0].segments.length === 2 &&\n listItem.blocks[0].segments[0].segmentType === 'SelectionMarker' &&\n listItem.blocks[0].segments[1].segmentType === 'Br'\n );\n};\n\nconst createNewListItem = (\n context: ValidDeleteSelectionContext,\n listItem: ContentModelListItem,\n listParent: ContentModelBlockGroup\n) => {\n const { insertPoint } = context;\n const listIndex = listParent.blocks.indexOf(listItem);\n const newParagraph = createNewParagraph(insertPoint);\n\n const levels = createNewListLevel(listItem);\n const newListItem = createListItem(levels, insertPoint.marker.format);\n newListItem.blocks.push(newParagraph);\n insertPoint.paragraph = newParagraph;\n context.lastParagraph = newParagraph;\n listParent.blocks.splice(listIndex + 1, 0, newListItem);\n\n return newListItem;\n};\n\nconst createNewListLevel = (listItem: ContentModelListItem) => {\n return listItem.levels.map(level => {\n return createListLevel(\n level.listType,\n {\n ...level.format,\n startNumberOverride: undefined,\n displayForDummyItem: undefined, // When ENTER, we should create a new regular list item, so force its dummy item display to undefined\n },\n level.dataset\n );\n });\n};\n\nconst createNewParagraph = (insertPoint: InsertPoint) => {\n const { paragraph, marker } = insertPoint;\n const newParagraph = createParagraph(\n false /*isImplicit*/,\n paragraph.format,\n paragraph.segmentFormat\n );\n\n const markerIndex = paragraph.segments.indexOf(marker);\n const segments = paragraph.segments.splice(\n markerIndex,\n paragraph.segments.length - markerIndex\n );\n\n newParagraph.segments.push(...segments);\n\n setParagraphNotImplicit(paragraph);\n\n if (paragraph.segments.every(x => x.segmentType == 'SelectionMarker')) {\n paragraph.segments.push(createBr(marker.format));\n }\n\n normalizeParagraph(newParagraph);\n\n return newParagraph;\n};\n"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "roosterjs-content-model-dom", "./deleteSteps/deleteAllSegmentBefore", "./deleteSteps/deleteEmptyQuote", "./deleteSteps/deleteList", "./handleKeyboardEventCommon", "./deleteSteps/deleteWordSelection", "./deleteSteps/deleteCollapsedSelection"], function (require, exports, roosterjs_content_model_dom_1, deleteAllSegmentBefore_1, deleteEmptyQuote_1, deleteList_1, handleKeyboardEventCommon_1, deleteWordSelection_1, deleteCollapsedSelection_1) {
1
+ define(["require", "exports", "./deleteSteps/deleteAllSegmentBefore", "./deleteSteps/deleteEmptyQuote", "./deleteSteps/deleteList", "roosterjs-content-model-dom", "./handleKeyboardEventCommon", "./deleteSteps/deleteWordSelection", "./deleteSteps/deleteCollapsedSelection"], function (require, exports, deleteAllSegmentBefore_1, deleteEmptyQuote_1, deleteList_1, roosterjs_content_model_dom_1, handleKeyboardEventCommon_1, deleteWordSelection_1, deleteCollapsedSelection_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.keyboardDelete = void 0;
@@ -42,8 +42,8 @@ define(["require", "exports", "roosterjs-content-model-dom", "./deleteSteps/dele
42
42
  return [
43
43
  deleteAllSegmentBeforeStep,
44
44
  deleteWordSelection,
45
+ isForward ? null : deleteList_1.deleteList,
45
46
  deleteCollapsedSelection,
46
- deleteList_1.deleteList,
47
47
  deleteQuote,
48
48
  ];
49
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"keyboardDelete.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardDelete.ts"],"names":[],"mappings":";;;;IAwBA;;;;;;OAMG;IACH,SAAgB,cAAc,CAAC,MAAe,EAAE,Q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GAAG,CAAC,CACxE,CAAC;IACN,CAAC","sourcesContent":["import {\n ChangeSource,\n deleteSelection,\n isModifierKey,\n isNodeOfType,\n} from 'roosterjs-content-model-dom';\nimport { deleteAllSegmentBefore } from './deleteSteps/deleteAllSegmentBefore';\nimport { deleteEmptyQuote } from './deleteSteps/deleteEmptyQuote';\nimport { deleteList } from './deleteSteps/deleteList';\nimport {\n handleKeyboardEventResult,\n shouldDeleteAllSegmentsBefore,\n shouldDeleteWord,\n} from './handleKeyboardEventCommon';\nimport {\n backwardDeleteWordSelection,\n forwardDeleteWordSelection,\n} from './deleteSteps/deleteWordSelection';\nimport {\n backwardDeleteCollapsedSelection,\n forwardDeleteCollapsedSelection,\n} from './deleteSteps/deleteCollapsedSelection';\nimport type { DOMSelection, DeleteSelectionStep, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Do keyboard event handling for DELETE/BACKSPACE key\n * @param editor The editor object\n * @param rawEvent DOM keyboard event\n * @returns True if the event is handled by content model, otherwise false\n */\nexport function keyboardDelete(editor: IEditor, rawEvent: KeyboardEvent) {\n let handled = false;\n const selection = editor.getDOMSelection();\n\n if (shouldDeleteWithContentModel(selection, rawEvent)) {\n editor.formatContentModel(\n (model, context) => {\n const result = deleteSelection(\n model,\n getDeleteSteps(rawEvent, !!editor.getEnvironment().isMac),\n context\n ).deleteResult;\n\n handled = handleKeyboardEventResult(editor, model, rawEvent, result, context);\n return handled;\n },\n {\n rawEvent,\n changeSource: ChangeSource.Keyboard,\n getChangeData: () => rawEvent.which,\n apiName: rawEvent.key == 'Delete' ? 'handleDeleteKey' : 'handleBackspaceKey',\n }\n );\n }\n\n return handled;\n}\n\nfunction getDeleteSteps(rawEvent: KeyboardEvent, isMac: boolean): (DeleteSelectionStep | null)[] {\n const isForward = rawEvent.key == 'Delete';\n const deleteAllSegmentBeforeStep =\n shouldDeleteAllSegmentsBefore(rawEvent) && !isForward ? deleteAllSegmentBefore : null;\n const deleteWordSelection = shouldDeleteWord(rawEvent, isMac)\n ? isForward\n ? forwardDeleteWordSelection\n : backwardDeleteWordSelection\n : null;\n const deleteCollapsedSelection = isForward\n ? forwardDeleteCollapsedSelection\n : backwardDeleteCollapsedSelection;\n const deleteQuote = !isForward ? deleteEmptyQuote : null;\n return [\n deleteAllSegmentBeforeStep,\n deleteWordSelection,\n deleteCollapsedSelection,\n deleteList,\n deleteQuote,\n ];\n}\n\nfunction shouldDeleteWithContentModel(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\n if (!selection) {\n return false; // Nothing to delete\n } else if (selection.type != 'range' || !selection.range.collapsed) {\n return true; // Selection is not collapsed, need to delete all selections\n } else {\n const range = selection.range;\n\n // When selection is collapsed and is in middle of text node, no need to use Content Model to delete\n return !(\n isNodeOfType(range.startContainer, 'TEXT_NODE') &&\n !isModifierKey(rawEvent) &&\n (canDeleteBefore(rawEvent, range) || canDeleteAfter(rawEvent, range))\n );\n }\n}\n\nfunction canDeleteBefore(rawEvent: KeyboardEvent, range: Range) {\n return rawEvent.key == 'Backspace' && range.startOffset > 1;\n}\n\nfunction canDeleteAfter(rawEvent: KeyboardEvent, range: Range) {\n return (\n rawEvent.key == 'Delete' &&\n range.startOffset < (range.startContainer.nodeValue?.length ?? 0) - 1\n );\n}\n"]}
1
+ {"version":3,"file":"keyboardDelete.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardDelete.ts"],"names":[],"mappings":";;;;IAwBA;;;;;;OAMG;IACH,SAAgB,cAAc,CAAC,MAAe,EAAE,QAAuB;QACnE,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QAE3C,IAAI,4BAA4B,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;YACnD,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;gBACX,IAAM,MAAM,GAAG,IAAA,6CAAe,EAC1B,KAAK,EACL,cAAc,CAAC,QAAQ,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AAC,CAAC,CAAC,uBAAU;YAC7B,wBAAwB;YACxB,WAAW;SACd,CAAC;IACN,CAAC;IAED,SAAS,4BAA4B,CAAC,SAA8B,EAAE,QAAuB;QACzF,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO,KAAK,CAAC,CAAC,oBAAoB;SACrC;aAAM,IAAI,SAAS,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;YAChE,OAAO,IAAI,CAAC,CAAC,4DAA4D;SAC5E;aAAM;YACH,IAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;YAE9B,oGAAoG;YACpG,OAAO,CAAC,CACJ,IAAA,0CAAY,EAAC,KAAK,CAAC,cAAc,EAAE,WAAW,CAAC;gBAC/C,CAAC,IAAA,2CAAa,EAAC,QAAQ,CAAC;gBACxB,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CACxE,CAAC;SACL;IACL,CAAC;IAED,SAAS,eAAe,CAAC,QAAuB,EAAE,KAAY;QAC1D,OAAO,QAAQ,CAAC,GAAG,IAAI,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,SAAS,cAAc,CAAC,QAAuB,EAAE,KAAY;;QACzD,OAAO,CACH,QAAQ,CAAC,GAAG,IAAI,QAAQ;YACxB,KAAK,CAAC,WAAW,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,cAAc,CAAC,SAAS,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,CAAC,CACxE,CAAC;IACN,CAAC","sourcesContent":["import { deleteAllSegmentBefore } from './deleteSteps/deleteAllSegmentBefore';\nimport { deleteEmptyQuote } from './deleteSteps/deleteEmptyQuote';\nimport { deleteList } from './deleteSteps/deleteList';\nimport {\n ChangeSource,\n deleteSelection,\n isModifierKey,\n isNodeOfType,\n} from 'roosterjs-content-model-dom';\nimport {\n handleKeyboardEventResult,\n shouldDeleteAllSegmentsBefore,\n shouldDeleteWord,\n} from './handleKeyboardEventCommon';\nimport {\n backwardDeleteWordSelection,\n forwardDeleteWordSelection,\n} from './deleteSteps/deleteWordSelection';\nimport {\n backwardDeleteCollapsedSelection,\n forwardDeleteCollapsedSelection,\n} from './deleteSteps/deleteCollapsedSelection';\nimport type { DOMSelection, DeleteSelectionStep, IEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Do keyboard event handling for DELETE/BACKSPACE key\n * @param editor The editor object\n * @param rawEvent DOM keyboard event\n * @returns True if the event is handled by content model, otherwise false\n */\nexport function keyboardDelete(editor: IEditor, rawEvent: KeyboardEvent) {\n let handled = false;\n const selection = editor.getDOMSelection();\n\n if (shouldDeleteWithContentModel(selection, rawEvent)) {\n editor.formatContentModel(\n (model, context) => {\n const result = deleteSelection(\n model,\n getDeleteSteps(rawEvent, !!editor.getEnvironment().isMac),\n context\n ).deleteResult;\n\n handled = handleKeyboardEventResult(editor, model, rawEvent, result, context);\n return handled;\n },\n {\n rawEvent,\n changeSource: ChangeSource.Keyboard,\n getChangeData: () => rawEvent.which,\n apiName: rawEvent.key == 'Delete' ? 'handleDeleteKey' : 'handleBackspaceKey',\n }\n );\n }\n\n return handled;\n}\n\nfunction getDeleteSteps(rawEvent: KeyboardEvent, isMac: boolean): (DeleteSelectionStep | null)[] {\n const isForward = rawEvent.key == 'Delete';\n const deleteAllSegmentBeforeStep =\n shouldDeleteAllSegmentsBefore(rawEvent) && !isForward ? deleteAllSegmentBefore : null;\n const deleteWordSelection = shouldDeleteWord(rawEvent, isMac)\n ? isForward\n ? forwardDeleteWordSelection\n : backwardDeleteWordSelection\n : null;\n const deleteCollapsedSelection = isForward\n ? forwardDeleteCollapsedSelection\n : backwardDeleteCollapsedSelection;\n const deleteQuote = !isForward ? deleteEmptyQuote : null;\n return [\n deleteAllSegmentBeforeStep,\n deleteWordSelection,\n isForward ? null : deleteList,\n deleteCollapsedSelection,\n deleteQuote,\n ];\n}\n\nfunction shouldDeleteWithContentModel(selection: DOMSelection | null, rawEvent: KeyboardEvent) {\n if (!selection) {\n return false; // Nothing to delete\n } else if (selection.type != 'range' || !selection.range.collapsed) {\n return true; // Selection is not collapsed, need to delete all selections\n } else {\n const range = selection.range;\n\n // When selection is collapsed and is in middle of text node, no need to use Content Model to delete\n return !(\n isNodeOfType(range.startContainer, 'TEXT_NODE') &&\n !isModifierKey(rawEvent) &&\n (canDeleteBefore(rawEvent, range) || canDeleteAfter(rawEvent, range))\n );\n }\n}\n\nfunction canDeleteBefore(rawEvent: KeyboardEvent, range: Range) {\n return rawEvent.key == 'Backspace' && range.startOffset > 1;\n}\n\nfunction canDeleteAfter(rawEvent: KeyboardEvent, range: Range) {\n return (\n rawEvent.key == 'Delete' &&\n range.startOffset < (range.startContainer.nodeValue?.length ?? 0) - 1\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "roosterjs-content-model-dom", "./tabUtils/handleTabOnList", "./tabUtils/handleTabOnParagraph", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_dom_1, handleTabOnList_1, handleTabOnParagraph_1, roosterjs_content_model_api_1) {
1
+ define(["require", "exports", "roosterjs-content-model-dom", "./tabUtils/handleTabOnList", "./tabUtils/handleTabOnParagraph", "./tabUtils/handleTabOnTable", "./tabUtils/handleTabOnTableCell", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_dom_1, handleTabOnList_1, handleTabOnParagraph_1, handleTabOnTable_1, handleTabOnTableCell_1, roosterjs_content_model_api_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.keyboardTab = void 0;
@@ -7,33 +7,47 @@ define(["require", "exports", "roosterjs-content-model-dom", "./tabUtils/handleT
7
7
  */
8
8
  function keyboardTab(editor, rawEvent) {
9
9
  var selection = editor.getDOMSelection();
10
- if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'range') {
11
- editor.formatContentModel(function (model) {
12
- return handleTab(model, rawEvent);
13
- }, {
14
- apiName: 'handleTabKey',
15
- });
16
- return true;
10
+ switch (selection === null || selection === void 0 ? void 0 : selection.type) {
11
+ case 'range':
12
+ editor.formatContentModel(function (model, context) {
13
+ return handleTab(model, rawEvent, context);
14
+ }, {
15
+ apiName: 'handleTabKey',
16
+ });
17
+ return true;
18
+ case 'table':
19
+ editor.formatContentModel(function (model) {
20
+ return (0, handleTabOnTable_1.handleTabOnTable)(model, rawEvent);
21
+ }, {
22
+ apiName: 'handleTabKey',
23
+ });
24
+ return true;
17
25
  }
18
26
  }
19
27
  exports.keyboardTab = keyboardTab;
20
28
  /**
21
29
  * If multiple blocks are selected, indent or outdent the selected blocks with setModelIndentation.
22
- * If only one block is selected, call handleTabOnParagraph or handleTabOnList to handle the tab key.
30
+ * If only one block is selected:
31
+ * - If it is a table cell, call handleTabOnTableCell to handle the tab key.
32
+ * - If it is a paragraph, call handleTabOnParagraph to handle the tab key.
33
+ * - If it is a list item, call handleTabOnList to handle the tab key.
23
34
  */
24
- function handleTab(model, rawEvent) {
25
- var blocks = (0, roosterjs_content_model_dom_1.getOperationalBlocks)(model, ['ListItem'], ['TableCell']);
35
+ function handleTab(model, rawEvent, context) {
36
+ var blocks = (0, roosterjs_content_model_dom_1.getOperationalBlocks)(model, ['ListItem', 'TableCell'], []);
26
37
  var block = blocks.length > 0 ? blocks[0].block : undefined;
27
38
  if (blocks.length > 1) {
28
39
  (0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent');
29
40
  rawEvent.preventDefault();
30
41
  return true;
31
42
  }
43
+ else if ((0, roosterjs_content_model_dom_1.isBlockGroupOfType)(block, 'TableCell')) {
44
+ return (0, handleTabOnTableCell_1.handleTabOnTableCell)(model, block, rawEvent);
45
+ }
32
46
  else if ((block === null || block === void 0 ? void 0 : block.blockType) === 'Paragraph') {
33
- return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, block, rawEvent);
47
+ return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, block, rawEvent, context);
34
48
  }
35
49
  else if ((0, roosterjs_content_model_dom_1.isBlockGroupOfType)(block, 'ListItem')) {
36
- return (0, handleTabOnList_1.handleTabOnList)(model, block, rawEvent);
50
+ return (0, handleTabOnList_1.handleTabOnList)(model, block, rawEvent, context);
37
51
  }
38
52
  return false;
39
53
  }