roosterjs-content-model-plugins 0.26.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +53 -53
  2. package/lib/autoFormat/AutoFormatPlugin.js +80 -80
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
  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 -87
  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 -153
  18. package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -1
  19. package/lib/edit/EditPlugin.d.ts +39 -39
  20. package/lib/edit/EditPlugin.js +128 -128
  21. package/lib/edit/EditPlugin.js.map +1 -1
  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 -5
  38. package/lib/edit/inputSteps/handleEnterOnList.js +67 -67
  39. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
  40. package/lib/edit/keyboardDelete.d.ts +9 -9
  41. package/lib/edit/keyboardDelete.js +71 -71
  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 -58
  45. package/lib/edit/keyboardInput.js.map +1 -1
  46. package/lib/edit/keyboardTab.d.ts +5 -5
  47. package/lib/edit/keyboardTab.js +34 -34
  48. package/lib/edit/keyboardTab.js.map +1 -1
  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/paste/PastePlugin.d.ts +43 -43
  59. package/lib/paste/PastePlugin.js +130 -130
  60. package/lib/paste/PastePlugin.js.map +1 -1
  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 -35
  131. package/lib/pluginUtils/CreateElement/CreateElementData.js +2 -2
  132. package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  133. package/lib/pluginUtils/CreateElement/createElement.d.ts +9 -9
  134. package/lib/pluginUtils/CreateElement/createElement.js +50 -50
  135. package/lib/pluginUtils/CreateElement/createElement.js.map +1 -1
  136. package/lib/pluginUtils/Disposable.d.ts +10 -10
  137. package/lib/pluginUtils/Disposable.js +2 -2
  138. package/lib/pluginUtils/Disposable.js.map +1 -1
  139. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -45
  140. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js +2 -2
  141. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  142. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -39
  143. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +119 -119
  144. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  145. package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +27 -27
  146. package/lib/pluginUtils/Rect/getIntersectedRect.js +44 -44
  147. package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  148. package/lib/pluginUtils/Rect/normalizeRect.d.ts +7 -7
  149. package/lib/pluginUtils/Rect/normalizeRect.js +19 -19
  150. package/lib/pluginUtils/Rect/normalizeRect.js.map +1 -1
  151. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +53 -53
  152. package/lib-amd/autoFormat/AutoFormatPlugin.js +81 -81
  153. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
  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 -86
  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 -153
  168. package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -1
  169. package/lib-amd/edit/EditPlugin.d.ts +39 -39
  170. package/lib-amd/edit/EditPlugin.js +127 -127
  171. package/lib-amd/edit/EditPlugin.js.map +1 -1
  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 -5
  188. package/lib-amd/edit/inputSteps/handleEnterOnList.js +66 -66
  189. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
  190. package/lib-amd/edit/keyboardDelete.d.ts +9 -9
  191. package/lib-amd/edit/keyboardDelete.js +66 -66
  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 -57
  195. package/lib-amd/edit/keyboardInput.js.map +1 -1
  196. package/lib-amd/edit/keyboardTab.d.ts +5 -5
  197. package/lib-amd/edit/keyboardTab.js +34 -34
  198. package/lib-amd/edit/keyboardTab.js.map +1 -1
  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-amd/paste/PastePlugin.d.ts +43 -43
  209. package/lib-amd/paste/PastePlugin.js +122 -122
  210. package/lib-amd/paste/PastePlugin.js.map +1 -1
  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 -35
  281. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js +4 -4
  282. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  283. package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +9 -9
  284. package/lib-amd/pluginUtils/CreateElement/createElement.js +51 -51
  285. package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -1
  286. package/lib-amd/pluginUtils/Disposable.d.ts +10 -10
  287. package/lib-amd/pluginUtils/Disposable.js +4 -4
  288. package/lib-amd/pluginUtils/Disposable.js.map +1 -1
  289. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -45
  290. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js +4 -4
  291. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  292. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -39
  293. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +120 -120
  294. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  295. package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +27 -27
  296. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +44 -44
  297. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  298. package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +7 -7
  299. package/lib-amd/pluginUtils/Rect/normalizeRect.js +21 -21
  300. package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +1 -1
  301. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +53 -53
  302. package/lib-mjs/autoFormat/AutoFormatPlugin.js +77 -77
  303. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
  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 -83
  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 -149
  318. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -1
  319. package/lib-mjs/edit/EditPlugin.d.ts +39 -39
  320. package/lib-mjs/edit/EditPlugin.js +125 -125
  321. package/lib-mjs/edit/EditPlugin.js.map +1 -1
  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 -5
  338. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +63 -63
  339. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
  340. package/lib-mjs/edit/keyboardDelete.d.ts +9 -9
  341. package/lib-mjs/edit/keyboardDelete.js +67 -67
  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 -54
  345. package/lib-mjs/edit/keyboardInput.js.map +1 -1
  346. package/lib-mjs/edit/keyboardTab.d.ts +5 -5
  347. package/lib-mjs/edit/keyboardTab.js +30 -30
  348. package/lib-mjs/edit/keyboardTab.js.map +1 -1
  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/PastePlugin.d.ts +43 -43
  359. package/lib-mjs/paste/PastePlugin.js +127 -127
  360. package/lib-mjs/paste/PastePlugin.js.map +1 -1
  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 -35
  431. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js +1 -1
  432. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -1
  433. package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +9 -9
  434. package/lib-mjs/pluginUtils/CreateElement/createElement.js +47 -47
  435. package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -1
  436. package/lib-mjs/pluginUtils/Disposable.d.ts +10 -10
  437. package/lib-mjs/pluginUtils/Disposable.js +1 -1
  438. package/lib-mjs/pluginUtils/Disposable.js.map +1 -1
  439. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -45
  440. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js +1 -1
  441. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -1
  442. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -39
  443. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +117 -117
  444. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -1
  445. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +27 -27
  446. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +41 -41
  447. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -1
  448. package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +7 -7
  449. package/lib-mjs/pluginUtils/Rect/normalizeRect.js +16 -16
  450. package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +1 -1
  451. package/package.json +5 -5
