roosterjs-content-model-plugins 0.25.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 (463) hide show
  1. package/{lib-mjs/autoFormat/ContentModelAutoFormatPlugin.d.ts → lib/autoFormat/AutoFormatPlugin.d.ts} +53 -53
  2. package/lib/autoFormat/{ContentModelAutoFormatPlugin.js → AutoFormatPlugin.js} +81 -81
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -0
  4. package/lib/autoFormat/keyboardListTrigger.d.ts +5 -5
  5. package/lib/autoFormat/keyboardListTrigger.js +45 -45
  6. package/lib/autoFormat/keyboardListTrigger.js.map +1 -1
  7. package/lib/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -7
  8. package/lib/autoFormat/utils/convertAlphaToDecimals.js +22 -22
  9. package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +1 -1
  10. package/lib/autoFormat/utils/getIndex.d.ts +4 -4
  11. package/lib/autoFormat/utils/getIndex.js +13 -13
  12. package/lib/autoFormat/utils/getIndex.js.map +1 -1
  13. package/lib/autoFormat/utils/getListTypeStyle.d.ts +14 -14
  14. package/lib/autoFormat/utils/getListTypeStyle.js +87 -79
  15. package/lib/autoFormat/utils/getListTypeStyle.js.map +1 -1
  16. package/lib/autoFormat/utils/getNumberingListStyle.d.ts +4 -4
  17. package/lib/autoFormat/utils/getNumberingListStyle.js +153 -152
  18. package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -1
  19. package/{lib-amd/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-amd/paste/ContentModelPastePlugin.d.ts → lib/paste/PastePlugin.d.ts} +43 -43
  59. package/lib/paste/{ContentModelPastePlugin.js → PastePlugin.js} +131 -131
  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/{ContentModelAutoFormatPlugin.d.ts → AutoFormatPlugin.d.ts} +53 -53
  152. package/lib-amd/autoFormat/{ContentModelAutoFormatPlugin.js → AutoFormatPlugin.js} +82 -82
  153. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -0
  154. package/lib-amd/autoFormat/keyboardListTrigger.d.ts +5 -5
  155. package/lib-amd/autoFormat/keyboardListTrigger.js +43 -43
  156. package/lib-amd/autoFormat/keyboardListTrigger.js.map +1 -1
  157. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -7
  158. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js +24 -24
  159. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +1 -1
  160. package/lib-amd/autoFormat/utils/getIndex.d.ts +4 -4
  161. package/lib-amd/autoFormat/utils/getIndex.js +14 -14
  162. package/lib-amd/autoFormat/utils/getIndex.js.map +1 -1
  163. package/lib-amd/autoFormat/utils/getListTypeStyle.d.ts +14 -14
  164. package/lib-amd/autoFormat/utils/getListTypeStyle.js +86 -78
  165. package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +1 -1
  166. package/lib-amd/autoFormat/utils/getNumberingListStyle.d.ts +4 -4
  167. package/lib-amd/autoFormat/utils/getNumberingListStyle.js +153 -152
  168. package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -1
  169. package/{lib-mjs/edit/ContentModelEditPlugin.d.ts → lib-amd/edit/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 -123
  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/autoFormat/ContentModelAutoFormatPlugin.d.ts → lib-mjs/autoFormat/AutoFormatPlugin.d.ts} +53 -53
  302. package/lib-mjs/autoFormat/{ContentModelAutoFormatPlugin.js → AutoFormatPlugin.js} +78 -78
  303. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -0
  304. package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +5 -5
  305. package/lib-mjs/autoFormat/keyboardListTrigger.js +41 -41
  306. package/lib-mjs/autoFormat/keyboardListTrigger.js.map +1 -1
  307. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -7
  308. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js +18 -18
  309. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +1 -1
  310. package/lib-mjs/autoFormat/utils/getIndex.d.ts +4 -4
  311. package/lib-mjs/autoFormat/utils/getIndex.js +9 -9
  312. package/lib-mjs/autoFormat/utils/getIndex.js.map +1 -1
  313. package/lib-mjs/autoFormat/utils/getListTypeStyle.d.ts +14 -14
  314. package/lib-mjs/autoFormat/utils/getListTypeStyle.js +83 -75
  315. package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +1 -1
  316. package/lib-mjs/autoFormat/utils/getNumberingListStyle.d.ts +4 -4
  317. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js +149 -148
  318. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -1
  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-mjs/paste/{ContentModelPastePlugin.d.ts → PastePlugin.d.ts} +43 -43
  359. package/lib-mjs/paste/{ContentModelPastePlugin.js → PastePlugin.js} +128 -128
  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 -5
  452. package/lib/autoFormat/ContentModelAutoFormatPlugin.js.map +0 -1
  453. package/lib/edit/ContentModelEditPlugin.js +0 -74
  454. package/lib/edit/ContentModelEditPlugin.js.map +0 -1
  455. package/lib/paste/ContentModelPastePlugin.js.map +0 -1
  456. package/lib-amd/autoFormat/ContentModelAutoFormatPlugin.js.map +0 -1
  457. package/lib-amd/edit/ContentModelEditPlugin.js +0 -74
  458. package/lib-amd/edit/ContentModelEditPlugin.js.map +0 -1
  459. package/lib-amd/paste/ContentModelPastePlugin.js.map +0 -1
  460. package/lib-mjs/autoFormat/ContentModelAutoFormatPlugin.js.map +0 -1
  461. package/lib-mjs/edit/ContentModelEditPlugin.js +0 -71
  462. package/lib-mjs/edit/ContentModelEditPlugin.js.map +0 -1
  463. package/lib-mjs/paste/ContentModelPastePlugin.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/keyboardListTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG5F;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAC/B,MAAyB,EACzB,QAAuB,EACvB,qBAAqC,EACrC,wBAAwC;IADxC,sCAAA,EAAA,4BAAqC;IACrC,yCAAA,EAAA,+BAAwC;IAExC,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,QAAQ;QACtC,IAAM,aAAa,GAAG,gBAAgB,CAClC,KAAK,EACL,qBAAqB,EACrB,wBAAwB,CAC3B,CAAC;QACF,IAAI,aAAa,EAAE;YACf,IAAM,qBAAqB,GAAG,gCAAgC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7E,IAAI,qBAAqB,CAAC,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACzD,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACrD;YACO,IAAA,QAAQ,GAAuB,aAAa,SAApC,EAAE,SAAS,GAAY,aAAa,UAAzB,EAAE,KAAK,GAAK,aAAa,MAAlB,CAAmB;YACrD,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YACvD,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,qBAAqB,CAAC,KAAK,CAAC,CAAC;YAC7B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,IAAM,WAAW,GAAG,UAChB,MAAyB,EACzB,KAA2B,EAC3B,QAAqB,EACrB,SAAiB,EACjB,KAAc;IAEd,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7B,IAAM,aAAa,GAAG,QAAQ,IAAI,IAAI,CAAC;IACvC,mGAAmG;IACnG,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,aAAa,EAAE;QACrC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACrC;IACD,YAAY,CACR,MAAM,EACN,aAAa;QACT,CAAC,CAAC;YACI,gBAAgB,EAAE,SAAS;SAC9B;QACH,CAAC,CAAC;YACI,kBAAkB,EAAE,SAAS;SAChC,CACV,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { getListTypeStyle } from './utils/getListTypeStyle';\nimport { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-core';\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\nimport { setListStartNumber, setListStyle, setListType } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument, IStandaloneEditor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardListTrigger(\n editor: IStandaloneEditor,\n rawEvent: KeyboardEvent,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n) {\n editor.formatContentModel((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(editor, model, listType, styleType, index);\n rawEvent.preventDefault();\n normalizeContentModel(model);\n return true;\n }\n return false;\n });\n}\n\nconst triggerList = (\n editor: IStandaloneEditor,\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 the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber\n if (index && index > 1 && isOrderedList) {\n setListStartNumber(editor, index);\n }\n setListStyle(\n editor,\n isOrderedList\n ? {\n orderedStyleType: styleType,\n }\n : {\n unorderedStyleType: styleType,\n }\n );\n};\n"]}
1
+ {"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/keyboardListTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI5F;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAC/B,MAAyB,EACzB,QAAuB,EACvB,qBAAqC,EACrC,wBAAwC;IADxC,sCAAA,EAAA,4BAAqC;IACrC,yCAAA,EAAA,+BAAwC;IAExC,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,QAAQ;QACtC,IAAM,aAAa,GAAG,gBAAgB,CAClC,KAAK,EACL,qBAAqB,EACrB,wBAAwB,CAC3B,CAAC;QACF,IAAI,aAAa,EAAE;YACf,IAAM,qBAAqB,GAAG,gCAAgC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7E,IAAI,qBAAqB,CAAC,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACzD,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACrD;YACO,IAAA,QAAQ,GAAuB,aAAa,SAApC,EAAE,SAAS,GAAY,aAAa,UAAzB,EAAE,KAAK,GAAK,aAAa,MAAlB,CAAmB;YACrD,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YACvD,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,qBAAqB,CAAC,KAAK,CAAC,CAAC;YAE7B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,IAAM,WAAW,GAAG,UAChB,MAAyB,EACzB,KAA2B,EAC3B,QAAqB,EACrB,SAAiB,EACjB,KAAc;IAEd,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7B,IAAM,aAAa,GAAG,QAAQ,IAAI,IAAI,CAAC;IACvC,mGAAmG;IACnG,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,aAAa,EAAE;QACrC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACrC;IACD,YAAY,CACR,MAAM,EACN,aAAa;QACT,CAAC,CAAC;YACI,gBAAgB,EAAE,SAAS;SAC9B;QACH,CAAC,CAAC;YACI,kBAAkB,EAAE,SAAS;SAChC,CACV,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { getListTypeStyle } from './utils/getListTypeStyle';\r\nimport { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-core';\r\nimport { normalizeContentModel } from 'roosterjs-content-model-dom';\r\nimport { setListStartNumber, setListStyle, setListType } from 'roosterjs-content-model-api';\r\n\r\nimport type { ContentModelDocument, IStandaloneEditor } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function keyboardListTrigger(\r\n editor: IStandaloneEditor,\r\n rawEvent: KeyboardEvent,\r\n shouldSearchForBullet: boolean = true,\r\n shouldSearchForNumbering: boolean = true\r\n) {\r\n editor.formatContentModel((model, _context) => {\r\n const listStyleType = getListTypeStyle(\r\n model,\r\n shouldSearchForBullet,\r\n shouldSearchForNumbering\r\n );\r\n if (listStyleType) {\r\n const segmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, false);\r\n if (segmentsAndParagraphs[0] && segmentsAndParagraphs[0][1]) {\r\n segmentsAndParagraphs[0][1].segments.splice(0, 1);\r\n }\r\n const { listType, styleType, index } = listStyleType;\r\n triggerList(editor, model, listType, styleType, index);\r\n rawEvent.preventDefault();\r\n normalizeContentModel(model);\r\n\r\n return true;\r\n }\r\n return false;\r\n });\r\n}\r\n\r\nconst triggerList = (\r\n editor: IStandaloneEditor,\r\n model: ContentModelDocument,\r\n listType: 'OL' | 'UL',\r\n styleType: number,\r\n index?: number\r\n) => {\r\n setListType(model, listType);\r\n const isOrderedList = listType == 'OL';\r\n // If the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber\r\n if (index && index > 1 && isOrderedList) {\r\n setListStartNumber(editor, index);\r\n }\r\n setListStyle(\r\n editor,\r\n isOrderedList\r\n ? {\r\n orderedStyleType: styleType,\r\n }\r\n : {\r\n unorderedStyleType: styleType,\r\n }\r\n );\r\n};\r\n"]}
@@ -1,7 +1,7 @@
1
- /**
2
- * @internal
3
- * Convert english alphabet numbers into decimal numbers
4
- * @param letter The letter that needs to be converted
5
- * @returns
6
- */
7
- export declare function convertAlphaToDecimals(letter: string): number | undefined;
1
+ /**
2
+ * @internal
3
+ * Convert english alphabet numbers into decimal numbers
4
+ * @param letter The letter that needs to be converted
5
+ * @returns
6
+ */
7
+ export declare function convertAlphaToDecimals(letter: string): number | undefined;
@@ -1,19 +1,19 @@
1
- /**
2
- * @internal
3
- * Convert english alphabet numbers into decimal numbers
4
- * @param letter The letter that needs to be converted
5
- * @returns
6
- */
7
- export function convertAlphaToDecimals(letter) {
8
- var alpha = letter.toUpperCase();
9
- if (alpha) {
10
- var result = 0;
11
- for (var i = 0; i < alpha.length; i++) {
12
- var charCode = alpha.charCodeAt(i) - 65 + 1;
13
- result = result * 26 + charCode;
14
- }
15
- return result;
16
- }
17
- return undefined;
18
- }
1
+ /**
2
+ * @internal
3
+ * Convert english alphabet numbers into decimal numbers
4
+ * @param letter The letter that needs to be converted
5
+ * @returns
6
+ */
7
+ export function convertAlphaToDecimals(letter) {
8
+ var alpha = letter.toUpperCase();
9
+ if (alpha) {
10
+ var result = 0;
11
+ for (var i = 0; i < alpha.length; i++) {
12
+ var charCode = alpha.charCodeAt(i) - 65 + 1;
13
+ result = result * 26 + charCode;
14
+ }
15
+ return result;
16
+ }
17
+ return undefined;
18
+ }
19
19
  //# sourceMappingURL=convertAlphaToDecimals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertAlphaToDecimals.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/convertAlphaToDecimals.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACjD,IAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,KAAK,EAAE;QACP,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,IAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAC9C,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC;SACnC;QAED,OAAO,MAAM,CAAC;KACjB;IACD,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["/**\n * @internal\n * Convert english alphabet numbers into decimal numbers\n * @param letter The letter that needs to be converted\n * @returns\n */\nexport function convertAlphaToDecimals(letter: string): number | undefined {\n const alpha = letter.toUpperCase();\n if (alpha) {\n let result = 0;\n for (let i = 0; i < alpha.length; i++) {\n const charCode = alpha.charCodeAt(i) - 65 + 1;\n result = result * 26 + charCode;\n }\n\n return result;\n }\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"convertAlphaToDecimals.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/convertAlphaToDecimals.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACjD,IAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,KAAK,EAAE;QACP,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,IAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAC9C,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC;SACnC;QAED,OAAO,MAAM,CAAC;KACjB;IACD,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["/**\r\n * @internal\r\n * Convert english alphabet numbers into decimal numbers\r\n * @param letter The letter that needs to be converted\r\n * @returns\r\n */\r\nexport function convertAlphaToDecimals(letter: string): number | undefined {\r\n const alpha = letter.toUpperCase();\r\n if (alpha) {\r\n let result = 0;\r\n for (let i = 0; i < alpha.length; i++) {\r\n const charCode = alpha.charCodeAt(i) - 65 + 1;\r\n result = result * 26 + charCode;\r\n }\r\n\r\n return result;\r\n }\r\n return undefined;\r\n}\r\n"]}
