roosterjs-content-model-plugins 0.24.0 → 0.26.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 (469) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +53 -0
  2. package/lib/autoFormat/AutoFormatPlugin.js +81 -0
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -0
  4. package/lib/autoFormat/keyboardListTrigger.d.ts +5 -0
  5. package/lib/autoFormat/keyboardListTrigger.js +46 -0
  6. package/lib/autoFormat/keyboardListTrigger.js.map +1 -0
  7. package/lib/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
  8. package/lib/autoFormat/utils/convertAlphaToDecimals.js +23 -0
  9. package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
  10. package/lib/autoFormat/utils/getIndex.d.ts +4 -0
  11. package/lib/autoFormat/utils/getIndex.js +14 -0
  12. package/lib/autoFormat/utils/getIndex.js.map +1 -0
  13. package/lib/autoFormat/utils/getListTypeStyle.d.ts +14 -0
  14. package/lib/autoFormat/utils/getListTypeStyle.js +88 -0
  15. package/lib/autoFormat/utils/getListTypeStyle.js.map +1 -0
  16. package/lib/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
  17. package/lib/autoFormat/utils/getNumberingListStyle.js +154 -0
  18. package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -0
  19. package/{lib-mjs/edit/ContentModelEditPlugin.d.ts → lib/edit/EditPlugin.d.ts} +39 -35
  20. package/lib/edit/EditPlugin.js +129 -0
  21. package/lib/edit/EditPlugin.js.map +1 -0
  22. package/lib/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  23. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js +22 -22
  24. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  25. package/lib/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  26. package/lib/edit/deleteSteps/deleteCollapsedSelection.js +93 -93
  27. package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  28. package/lib/edit/deleteSteps/deleteList.d.ts +5 -5
  29. package/lib/edit/deleteSteps/deleteList.js +23 -23
  30. package/lib/edit/deleteSteps/deleteList.js.map +1 -1
  31. package/lib/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  32. package/lib/edit/deleteSteps/deleteWordSelection.js +173 -173
  33. package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  34. package/lib/edit/handleKeyboardEventCommon.d.ts +14 -14
  35. package/lib/edit/handleKeyboardEventCommon.js +54 -54
  36. package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
  37. package/lib/edit/inputSteps/handleEnterOnList.d.ts +5 -0
  38. package/lib/edit/inputSteps/handleEnterOnList.js +68 -0
  39. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -0
  40. package/lib/edit/keyboardDelete.d.ts +9 -8
  41. package/lib/edit/keyboardDelete.js +71 -74
  42. package/lib/edit/keyboardDelete.js.map +1 -1
  43. package/lib/edit/keyboardInput.d.ts +5 -5
  44. package/lib/edit/keyboardInput.js +58 -50
  45. package/lib/edit/keyboardInput.js.map +1 -1
  46. package/lib/edit/keyboardTab.d.ts +5 -0
  47. package/lib/edit/keyboardTab.js +35 -0
  48. package/lib/edit/keyboardTab.js.map +1 -0
  49. package/lib/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  50. package/lib/edit/utils/getLeafSiblingBlock.js +75 -75
  51. package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
  52. package/lib/index.d.ts +3 -3
  53. package/lib/index.js +9 -9
  54. package/lib/index.js.map +1 -1
  55. package/lib/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
  56. package/lib/paste/Excel/processPastedContentFromExcel.js +82 -82
  57. package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  58. package/{lib-mjs/paste/ContentModelPastePlugin.d.ts → lib/paste/PastePlugin.d.ts} +43 -43
  59. package/lib/paste/{ContentModelPastePlugin.js → PastePlugin.js} +131 -132
  60. package/lib/paste/PastePlugin.js.map +1 -0
  61. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  62. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js +19 -19
  63. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  64. package/lib/paste/WacComponents/constants.d.ts +48 -48
  65. package/lib/paste/WacComponents/constants.js +62 -62
  66. package/lib/paste/WacComponents/constants.js.map +1 -1
  67. package/lib/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  68. package/lib/paste/WacComponents/processPastedContentWacComponents.js +188 -188
  69. package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  70. package/lib/paste/WordDesktop/WordMetadata.d.ts +9 -9
  71. package/lib/paste/WordDesktop/WordMetadata.js +2 -2
  72. package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
  73. package/lib/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
  74. package/lib/paste/WordDesktop/getStyleMetadata.js +78 -78
  75. package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  76. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
  77. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +58 -58
  78. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  79. package/lib/paste/WordDesktop/processWordComments.d.ts +7 -7
  80. package/lib/paste/WordDesktop/processWordComments.js +21 -21
  81. package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
  82. package/lib/paste/WordDesktop/processWordLists.d.ts +11 -11
  83. package/lib/paste/WordDesktop/processWordLists.js +179 -179
  84. package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
  85. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
  86. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js +13 -13
  87. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  88. package/lib/paste/pasteSourceValidations/constants.d.ts +17 -17
  89. package/lib/paste/pasteSourceValidations/constants.js +20 -20
  90. package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
  91. package/lib/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  92. package/lib/paste/pasteSourceValidations/documentContainWacElements.js +15 -15
  93. package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  94. package/lib/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  95. package/lib/paste/pasteSourceValidations/getPasteSource.js +43 -43
  96. package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  97. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  98. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js +17 -17
  99. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  100. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  101. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js +19 -19
  102. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  103. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  104. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js +15 -15
  105. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  106. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  107. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +15 -15
  108. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  109. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  110. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js +19 -19
  111. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  112. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  113. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js +18 -18
  114. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  115. package/lib/paste/utils/addParser.d.ts +5 -5
  116. package/lib/paste/utils/addParser.js +16 -16
  117. package/lib/paste/utils/addParser.js.map +1 -1
  118. package/lib/paste/utils/deprecatedColorParser.d.ts +5 -5
  119. package/lib/paste/utils/deprecatedColorParser.js +19 -19
  120. package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
  121. package/lib/paste/utils/getStyles.d.ts +6 -6
  122. package/lib/paste/utils/getStyles.js +22 -22
  123. package/lib/paste/utils/getStyles.js.map +1 -1
  124. package/lib/paste/utils/linkParser.d.ts +5 -5
  125. package/lib/paste/utils/linkParser.js +27 -27
  126. package/lib/paste/utils/linkParser.js.map +1 -1
  127. package/lib/paste/utils/setProcessor.d.ts +5 -5
  128. package/lib/paste/utils/setProcessor.js +13 -13
  129. package/lib/paste/utils/setProcessor.js.map +1 -1
  130. package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +35 -0
  131. package/lib/pluginUtils/CreateElement/CreateElementData.js +3 -0
  132. package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
  133. package/lib/pluginUtils/CreateElement/createElement.d.ts +9 -0
  134. package/lib/pluginUtils/CreateElement/createElement.js +51 -0
  135. package/lib/pluginUtils/CreateElement/createElement.js.map +1 -0
  136. package/lib/pluginUtils/Disposable.d.ts +10 -0
  137. package/lib/pluginUtils/Disposable.js +3 -0
  138. package/lib/pluginUtils/Disposable.js.map +1 -0
  139. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
  140. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js +3 -0
  141. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
  142. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
  143. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +120 -0
  144. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
  145. package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
  146. package/lib/pluginUtils/Rect/getIntersectedRect.js +45 -0
  147. package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
  148. package/lib/pluginUtils/Rect/normalizeRect.d.ts +7 -0
  149. package/lib/pluginUtils/Rect/normalizeRect.js +20 -0
  150. package/lib/pluginUtils/Rect/normalizeRect.js.map +1 -0
  151. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +53 -0
  152. package/lib-amd/autoFormat/AutoFormatPlugin.js +82 -0
  153. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -0
  154. package/lib-amd/autoFormat/keyboardListTrigger.d.ts +5 -0
  155. package/lib-amd/autoFormat/keyboardListTrigger.js +44 -0
  156. package/lib-amd/autoFormat/keyboardListTrigger.js.map +1 -0
  157. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
  158. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js +25 -0
  159. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
  160. package/lib-amd/autoFormat/utils/getIndex.d.ts +4 -0
  161. package/lib-amd/autoFormat/utils/getIndex.js +15 -0
  162. package/lib-amd/autoFormat/utils/getIndex.js.map +1 -0
  163. package/lib-amd/autoFormat/utils/getListTypeStyle.d.ts +14 -0
  164. package/lib-amd/autoFormat/utils/getListTypeStyle.js +87 -0
  165. package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +1 -0
  166. package/lib-amd/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
  167. package/lib-amd/autoFormat/utils/getNumberingListStyle.js +154 -0
  168. package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -0
  169. package/lib-amd/edit/{ContentModelEditPlugin.d.ts → EditPlugin.d.ts} +39 -35
  170. package/lib-amd/edit/EditPlugin.js +128 -0
  171. package/lib-amd/edit/EditPlugin.js.map +1 -0
  172. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  173. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js +23 -23
  174. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  175. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  176. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +92 -92
  177. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  178. package/lib-amd/edit/deleteSteps/deleteList.d.ts +5 -5
  179. package/lib-amd/edit/deleteSteps/deleteList.js +24 -24
  180. package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
  181. package/lib-amd/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  182. package/lib-amd/edit/deleteSteps/deleteWordSelection.js +172 -172
  183. package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  184. package/lib-amd/edit/handleKeyboardEventCommon.d.ts +14 -14
  185. package/lib-amd/edit/handleKeyboardEventCommon.js +55 -55
  186. package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
  187. package/lib-amd/edit/inputSteps/handleEnterOnList.d.ts +5 -0
  188. package/lib-amd/edit/inputSteps/handleEnterOnList.js +67 -0
  189. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -0
  190. package/lib-amd/edit/keyboardDelete.d.ts +9 -8
  191. package/lib-amd/edit/keyboardDelete.js +66 -69
  192. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  193. package/lib-amd/edit/keyboardInput.d.ts +5 -5
  194. package/lib-amd/edit/keyboardInput.js +57 -50
  195. package/lib-amd/edit/keyboardInput.js.map +1 -1
  196. package/lib-amd/edit/keyboardTab.d.ts +5 -0
  197. package/lib-amd/edit/keyboardTab.js +35 -0
  198. package/lib-amd/edit/keyboardTab.js.map +1 -0
  199. package/lib-amd/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  200. package/lib-amd/edit/utils/getLeafSiblingBlock.js +75 -75
  201. package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
  202. package/lib-amd/index.d.ts +3 -3
  203. package/lib-amd/index.js +8 -8
  204. package/lib-amd/index.js.map +1 -1
  205. package/lib-amd/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
  206. package/lib-amd/paste/Excel/processPastedContentFromExcel.js +80 -80
  207. package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  208. package/{lib/paste/ContentModelPastePlugin.d.ts → lib-amd/paste/PastePlugin.d.ts} +43 -43
  209. package/lib-amd/paste/{ContentModelPastePlugin.js → PastePlugin.js} +123 -124
  210. package/lib-amd/paste/PastePlugin.js.map +1 -0
  211. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  212. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js +20 -20
  213. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  214. package/lib-amd/paste/WacComponents/constants.d.ts +48 -48
  215. package/lib-amd/paste/WacComponents/constants.js +63 -63
  216. package/lib-amd/paste/WacComponents/constants.js.map +1 -1
  217. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  218. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +185 -185
  219. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  220. package/lib-amd/paste/WordDesktop/WordMetadata.d.ts +9 -9
  221. package/lib-amd/paste/WordDesktop/WordMetadata.js +4 -4
  222. package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
  223. package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
  224. package/lib-amd/paste/WordDesktop/getStyleMetadata.js +78 -78
  225. package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  226. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
  227. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +53 -53
  228. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  229. package/lib-amd/paste/WordDesktop/processWordComments.d.ts +7 -7
  230. package/lib-amd/paste/WordDesktop/processWordComments.js +22 -22
  231. package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
  232. package/lib-amd/paste/WordDesktop/processWordLists.d.ts +11 -11
  233. package/lib-amd/paste/WordDesktop/processWordLists.js +177 -177
  234. package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
  235. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
  236. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js +15 -15
  237. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  238. package/lib-amd/paste/pasteSourceValidations/constants.d.ts +17 -17
  239. package/lib-amd/paste/pasteSourceValidations/constants.js +22 -22
  240. package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
  241. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  242. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js +16 -16
  243. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  244. package/lib-amd/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  245. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js +38 -38
  246. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  247. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  248. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js +18 -18
  249. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  250. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  251. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js +20 -20
  252. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  253. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  254. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js +16 -16
  255. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  256. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  257. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +16 -16
  258. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  259. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  260. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js +20 -20
  261. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  262. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  263. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js +20 -20
  264. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  265. package/lib-amd/paste/utils/addParser.d.ts +5 -5
  266. package/lib-amd/paste/utils/addParser.js +18 -18
  267. package/lib-amd/paste/utils/addParser.js.map +1 -1
  268. package/lib-amd/paste/utils/deprecatedColorParser.d.ts +5 -5
  269. package/lib-amd/paste/utils/deprecatedColorParser.js +20 -20
  270. package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
  271. package/lib-amd/paste/utils/getStyles.d.ts +6 -6
  272. package/lib-amd/paste/utils/getStyles.js +24 -24
  273. package/lib-amd/paste/utils/getStyles.js.map +1 -1
  274. package/lib-amd/paste/utils/linkParser.d.ts +5 -5
  275. package/lib-amd/paste/utils/linkParser.js +28 -28
  276. package/lib-amd/paste/utils/linkParser.js.map +1 -1
  277. package/lib-amd/paste/utils/setProcessor.d.ts +5 -5
  278. package/lib-amd/paste/utils/setProcessor.js +15 -15
  279. package/lib-amd/paste/utils/setProcessor.js.map +1 -1
  280. package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +35 -0
  281. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js +5 -0
  282. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
  283. package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +9 -0
  284. package/lib-amd/pluginUtils/CreateElement/createElement.js +52 -0
  285. package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -0
  286. package/lib-amd/pluginUtils/Disposable.d.ts +10 -0
  287. package/lib-amd/pluginUtils/Disposable.js +5 -0
  288. package/lib-amd/pluginUtils/Disposable.js.map +1 -0
  289. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
  290. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js +5 -0
  291. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
  292. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
  293. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +121 -0
  294. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
  295. package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
  296. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +45 -0
  297. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
  298. package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +7 -0
  299. package/lib-amd/pluginUtils/Rect/normalizeRect.js +22 -0
  300. package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +1 -0
  301. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +53 -0
  302. package/lib-mjs/autoFormat/AutoFormatPlugin.js +78 -0
  303. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -0
  304. package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +5 -0
  305. package/lib-mjs/autoFormat/keyboardListTrigger.js +42 -0
  306. package/lib-mjs/autoFormat/keyboardListTrigger.js.map +1 -0
  307. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
  308. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js +19 -0
  309. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
  310. package/lib-mjs/autoFormat/utils/getIndex.d.ts +4 -0
  311. package/lib-mjs/autoFormat/utils/getIndex.js +10 -0
  312. package/lib-mjs/autoFormat/utils/getIndex.js.map +1 -0
  313. package/lib-mjs/autoFormat/utils/getListTypeStyle.d.ts +14 -0
  314. package/lib-mjs/autoFormat/utils/getListTypeStyle.js +84 -0
  315. package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +1 -0
  316. package/lib-mjs/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
  317. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js +150 -0
  318. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -0
  319. package/{lib/edit/ContentModelEditPlugin.d.ts → lib-mjs/edit/EditPlugin.d.ts} +39 -35
  320. package/lib-mjs/edit/EditPlugin.js +126 -0
  321. package/lib-mjs/edit/EditPlugin.js.map +1 -0
  322. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  323. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js +18 -18
  324. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  325. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  326. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +90 -90
  327. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  328. package/lib-mjs/edit/deleteSteps/deleteList.d.ts +5 -5
  329. package/lib-mjs/edit/deleteSteps/deleteList.js +19 -19
  330. package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
  331. package/lib-mjs/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  332. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js +170 -170
  333. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  334. package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +14 -14
  335. package/lib-mjs/edit/handleKeyboardEventCommon.js +48 -48
  336. package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
  337. package/lib-mjs/edit/inputSteps/handleEnterOnList.d.ts +5 -0
  338. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +64 -0
  339. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -0
  340. package/lib-mjs/edit/keyboardDelete.d.ts +9 -8
  341. package/lib-mjs/edit/keyboardDelete.js +67 -70
  342. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  343. package/lib-mjs/edit/keyboardInput.d.ts +5 -5
  344. package/lib-mjs/edit/keyboardInput.js +54 -46
  345. package/lib-mjs/edit/keyboardInput.js.map +1 -1
  346. package/lib-mjs/edit/keyboardTab.d.ts +5 -0
  347. package/lib-mjs/edit/keyboardTab.js +31 -0
  348. package/lib-mjs/edit/keyboardTab.js.map +1 -0
  349. package/lib-mjs/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  350. package/lib-mjs/edit/utils/getLeafSiblingBlock.js +71 -71
  351. package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
  352. package/lib-mjs/index.d.ts +3 -3
  353. package/lib-mjs/index.js +3 -3
  354. package/lib-mjs/index.js.map +1 -1
  355. package/lib-mjs/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
  356. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +77 -77
  357. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  358. package/{lib-amd/paste/ContentModelPastePlugin.d.ts → lib-mjs/paste/PastePlugin.d.ts} +43 -43
  359. package/lib-mjs/paste/{ContentModelPastePlugin.js → PastePlugin.js} +128 -129
  360. package/lib-mjs/paste/PastePlugin.js.map +1 -0
  361. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  362. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js +15 -15
  363. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  364. package/lib-mjs/paste/WacComponents/constants.d.ts +48 -48
  365. package/lib-mjs/paste/WacComponents/constants.js +59 -59
  366. package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
  367. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  368. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +184 -184
  369. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  370. package/lib-mjs/paste/WordDesktop/WordMetadata.d.ts +9 -9
  371. package/lib-mjs/paste/WordDesktop/WordMetadata.js +1 -1
  372. package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
  373. package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
  374. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +75 -75
  375. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  376. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
  377. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +54 -54
  378. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  379. package/lib-mjs/paste/WordDesktop/processWordComments.d.ts +7 -7
  380. package/lib-mjs/paste/WordDesktop/processWordComments.js +17 -17
  381. package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
  382. package/lib-mjs/paste/WordDesktop/processWordLists.d.ts +11 -11
  383. package/lib-mjs/paste/WordDesktop/processWordLists.js +175 -175
  384. package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
  385. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
  386. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js +9 -9
  387. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  388. package/lib-mjs/paste/pasteSourceValidations/constants.d.ts +17 -17
  389. package/lib-mjs/paste/pasteSourceValidations/constants.js +17 -17
  390. package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
  391. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  392. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js +11 -11
  393. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  394. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  395. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js +39 -39
  396. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  397. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  398. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js +13 -13
  399. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  400. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  401. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js +15 -15
  402. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  403. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  404. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js +11 -11
  405. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  406. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  407. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +11 -11
  408. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  409. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  410. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js +15 -15
  411. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  412. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  413. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js +14 -14
  414. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  415. package/lib-mjs/paste/utils/addParser.d.ts +5 -5
  416. package/lib-mjs/paste/utils/addParser.js +13 -13
  417. package/lib-mjs/paste/utils/addParser.js.map +1 -1
  418. package/lib-mjs/paste/utils/deprecatedColorParser.d.ts +5 -5
  419. package/lib-mjs/paste/utils/deprecatedColorParser.js +15 -15
  420. package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
  421. package/lib-mjs/paste/utils/getStyles.d.ts +6 -6
  422. package/lib-mjs/paste/utils/getStyles.js +18 -18
  423. package/lib-mjs/paste/utils/getStyles.js.map +1 -1
  424. package/lib-mjs/paste/utils/linkParser.d.ts +5 -5
  425. package/lib-mjs/paste/utils/linkParser.js +23 -23
  426. package/lib-mjs/paste/utils/linkParser.js.map +1 -1
  427. package/lib-mjs/paste/utils/setProcessor.d.ts +5 -5
  428. package/lib-mjs/paste/utils/setProcessor.js +9 -9
  429. package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
  430. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +35 -0
  431. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js +2 -0
  432. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
  433. package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +9 -0
  434. package/lib-mjs/pluginUtils/CreateElement/createElement.js +48 -0
  435. package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -0
  436. package/lib-mjs/pluginUtils/Disposable.d.ts +10 -0
  437. package/lib-mjs/pluginUtils/Disposable.js +2 -0
  438. package/lib-mjs/pluginUtils/Disposable.js.map +1 -0
  439. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
  440. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js +2 -0
  441. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
  442. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
  443. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +118 -0
  444. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
  445. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
  446. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +42 -0
  447. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
  448. package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +7 -0
  449. package/lib-mjs/pluginUtils/Rect/normalizeRect.js +17 -0
  450. package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +1 -0
  451. package/package.json +5 -7
  452. package/lib/edit/ContentModelEditPlugin.js +0 -75
  453. package/lib/edit/ContentModelEditPlugin.js.map +0 -1
  454. package/lib/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
  455. package/lib/entityDelimiter/EntityDelimiterPlugin.js +0 -257
  456. package/lib/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
  457. package/lib/paste/ContentModelPastePlugin.js.map +0 -1
  458. package/lib-amd/edit/ContentModelEditPlugin.js +0 -75
  459. package/lib-amd/edit/ContentModelEditPlugin.js.map +0 -1
  460. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
  461. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js +0 -256
  462. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
  463. package/lib-amd/paste/ContentModelPastePlugin.js.map +0 -1
  464. package/lib-mjs/edit/ContentModelEditPlugin.js +0 -72
  465. package/lib-mjs/edit/ContentModelEditPlugin.js.map +0 -1
  466. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
  467. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js +0 -253
  468. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
  469. package/lib-mjs/paste/ContentModelPastePlugin.js.map +0 -1