@@ -1,39 +1,39 @@
1
- import type Disposable from '../Disposable';
2
- import type DragAndDropHandler from './DragAndDropHandler';
3
- /**
4
- * @internal
5
- * A helper class to help manage drag and drop to an HTML element
6
- */
7
- export default class DragAndDropHelper<TContext, TInitValue> implements Disposable {
8
- private trigger;
9
- private context;
10
- private onSubmit;
11
- private handler;
12
- private zoomScale;
13
- private initX;
14
- private initY;
15
- private initValue;
16
- private dndMouse;
17
- /**
18
- * Create a new instance of DragAndDropHelper class
19
- * @param trigger The trigger element. When user start drag on this element,
20
- * events will be fired to the handler object
21
- * @param context Context object that will be passed to handler function when event is fired,
22
- * so that the handler object knows which element it is triggered from.
23
- * @param onSubmit A callback that will be invoked when event handler in handler object returns true
24
- * @param handler The event handler object, see DragAndDropHandler interface for more information
25
- * @param zoomScale The zoom scale of the editor
26
- * @param forceMobile A boolean to force the use of touch controls for the helper
27
- */
28
- constructor(trigger: HTMLElement, context: TContext, onSubmit: (context: TContext, trigger: HTMLElement) => void, handler: DragAndDropHandler<TContext, TInitValue>, zoomScale: number, forceMobile?: boolean);
29
- /**
30
- * Dispose this object, remove all event listeners that has been attached
31
- */
32
- dispose(): void;
33
- get mouseType(): string;
34
- private addDocumentEvents;
35
- private removeDocumentEvents;
36
- private onMouseDown;
37
- private onMouseMove;
38
- private onMouseUp;
39
- }
1
+ import type Disposable from '../Disposable';
2
+ import type DragAndDropHandler from './DragAndDropHandler';
3
+ /**
4
+ * @internal
5
+ * A helper class to help manage drag and drop to an HTML element
6
+ */
7
+ export default class DragAndDropHelper<TContext, TInitValue> implements Disposable {
8
+ private trigger;
9
+ private context;
10
+ private onSubmit;
11
+ private handler;
12
+ private zoomScale;
13
+ private initX;
14
+ private initY;
15
+ private initValue;
16
+ private dndMouse;
17
+ /**
18
+ * Create a new instance of DragAndDropHelper class
19
+ * @param trigger The trigger element. When user start drag on this element,
20
+ * events will be fired to the handler object
21
+ * @param context Context object that will be passed to handler function when event is fired,
22
+ * so that the handler object knows which element it is triggered from.
23
+ * @param onSubmit A callback that will be invoked when event handler in handler object returns true
24
+ * @param handler The event handler object, see DragAndDropHandler interface for more information
25
+ * @param zoomScale The zoom scale of the editor
26
+ * @param forceMobile A boolean to force the use of touch controls for the helper
27
+ */
28
+ constructor(trigger: HTMLElement, context: TContext, onSubmit: (context: TContext, trigger: HTMLElement) => void, handler: DragAndDropHandler<TContext, TInitValue>, zoomScale: number, forceMobile?: boolean);
29
+ /**
30
+ * Dispose this object, remove all event listeners that has been attached
31
+ */
32
+ dispose(): void;
33
+ get mouseType(): string;
34
+ private addDocumentEvents;
35
+ private removeDocumentEvents;
36
+ private onMouseDown;
37
+ private onMouseMove;
38
+ private onMouseUp;
39
+ }
@@ -1,118 +1,118 @@
1
- import { __read } from "tslib";
2
- /**
3
- * Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers
4
- */
5
- var MOUSE_EVENT_INFO_DESKTOP = (function () {
6
- return {
7
- MOUSEDOWN: 'mousedown',
8
- MOUSEMOVE: 'mousemove',
9
- MOUSEUP: 'mouseup',
10
- getPageXY: getMouseEventPageXY,
11
- };
12
- })();
13
- var MOUSE_EVENT_INFO_MOBILE = (function () {
14
- return {
15
- MOUSEDOWN: 'touchstart',
16
- MOUSEMOVE: 'touchmove',
17
- MOUSEUP: 'touchend',
18
- getPageXY: getTouchEventPageXY,
19
- };
20
- })();
21
- function getMouseEventPageXY(e) {
22
- return [e.pageX, e.pageY];
23
- }
24
- function getTouchEventPageXY(e) {
25
- var pageX = 0;
26
- var pageY = 0;
27
- if (e.targetTouches && e.targetTouches.length > 0) {
28
- var touch = e.targetTouches[0];
29
- pageX = touch.pageX;
30
- pageY = touch.pageY;
31
- }
32
- return [pageX, pageY];
33
- }
34
- /**
35
- * @internal
36
- * A helper class to help manage drag and drop to an HTML element
37
- */
38
- var DragAndDropHelper = /** @class */ (function () {
39
- /**
40
- * Create a new instance of DragAndDropHelper class
41
- * @param trigger The trigger element. When user start drag on this element,
42
- * events will be fired to the handler object
43
- * @param context Context object that will be passed to handler function when event is fired,
44
- * so that the handler object knows which element it is triggered from.
45
- * @param onSubmit A callback that will be invoked when event handler in handler object returns true
46
- * @param handler The event handler object, see DragAndDropHandler interface for more information
47
- * @param zoomScale The zoom scale of the editor
48
- * @param forceMobile A boolean to force the use of touch controls for the helper
49
- */
50
- function DragAndDropHelper(trigger, context, onSubmit, handler, zoomScale, forceMobile) {
51
- var _this = this;
52
- this.trigger = trigger;
53
- this.context = context;
54
- this.onSubmit = onSubmit;
55
- this.handler = handler;
56
- this.zoomScale = zoomScale;
57
- this.initX = 0;
58
- this.initY = 0;
59
- this.initValue = undefined;
60
- this.onMouseDown = function (e) {
61
- var _a;
62
- var _b, _c;
63
- e.preventDefault();
64
- e.stopPropagation();
65
- _this.addDocumentEvents();
66
- _a = __read(_this.dndMouse.getPageXY(e), 2), _this.initX = _a[0], _this.initY = _a[1];
67
- _this.initValue = (_c = (_b = _this.handler).onDragStart) === null || _c === void 0 ? void 0 : _c.call(_b, _this.context, e);
68
- };
69
- this.onMouseMove = function (e) {
70
- var _a, _b, _c;
71
- e.preventDefault();
72
- var _d = __read(_this.dndMouse.getPageXY(e), 2), pageX = _d[0], pageY = _d[1];
73
- var deltaX = (pageX - _this.initX) / _this.zoomScale;
74
- var deltaY = (pageY - _this.initY) / _this.zoomScale;
75
- if (_this.initValue &&
76
- ((_b = (_a = _this.handler).onDragging) === null || _b === void 0 ? void 0 : _b.call(_a, _this.context, e, _this.initValue, deltaX, deltaY))) {
77
- (_c = _this.onSubmit) === null || _c === void 0 ? void 0 : _c.call(_this, _this.context, _this.trigger);
78
- }
79
- };
80
- this.onMouseUp = function (e) {
81
- var _a, _b, _c;
82
- e.preventDefault();
83
- _this.removeDocumentEvents();
84
- if ((_b = (_a = _this.handler).onDragEnd) === null || _b === void 0 ? void 0 : _b.call(_a, _this.context, e, _this.initValue)) {
85
- (_c = _this.onSubmit) === null || _c === void 0 ? void 0 : _c.call(_this, _this.context, _this.trigger);
86
- }
87
- };
88
- this.dndMouse = forceMobile ? MOUSE_EVENT_INFO_MOBILE : MOUSE_EVENT_INFO_DESKTOP;
89
- trigger.addEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);
90
- }
91
- /**
92
- * Dispose this object, remove all event listeners that has been attached
93
- */
94
- DragAndDropHelper.prototype.dispose = function () {
95
- this.trigger.removeEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);
96
- this.removeDocumentEvents();
97
- };
98
- Object.defineProperty(DragAndDropHelper.prototype, "mouseType", {
99
- get: function () {
100
- return this.dndMouse == MOUSE_EVENT_INFO_MOBILE ? 'touch' : 'mouse';
101
- },
102
- enumerable: false,
103
- configurable: true
104
- });
105
- DragAndDropHelper.prototype.addDocumentEvents = function () {
106
- var doc = this.trigger.ownerDocument;
107
- doc.addEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);
108
- doc.addEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);
109
- };
110
- DragAndDropHelper.prototype.removeDocumentEvents = function () {
111
- var doc = this.trigger.ownerDocument;
112
- doc.removeEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);
113
- doc.removeEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);
114
- };
115
- return DragAndDropHelper;
116
- }());
117
- export default DragAndDropHelper;
1
+ import { __read } from "tslib";
2
+ /**
3
+ * Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers
4
+ */
5
+ var MOUSE_EVENT_INFO_DESKTOP = (function () {
6
+ return {
7
+ MOUSEDOWN: 'mousedown',
8
+ MOUSEMOVE: 'mousemove',
9
+ MOUSEUP: 'mouseup',
10
+ getPageXY: getMouseEventPageXY,
11
+ };
12
+ })();
13
+ var MOUSE_EVENT_INFO_MOBILE = (function () {
14
+ return {
15
+ MOUSEDOWN: 'touchstart',
16
+ MOUSEMOVE: 'touchmove',
17
+ MOUSEUP: 'touchend',
18
+ getPageXY: getTouchEventPageXY,
19
+ };
20
+ })();
21
+ function getMouseEventPageXY(e) {
22
+ return [e.pageX, e.pageY];
23
+ }
24
+ function getTouchEventPageXY(e) {
25
+ var pageX = 0;
26
+ var pageY = 0;
27
+ if (e.targetTouches && e.targetTouches.length > 0) {
28
+ var touch = e.targetTouches[0];
29
+ pageX = touch.pageX;
30
+ pageY = touch.pageY;
31
+ }
32
+ return [pageX, pageY];
33
+ }
34
+ /**
35
+ * @internal
36
+ * A helper class to help manage drag and drop to an HTML element
37
+ */
38
+ var DragAndDropHelper = /** @class */ (function () {
39
+ /**
40
+ * Create a new instance of DragAndDropHelper class
41
+ * @param trigger The trigger element. When user start drag on this element,
42
+ * events will be fired to the handler object
43
+ * @param context Context object that will be passed to handler function when event is fired,
44
+ * so that the handler object knows which element it is triggered from.
45
+ * @param onSubmit A callback that will be invoked when event handler in handler object returns true
46
+ * @param handler The event handler object, see DragAndDropHandler interface for more information
47
+ * @param zoomScale The zoom scale of the editor
48
+ * @param forceMobile A boolean to force the use of touch controls for the helper
49
+ */
50
+ function DragAndDropHelper(trigger, context, onSubmit, handler, zoomScale, forceMobile) {
51
+ var _this = this;
52
+ this.trigger = trigger;
53
+ this.context = context;
54
+ this.onSubmit = onSubmit;
55
+ this.handler = handler;
56
+ this.zoomScale = zoomScale;
57
+ this.initX = 0;
58
+ this.initY = 0;
59
+ this.initValue = undefined;
60
+ this.onMouseDown = function (e) {
61
+ var _a;
62
+ var _b, _c;
63
+ e.preventDefault();
64
+ e.stopPropagation();
65
+ _this.addDocumentEvents();
66
+ _a = __read(_this.dndMouse.getPageXY(e), 2), _this.initX = _a[0], _this.initY = _a[1];
67
+ _this.initValue = (_c = (_b = _this.handler).onDragStart) === null || _c === void 0 ? void 0 : _c.call(_b, _this.context, e);
68
+ };
69
+ this.onMouseMove = function (e) {
70
+ var _a, _b, _c;
71
+ e.preventDefault();
72
+ var _d = __read(_this.dndMouse.getPageXY(e), 2), pageX = _d[0], pageY = _d[1];
73
+ var deltaX = (pageX - _this.initX) / _this.zoomScale;
74
+ var deltaY = (pageY - _this.initY) / _this.zoomScale;
75
+ if (_this.initValue &&
76
+ ((_b = (_a = _this.handler).onDragging) === null || _b === void 0 ? void 0 : _b.call(_a, _this.context, e, _this.initValue, deltaX, deltaY))) {
77
+ (_c = _this.onSubmit) === null || _c === void 0 ? void 0 : _c.call(_this, _this.context, _this.trigger);
78
+ }
79
+ };
80
+ this.onMouseUp = function (e) {
81
+ var _a, _b, _c;
82
+ e.preventDefault();
83
+ _this.removeDocumentEvents();
84
+ if ((_b = (_a = _this.handler).onDragEnd) === null || _b === void 0 ? void 0 : _b.call(_a, _this.context, e, _this.initValue)) {
85
+ (_c = _this.onSubmit) === null || _c === void 0 ? void 0 : _c.call(_this, _this.context, _this.trigger);
86
+ }
87
+ };
88
+ this.dndMouse = forceMobile ? MOUSE_EVENT_INFO_MOBILE : MOUSE_EVENT_INFO_DESKTOP;
89
+ trigger.addEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);
90
+ }
91
+ /**
92
+ * Dispose this object, remove all event listeners that has been attached
93
+ */
94
+ DragAndDropHelper.prototype.dispose = function () {
95
+ this.trigger.removeEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);
96
+ this.removeDocumentEvents();
97
+ };
98
+ Object.defineProperty(DragAndDropHelper.prototype, "mouseType", {
99
+ get: function () {
100
+ return this.dndMouse == MOUSE_EVENT_INFO_MOBILE ? 'touch' : 'mouse';
101
+ },
102
+ enumerable: false,
103
+ configurable: true
104
+ });
105
+ DragAndDropHelper.prototype.addDocumentEvents = function () {
106
+ var doc = this.trigger.ownerDocument;
107
+ doc.addEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);
108
+ doc.addEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);
109
+ };
110
+ DragAndDropHelper.prototype.removeDocumentEvents = function () {
111
+ var doc = this.trigger.ownerDocument;
112
+ doc.removeEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);
113
+ doc.removeEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);
114
+ };
115
+ return DragAndDropHelper;
116
+ }());
117
+ export default DragAndDropHelper;
118
118
  //# sourceMappingURL=DragAndDropHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragAndDropHelper.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/DragAndDrop/DragAndDropHelper.ts"],"names":[],"mappings":"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","sourcesContent":["import type Disposable from '../Disposable';\r\nimport type DragAndDropHandler from './DragAndDropHandler';\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface MouseEventMoves {\r\n MOUSEDOWN: string;\r\n MOUSEMOVE: string;\r\n MOUSEUP: string;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface MouseEventInfo extends MouseEventMoves {\r\n getPageXY: (e: MouseEvent) => number[];\r\n}\r\n\r\n/**\r\n * @internal\r\n * Compatible mouse event names for different platform\r\n */\r\ninterface TouchEventInfo extends MouseEventMoves {\r\n getPageXY: (e: TouchEvent) => number[];\r\n}\r\n\r\n/**\r\n * Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers\r\n */\r\nconst MOUSE_EVENT_INFO_DESKTOP: MouseEventInfo = (() => {\r\n return {\r\n MOUSEDOWN: 'mousedown',\r\n MOUSEMOVE: 'mousemove',\r\n MOUSEUP: 'mouseup',\r\n getPageXY: getMouseEventPageXY,\r\n };\r\n})();\r\n\r\nconst MOUSE_EVENT_INFO_MOBILE: TouchEventInfo = (() => {\r\n return {\r\n MOUSEDOWN: 'touchstart',\r\n MOUSEMOVE: 'touchmove',\r\n MOUSEUP: 'touchend',\r\n getPageXY: getTouchEventPageXY,\r\n };\r\n})();\r\n\r\nfunction getMouseEventPageXY(e: MouseEvent): [number, number] {\r\n return [e.pageX, e.pageY];\r\n}\r\n\r\nfunction getTouchEventPageXY(e: TouchEvent): [number, number] {\r\n let pageX = 0;\r\n let pageY = 0;\r\n if (e.targetTouches && e.targetTouches.length > 0) {\r\n const touch = e.targetTouches[0];\r\n pageX = touch.pageX;\r\n pageY = touch.pageY;\r\n }\r\n return [pageX, pageY];\r\n}\r\n\r\n/**\r\n * @internal\r\n * A helper class to help manage drag and drop to an HTML element\r\n */\r\nexport default class DragAndDropHelper<TContext, TInitValue> implements Disposable {\r\n private initX: number = 0;\r\n private initY: number = 0;\r\n private initValue: TInitValue | undefined = undefined;\r\n private dndMouse: MouseEventInfo | TouchEventInfo;\r\n\r\n /**\r\n * Create a new instance of DragAndDropHelper class\r\n * @param trigger The trigger element. When user start drag on this element,\r\n * events will be fired to the handler object\r\n * @param context Context object that will be passed to handler function when event is fired,\r\n * so that the handler object knows which element it is triggered from.\r\n * @param onSubmit A callback that will be invoked when event handler in handler object returns true\r\n * @param handler The event handler object, see DragAndDropHandler interface for more information\r\n * @param zoomScale The zoom scale of the editor\r\n * @param forceMobile A boolean to force the use of touch controls for the helper\r\n */\r\n constructor(\r\n private trigger: HTMLElement,\r\n private context: TContext,\r\n private onSubmit: (context: TContext, trigger: HTMLElement) => void,\r\n private handler: DragAndDropHandler<TContext, TInitValue>,\r\n private zoomScale: number,\r\n forceMobile?: boolean\r\n ) {\r\n this.dndMouse = forceMobile ? MOUSE_EVENT_INFO_MOBILE : MOUSE_EVENT_INFO_DESKTOP;\r\n trigger.addEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\r\n }\r\n\r\n /**\r\n * Dispose this object, remove all event listeners that has been attached\r\n */\r\n dispose() {\r\n this.trigger.removeEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\r\n this.removeDocumentEvents();\r\n }\r\n\r\n public get mouseType(): string {\r\n return this.dndMouse == MOUSE_EVENT_INFO_MOBILE ? 'touch' : 'mouse';\r\n }\r\n\r\n private addDocumentEvents() {\r\n const doc = this.trigger.ownerDocument;\r\n doc.addEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\r\n doc.addEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\r\n }\r\n\r\n private removeDocumentEvents() {\r\n const doc = this.trigger.ownerDocument;\r\n doc.removeEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\r\n doc.removeEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\r\n }\r\n\r\n private onMouseDown = (e: Event) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this.addDocumentEvents();\r\n [this.initX, this.initY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\r\n this.initValue = this.handler.onDragStart?.(this.context, e as MouseEvent);\r\n };\r\n\r\n private onMouseMove = (e: Event) => {\r\n e.preventDefault();\r\n const [pageX, pageY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\r\n const deltaX = (pageX - this.initX) / this.zoomScale;\r\n const deltaY = (pageY - this.initY) / this.zoomScale;\r\n if (\r\n this.initValue &&\r\n this.handler.onDragging?.(this.context, e as MouseEvent, this.initValue, deltaX, deltaY)\r\n ) {\r\n this.onSubmit?.(this.context, this.trigger);\r\n }\r\n };\r\n\r\n private onMouseUp = (e: Event) => {\r\n e.preventDefault();\r\n this.removeDocumentEvents();\r\n if (this.handler.onDragEnd?.(this.context, e as MouseEvent, this.initValue)) {\r\n this.onSubmit?.(this.context, this.trigger);\r\n }\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"DragAndDropHelper.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/DragAndDrop/DragAndDropHelper.ts"],"names":[],"mappings":"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","sourcesContent":["import type Disposable from '../Disposable';\nimport type DragAndDropHandler from './DragAndDropHandler';\n\n/**\n * @internal\n */\ninterface MouseEventMoves {\n MOUSEDOWN: string;\n MOUSEMOVE: string;\n MOUSEUP: string;\n}\n\n/**\n * @internal\n */\ninterface MouseEventInfo extends MouseEventMoves {\n getPageXY: (e: MouseEvent) => number[];\n}\n\n/**\n * @internal\n * Compatible mouse event names for different platform\n */\ninterface TouchEventInfo extends MouseEventMoves {\n getPageXY: (e: TouchEvent) => number[];\n}\n\n/**\n * Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers\n */\nconst MOUSE_EVENT_INFO_DESKTOP: MouseEventInfo = (() => {\n return {\n MOUSEDOWN: 'mousedown',\n MOUSEMOVE: 'mousemove',\n MOUSEUP: 'mouseup',\n getPageXY: getMouseEventPageXY,\n };\n})();\n\nconst MOUSE_EVENT_INFO_MOBILE: TouchEventInfo = (() => {\n return {\n MOUSEDOWN: 'touchstart',\n MOUSEMOVE: 'touchmove',\n MOUSEUP: 'touchend',\n getPageXY: getTouchEventPageXY,\n };\n})();\n\nfunction getMouseEventPageXY(e: MouseEvent): [number, number] {\n return [e.pageX, e.pageY];\n}\n\nfunction getTouchEventPageXY(e: TouchEvent): [number, number] {\n let pageX = 0;\n let pageY = 0;\n if (e.targetTouches && e.targetTouches.length > 0) {\n const touch = e.targetTouches[0];\n pageX = touch.pageX;\n pageY = touch.pageY;\n }\n return [pageX, pageY];\n}\n\n/**\n * @internal\n * A helper class to help manage drag and drop to an HTML element\n */\nexport default class DragAndDropHelper<TContext, TInitValue> implements Disposable {\n private initX: number = 0;\n private initY: number = 0;\n private initValue: TInitValue | undefined = undefined;\n private dndMouse: MouseEventInfo | TouchEventInfo;\n\n /**\n * Create a new instance of DragAndDropHelper class\n * @param trigger The trigger element. When user start drag on this element,\n * events will be fired to the handler object\n * @param context Context object that will be passed to handler function when event is fired,\n * so that the handler object knows which element it is triggered from.\n * @param onSubmit A callback that will be invoked when event handler in handler object returns true\n * @param handler The event handler object, see DragAndDropHandler interface for more information\n * @param zoomScale The zoom scale of the editor\n * @param forceMobile A boolean to force the use of touch controls for the helper\n */\n constructor(\n private trigger: HTMLElement,\n private context: TContext,\n private onSubmit: (context: TContext, trigger: HTMLElement) => void,\n private handler: DragAndDropHandler<TContext, TInitValue>,\n private zoomScale: number,\n forceMobile?: boolean\n ) {\n this.dndMouse = forceMobile ? MOUSE_EVENT_INFO_MOBILE : MOUSE_EVENT_INFO_DESKTOP;\n trigger.addEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\n }\n\n /**\n * Dispose this object, remove all event listeners that has been attached\n */\n dispose() {\n this.trigger.removeEventListener(this.dndMouse.MOUSEDOWN, this.onMouseDown);\n this.removeDocumentEvents();\n }\n\n public get mouseType(): string {\n return this.dndMouse == MOUSE_EVENT_INFO_MOBILE ? 'touch' : 'mouse';\n }\n\n private addDocumentEvents() {\n const doc = this.trigger.ownerDocument;\n doc.addEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\n doc.addEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\n }\n\n private removeDocumentEvents() {\n const doc = this.trigger.ownerDocument;\n doc.removeEventListener(this.dndMouse.MOUSEMOVE, this.onMouseMove, true /*useCapture*/);\n doc.removeEventListener(this.dndMouse.MOUSEUP, this.onMouseUp, true /*useCapture*/);\n }\n\n private onMouseDown = (e: Event) => {\n e.preventDefault();\n e.stopPropagation();\n this.addDocumentEvents();\n [this.initX, this.initY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\n this.initValue = this.handler.onDragStart?.(this.context, e as MouseEvent);\n };\n\n private onMouseMove = (e: Event) => {\n e.preventDefault();\n const [pageX, pageY] = this.dndMouse.getPageXY(e as MouseEvent & TouchEvent);\n const deltaX = (pageX - this.initX) / this.zoomScale;\n const deltaY = (pageY - this.initY) / this.zoomScale;\n if (\n this.initValue &&\n this.handler.onDragging?.(this.context, e as MouseEvent, this.initValue, deltaX, deltaY)\n ) {\n this.onSubmit?.(this.context, this.trigger);\n }\n };\n\n private onMouseUp = (e: Event) => {\n e.preventDefault();\n this.removeDocumentEvents();\n if (this.handler.onDragEnd?.(this.context, e as MouseEvent, this.initValue)) {\n this.onSubmit?.(this.context, this.trigger);\n }\n };\n}\n"]}