@@ -1,4 +1,4 @@
1
- /**
2
- * @internal
3
- */
4
- export declare function getIndex(listIndex: string): number | undefined;
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare function getIndex(listIndex: string): number | undefined;
@@ -1,10 +1,10 @@
1
- import { convertAlphaToDecimals } from './convertAlphaToDecimals';
2
- /**
3
- * @internal
4
- */
5
- export function getIndex(listIndex) {
6
- var index = listIndex.replace(/[^a-zA-Z0-9 ]/g, '');
7
- var indexNumber = parseInt(index);
8
- return !isNaN(indexNumber) ? indexNumber : convertAlphaToDecimals(index);
9
- }
1
+ import { convertAlphaToDecimals } from './convertAlphaToDecimals';
2
+ /**
3
+ * @internal
4
+ */
5
+ export function getIndex(listIndex) {
6
+ var index = listIndex.replace(/[^a-zA-Z0-9 ]/g, '');
7
+ var indexNumber = parseInt(index);
8
+ return !isNaN(indexNumber) ? indexNumber : convertAlphaToDecimals(index);
9
+ }
10
10
  //# sourceMappingURL=getIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIndex.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/getIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAiB;IACtC,IAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACtD,IAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { convertAlphaToDecimals } from './convertAlphaToDecimals';\n\n/**\n * @internal\n */\nexport function getIndex(listIndex: string) {\n const index = listIndex.replace(/[^a-zA-Z0-9 ]/g, '');\n const indexNumber = parseInt(index);\n return !isNaN(indexNumber) ? indexNumber : convertAlphaToDecimals(index);\n}\n"]}