@@ -1,35 +1,39 @@
1
- import type { EditorPlugin, IStandaloneEditor, PluginEvent } from 'roosterjs-content-model-types';
2
- /**
3
- * ContentModel edit plugins helps editor to do editing operation on top of content model.
4
- * This includes:
5
- * 1. Delete Key
6
- * 2. Backspace Key
7
- */
8
- export declare class ContentModelEditPlugin implements EditorPlugin {
9
- private editor;
10
- /**
11
- * Get name of this plugin
12
- */
13
- getName(): string;
14
- /**
15
- * The first method that editor will call to a plugin when editor is initializing.
16
- * It will pass in the editor instance, plugin should take this chance to save the
17
- * editor reference so that it can call to any editor method or format API later.
18
- * @param editor The editor object
19
- */
20
- initialize(editor: IStandaloneEditor): void;
21
- /**
22
- * The last method that editor will call to a plugin before it is disposed.
23
- * Plugin can take this chance to clear the reference to editor. After this method is
24
- * called, plugin should not call to any editor method since it will result in error.
25
- */
26
- dispose(): void;
27
- /**
28
- * Core method for a plugin. Once an event happens in editor, editor will call this
29
- * method of each plugin to handle the event as long as the event is not handled
30
- * exclusively by another plugin.
31
- * @param event The event to handle:
32
- */
33
- onPluginEvent(event: PluginEvent): void;
34
- private handleKeyDownEvent;
35
- }
1
+ import type { EditorPlugin, IStandaloneEditor, PluginEvent } from 'roosterjs-content-model-types';
2
+ /**
3
+ * ContentModel edit plugins helps editor to do editing operation on top of content model.
4
+ * This includes:
5
+ * 1. Delete Key
6
+ * 2. Backspace Key
7
+ * 3. Tab Key
8
+ */
9
+ export declare class EditPlugin implements EditorPlugin {
10
+ private editor;
11
+ private disposer;
12
+ private shouldHandleNextInputEvent;
13
+ /**
14
+ * Get name of this plugin
15
+ */
16
+ getName(): string;
17
+ /**
18
+ * The first method that editor will call to a plugin when editor is initializing.
19
+ * It will pass in the editor instance, plugin should take this chance to save the
20
+ * editor reference so that it can call to any editor method or format API later.
21
+ * @param editor The editor object
22
+ */
23
+ initialize(editor: IStandaloneEditor): void;
24
+ /**
25
+ * The last method that editor will call to a plugin before it is disposed.
26
+ * Plugin can take this chance to clear the reference to editor. After this method is
27
+ * called, plugin should not call to any editor method since it will result in error.
28
+ */
29
+ dispose(): void;
30
+ /**
31
+ * Core method for a plugin. Once an event happens in editor, editor will call this
32
+ * method of each plugin to handle the event as long as the event is not handled
33
+ * exclusively by another plugin.
34
+ * @param event The event to handle:
35
+ */
36
+ onPluginEvent(event: PluginEvent): void;
37
+ private handleKeyDownEvent;
38
+ private handleBeforeInputEvent;
39
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EditPlugin = void 0;
4
+ var keyboardDelete_1 = require("./keyboardDelete");
5
+ var keyboardInput_1 = require("./keyboardInput");
6
+ var keyboardTab_1 = require("./keyboardTab");
7
+ var BACKSPACE_KEY = 8;
8
+ var DELETE_KEY = 46;
9
+ /**
10
+ * ContentModel edit plugins helps editor to do editing operation on top of content model.
11
+ * This includes:
12
+ * 1. Delete Key
13
+ * 2. Backspace Key
14
+ * 3. Tab Key
15
+ */
16
+ var EditPlugin = /** @class */ (function () {
17
+ function EditPlugin() {
18
+ this.editor = null;
19
+ this.disposer = null;
20
+ this.shouldHandleNextInputEvent = false;
21
+ }
22
+ /**
23
+ * Get name of this plugin
24
+ */
25
+ EditPlugin.prototype.getName = function () {
26
+ return 'Edit';
27
+ };
28
+ /**
29
+ * The first method that editor will call to a plugin when editor is initializing.
30
+ * It will pass in the editor instance, plugin should take this chance to save the
31
+ * editor reference so that it can call to any editor method or format API later.
32
+ * @param editor The editor object
33
+ */
34
+ EditPlugin.prototype.initialize = function (editor) {
35
+ var _this = this;
36
+ this.editor = editor;
37
+ if (editor.getEnvironment().isAndroid) {
38
+ this.disposer = this.editor.attachDomEvent({
39
+ beforeinput: {
40
+ beforeDispatch: function (e) { return _this.handleBeforeInputEvent(editor, e); },
41
+ },
42
+ });
43
+ }
44
+ };
45
+ /**
46
+ * The last method that editor will call to a plugin before it is disposed.
47
+ * Plugin can take this chance to clear the reference to editor. After this method is
48
+ * called, plugin should not call to any editor method since it will result in error.
49
+ */
50
+ EditPlugin.prototype.dispose = function () {
51
+ var _a;
52
+ this.editor = null;
53
+ (_a = this.disposer) === null || _a === void 0 ? void 0 : _a.call(this);
54
+ this.disposer = null;
55
+ };
56
+ /**
57
+ * Core method for a plugin. Once an event happens in editor, editor will call this
58
+ * method of each plugin to handle the event as long as the event is not handled
59
+ * exclusively by another plugin.
60
+ * @param event The event to handle:
61
+ */
62
+ EditPlugin.prototype.onPluginEvent = function (event) {
63
+ if (this.editor) {
64
+ switch (event.eventType) {
65
+ case 'keyDown':
66
+ this.handleKeyDownEvent(this.editor, event);
67
+ break;
68
+ }
69
+ }
70
+ };
71
+ EditPlugin.prototype.handleKeyDownEvent = function (editor, event) {
72
+ var rawEvent = event.rawEvent;
73
+ if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {
74
+ switch (rawEvent.key) {
75
+ case 'Backspace':
76
+ case 'Delete':
77
+ // Use our API to handle BACKSPACE/DELETE key.
78
+ // 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
79
+ (0, keyboardDelete_1.keyboardDelete)(editor, rawEvent);
80
+ break;
81
+ case 'Tab':
82
+ (0, keyboardTab_1.keyboardTab)(editor, rawEvent);
83
+ break;
84
+ case 'Unidentified':
85
+ if (editor.getEnvironment().isAndroid) {
86
+ this.shouldHandleNextInputEvent = true;
87
+ }
88
+ break;
89
+ case 'Enter':
90
+ default:
91
+ (0, keyboardInput_1.keyboardInput)(editor, rawEvent);
92
+ break;
93
+ }
94
+ }
95
+ };
96
+ EditPlugin.prototype.handleBeforeInputEvent = function (editor, rawEvent) {
97
+ // Some Android IMEs doesn't fire correct keydown event for BACKSPACE/DELETE key
98
+ // Here we translate input event to BACKSPACE/DELETE keydown event to be compatible with existing logic
99
+ if (!this.shouldHandleNextInputEvent ||
100
+ !(rawEvent instanceof InputEvent) ||
101
+ rawEvent.defaultPrevented) {
102
+ return;
103
+ }
104
+ this.shouldHandleNextInputEvent = false;
105
+ var handled = false;
106
+ switch (rawEvent.inputType) {
107
+ case 'deleteContentBackward':
108
+ handled = (0, keyboardDelete_1.keyboardDelete)(editor, new KeyboardEvent('keydown', {
109
+ key: 'Backspace',
110
+ keyCode: BACKSPACE_KEY,
111
+ which: BACKSPACE_KEY,
112
+ }));
113
+ break;
114
+ case 'deleteContentForward':
115
+ handled = (0, keyboardDelete_1.keyboardDelete)(editor, new KeyboardEvent('keydown', {
116
+ key: 'Delete',
117
+ keyCode: DELETE_KEY,
118
+ which: DELETE_KEY,
119
+ }));
120
+ break;
121
+ }
122
+ if (handled) {
123
+ rawEvent.preventDefault();
124
+ }
125
+ };
126
+ return EditPlugin;
127
+ }());
128
+ exports.EditPlugin = EditPlugin;
129
+ //# sourceMappingURL=EditPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditPlugin.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/EditPlugin.ts"],"names":[],"mappings":"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","sourcesContent":["import { keyboardDelete } from './keyboardDelete';\r\nimport { keyboardInput } from './keyboardInput';\r\nimport { keyboardTab } from './keyboardTab';\r\nimport type {\r\n EditorPlugin,\r\n IStandaloneEditor,\r\n KeyDownEvent,\r\n PluginEvent,\r\n} from 'roosterjs-content-model-types';\r\n\r\nconst BACKSPACE_KEY = 8;\r\nconst DELETE_KEY = 46;\r\n\r\n/**\r\n * ContentModel edit plugins helps editor to do editing operation on top of content model.\r\n * This includes:\r\n * 1. Delete Key\r\n * 2. Backspace Key\r\n * 3. Tab Key\r\n */\r\nexport class EditPlugin implements EditorPlugin {\r\n private editor: IStandaloneEditor | null = null;\r\n private disposer: (() => void) | null = null;\r\n private shouldHandleNextInputEvent = false;\r\n\r\n /**\r\n * Get name of this plugin\r\n */\r\n getName() {\r\n return 'Edit';\r\n }\r\n\r\n /**\r\n * The first method that editor will call to a plugin when editor is initializing.\r\n * It will pass in the editor instance, plugin should take this chance to save the\r\n * editor reference so that it can call to any editor method or format API later.\r\n * @param editor The editor object\r\n */\r\n initialize(editor: IStandaloneEditor) {\r\n this.editor = editor;\r\n if (editor.getEnvironment().isAndroid) {\r\n this.disposer = this.editor.attachDomEvent({\r\n beforeinput: {\r\n beforeDispatch: e => this.handleBeforeInputEvent(editor, e),\r\n },\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * The last method that editor will call to a plugin before it is disposed.\r\n * Plugin can take this chance to clear the reference to editor. After this method is\r\n * called, plugin should not call to any editor method since it will result in error.\r\n */\r\n dispose() {\r\n this.editor = null;\r\n this.disposer?.();\r\n this.disposer = null;\r\n }\r\n\r\n /**\r\n * Core method for a plugin. Once an event happens in editor, editor will call this\r\n * method of each plugin to handle the event as long as the event is not handled\r\n * exclusively by another plugin.\r\n * @param event The event to handle:\r\n */\r\n onPluginEvent(event: PluginEvent) {\r\n if (this.editor) {\r\n switch (event.eventType) {\r\n case 'keyDown':\r\n this.handleKeyDownEvent(this.editor, event);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n private handleKeyDownEvent(editor: IStandaloneEditor, event: KeyDownEvent) {\r\n const rawEvent = event.rawEvent;\r\n\r\n if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {\r\n switch (rawEvent.key) {\r\n case 'Backspace':\r\n case 'Delete':\r\n // Use our API to handle BACKSPACE/DELETE key.\r\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\r\n keyboardDelete(editor, rawEvent);\r\n break;\r\n\r\n case 'Tab':\r\n keyboardTab(editor, rawEvent);\r\n break;\r\n case 'Unidentified':\r\n if (editor.getEnvironment().isAndroid) {\r\n this.shouldHandleNextInputEvent = true;\r\n }\r\n break;\r\n\r\n case 'Enter':\r\n default:\r\n keyboardInput(editor, rawEvent);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n private handleBeforeInputEvent(editor: IStandaloneEditor, rawEvent: Event) {\r\n // Some Android IMEs doesn't fire correct keydown event for BACKSPACE/DELETE key\r\n // Here we translate input event to BACKSPACE/DELETE keydown event to be compatible with existing logic\r\n if (\r\n !this.shouldHandleNextInputEvent ||\r\n !(rawEvent instanceof InputEvent) ||\r\n rawEvent.defaultPrevented\r\n ) {\r\n return;\r\n }\r\n this.shouldHandleNextInputEvent = false;\r\n\r\n let handled = false;\r\n switch (rawEvent.inputType) {\r\n case 'deleteContentBackward':\r\n handled = keyboardDelete(\r\n editor,\r\n new KeyboardEvent('keydown', {\r\n key: 'Backspace',\r\n keyCode: BACKSPACE_KEY,\r\n which: BACKSPACE_KEY,\r\n })\r\n );\r\n break;\r\n case 'deleteContentForward':\r\n handled = keyboardDelete(\r\n editor,\r\n new KeyboardEvent('keydown', {\r\n key: 'Delete',\r\n keyCode: DELETE_KEY,\r\n which: DELETE_KEY,\r\n })\r\n );\r\n break;\r\n }\r\n\r\n if (handled) {\r\n rawEvent.preventDefault();\r\n }\r\n }\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
- import type { DeleteSelectionStep } from 'roosterjs-content-model-types';
2
- /**
3
- * @internal
4
- */
5
- export declare const deleteAllSegmentBefore: DeleteSelectionStep;
1
+ import type { DeleteSelectionStep } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare const deleteAllSegmentBefore: DeleteSelectionStep;
@@ -1,23 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAllSegmentBefore = void 0;
4
- var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
- /**
6
- * @internal
7
- */
8
- var deleteAllSegmentBefore = function (context) {
9
- if (context.deleteResult != 'notDeleted') {
10
- return;
11
- }
12
- var _a = context.insertPoint, paragraph = _a.paragraph, marker = _a.marker;
13
- var index = paragraph.segments.indexOf(marker);
14
- for (var i = index - 1; i >= 0; i--) {
15
- var segment = paragraph.segments[i];
16
- segment.isSelected = true;
17
- if ((0, roosterjs_content_model_core_1.deleteSegment)(paragraph, segment, context.formatContext)) {
18
- context.deleteResult = 'range';
19
- }
20
- }
21
- };
22
- exports.deleteAllSegmentBefore = deleteAllSegmentBefore;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteAllSegmentBefore = void 0;
4
+ var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
+ /**
6
+ * @internal
7
+ */
8
+ var deleteAllSegmentBefore = function (context) {
9
+ if (context.deleteResult != 'notDeleted') {
10
+ return;
11
+ }
12
+ var _a = context.insertPoint, paragraph = _a.paragraph, marker = _a.marker;
13
+ var index = paragraph.segments.indexOf(marker);
14
+ for (var i = index - 1; i >= 0; i--) {
15
+ var segment = paragraph.segments[i];
16
+ segment.isSelected = true;
17
+ if ((0, roosterjs_content_model_core_1.deleteSegment)(paragraph, segment, context.formatContext)) {
18
+ context.deleteResult = 'range';
19
+ }
20
+ }
21
+ };
22
+ exports.deleteAllSegmentBefore = deleteAllSegmentBefore;
23
23
  //# sourceMappingURL=deleteAllSegmentBefore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deleteAllSegmentBefore.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteAllSegmentBefore.ts"],"names":[],"mappings":";;;AAAA,6EAA6D;AAG7D;;GAEG;AACI,IAAM,sBAAsB,GAAwB,UAAA,OAAO;IAC9D,IAAI,OAAO,CAAC,YAAY,IAAI,YAAY,EAAE;QACtC,OAAO;KACV;IAEK,IAAA,KAAwB,OAAO,CAAC,WAAW,EAAzC,SAAS,eAAA,EAAE,MAAM,YAAwB,CAAC;IAClD,IAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjD,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACjC,IAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEtC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;QAE1B,IAAI,IAAA,4CAAa,EAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE;YAC1D,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;SAClC;KACJ;AACL,CAAC,CAAC;AAjBW,QAAA,sBAAsB,0BAiBjC","sourcesContent":["import { deleteSegment } from 'roosterjs-content-model-core';\nimport type { DeleteSelectionStep } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const deleteAllSegmentBefore: DeleteSelectionStep = context => {\n if (context.deleteResult != 'notDeleted') {\n return;\n }\n\n const { paragraph, marker } = context.insertPoint;\n const index = paragraph.segments.indexOf(marker);\n\n for (let i = index - 1; i >= 0; i--) {\n const segment = paragraph.segments[i];\n\n segment.isSelected = true;\n\n if (deleteSegment(paragraph, segment, context.formatContext)) {\n context.deleteResult = 'range';\n }\n }\n};\n"]}
1
+ {"version":3,"file":"deleteAllSegmentBefore.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteAllSegmentBefore.ts"],"names":[],"mappings":";;;AAAA,6EAA6D;AAG7D;;GAEG;AACI,IAAM,sBAAsB,GAAwB,UAAA,OAAO;IAC9D,IAAI,OAAO,CAAC,YAAY,IAAI,YAAY,EAAE;QACtC,OAAO;KACV;IAEK,IAAA,KAAwB,OAAO,CAAC,WAAW,EAAzC,SAAS,eAAA,EAAE,MAAM,YAAwB,CAAC;IAClD,IAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjD,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACjC,IAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEtC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;QAE1B,IAAI,IAAA,4CAAa,EAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE;YAC1D,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;SAClC;KACJ;AACL,CAAC,CAAC;AAjBW,QAAA,sBAAsB,0BAiBjC","sourcesContent":["import { deleteSegment } from 'roosterjs-content-model-core';\r\nimport type { DeleteSelectionStep } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const deleteAllSegmentBefore: DeleteSelectionStep = context => {\r\n if (context.deleteResult != 'notDeleted') {\r\n return;\r\n }\r\n\r\n const { paragraph, marker } = context.insertPoint;\r\n const index = paragraph.segments.indexOf(marker);\r\n\r\n for (let i = index - 1; i >= 0; i--) {\r\n const segment = paragraph.segments[i];\r\n\r\n segment.isSelected = true;\r\n\r\n if (deleteSegment(paragraph, segment, context.formatContext)) {\r\n context.deleteResult = 'range';\r\n }\r\n }\r\n};\r\n"]}
@@ -1,9 +1,9 @@
1
- import type { DeleteSelectionStep } from 'roosterjs-content-model-types';
2
- /**
3
- * @internal if we didn't delete anything, and we want to delete forward, now perform it
4
- */
5
- export declare const forwardDeleteCollapsedSelection: DeleteSelectionStep;
6
- /**
7
- * @internal if we didn't delete anything, and we want to delete backward, now perform it
8
- */
9
- export declare const backwardDeleteCollapsedSelection: DeleteSelectionStep;
1
+ import type { DeleteSelectionStep } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal if we didn't delete anything, and we want to delete forward, now perform it
4
+ */
5
+ export declare const forwardDeleteCollapsedSelection: DeleteSelectionStep;
6
+ /**
7
+ * @internal if we didn't delete anything, and we want to delete backward, now perform it
8
+ */
9
+ export declare const backwardDeleteCollapsedSelection: DeleteSelectionStep;
@@ -1,94 +1,94 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.backwardDeleteCollapsedSelection = exports.forwardDeleteCollapsedSelection = void 0;
4
- var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
- var getLeafSiblingBlock_1 = require("../utils/getLeafSiblingBlock");
6
- var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
7
- function getDeleteCollapsedSelection(direction) {
8
- return function (context) {
9
- var _a;
10
- if (context.deleteResult != 'notDeleted') {
11
- return;
12
- }
13
- var isForward = direction == 'forward';
14
- var _b = context.insertPoint, paragraph = _b.paragraph, marker = _b.marker, path = _b.path, tableContext = _b.tableContext;
15
- var segments = paragraph.segments;
16
- fixupBr(segments);
17
- var index = segments.indexOf(marker) + (isForward ? 1 : -1);
18
- var segmentToDelete = segments[index];
19
- var blockToDelete;
20
- if (segmentToDelete) {
21
- if ((0, roosterjs_content_model_core_1.deleteSegment)(paragraph, segmentToDelete, context.formatContext, direction)) {
22
- context.deleteResult = 'singleChar';
23
- // It is possible that we have deleted everything from this paragraph, so we need to mark it as not implicit
24
- // to avoid losing its format. See https://github.com/microsoft/roosterjs/issues/1953
25
- (0, roosterjs_content_model_dom_1.setParagraphNotImplicit)(paragraph);
26
- }
27
- }
28
- else if ((blockToDelete = (0, getLeafSiblingBlock_1.getLeafSiblingBlock)(path, paragraph, isForward))) {
29
- var block = blockToDelete.block, path_1 = blockToDelete.path, siblingSegment = blockToDelete.siblingSegment;
30
- if (block.blockType == 'Paragraph') {
31
- if (siblingSegment) {
32
- // When selection is under general segment, need to check if it has a sibling sibling, and delete from it
33
- if ((0, roosterjs_content_model_core_1.deleteSegment)(block, siblingSegment, context.formatContext, direction)) {
34
- context.deleteResult = 'range';
35
- }
36
- }
37
- else {
38
- if (isForward) {
39
- context.lastParagraph = block;
40
- }
41
- else {
42
- if (((_a = block.segments[block.segments.length - 1]) === null || _a === void 0 ? void 0 : _a.segmentType) == 'Br') {
43
- block.segments.pop();
44
- }
45
- context.insertPoint = {
46
- marker: marker,
47
- paragraph: block,
48
- path: path_1,
49
- tableContext: tableContext,
50
- };
51
- context.lastParagraph = paragraph;
52
- delete block.cachedElement;
53
- }
54
- context.deleteResult = 'range';
55
- }
56
- // When go across table, getLeafSiblingBlock will return null, when we are here, we must be in the same table context
57
- context.lastTableContext = tableContext;
58
- }
59
- else {
60
- if ((0, roosterjs_content_model_core_1.deleteBlock)(path_1[0].blocks, block, undefined /*replacement*/, context.formatContext, direction)) {
61
- context.deleteResult = 'range';
62
- }
63
- }
64
- }
65
- else {
66
- // We have nothing to delete, in this case we don't want browser handle it as well.
67
- // Because when Backspace on an empty document, it will also delete the only DIV and SPAN element, causes
68
- // editor is really empty. We don't want that happen. So the handling should stop here.
69
- context.deleteResult = 'nothingToDelete';
70
- }
71
- };
72
- }
73
- /**
74
- * If the last segment is BR, remove it for now. We may add it back later when normalize model.
75
- * So that if this is an empty paragraph, it will start to delete next block
76
- */
77
- function fixupBr(segments) {
78
- var _a, _b;
79
- if (((_a = segments[segments.length - 1]) === null || _a === void 0 ? void 0 : _a.segmentType) == 'Br') {
80
- var segmentsWithoutBr = segments.filter(function (x) { return x.segmentType != 'SelectionMarker'; });
81
- if (((_b = segmentsWithoutBr[segmentsWithoutBr.length - 2]) === null || _b === void 0 ? void 0 : _b.segmentType) != 'Br') {
82
- segments.pop();
83
- }
84
- }
85
- }
86
- /**
87
- * @internal if we didn't delete anything, and we want to delete forward, now perform it
88
- */
89
- exports.forwardDeleteCollapsedSelection = getDeleteCollapsedSelection('forward');
90
- /**
91
- * @internal if we didn't delete anything, and we want to delete backward, now perform it
92
- */
93
- exports.backwardDeleteCollapsedSelection = getDeleteCollapsedSelection('backward');
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.backwardDeleteCollapsedSelection = exports.forwardDeleteCollapsedSelection = void 0;
4
+ var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
+ var getLeafSiblingBlock_1 = require("../utils/getLeafSiblingBlock");
6
+ var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
7
+ function getDeleteCollapsedSelection(direction) {
8
+ return function (context) {
9
+ var _a;
10
+ if (context.deleteResult != 'notDeleted') {
11
+ return;
12
+ }
13
+ var isForward = direction == 'forward';
14
+ var _b = context.insertPoint, paragraph = _b.paragraph, marker = _b.marker, path = _b.path, tableContext = _b.tableContext;
15
+ var segments = paragraph.segments;
16
+ fixupBr(segments);
17
+ var index = segments.indexOf(marker) + (isForward ? 1 : -1);
18
+ var segmentToDelete = segments[index];
19
+ var blockToDelete;
20
+ if (segmentToDelete) {
21
+ if ((0, roosterjs_content_model_core_1.deleteSegment)(paragraph, segmentToDelete, context.formatContext, direction)) {
22
+ context.deleteResult = 'singleChar';
23
+ // It is possible that we have deleted everything from this paragraph, so we need to mark it as not implicit
24
+ // to avoid losing its format. See https://github.com/microsoft/roosterjs/issues/1953
25
+ (0, roosterjs_content_model_dom_1.setParagraphNotImplicit)(paragraph);
26
+ }
27
+ }
28
+ else if ((blockToDelete = (0, getLeafSiblingBlock_1.getLeafSiblingBlock)(path, paragraph, isForward))) {
29
+ var block = blockToDelete.block, path_1 = blockToDelete.path, siblingSegment = blockToDelete.siblingSegment;
30
+ if (block.blockType == 'Paragraph') {
31
+ if (siblingSegment) {
32
+ // When selection is under general segment, need to check if it has a sibling sibling, and delete from it
33
+ if ((0, roosterjs_content_model_core_1.deleteSegment)(block, siblingSegment, context.formatContext, direction)) {
34
+ context.deleteResult = 'range';
35
+ }
36
+ }
37
+ else {
38
+ if (isForward) {
39
+ context.lastParagraph = block;
40
+ }
41
+ else {
42
+ if (((_a = block.segments[block.segments.length - 1]) === null || _a === void 0 ? void 0 : _a.segmentType) == 'Br') {
43
+ block.segments.pop();
44
+ }
45
+ context.insertPoint = {
46
+ marker: marker,
47
+ paragraph: block,
48
+ path: path_1,
49
+ tableContext: tableContext,
50
+ };
51
+ context.lastParagraph = paragraph;
52
+ delete block.cachedElement;
53
+ }
54
+ context.deleteResult = 'range';
55
+ }
56
+ // When go across table, getLeafSiblingBlock will return null, when we are here, we must be in the same table context
57
+ context.lastTableContext = tableContext;
58
+ }
59
+ else {
60
+ if ((0, roosterjs_content_model_core_1.deleteBlock)(path_1[0].blocks, block, undefined /*replacement*/, context.formatContext, direction)) {
61
+ context.deleteResult = 'range';
62
+ }
63
+ }
64
+ }
65
+ else {
66
+ // We have nothing to delete, in this case we don't want browser handle it as well.
67
+ // Because when Backspace on an empty document, it will also delete the only DIV and SPAN element, causes
68
+ // editor is really empty. We don't want that happen. So the handling should stop here.
69
+ context.deleteResult = 'nothingToDelete';
70
+ }
71
+ };
72
+ }
73
+ /**
74
+ * If the last segment is BR, remove it for now. We may add it back later when normalize model.
75
+ * So that if this is an empty paragraph, it will start to delete next block
76
+ */
77
+ function fixupBr(segments) {
78
+ var _a, _b;
79
+ if (((_a = segments[segments.length - 1]) === null || _a === void 0 ? void 0 : _a.segmentType) == 'Br') {
80
+ var segmentsWithoutBr = segments.filter(function (x) { return x.segmentType != 'SelectionMarker'; });
81
+ if (((_b = segmentsWithoutBr[segmentsWithoutBr.length - 2]) === null || _b === void 0 ? void 0 : _b.segmentType) != 'Br') {
82
+ segments.pop();
83
+ }
84
+ }
85
+ }
86
+ /**
87
+ * @internal if we didn't delete anything, and we want to delete forward, now perform it
88
+ */
89
+ exports.forwardDeleteCollapsedSelection = getDeleteCollapsedSelection('forward');
90
+ /**
91
+ * @internal if we didn't delete anything, and we want to delete backward, now perform it
92
+ */
93
+ exports.backwardDeleteCollapsedSelection = getDeleteCollapsedSelection('backward');
94
94
  //# sourceMappingURL=deleteCollapsedSelection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deleteCollapsedSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteCollapsedSelection.ts"],"names":[],"mappings":"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","sourcesContent":["import { deleteBlock, deleteSegment } from 'roosterjs-content-model-core';\nimport { getLeafSiblingBlock } from '../utils/getLeafSiblingBlock';\nimport { setParagraphNotImplicit } from 'roosterjs-content-model-dom';\nimport type { BlockAndPath } from '../utils/getLeafSiblingBlock';\nimport type { ContentModelSegment, DeleteSelectionStep } from 'roosterjs-content-model-types';\n\nfunction getDeleteCollapsedSelection(direction: 'forward' | 'backward'): DeleteSelectionStep {\n return context => {\n if (context.deleteResult != 'notDeleted') {\n return;\n }\n\n const isForward = direction == 'forward';\n const { paragraph, marker, path, tableContext } = context.insertPoint;\n const segments = paragraph.segments;\n\n fixupBr(segments);\n\n const index = segments.indexOf(marker) + (isForward ? 1 : -1);\n const segmentToDelete = segments[index];\n let blockToDelete: BlockAndPath | null;\n\n if (segmentToDelete) {\n if (deleteSegment(paragraph, segmentToDelete, context.formatContext, direction)) {\n context.deleteResult = 'singleChar';\n\n // It is possible that we have deleted everything from this paragraph, so we need to mark it as not implicit\n // to avoid losing its format. See https://github.com/microsoft/roosterjs/issues/1953\n setParagraphNotImplicit(paragraph);\n }\n } else if ((blockToDelete = getLeafSiblingBlock(path, paragraph, isForward))) {\n const { block, path, siblingSegment } = blockToDelete;\n\n if (block.blockType == 'Paragraph') {\n if (siblingSegment) {\n // When selection is under general segment, need to check if it has a sibling sibling, and delete from it\n if (deleteSegment(block, siblingSegment, context.formatContext, direction)) {\n context.deleteResult = 'range';\n }\n } else {\n if (isForward) {\n context.lastParagraph = block;\n } else {\n if (block.segments[block.segments.length - 1]?.segmentType == 'Br') {\n block.segments.pop();\n }\n\n context.insertPoint = {\n marker,\n paragraph: block,\n path,\n tableContext,\n };\n context.lastParagraph = paragraph;\n delete block.cachedElement;\n }\n\n context.deleteResult = 'range';\n }\n\n // When go across table, getLeafSiblingBlock will return null, when we are here, we must be in the same table context\n context.lastTableContext = tableContext;\n } else {\n if (\n deleteBlock(\n path[0].blocks,\n block,\n undefined /*replacement*/,\n context.formatContext,\n direction\n )\n ) {\n context.deleteResult = 'range';\n }\n }\n } else {\n // We have nothing to delete, in this case we don't want browser handle it as well.\n // Because when Backspace on an empty document, it will also delete the only DIV and SPAN element, causes\n // editor is really empty. We don't want that happen. So the handling should stop here.\n context.deleteResult = 'nothingToDelete';\n }\n };\n}\n\n/**\n * If the last segment is BR, remove it for now. We may add it back later when normalize model.\n * So that if this is an empty paragraph, it will start to delete next block\n */\nfunction fixupBr(segments: ContentModelSegment[]) {\n if (segments[segments.length - 1]?.segmentType == 'Br') {\n const segmentsWithoutBr = segments.filter(x => x.segmentType != 'SelectionMarker');\n\n if (segmentsWithoutBr[segmentsWithoutBr.length - 2]?.segmentType != 'Br') {\n segments.pop();\n }\n }\n}\n\n/**\n * @internal if we didn't delete anything, and we want to delete forward, now perform it\n */\nexport const forwardDeleteCollapsedSelection = getDeleteCollapsedSelection('forward');\n\n/**\n * @internal if we didn't delete anything, and we want to delete backward, now perform it\n */\nexport const backwardDeleteCollapsedSelection = getDeleteCollapsedSelection('backward');\n"]}