@@ -1,27 +1,27 @@
1
- import type { Rect } from 'roosterjs-content-model-types';
2
- /**
3
- * Get the intersected Rect of elements provided
4
- *
5
- * @example
6
- * The result of the following Elements Rects would be:
7
- {
8
- top: Element2.top,
9
- bottom: Element1.bottom,
10
- left: Element2.left,
11
- right: Element2.right
12
- }
13
- +-------------------------+
14
- | Element 1 |
15
- | +-----------------+ |
16
- | | Element2 | |
17
- | | | |
18
- | | | |
19
- +-------------------------+
20
- | |
21
- +-----------------+
22
- * @internal
23
- * @param elements Elements to use.
24
- * @param additionalRects additional rects to use
25
- * @returns If the Rect is valid return the rect, if not, return null.
26
- */
27
- export default function getIntersectedRect(elements: HTMLElement[], additionalRects?: Rect[]): Rect | null;
1
+ import type { Rect } from 'roosterjs-content-model-types';
2
+ /**
3
+ * Get the intersected Rect of elements provided
4
+ *
5
+ * @example
6
+ * The result of the following Elements Rects would be:
7
+ {
8
+ top: Element2.top,
9
+ bottom: Element1.bottom,
10
+ left: Element2.left,
11
+ right: Element2.right
12
+ }
13
+ +-------------------------+
14
+ | Element 1 |
15
+ | +-----------------+ |
16
+ | | Element2 | |
17
+ | | | |
18
+ | | | |
19
+ +-------------------------+
20
+ | |
21
+ +-----------------+
22
+ * @internal
23
+ * @param elements Elements to use.
24
+ * @param additionalRects additional rects to use
25
+ * @returns If the Rect is valid return the rect, if not, return null.
26
+ */
27
+ export default function getIntersectedRect(elements: HTMLElement[], additionalRects?: Rect[]): Rect | null;
@@ -1,42 +1,42 @@
1
- import { __read, __spreadArray } from "tslib";
2
- import normalizeRect from './normalizeRect';
3
- /**
4
- * Get the intersected Rect of elements provided
5
- *
6
- * @example
7
- * The result of the following Elements Rects would be:
8
- {
9
- top: Element2.top,
10
- bottom: Element1.bottom,
11
- left: Element2.left,
12
- right: Element2.right
13
- }
14
- +-------------------------+
15
- | Element 1 |
16
- | +-----------------+ |
17
- | | Element2 | |
18
- | | | |
19
- | | | |
20
- +-------------------------+
21
- | |
22
- +-----------------+
23
- * @internal
24
- * @param elements Elements to use.
25
- * @param additionalRects additional rects to use
26
- * @returns If the Rect is valid return the rect, if not, return null.
27
- */
28
- export default function getIntersectedRect(elements, additionalRects) {
29
- if (additionalRects === void 0) { additionalRects = []; }
30
- var rects = elements
31
- .map(function (element) { return normalizeRect(element.getBoundingClientRect()); })
32
- .concat(additionalRects)
33
- .filter(function (element) { return !!element; });
34
- var result = {
35
- top: Math.max.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.top; })), false)),
36
- bottom: Math.min.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.bottom; })), false)),
37
- left: Math.max.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.left; })), false)),
38
- right: Math.min.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.right; })), false)),
39
- };
40
- return result.top < result.bottom && result.left < result.right ? result : null;
41
- }
1
+ import { __read, __spreadArray } from "tslib";
2
+ import normalizeRect from './normalizeRect';
3
+ /**
4
+ * Get the intersected Rect of elements provided
5
+ *
6
+ * @example
7
+ * The result of the following Elements Rects would be:
8
+ {
9
+ top: Element2.top,
10
+ bottom: Element1.bottom,
11
+ left: Element2.left,
12
+ right: Element2.right
13
+ }
14
+ +-------------------------+
15
+ | Element 1 |
16
+ | +-----------------+ |
17
+ | | Element2 | |
18
+ | | | |
19
+ | | | |
20
+ +-------------------------+
21
+ | |
22
+ +-----------------+
23
+ * @internal
24
+ * @param elements Elements to use.
25
+ * @param additionalRects additional rects to use
26
+ * @returns If the Rect is valid return the rect, if not, return null.
27
+ */
28
+ export default function getIntersectedRect(elements, additionalRects) {
29
+ if (additionalRects === void 0) { additionalRects = []; }
30
+ var rects = elements
31
+ .map(function (element) { return normalizeRect(element.getBoundingClientRect()); })
32
+ .concat(additionalRects)
33
+ .filter(function (element) { return !!element; });
34
+ var result = {
35
+ top: Math.max.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.top; })), false)),
36
+ bottom: Math.min.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.bottom; })), false)),
37
+ left: Math.max.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.left; })), false)),
38
+ right: Math.min.apply(Math, __spreadArray([], __read(rects.map(function (r) { return r.right; })), false)),
39
+ };
40
+ return result.top < result.bottom && result.left < result.right ? result : null;
41
+ }
42
42
  //# sourceMappingURL=getIntersectedRect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/Rect/getIntersectedRect.ts"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACtC,QAAuB,EACvB,eAA4B;IAA5B,gCAAA,EAAA,oBAA4B;IAE5B,IAAM,KAAK,GAAG,QAAQ;SACjB,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,aAAa,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAA9C,CAA8C,CAAC;SAC9D,MAAM,CAAC,eAAe,CAAC;SACvB,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAW,CAAC;IAE5C,IAAM,MAAM,GAAS;QACjB,GAAG,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,UAAC;QACvC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC,UAAC;QAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,UAAC;QACzC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,UAAC;KAC9C,CAAC;IAEF,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC","sourcesContent":["import normalizeRect from './normalizeRect';\r\nimport type { Rect } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * Get the intersected Rect of elements provided\r\n *\r\n * @example\r\n * The result of the following Elements Rects would be:\r\n {\r\n top: Element2.top,\r\n bottom: Element1.bottom,\r\n left: Element2.left,\r\n right: Element2.right\r\n }\r\n +-------------------------+\r\n | Element 1 |\r\n | +-----------------+ |\r\n | | Element2 | |\r\n | | | |\r\n | | | |\r\n +-------------------------+\r\n | |\r\n +-----------------+\r\n * @internal\r\n * @param elements Elements to use.\r\n * @param additionalRects additional rects to use\r\n * @returns If the Rect is valid return the rect, if not, return null.\r\n */\r\nexport default function getIntersectedRect(\r\n elements: HTMLElement[],\r\n additionalRects: Rect[] = []\r\n): Rect | null {\r\n const rects = elements\r\n .map(element => normalizeRect(element.getBoundingClientRect()))\r\n .concat(additionalRects)\r\n .filter(element => !!element) as Rect[];\r\n\r\n const result: Rect = {\r\n top: Math.max(...rects.map(r => r.top)),\r\n bottom: Math.min(...rects.map(r => r.bottom)),\r\n left: Math.max(...rects.map(r => r.left)),\r\n right: Math.min(...rects.map(r => r.right)),\r\n };\r\n\r\n return result.top < result.bottom && result.left < result.right ? result : null;\r\n}\r\n"]}