1
+ {"version":3,"file":"getIndex.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/getIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAiB;IACtC,IAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACtD,IAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { convertAlphaToDecimals } from './convertAlphaToDecimals';\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getIndex(listIndex: string) {\r\n const index = listIndex.replace(/[^a-zA-Z0-9 ]/g, '');\r\n const indexNumber = parseInt(index);\r\n return !isNaN(indexNumber) ? indexNumber : convertAlphaToDecimals(index);\r\n}\r\n"]}
@@ -1,14 +1,14 @@
1
- import type { ContentModelDocument } from 'roosterjs-content-model-types';
2
- /**
3
- * @internal
4
- */
5
- interface ListTypeStyle {
6
- listType: 'UL' | 'OL';
7
- styleType: number;
8
- index?: number;
9
- }
10
- /**
11
- * @internal
12
- */
13
- export declare function getListTypeStyle(model: ContentModelDocument, shouldSearchForBullet?: boolean, shouldSearchForNumbering?: boolean): ListTypeStyle | undefined;
14
- export {};
1
+ import type { ContentModelDocument } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ */
5
+ interface ListTypeStyle {
6
+ listType: 'UL' | 'OL';
7
+ styleType: number;
8
+ index?: number;
9
+ }
10
+ /**
11
+ * @internal
12
+ */
13
+ export declare function getListTypeStyle(model: ContentModelDocument, shouldSearchForBullet?: boolean, shouldSearchForNumbering?: boolean): ListTypeStyle | undefined;
14
+ export {};
@@ -1,76 +1,84 @@
1
- import { getIndex } from './getIndex';
2
- import { getNumberingListStyle } from './getNumberingListStyle';
3
- import { BulletListType, isBlockGroupOfType, updateListMetadata, getOperationalBlocks, getSelectedSegmentsAndParagraphs, } from 'roosterjs-content-model-core';
4
- /**
5
- * @internal
6
- */
7
- export function getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering) {
8
- var _a, _b;
9
- if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
10
- if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
11
- var selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, true);
12
- var marker = selectedSegmentsAndParagraphs[0][0];
13
- var paragraph = selectedSegmentsAndParagraphs[0][1];
14
- var listMarkerSegment = paragraph === null || paragraph === void 0 ? void 0 : paragraph.segments[0];
15
- if (marker &&
16
- marker.segmentType == 'SelectionMarker' &&
17
- listMarkerSegment &&
18
- listMarkerSegment.segmentType == 'Text') {
19
- var listMarker = listMarkerSegment.text;
20
- var bulletType = bulletListType[listMarker];
21
- if (bulletType && shouldSearchForBullet) {
22
- return { listType: 'UL', styleType: bulletType };
23
- }
24
- else if (shouldSearchForNumbering) {
25
- var previousList = getPreviousListLevel(model, paragraph);
26
- var previousListStyle = getPreviousListStyle(previousList);
27
- var numberingType = getNumberingListStyle(listMarker, ((_a = previousList === null || previousList === void 0 ? void 0 : previousList.format) === null || _a === void 0 ? void 0 : _a.listStyleType)
28
- ? getIndex(previousList.format.listStyleType)
29
- : undefined, previousListStyle);
30
- if (numberingType) {
31
- return {
32
- listType: 'OL',
33
- styleType: numberingType,
34
- index: ((_b = previousList === null || previousList === void 0 ? void 0 : previousList.format) === null || _b === void 0 ? void 0 : _b.listStyleType) ? getIndex(listMarker) : undefined,
35
- };
36
- }
37
- }
38
- }
39
- return undefined;
40
- }
41
- var getPreviousListLevel = function (model, paragraph) {
42
- var blocks = getOperationalBlocks(model, ['ListItem'], ['TableCell']);
43
- var listItem = undefined;
44
- var listBlock = blocks.filter(function (_a) {
45
- var block = _a.block, parent = _a.parent;
46
- return parent.blocks.indexOf(paragraph) > -1;
47
- })[0];
48
- if (listBlock) {
49
- var length_1 = listBlock.parent.blocks.length;
50
- for (var i = length_1 - 1; i > -1; i--) {
51
- var item = listBlock.parent.blocks[i];
52
- if (isBlockGroupOfType(item, 'ListItem')) {
53
- listItem = item;
54
- break;
55
- }
56
- }
57
- }
58
- return listItem;
59
- };
60
- var getPreviousListStyle = function (list) {
61
- var _a;
62
- if (list === null || list === void 0 ? void 0 : list.levels[0].dataset) {
63
- return (_a = updateListMetadata(list.levels[0])) === null || _a === void 0 ? void 0 : _a.orderedStyleType;
64
- }
65
- };
66
- var bulletListType = {
67
- '*': BulletListType.Disc,
68
- '-': BulletListType.Dash,
69
- '--': BulletListType.Square,
70
- '->': BulletListType.LongArrow,
71
- '-->': BulletListType.DoubleLongArrow,
72
- '=>': BulletListType.UnfilledArrow,
73
- '>': BulletListType.ShortArrow,
74
- '': BulletListType.Hyphen,
75
- };
1
+ import { findListItemsInSameThread } from 'roosterjs-content-model-api';
2
+ import { getNumberingListStyle } from './getNumberingListStyle';
3
+ import { BulletListType, isBlockGroupOfType, updateListMetadata, getOperationalBlocks, getSelectedSegmentsAndParagraphs, } from 'roosterjs-content-model-core';
4
+ /**
5
+ * @internal
6
+ */
7
+ export function getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering) {
8
+ if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
9
+ if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
10
+ var selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, true);
11
+ var marker = selectedSegmentsAndParagraphs[0][0];
12
+ var paragraph = selectedSegmentsAndParagraphs[0][1];
13
+ var listMarkerSegment = paragraph === null || paragraph === void 0 ? void 0 : paragraph.segments[0];
14
+ if (marker &&
15
+ marker.segmentType == 'SelectionMarker' &&
16
+ listMarkerSegment &&
17
+ listMarkerSegment.segmentType == 'Text') {
18
+ var listMarker = listMarkerSegment.text;
19
+ var bulletType = bulletListType[listMarker];
20
+ if (bulletType && shouldSearchForBullet) {
21
+ return { listType: 'UL', styleType: bulletType };
22
+ }
23
+ else if (shouldSearchForNumbering) {
24
+ var previousList = getPreviousListLevel(model, paragraph);
25
+ var previousIndex = getPreviousListIndex(model, previousList);
26
+ var previousListStyle = getPreviousListStyle(previousList);
27
+ var numberingType = getNumberingListStyle(listMarker, previousIndex, previousListStyle);
28
+ if (numberingType) {
29
+ return {
30
+ listType: 'OL',
31
+ styleType: numberingType,
32
+ index: !isNewList(listMarker) &&
33
+ previousListStyle === numberingType &&
34
+ previousIndex
35
+ ? previousIndex + 1
36
+ : undefined,
37
+ };
38
+ }
39
+ }
40
+ }
41
+ return undefined;
42
+ }
43
+ var getPreviousListIndex = function (model, previousListItem) {
44
+ return previousListItem ? findListItemsInSameThread(model, previousListItem).length : undefined;
45
+ };
46
+ var getPreviousListLevel = function (model, paragraph) {
47
+ var blocks = getOperationalBlocks(model, ['ListItem'], ['TableCell'])[0];
48
+ var listItem = undefined;
49
+ if (blocks) {
50
+ var listBlockIndex = blocks.parent.blocks.indexOf(paragraph);
51
+ if (listBlockIndex > -1) {
52
+ for (var i = listBlockIndex - 1; i > -1; i--) {
53
+ var item = blocks.parent.blocks[i];
54
+ if (isBlockGroupOfType(item, 'ListItem')) {
55
+ listItem = item;
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ }
61
+ return listItem;
62
+ };
63
+ var getPreviousListStyle = function (list) {
64
+ var _a;
65
+ if (list === null || list === void 0 ? void 0 : list.levels[0].dataset) {
66
+ return (_a = updateListMetadata(list.levels[0])) === null || _a === void 0 ? void 0 : _a.orderedStyleType;
67
+ }
68
+ };
69
+ var bulletListType = {
70
+ '*': BulletListType.Disc,
71
+ '-': BulletListType.Dash,
72
+ '--': BulletListType.Square,
73
+ '->': BulletListType.LongArrow,
74
+ '-->': BulletListType.DoubleLongArrow,
75
+ '=>': BulletListType.UnfilledArrow,
76
+ '>': BulletListType.ShortArrow,
77
+ '—': BulletListType.Hyphen,
78
+ };
79
+ var isNewList = function (listMarker) {
80
+ var marker = listMarker.replace(/[^\w\s]/g, '');
81
+ var pattern = /^[1aAiI]$/;
82
+ return pattern.test(marker);
83
+ };
76
84
  //# sourceMappingURL=getListTypeStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getListTypeStyle.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/getListTypeStyle.ts"],"names":[],"mappings":"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","sourcesContent":["import { getIndex } from './getIndex';\nimport { getNumberingListStyle } from './getNumberingListStyle';\n\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n ContentModelParagraph,\n} from 'roosterjs-content-model-types';\nimport {\n BulletListType,\n isBlockGroupOfType,\n updateListMetadata,\n getOperationalBlocks,\n getSelectedSegmentsAndParagraphs,\n} from 'roosterjs-content-model-core';\n\n/**\n * @internal\n */\ninterface ListTypeStyle {\n listType: 'UL' | 'OL';\n styleType: number;\n index?: number;\n}\n\n/**\n * @internal\n */\nexport function getListTypeStyle(\n model: ContentModelDocument,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n): ListTypeStyle | undefined {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, true);\n const marker = selectedSegmentsAndParagraphs[0][0];\n const paragraph = selectedSegmentsAndParagraphs[0][1];\n const listMarkerSegment = paragraph?.segments[0];\n\n if (\n marker &&\n marker.segmentType == 'SelectionMarker' &&\n listMarkerSegment &&\n listMarkerSegment.segmentType == 'Text'\n ) {\n const listMarker = listMarkerSegment.text;\n const bulletType = bulletListType[listMarker];\n\n if (bulletType && shouldSearchForBullet) {\n return { listType: 'UL', styleType: bulletType };\n } else if (shouldSearchForNumbering) {\n const previousList = getPreviousListLevel(model, paragraph);\n const previousListStyle = getPreviousListStyle(previousList);\n const numberingType = getNumberingListStyle(\n listMarker,\n previousList?.format?.listStyleType\n ? getIndex(previousList.format.listStyleType)\n : undefined,\n previousListStyle\n );\n if (numberingType) {\n return {\n listType: 'OL',\n styleType: numberingType,\n index: previousList?.format?.listStyleType ? getIndex(listMarker) : undefined,\n };\n }\n }\n }\n return undefined;\n}\n\nconst getPreviousListLevel = (model: ContentModelDocument, paragraph: ContentModelParagraph) => {\n const blocks = getOperationalBlocks(model, ['ListItem'], ['TableCell']);\n let listItem: ContentModelListItem | undefined = undefined;\n const listBlock = blocks.filter(({ block, parent }) => {\n return parent.blocks.indexOf(paragraph) > -1;\n })[0];\n if (listBlock) {\n const length = listBlock.parent.blocks.length;\n for (let i = length - 1; i > -1; i--) {\n const item = listBlock.parent.blocks[i];\n if (isBlockGroupOfType<ContentModelListItem>(item, 'ListItem')) {\n listItem = item;\n break;\n }\n }\n }\n return listItem;\n};\n\nconst getPreviousListStyle = (list?: ContentModelListItem) => {\n if (list?.levels[0].dataset) {\n return updateListMetadata(list.levels[0])?.orderedStyleType;\n }\n};\n\nconst bulletListType: Record<string, number> = {\n '*': BulletListType.Disc,\n '-': BulletListType.Dash,\n '--': BulletListType.Square,\n '->': BulletListType.LongArrow,\n '-->': BulletListType.DoubleLongArrow,\n '=>': BulletListType.UnfilledArrow,\n '>': BulletListType.ShortArrow,\n '—': BulletListType.Hyphen,\n};\n"]}
1
+ {"version":3,"file":"getListTypeStyle.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/autoFormat/utils/getListTypeStyle.ts"],"names":[],"mappings":"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","sourcesContent":["import { findListItemsInSameThread } from 'roosterjs-content-model-api';\r\nimport { getNumberingListStyle } from './getNumberingListStyle';\r\nimport type {\r\n ContentModelDocument,\r\n ContentModelListItem,\r\n ContentModelParagraph,\r\n} from 'roosterjs-content-model-types';\r\nimport {\r\n BulletListType,\r\n isBlockGroupOfType,\r\n updateListMetadata,\r\n getOperationalBlocks,\r\n getSelectedSegmentsAndParagraphs,\r\n} from 'roosterjs-content-model-core';\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface ListTypeStyle {\r\n listType: 'UL' | 'OL';\r\n styleType: number;\r\n index?: number;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getListTypeStyle(\r\n model: ContentModelDocument,\r\n shouldSearchForBullet: boolean = true,\r\n shouldSearchForNumbering: boolean = true\r\n): ListTypeStyle | undefined {\r\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, true);\r\n const marker = selectedSegmentsAndParagraphs[0][0];\r\n const paragraph = selectedSegmentsAndParagraphs[0][1];\r\n const listMarkerSegment = paragraph?.segments[0];\r\n\r\n if (\r\n marker &&\r\n marker.segmentType == 'SelectionMarker' &&\r\n listMarkerSegment &&\r\n listMarkerSegment.segmentType == 'Text'\r\n ) {\r\n const listMarker = listMarkerSegment.text;\r\n const bulletType = bulletListType[listMarker];\r\n\r\n if (bulletType && shouldSearchForBullet) {\r\n return { listType: 'UL', styleType: bulletType };\r\n } else if (shouldSearchForNumbering) {\r\n const previousList = getPreviousListLevel(model, paragraph);\r\n const previousIndex = getPreviousListIndex(model, previousList);\r\n const previousListStyle = getPreviousListStyle(previousList);\r\n const numberingType = getNumberingListStyle(\r\n listMarker,\r\n previousIndex,\r\n previousListStyle\r\n );\r\n if (numberingType) {\r\n return {\r\n listType: 'OL',\r\n styleType: numberingType,\r\n index:\r\n !isNewList(listMarker) &&\r\n previousListStyle === numberingType &&\r\n previousIndex\r\n ? previousIndex + 1\r\n : undefined,\r\n };\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nconst getPreviousListIndex = (\r\n model: ContentModelDocument,\r\n previousListItem?: ContentModelListItem\r\n) => {\r\n return previousListItem ? findListItemsInSameThread(model, previousListItem).length : undefined;\r\n};\r\n\r\nconst getPreviousListLevel = (model: ContentModelDocument, paragraph: ContentModelParagraph) => {\r\n const blocks = getOperationalBlocks<ContentModelListItem>(\r\n model,\r\n ['ListItem'],\r\n ['TableCell']\r\n )[0];\r\n let listItem: ContentModelListItem | undefined = undefined;\r\n if (blocks) {\r\n const listBlockIndex = blocks.parent.blocks.indexOf(paragraph);\r\n\r\n if (listBlockIndex > -1) {\r\n for (let i = listBlockIndex - 1; i > -1; i--) {\r\n const item = blocks.parent.blocks[i];\r\n if (isBlockGroupOfType<ContentModelListItem>(item, 'ListItem')) {\r\n listItem = item;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return listItem;\r\n};\r\n\r\nconst getPreviousListStyle = (list?: ContentModelListItem) => {\r\n if (list?.levels[0].dataset) {\r\n return updateListMetadata(list.levels[0])?.orderedStyleType;\r\n }\r\n};\r\n\r\nconst bulletListType: Record<string, number> = {\r\n '*': BulletListType.Disc,\r\n '-': BulletListType.Dash,\r\n '--': BulletListType.Square,\r\n '->': BulletListType.LongArrow,\r\n '-->': BulletListType.DoubleLongArrow,\r\n '=>': BulletListType.UnfilledArrow,\r\n '>': BulletListType.ShortArrow,\r\n '—': BulletListType.Hyphen,\r\n};\r\n\r\nconst isNewList = (listMarker: string) => {\r\n const marker = listMarker.replace(/[^\\w\\s]/g, '');\r\n const pattern = /^[1aAiI]$/;\r\n return pattern.test(marker);\r\n};\r\n"]}
@@ -1,4 +1,4 @@
1
- /**
2
- * @internal
3
- */
4
- export declare function getNumberingListStyle(textBeforeCursor: string, previousListIndex?: number, previousListStyle?: number): number | undefined;
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare function getNumberingListStyle(textBeforeCursor: string, previousListIndex?: number, previousListStyle?: number): number | undefined;