1
+ {"version":3,"file":"deleteCollapsedSelection.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteCollapsedSelection.ts"],"names":[],"mappings":";;;AAAA,6EAA0E;AAC1E,oEAAmE;AACnE,2EAAsE;AAItE,SAAS,2BAA2B,CAAC,SAAiC;IAClE,OAAO,UAAA,OAAO;;QACV,IAAI,OAAO,CAAC,YAAY,IAAI,YAAY,EAAE;YACtC,OAAO;SACV;QAED,IAAM,SAAS,GAAG,SAAS,IAAI,SAAS,CAAC;QACnC,IAAA,KAA4C,OAAO,CAAC,WAAW,EAA7D,SAAS,eAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAA,EAAE,YAAY,kBAAwB,CAAC;QACtE,IAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QAEpC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAElB,IAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,IAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,aAAkC,CAAC;QAEvC,IAAI,eAAe,EAAE;YACjB,IAAI,IAAA,4CAAa,EAAC,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE;gBAC7E,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;gBAEpC,4GAA4G;gBAC5G,qFAAqF;gBACrF,IAAA,qDAAuB,EAAC,SAAS,CAAC,CAAC;aACtC;SACJ;aAAM,IAAI,CAAC,aAAa,GAAG,IAAA,yCAAmB,EAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE;YAClE,IAAA,KAAK,GAA2B,aAAa,MAAxC,EAAE,MAAI,GAAqB,aAAa,KAAlC,EAAE,cAAc,GAAK,aAAa,eAAlB,CAAmB;YAEtD,IAAI,KAAK,CAAC,SAAS,IAAI,WAAW,EAAE;gBAChC,IAAI,cAAc,EAAE;oBAChB,yGAAyG;oBACzG,IAAI,IAAA,4CAAa,EAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE;wBACxE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;qBAClC;iBACJ;qBAAM;oBACH,IAAI,SAAS,EAAE;wBACX,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;qBACjC;yBAAM;wBACH,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,WAAW,KAAI,IAAI,EAAE;4BAChE,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;yBACxB;wBAED,OAAO,CAAC,WAAW,GAAG;4BAClB,MAAM,QAAA;4BACN,SAAS,EAAE,KAAK;4BAChB,IAAI,QAAA;4BACJ,YAAY,cAAA;yBACf,CAAC;wBACF,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;wBAClC,OAAO,KAAK,CAAC,aAAa,CAAC;qBAC9B;oBAED,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;iBAClC;gBAED,qHAAqH;gBACrH,OAAO,CAAC,gBAAgB,GAAG,YAAY,CAAC;aAC3C;iBAAM;gBACH,IACI,IAAA,0CAAW,EACP,MAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EACd,KAAK,EACL,SAAS,CAAC,eAAe,EACzB,OAAO,CAAC,aAAa,EACrB,SAAS,CACZ,EACH;oBACE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;iBAClC;aACJ;SACJ;aAAM;YACH,mFAAmF;YACnF,yGAAyG;YACzG,uFAAuF;YACvF,OAAO,CAAC,YAAY,GAAG,iBAAiB,CAAC;SAC5C;IACL,CAAC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAS,OAAO,CAAC,QAA+B;;IAC5C,IAAI,CAAA,MAAA,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,WAAW,KAAI,IAAI,EAAE;QACpD,IAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,WAAW,IAAI,iBAAiB,EAAlC,CAAkC,CAAC,CAAC;QAEnF,IAAI,CAAA,MAAA,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,WAAW,KAAI,IAAI,EAAE;YACtE,QAAQ,CAAC,GAAG,EAAE,CAAC;SAClB;KACJ;AACL,CAAC;AAED;;GAEG;AACU,QAAA,+BAA+B,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;AAEtF;;GAEG;AACU,QAAA,gCAAgC,GAAG,2BAA2B,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import { deleteBlock, deleteSegment } from 'roosterjs-content-model-core';\r\nimport { getLeafSiblingBlock } from '../utils/getLeafSiblingBlock';\r\nimport { setParagraphNotImplicit } from 'roosterjs-content-model-dom';\r\nimport type { BlockAndPath } from '../utils/getLeafSiblingBlock';\r\nimport type { ContentModelSegment, DeleteSelectionStep } from 'roosterjs-content-model-types';\r\n\r\nfunction getDeleteCollapsedSelection(direction: 'forward' | 'backward'): DeleteSelectionStep {\r\n return context => {\r\n if (context.deleteResult != 'notDeleted') {\r\n return;\r\n }\r\n\r\n const isForward = direction == 'forward';\r\n const { paragraph, marker, path, tableContext } = context.insertPoint;\r\n const segments = paragraph.segments;\r\n\r\n fixupBr(segments);\r\n\r\n const index = segments.indexOf(marker) + (isForward ? 1 : -1);\r\n const segmentToDelete = segments[index];\r\n let blockToDelete: BlockAndPath | null;\r\n\r\n if (segmentToDelete) {\r\n if (deleteSegment(paragraph, segmentToDelete, context.formatContext, direction)) {\r\n context.deleteResult = 'singleChar';\r\n\r\n // It is possible that we have deleted everything from this paragraph, so we need to mark it as not implicit\r\n // to avoid losing its format. See https://github.com/microsoft/roosterjs/issues/1953\r\n setParagraphNotImplicit(paragraph);\r\n }\r\n } else if ((blockToDelete = getLeafSiblingBlock(path, paragraph, isForward))) {\r\n const { block, path, siblingSegment } = blockToDelete;\r\n\r\n if (block.blockType == 'Paragraph') {\r\n if (siblingSegment) {\r\n // When selection is under general segment, need to check if it has a sibling sibling, and delete from it\r\n if (deleteSegment(block, siblingSegment, context.formatContext, direction)) {\r\n context.deleteResult = 'range';\r\n }\r\n } else {\r\n if (isForward) {\r\n context.lastParagraph = block;\r\n } else {\r\n if (block.segments[block.segments.length - 1]?.segmentType == 'Br') {\r\n block.segments.pop();\r\n }\r\n\r\n context.insertPoint = {\r\n marker,\r\n paragraph: block,\r\n path,\r\n tableContext,\r\n };\r\n context.lastParagraph = paragraph;\r\n delete block.cachedElement;\r\n }\r\n\r\n context.deleteResult = 'range';\r\n }\r\n\r\n // When go across table, getLeafSiblingBlock will return null, when we are here, we must be in the same table context\r\n context.lastTableContext = tableContext;\r\n } else {\r\n if (\r\n deleteBlock(\r\n path[0].blocks,\r\n block,\r\n undefined /*replacement*/,\r\n context.formatContext,\r\n direction\r\n )\r\n ) {\r\n context.deleteResult = 'range';\r\n }\r\n }\r\n } else {\r\n // We have nothing to delete, in this case we don't want browser handle it as well.\r\n // Because when Backspace on an empty document, it will also delete the only DIV and SPAN element, causes\r\n // editor is really empty. We don't want that happen. So the handling should stop here.\r\n context.deleteResult = 'nothingToDelete';\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * If the last segment is BR, remove it for now. We may add it back later when normalize model.\r\n * So that if this is an empty paragraph, it will start to delete next block\r\n */\r\nfunction fixupBr(segments: ContentModelSegment[]) {\r\n if (segments[segments.length - 1]?.segmentType == 'Br') {\r\n const segmentsWithoutBr = segments.filter(x => x.segmentType != 'SelectionMarker');\r\n\r\n if (segmentsWithoutBr[segmentsWithoutBr.length - 2]?.segmentType != 'Br') {\r\n segments.pop();\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @internal if we didn't delete anything, and we want to delete forward, now perform it\r\n */\r\nexport const forwardDeleteCollapsedSelection = getDeleteCollapsedSelection('forward');\r\n\r\n/**\r\n * @internal if we didn't delete anything, and we want to delete backward, now perform it\r\n */\r\nexport const backwardDeleteCollapsedSelection = getDeleteCollapsedSelection('backward');\r\n"]}
@@ -1,5 +1,5 @@
1
- import type { DeleteSelectionStep } from 'roosterjs-content-model-types';
2
- /**
3
- * @internal
4
- */
5
- export declare const deleteList: DeleteSelectionStep;
1
+ import type { DeleteSelectionStep } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare const deleteList: DeleteSelectionStep;
@@ -1,24 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteList = void 0;
4
- var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
- /**
6
- * @internal
7
- */
8
- var deleteList = function (context) {
9
- 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_core_1.getClosestAncestorBlockGroupIndex)(path, ['ListItem', 'TableCell']);
12
- var item = path[index];
13
- if (index >= 0 &&
14
- paragraph.segments[0] == marker &&
15
- item.blockGroupType == 'ListItem' &&
16
- (paragraph.segments.length == 1 ||
17
- (paragraph.segments.length == 2 && paragraph.segments[1].segmentType == 'Br'))) {
18
- item.levels = [];
19
- context.deleteResult = 'range';
20
- }
21
- }
22
- };
23
- exports.deleteList = deleteList;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteList = void 0;
4
+ var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
5
+ /**
6
+ * @internal
7
+ */
8
+ var deleteList = function (context) {
9
+ 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_core_1.getClosestAncestorBlockGroupIndex)(path, ['ListItem', 'TableCell']);
12
+ var item = path[index];
13
+ if (index >= 0 &&
14
+ paragraph.segments[0] == marker &&
15
+ item.blockGroupType == 'ListItem' &&
16
+ (paragraph.segments.length == 1 ||
17
+ (paragraph.segments.length == 2 && paragraph.segments[1].segmentType == 'Br'))) {
18
+ item.levels = [];
19
+ context.deleteResult = 'range';
20
+ }
21
+ }
22
+ };
23
+ exports.deleteList = deleteList;
24
24
  //# sourceMappingURL=deleteList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deleteList.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteList.ts"],"names":[],"mappings":";;;AAAA,6EAAiF;AAGjF;;GAEG;AACI,IAAM,UAAU,GAAwB,UAAA,OAAO;IAC5C,IAAA,KAA8B,OAAO,CAAC,WAAW,EAA/C,SAAS,eAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAwB,CAAC;IAExD,IAAI,OAAO,CAAC,YAAY,IAAI,iBAAiB,IAAI,OAAO,CAAC,YAAY,IAAI,YAAY,EAAE;QACnF,IAAM,KAAK,GAAG,IAAA,gEAAiC,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;QACjF,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IACI,KAAK,IAAI,CAAC;YACV,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM;YAC/B,IAAI,CAAC,cAAc,IAAI,UAAU;YACjC,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC;gBAC3B,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,EACpF;YACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;SAClC;KACJ;AACL,CAAC,CAAC;AAjBW,QAAA,UAAU,cAiBrB","sourcesContent":["import { getClosestAncestorBlockGroupIndex } from 'roosterjs-content-model-core';\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 index >= 0 &&\n paragraph.segments[0] == marker &&\n item.blockGroupType == 'ListItem' &&\n (paragraph.segments.length == 1 ||\n (paragraph.segments.length == 2 && paragraph.segments[1].segmentType == 'Br'))\n ) {\n item.levels = [];\n context.deleteResult = 'range';\n }\n }\n};\n"]}