1
+ {"version":3,"file":"getIntersectedRect.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/Rect/getIntersectedRect.ts"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACtC,QAAuB,EACvB,eAA4B;IAA5B,gCAAA,EAAA,oBAA4B;IAE5B,IAAM,KAAK,GAAG,QAAQ;SACjB,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,aAAa,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAA9C,CAA8C,CAAC;SAC9D,MAAM,CAAC,eAAe,CAAC;SACvB,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAW,CAAC;IAE5C,IAAM,MAAM,GAAS;QACjB,GAAG,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,UAAC;QACvC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC,UAAC;QAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,UAAC;QACzC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAR,IAAI,2BAAQ,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,UAAC;KAC9C,CAAC;IAEF,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC","sourcesContent":["import normalizeRect from './normalizeRect';\nimport type { Rect } from 'roosterjs-content-model-types';\n\n/**\n * Get the intersected Rect of elements provided\n *\n * @example\n * The result of the following Elements Rects would be:\n {\n top: Element2.top,\n bottom: Element1.bottom,\n left: Element2.left,\n right: Element2.right\n }\n +-------------------------+\n | Element 1 |\n | +-----------------+ |\n | | Element2 | |\n | | | |\n | | | |\n +-------------------------+\n | |\n +-----------------+\n * @internal\n * @param elements Elements to use.\n * @param additionalRects additional rects to use\n * @returns If the Rect is valid return the rect, if not, return null.\n */\nexport default function getIntersectedRect(\n elements: HTMLElement[],\n additionalRects: Rect[] = []\n): Rect | null {\n const rects = elements\n .map(element => normalizeRect(element.getBoundingClientRect()))\n .concat(additionalRects)\n .filter(element => !!element) as Rect[];\n\n const result: Rect = {\n top: Math.max(...rects.map(r => r.top)),\n bottom: Math.min(...rects.map(r => r.bottom)),\n left: Math.max(...rects.map(r => r.left)),\n right: Math.min(...rects.map(r => r.right)),\n };\n\n return result.top < result.bottom && result.left < result.right ? result : null;\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { Rect } from 'roosterjs-content-model-types';
2
- /**
3
- * @internal
4
- * A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p
5
- * We validate that and only return a rect when the passed in ClientRect is valid
6
- */
7
- export default function normalizeRect(clientRect: DOMRect): Rect | null;
1
+ import type { Rect } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ * A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p
5
+ * We validate that and only return a rect when the passed in ClientRect is valid
6
+ */
7
+ export default function normalizeRect(clientRect: DOMRect): Rect | null;
@@ -1,17 +1,17 @@
1
- /**
2
- * @internal
3
- * A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p
4
- * We validate that and only return a rect when the passed in ClientRect is valid
5
- */
6
- export default function normalizeRect(clientRect) {
7
- var _a = clientRect || { left: 0, right: 0, top: 0, bottom: 0 }, left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom;
8
- return left === 0 && right === 0 && top === 0 && bottom === 0
9
- ? null
10
- : {
11
- left: Math.round(left),
12
- right: Math.round(right),
13
- top: Math.round(top),
14
- bottom: Math.round(bottom),
15
- };
16
- }
1
+ /**
2
+ * @internal
3
+ * A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p
4
+ * We validate that and only return a rect when the passed in ClientRect is valid
5
+ */
6
+ export default function normalizeRect(clientRect) {
7
+ var _a = clientRect || { left: 0, right: 0, top: 0, bottom: 0 }, left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom;
8
+ return left === 0 && right === 0 && top === 0 && bottom === 0
9
+ ? null
10
+ : {
11
+ left: Math.round(left),
12
+ right: Math.round(right),
13
+ top: Math.round(top),
14
+ bottom: Math.round(bottom),
15
+ };
16
+ }
17
17
  //# sourceMappingURL=normalizeRect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeRect.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/Rect/normalizeRect.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,UAAmB;IAC/C,IAAA,KACF,UAAU,IAAa,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAD3D,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,GAAG,SAAA,EAAE,MAAM,YACmC,CAAC;IACpE,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC;QACzD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC;YACI,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YACxB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;SAC7B,CAAC;AACZ,CAAC","sourcesContent":["import type { Rect } from 'roosterjs-content-model-types';\r\n\r\n/**\r\n * @internal\r\n * A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p\r\n * We validate that and only return a rect when the passed in ClientRect is valid\r\n */\r\nexport default function normalizeRect(clientRect: DOMRect): Rect | null {\r\n const { left, right, top, bottom } =\r\n clientRect || <DOMRect>{ left: 0, right: 0, top: 0, bottom: 0 };\r\n return left === 0 && right === 0 && top === 0 && bottom === 0\r\n ? null\r\n : {\r\n left: Math.round(left),\r\n right: Math.round(right),\r\n top: Math.round(top),\r\n bottom: Math.round(bottom),\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"normalizeRect.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/pluginUtils/Rect/normalizeRect.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,UAAmB;IAC/C,IAAA,KACF,UAAU,IAAa,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAD3D,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,GAAG,SAAA,EAAE,MAAM,YACmC,CAAC;IACpE,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC;QACzD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC;YACI,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YACxB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;SAC7B,CAAC;AACZ,CAAC","sourcesContent":["import type { Rect } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p\n * We validate that and only return a rect when the passed in ClientRect is valid\n */\nexport default function normalizeRect(clientRect: DOMRect): Rect | null {\n const { left, right, top, bottom } =\n clientRect || <DOMRect>{ left: 0, right: 0, top: 0, bottom: 0 };\n return left === 0 && right === 0 && top === 0 && bottom === 0\n ? null\n : {\n left: Math.round(left),\n right: Math.round(right),\n top: Math.round(top),\n bottom: Math.round(bottom),\n };\n}\n"]}
package/package.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "description": "Content Model for roosterjs (Under development)",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.1",
6
- "roosterjs-content-model-core": "^0.26.0",
7
- "roosterjs-content-model-dom": "^0.26.0",
8
- "roosterjs-content-model-types": "^0.26.0",
9
- "roosterjs-content-model-api": "^0.26.0"
6
+ "roosterjs-content-model-core": "^0.26.1",
7
+ "roosterjs-content-model-dom": "^0.26.1",
8
+ "roosterjs-content-model-types": "^0.26.1",
9
+ "roosterjs-content-model-api": "^0.26.1"
10
10
  },
11
- "version": "0.26.0",
11
+ "version": "0.26.1",
12
12
  "main": "./lib/index.js",
13
13
  "typings": "./lib/index.d.ts",
14
14
  "module": "./lib-mjs/index.js",