1
+ {"version":3,"file":"deleteList.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteList.ts"],"names":[],"mappings":";;;AAAA,6EAAiF;AAGjF;;GAEG;AACI,IAAM,UAAU,GAAwB,UAAA,OAAO;IAC5C,IAAA,KAA8B,OAAO,CAAC,WAAW,EAA/C,SAAS,eAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAwB,CAAC;IAExD,IAAI,OAAO,CAAC,YAAY,IAAI,iBAAiB,IAAI,OAAO,CAAC,YAAY,IAAI,YAAY,EAAE;QACnF,IAAM,KAAK,GAAG,IAAA,gEAAiC,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;QACjF,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IACI,KAAK,IAAI,CAAC;YACV,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM;YAC/B,IAAI,CAAC,cAAc,IAAI,UAAU;YACjC,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC;gBAC3B,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,EACpF;YACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC;SAClC;KACJ;AACL,CAAC,CAAC;AAjBW,QAAA,UAAU,cAiBrB","sourcesContent":["import { getClosestAncestorBlockGroupIndex } from 'roosterjs-content-model-core';\r\nimport type { DeleteSelectionStep } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const deleteList: DeleteSelectionStep = context => {\r\n const { paragraph, marker, path } = context.insertPoint;\r\n\r\n if (context.deleteResult == 'nothingToDelete' || context.deleteResult == 'notDeleted') {\r\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem', 'TableCell']);\r\n const item = path[index];\r\n if (\r\n index >= 0 &&\r\n paragraph.segments[0] == marker &&\r\n item.blockGroupType == 'ListItem' &&\r\n (paragraph.segments.length == 1 ||\r\n (paragraph.segments.length == 2 && paragraph.segments[1].segmentType == 'Br'))\r\n ) {\r\n item.levels = [];\r\n context.deleteResult = 'range';\r\n }\r\n }\r\n};\r\n"]}