roosterjs-content-model-plugins 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (469) hide show
  1. package/lib/autoFormat/AutoFormatPlugin.d.ts +53 -0
  2. package/lib/autoFormat/AutoFormatPlugin.js +81 -0
  3. package/lib/autoFormat/AutoFormatPlugin.js.map +1 -0
  4. package/lib/autoFormat/keyboardListTrigger.d.ts +5 -0
  5. package/lib/autoFormat/keyboardListTrigger.js +46 -0
  6. package/lib/autoFormat/keyboardListTrigger.js.map +1 -0
  7. package/lib/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
  8. package/lib/autoFormat/utils/convertAlphaToDecimals.js +23 -0
  9. package/lib/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
  10. package/lib/autoFormat/utils/getIndex.d.ts +4 -0
  11. package/lib/autoFormat/utils/getIndex.js +14 -0
  12. package/lib/autoFormat/utils/getIndex.js.map +1 -0
  13. package/lib/autoFormat/utils/getListTypeStyle.d.ts +14 -0
  14. package/lib/autoFormat/utils/getListTypeStyle.js +88 -0
  15. package/lib/autoFormat/utils/getListTypeStyle.js.map +1 -0
  16. package/lib/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
  17. package/lib/autoFormat/utils/getNumberingListStyle.js +154 -0
  18. package/lib/autoFormat/utils/getNumberingListStyle.js.map +1 -0
  19. package/{lib-mjs/edit/ContentModelEditPlugin.d.ts → lib/edit/EditPlugin.d.ts} +39 -35
  20. package/lib/edit/EditPlugin.js +129 -0
  21. package/lib/edit/EditPlugin.js.map +1 -0
  22. package/lib/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  23. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js +22 -22
  24. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  25. package/lib/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  26. package/lib/edit/deleteSteps/deleteCollapsedSelection.js +93 -93
  27. package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  28. package/lib/edit/deleteSteps/deleteList.d.ts +5 -5
  29. package/lib/edit/deleteSteps/deleteList.js +23 -23
  30. package/lib/edit/deleteSteps/deleteList.js.map +1 -1
  31. package/lib/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  32. package/lib/edit/deleteSteps/deleteWordSelection.js +173 -173
  33. package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  34. package/lib/edit/handleKeyboardEventCommon.d.ts +14 -14
  35. package/lib/edit/handleKeyboardEventCommon.js +54 -54
  36. package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
  37. package/lib/edit/inputSteps/handleEnterOnList.d.ts +5 -0
  38. package/lib/edit/inputSteps/handleEnterOnList.js +68 -0
  39. package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -0
  40. package/lib/edit/keyboardDelete.d.ts +9 -8
  41. package/lib/edit/keyboardDelete.js +71 -74
  42. package/lib/edit/keyboardDelete.js.map +1 -1
  43. package/lib/edit/keyboardInput.d.ts +5 -5
  44. package/lib/edit/keyboardInput.js +58 -50
  45. package/lib/edit/keyboardInput.js.map +1 -1
  46. package/lib/edit/keyboardTab.d.ts +5 -0
  47. package/lib/edit/keyboardTab.js +35 -0
  48. package/lib/edit/keyboardTab.js.map +1 -0
  49. package/lib/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  50. package/lib/edit/utils/getLeafSiblingBlock.js +75 -75
  51. package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
  52. package/lib/index.d.ts +3 -3
  53. package/lib/index.js +9 -9
  54. package/lib/index.js.map +1 -1
  55. package/lib/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
  56. package/lib/paste/Excel/processPastedContentFromExcel.js +82 -82
  57. package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  58. package/{lib-mjs/paste/ContentModelPastePlugin.d.ts → lib/paste/PastePlugin.d.ts} +43 -43
  59. package/lib/paste/{ContentModelPastePlugin.js → PastePlugin.js} +131 -132
  60. package/lib/paste/PastePlugin.js.map +1 -0
  61. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  62. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js +19 -19
  63. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  64. package/lib/paste/WacComponents/constants.d.ts +48 -48
  65. package/lib/paste/WacComponents/constants.js +62 -62
  66. package/lib/paste/WacComponents/constants.js.map +1 -1
  67. package/lib/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  68. package/lib/paste/WacComponents/processPastedContentWacComponents.js +188 -188
  69. package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  70. package/lib/paste/WordDesktop/WordMetadata.d.ts +9 -9
  71. package/lib/paste/WordDesktop/WordMetadata.js +2 -2
  72. package/lib/paste/WordDesktop/WordMetadata.js.map +1 -1
  73. package/lib/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
  74. package/lib/paste/WordDesktop/getStyleMetadata.js +78 -78
  75. package/lib/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  76. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
  77. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +58 -58
  78. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  79. package/lib/paste/WordDesktop/processWordComments.d.ts +7 -7
  80. package/lib/paste/WordDesktop/processWordComments.js +21 -21
  81. package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
  82. package/lib/paste/WordDesktop/processWordLists.d.ts +11 -11
  83. package/lib/paste/WordDesktop/processWordLists.js +179 -179
  84. package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
  85. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
  86. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js +13 -13
  87. package/lib/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  88. package/lib/paste/pasteSourceValidations/constants.d.ts +17 -17
  89. package/lib/paste/pasteSourceValidations/constants.js +20 -20
  90. package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
  91. package/lib/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  92. package/lib/paste/pasteSourceValidations/documentContainWacElements.js +15 -15
  93. package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  94. package/lib/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  95. package/lib/paste/pasteSourceValidations/getPasteSource.js +43 -43
  96. package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  97. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  98. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js +17 -17
  99. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  100. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  101. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js +19 -19
  102. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  103. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  104. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js +15 -15
  105. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  106. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  107. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +15 -15
  108. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  109. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  110. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js +19 -19
  111. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  112. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  113. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js +18 -18
  114. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  115. package/lib/paste/utils/addParser.d.ts +5 -5
  116. package/lib/paste/utils/addParser.js +16 -16
  117. package/lib/paste/utils/addParser.js.map +1 -1
  118. package/lib/paste/utils/deprecatedColorParser.d.ts +5 -5
  119. package/lib/paste/utils/deprecatedColorParser.js +19 -19
  120. package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
  121. package/lib/paste/utils/getStyles.d.ts +6 -6
  122. package/lib/paste/utils/getStyles.js +22 -22
  123. package/lib/paste/utils/getStyles.js.map +1 -1
  124. package/lib/paste/utils/linkParser.d.ts +5 -5
  125. package/lib/paste/utils/linkParser.js +27 -27
  126. package/lib/paste/utils/linkParser.js.map +1 -1
  127. package/lib/paste/utils/setProcessor.d.ts +5 -5
  128. package/lib/paste/utils/setProcessor.js +13 -13
  129. package/lib/paste/utils/setProcessor.js.map +1 -1
  130. package/lib/pluginUtils/CreateElement/CreateElementData.d.ts +35 -0
  131. package/lib/pluginUtils/CreateElement/CreateElementData.js +3 -0
  132. package/lib/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
  133. package/lib/pluginUtils/CreateElement/createElement.d.ts +9 -0
  134. package/lib/pluginUtils/CreateElement/createElement.js +51 -0
  135. package/lib/pluginUtils/CreateElement/createElement.js.map +1 -0
  136. package/lib/pluginUtils/Disposable.d.ts +10 -0
  137. package/lib/pluginUtils/Disposable.js +3 -0
  138. package/lib/pluginUtils/Disposable.js.map +1 -0
  139. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
  140. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js +3 -0
  141. package/lib/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
  142. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
  143. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js +120 -0
  144. package/lib/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
  145. package/lib/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
  146. package/lib/pluginUtils/Rect/getIntersectedRect.js +45 -0
  147. package/lib/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
  148. package/lib/pluginUtils/Rect/normalizeRect.d.ts +7 -0
  149. package/lib/pluginUtils/Rect/normalizeRect.js +20 -0
  150. package/lib/pluginUtils/Rect/normalizeRect.js.map +1 -0
  151. package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +53 -0
  152. package/lib-amd/autoFormat/AutoFormatPlugin.js +82 -0
  153. package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -0
  154. package/lib-amd/autoFormat/keyboardListTrigger.d.ts +5 -0
  155. package/lib-amd/autoFormat/keyboardListTrigger.js +44 -0
  156. package/lib-amd/autoFormat/keyboardListTrigger.js.map +1 -0
  157. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
  158. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js +25 -0
  159. package/lib-amd/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
  160. package/lib-amd/autoFormat/utils/getIndex.d.ts +4 -0
  161. package/lib-amd/autoFormat/utils/getIndex.js +15 -0
  162. package/lib-amd/autoFormat/utils/getIndex.js.map +1 -0
  163. package/lib-amd/autoFormat/utils/getListTypeStyle.d.ts +14 -0
  164. package/lib-amd/autoFormat/utils/getListTypeStyle.js +87 -0
  165. package/lib-amd/autoFormat/utils/getListTypeStyle.js.map +1 -0
  166. package/lib-amd/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
  167. package/lib-amd/autoFormat/utils/getNumberingListStyle.js +154 -0
  168. package/lib-amd/autoFormat/utils/getNumberingListStyle.js.map +1 -0
  169. package/lib-amd/edit/{ContentModelEditPlugin.d.ts → EditPlugin.d.ts} +39 -35
  170. package/lib-amd/edit/EditPlugin.js +128 -0
  171. package/lib-amd/edit/EditPlugin.js.map +1 -0
  172. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  173. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js +23 -23
  174. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  175. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  176. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +92 -92
  177. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  178. package/lib-amd/edit/deleteSteps/deleteList.d.ts +5 -5
  179. package/lib-amd/edit/deleteSteps/deleteList.js +24 -24
  180. package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
  181. package/lib-amd/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  182. package/lib-amd/edit/deleteSteps/deleteWordSelection.js +172 -172
  183. package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  184. package/lib-amd/edit/handleKeyboardEventCommon.d.ts +14 -14
  185. package/lib-amd/edit/handleKeyboardEventCommon.js +55 -55
  186. package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
  187. package/lib-amd/edit/inputSteps/handleEnterOnList.d.ts +5 -0
  188. package/lib-amd/edit/inputSteps/handleEnterOnList.js +67 -0
  189. package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -0
  190. package/lib-amd/edit/keyboardDelete.d.ts +9 -8
  191. package/lib-amd/edit/keyboardDelete.js +66 -69
  192. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  193. package/lib-amd/edit/keyboardInput.d.ts +5 -5
  194. package/lib-amd/edit/keyboardInput.js +57 -50
  195. package/lib-amd/edit/keyboardInput.js.map +1 -1
  196. package/lib-amd/edit/keyboardTab.d.ts +5 -0
  197. package/lib-amd/edit/keyboardTab.js +35 -0
  198. package/lib-amd/edit/keyboardTab.js.map +1 -0
  199. package/lib-amd/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  200. package/lib-amd/edit/utils/getLeafSiblingBlock.js +75 -75
  201. package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
  202. package/lib-amd/index.d.ts +3 -3
  203. package/lib-amd/index.js +8 -8
  204. package/lib-amd/index.js.map +1 -1
  205. package/lib-amd/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
  206. package/lib-amd/paste/Excel/processPastedContentFromExcel.js +80 -80
  207. package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  208. package/{lib/paste/ContentModelPastePlugin.d.ts → lib-amd/paste/PastePlugin.d.ts} +43 -43
  209. package/lib-amd/paste/{ContentModelPastePlugin.js → PastePlugin.js} +123 -124
  210. package/lib-amd/paste/PastePlugin.js.map +1 -0
  211. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  212. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js +20 -20
  213. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  214. package/lib-amd/paste/WacComponents/constants.d.ts +48 -48
  215. package/lib-amd/paste/WacComponents/constants.js +63 -63
  216. package/lib-amd/paste/WacComponents/constants.js.map +1 -1
  217. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  218. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +185 -185
  219. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  220. package/lib-amd/paste/WordDesktop/WordMetadata.d.ts +9 -9
  221. package/lib-amd/paste/WordDesktop/WordMetadata.js +4 -4
  222. package/lib-amd/paste/WordDesktop/WordMetadata.js.map +1 -1
  223. package/lib-amd/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
  224. package/lib-amd/paste/WordDesktop/getStyleMetadata.js +78 -78
  225. package/lib-amd/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  226. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
  227. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +53 -53
  228. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  229. package/lib-amd/paste/WordDesktop/processWordComments.d.ts +7 -7
  230. package/lib-amd/paste/WordDesktop/processWordComments.js +22 -22
  231. package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
  232. package/lib-amd/paste/WordDesktop/processWordLists.d.ts +11 -11
  233. package/lib-amd/paste/WordDesktop/processWordLists.js +177 -177
  234. package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
  235. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
  236. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js +15 -15
  237. package/lib-amd/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  238. package/lib-amd/paste/pasteSourceValidations/constants.d.ts +17 -17
  239. package/lib-amd/paste/pasteSourceValidations/constants.js +22 -22
  240. package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
  241. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  242. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js +16 -16
  243. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  244. package/lib-amd/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  245. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js +38 -38
  246. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  247. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  248. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js +18 -18
  249. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  250. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  251. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js +20 -20
  252. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  253. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  254. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js +16 -16
  255. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  256. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  257. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +16 -16
  258. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  259. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  260. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js +20 -20
  261. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  262. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  263. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js +20 -20
  264. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  265. package/lib-amd/paste/utils/addParser.d.ts +5 -5
  266. package/lib-amd/paste/utils/addParser.js +18 -18
  267. package/lib-amd/paste/utils/addParser.js.map +1 -1
  268. package/lib-amd/paste/utils/deprecatedColorParser.d.ts +5 -5
  269. package/lib-amd/paste/utils/deprecatedColorParser.js +20 -20
  270. package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
  271. package/lib-amd/paste/utils/getStyles.d.ts +6 -6
  272. package/lib-amd/paste/utils/getStyles.js +24 -24
  273. package/lib-amd/paste/utils/getStyles.js.map +1 -1
  274. package/lib-amd/paste/utils/linkParser.d.ts +5 -5
  275. package/lib-amd/paste/utils/linkParser.js +28 -28
  276. package/lib-amd/paste/utils/linkParser.js.map +1 -1
  277. package/lib-amd/paste/utils/setProcessor.d.ts +5 -5
  278. package/lib-amd/paste/utils/setProcessor.js +15 -15
  279. package/lib-amd/paste/utils/setProcessor.js.map +1 -1
  280. package/lib-amd/pluginUtils/CreateElement/CreateElementData.d.ts +35 -0
  281. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js +5 -0
  282. package/lib-amd/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
  283. package/lib-amd/pluginUtils/CreateElement/createElement.d.ts +9 -0
  284. package/lib-amd/pluginUtils/CreateElement/createElement.js +52 -0
  285. package/lib-amd/pluginUtils/CreateElement/createElement.js.map +1 -0
  286. package/lib-amd/pluginUtils/Disposable.d.ts +10 -0
  287. package/lib-amd/pluginUtils/Disposable.js +5 -0
  288. package/lib-amd/pluginUtils/Disposable.js.map +1 -0
  289. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
  290. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js +5 -0
  291. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
  292. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
  293. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js +121 -0
  294. package/lib-amd/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
  295. package/lib-amd/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
  296. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js +45 -0
  297. package/lib-amd/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
  298. package/lib-amd/pluginUtils/Rect/normalizeRect.d.ts +7 -0
  299. package/lib-amd/pluginUtils/Rect/normalizeRect.js +22 -0
  300. package/lib-amd/pluginUtils/Rect/normalizeRect.js.map +1 -0
  301. package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +53 -0
  302. package/lib-mjs/autoFormat/AutoFormatPlugin.js +78 -0
  303. package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -0
  304. package/lib-mjs/autoFormat/keyboardListTrigger.d.ts +5 -0
  305. package/lib-mjs/autoFormat/keyboardListTrigger.js +42 -0
  306. package/lib-mjs/autoFormat/keyboardListTrigger.js.map +1 -0
  307. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.d.ts +7 -0
  308. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js +19 -0
  309. package/lib-mjs/autoFormat/utils/convertAlphaToDecimals.js.map +1 -0
  310. package/lib-mjs/autoFormat/utils/getIndex.d.ts +4 -0
  311. package/lib-mjs/autoFormat/utils/getIndex.js +10 -0
  312. package/lib-mjs/autoFormat/utils/getIndex.js.map +1 -0
  313. package/lib-mjs/autoFormat/utils/getListTypeStyle.d.ts +14 -0
  314. package/lib-mjs/autoFormat/utils/getListTypeStyle.js +84 -0
  315. package/lib-mjs/autoFormat/utils/getListTypeStyle.js.map +1 -0
  316. package/lib-mjs/autoFormat/utils/getNumberingListStyle.d.ts +4 -0
  317. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js +150 -0
  318. package/lib-mjs/autoFormat/utils/getNumberingListStyle.js.map +1 -0
  319. package/{lib/edit/ContentModelEditPlugin.d.ts → lib-mjs/edit/EditPlugin.d.ts} +39 -35
  320. package/lib-mjs/edit/EditPlugin.js +126 -0
  321. package/lib-mjs/edit/EditPlugin.js.map +1 -0
  322. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  323. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js +18 -18
  324. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  325. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  326. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +90 -90
  327. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  328. package/lib-mjs/edit/deleteSteps/deleteList.d.ts +5 -5
  329. package/lib-mjs/edit/deleteSteps/deleteList.js +19 -19
  330. package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
  331. package/lib-mjs/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  332. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js +170 -170
  333. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  334. package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +14 -14
  335. package/lib-mjs/edit/handleKeyboardEventCommon.js +48 -48
  336. package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
  337. package/lib-mjs/edit/inputSteps/handleEnterOnList.d.ts +5 -0
  338. package/lib-mjs/edit/inputSteps/handleEnterOnList.js +64 -0
  339. package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -0
  340. package/lib-mjs/edit/keyboardDelete.d.ts +9 -8
  341. package/lib-mjs/edit/keyboardDelete.js +67 -70
  342. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  343. package/lib-mjs/edit/keyboardInput.d.ts +5 -5
  344. package/lib-mjs/edit/keyboardInput.js +54 -46
  345. package/lib-mjs/edit/keyboardInput.js.map +1 -1
  346. package/lib-mjs/edit/keyboardTab.d.ts +5 -0
  347. package/lib-mjs/edit/keyboardTab.js +31 -0
  348. package/lib-mjs/edit/keyboardTab.js.map +1 -0
  349. package/lib-mjs/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  350. package/lib-mjs/edit/utils/getLeafSiblingBlock.js +71 -71
  351. package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
  352. package/lib-mjs/index.d.ts +3 -3
  353. package/lib-mjs/index.js +3 -3
  354. package/lib-mjs/index.js.map +1 -1
  355. package/lib-mjs/paste/Excel/processPastedContentFromExcel.d.ts +12 -12
  356. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +77 -77
  357. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  358. package/{lib-amd/paste/ContentModelPastePlugin.d.ts → lib-mjs/paste/PastePlugin.d.ts} +43 -43
  359. package/lib-mjs/paste/{ContentModelPastePlugin.js → PastePlugin.js} +128 -129
  360. package/lib-mjs/paste/PastePlugin.js.map +1 -0
  361. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  362. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js +15 -15
  363. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  364. package/lib-mjs/paste/WacComponents/constants.d.ts +48 -48
  365. package/lib-mjs/paste/WacComponents/constants.js +59 -59
  366. package/lib-mjs/paste/WacComponents/constants.js.map +1 -1
  367. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  368. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +184 -184
  369. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  370. package/lib-mjs/paste/WordDesktop/WordMetadata.d.ts +9 -9
  371. package/lib-mjs/paste/WordDesktop/WordMetadata.js +1 -1
  372. package/lib-mjs/paste/WordDesktop/WordMetadata.js.map +1 -1
  373. package/lib-mjs/paste/WordDesktop/getStyleMetadata.d.ts +23 -23
  374. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js +75 -75
  375. package/lib-mjs/paste/WordDesktop/getStyleMetadata.js.map +1 -1
  376. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +7 -7
  377. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +54 -54
  378. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  379. package/lib-mjs/paste/WordDesktop/processWordComments.d.ts +7 -7
  380. package/lib-mjs/paste/WordDesktop/processWordComments.js +17 -17
  381. package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
  382. package/lib-mjs/paste/WordDesktop/processWordLists.d.ts +11 -11
  383. package/lib-mjs/paste/WordDesktop/processWordLists.js +175 -175
  384. package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
  385. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.d.ts +5 -5
  386. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js +9 -9
  387. package/lib-mjs/paste/WordDesktop/removeNegativeTextIndentParser.js.map +1 -1
  388. package/lib-mjs/paste/pasteSourceValidations/constants.d.ts +17 -17
  389. package/lib-mjs/paste/pasteSourceValidations/constants.js +17 -17
  390. package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
  391. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  392. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js +11 -11
  393. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  394. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  395. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js +39 -39
  396. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  397. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  398. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js +13 -13
  399. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  400. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  401. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js +15 -15
  402. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  403. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  404. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js +11 -11
  405. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  406. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  407. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +11 -11
  408. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  409. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  410. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js +15 -15
  411. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  412. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  413. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js +14 -14
  414. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  415. package/lib-mjs/paste/utils/addParser.d.ts +5 -5
  416. package/lib-mjs/paste/utils/addParser.js +13 -13
  417. package/lib-mjs/paste/utils/addParser.js.map +1 -1
  418. package/lib-mjs/paste/utils/deprecatedColorParser.d.ts +5 -5
  419. package/lib-mjs/paste/utils/deprecatedColorParser.js +15 -15
  420. package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
  421. package/lib-mjs/paste/utils/getStyles.d.ts +6 -6
  422. package/lib-mjs/paste/utils/getStyles.js +18 -18
  423. package/lib-mjs/paste/utils/getStyles.js.map +1 -1
  424. package/lib-mjs/paste/utils/linkParser.d.ts +5 -5
  425. package/lib-mjs/paste/utils/linkParser.js +23 -23
  426. package/lib-mjs/paste/utils/linkParser.js.map +1 -1
  427. package/lib-mjs/paste/utils/setProcessor.d.ts +5 -5
  428. package/lib-mjs/paste/utils/setProcessor.js +9 -9
  429. package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
  430. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.d.ts +35 -0
  431. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js +2 -0
  432. package/lib-mjs/pluginUtils/CreateElement/CreateElementData.js.map +1 -0
  433. package/lib-mjs/pluginUtils/CreateElement/createElement.d.ts +9 -0
  434. package/lib-mjs/pluginUtils/CreateElement/createElement.js +48 -0
  435. package/lib-mjs/pluginUtils/CreateElement/createElement.js.map +1 -0
  436. package/lib-mjs/pluginUtils/Disposable.d.ts +10 -0
  437. package/lib-mjs/pluginUtils/Disposable.js +2 -0
  438. package/lib-mjs/pluginUtils/Disposable.js.map +1 -0
  439. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.d.ts +45 -0
  440. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js +2 -0
  441. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHandler.js.map +1 -0
  442. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.d.ts +39 -0
  443. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js +118 -0
  444. package/lib-mjs/pluginUtils/DragAndDrop/DragAndDropHelper.js.map +1 -0
  445. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.d.ts +27 -0
  446. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js +42 -0
  447. package/lib-mjs/pluginUtils/Rect/getIntersectedRect.js.map +1 -0
  448. package/lib-mjs/pluginUtils/Rect/normalizeRect.d.ts +7 -0
  449. package/lib-mjs/pluginUtils/Rect/normalizeRect.js +17 -0
  450. package/lib-mjs/pluginUtils/Rect/normalizeRect.js.map +1 -0
  451. package/package.json +5 -7
  452. package/lib/edit/ContentModelEditPlugin.js +0 -75
  453. package/lib/edit/ContentModelEditPlugin.js.map +0 -1
  454. package/lib/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
  455. package/lib/entityDelimiter/EntityDelimiterPlugin.js +0 -257
  456. package/lib/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
  457. package/lib/paste/ContentModelPastePlugin.js.map +0 -1
  458. package/lib-amd/edit/ContentModelEditPlugin.js +0 -75
  459. package/lib-amd/edit/ContentModelEditPlugin.js.map +0 -1
  460. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
  461. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js +0 -256
  462. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
  463. package/lib-amd/paste/ContentModelPastePlugin.js.map +0 -1
  464. package/lib-mjs/edit/ContentModelEditPlugin.js +0 -72
  465. package/lib-mjs/edit/ContentModelEditPlugin.js.map +0 -1
  466. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.d.ts +0 -35
  467. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js +0 -253
  468. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js.map +0 -1
  469. package/lib-mjs/paste/ContentModelPastePlugin.js.map +0 -1
@@ -1,76 +1,76 @@
1
- import { __read } from "tslib";
2
- import { getObjectKeys } from 'roosterjs-content-model-dom';
3
- var FORMATING_REGEX = /[\n\t'{}"]+/g;
4
- /**
5
- * @internal
6
- * Word Desktop content has a style tag that contains data for the lists.
7
- * So this function query that style tag and extract the data from the innerHTML, since it is not available from the HTMLStyleElement.sheet.
8
- *
9
- * The format is like:
10
- * example of style element content
11
- * @list l0:level1 {
12
- * styleTag: styleValue;
13
- * ...
14
- * }
15
- *
16
- * To extract the data:
17
- * 1. Substring the value of the style selector, using @ index and { index
18
- * 2. Substring the value of the style rules by Substring the content between { and }
19
- * 3. Split the value of the rules using ; as separator { styleTag: styleValue; styleTag1: StyleValue1 } = ['styleTag: styleValue', 'styleTag1: StyleValue1']
20
- * 4. Split the value of the rule using : as separator: styleTag: styleValue = [styleTag, styleValue]
21
- * 5. Save data in record and only use the required information.
22
- *
23
- */
24
- export default function getStyleMetadata(ev, trustedHTMLHandler) {
25
- var metadataMap = new Map();
26
- var doc = new DOMParser().parseFromString(trustedHTMLHandler(ev.htmlBefore), 'text/html');
27
- var styles = doc.querySelectorAll('style');
28
- styles.forEach(function (style) {
29
- var text = (style === null || style === void 0 ? void 0 : style.innerHTML.trim()) || '';
30
- var index = 0;
31
- var _loop_1 = function () {
32
- var indexAt = text.indexOf('@', index + 1);
33
- var indexCurlyEnd = text.indexOf('}', indexAt);
34
- var indexCurlyStart = text.indexOf('{', indexAt);
35
- index = indexAt;
36
- // 1.
37
- var metadataName = text
38
- .substring(indexAt + 1, indexCurlyStart)
39
- .replace(FORMATING_REGEX, '')
40
- .replace('list', '')
41
- .trimRight()
42
- .trimLeft();
43
- // 2.
44
- var dataName = text
45
- .substring(indexCurlyStart, indexCurlyEnd + 1)
46
- .trimLeft()
47
- .trimRight();
48
- var record = {};
49
- // 3.
50
- var entries = dataName.split(';');
51
- entries.forEach(function (entry) {
52
- // 4.
53
- var _a = __read(entry.split(':'), 2), key = _a[0], value = _a[1];
54
- if (key && value) {
55
- var formatedKey = key.replace(FORMATING_REGEX, '').trimRight().trimLeft();
56
- var formatedValue = value.replace(FORMATING_REGEX, '').trimRight().trimLeft();
57
- // 5.
58
- record[formatedKey] = formatedValue;
59
- }
60
- });
61
- var data = {
62
- 'mso-level-number-format': record['mso-level-number-format'],
63
- 'mso-level-start-at': record['mso-level-start-at'] || '1',
64
- 'mso-level-text': record['mso-level-text'],
65
- };
66
- if (getObjectKeys(data).some(function (key) { return !!data[key]; })) {
67
- metadataMap.set(metadataName, data);
68
- }
69
- };
70
- while (index >= 0) {
71
- _loop_1();
72
- }
73
- });
74
- return metadataMap;
75
- }
1
+ import { __read } from "tslib";
2
+ import { getObjectKeys } from 'roosterjs-content-model-dom';
3
+ var FORMATING_REGEX = /[\n\t'{}"]+/g;
4
+ /**
5
+ * @internal
6
+ * Word Desktop content has a style tag that contains data for the lists.
7
+ * So this function query that style tag and extract the data from the innerHTML, since it is not available from the HTMLStyleElement.sheet.
8
+ *
9
+ * The format is like:
10
+ * example of style element content
11
+ * @list l0:level1 {
12
+ * styleTag: styleValue;
13
+ * ...
14
+ * }
15
+ *
16
+ * To extract the data:
17
+ * 1. Substring the value of the style selector, using @ index and { index
18
+ * 2. Substring the value of the style rules by Substring the content between { and }
19
+ * 3. Split the value of the rules using ; as separator { styleTag: styleValue; styleTag1: StyleValue1 } = ['styleTag: styleValue', 'styleTag1: StyleValue1']
20
+ * 4. Split the value of the rule using : as separator: styleTag: styleValue = [styleTag, styleValue]
21
+ * 5. Save data in record and only use the required information.
22
+ *
23
+ */
24
+ export default function getStyleMetadata(ev, trustedHTMLHandler) {
25
+ var metadataMap = new Map();
26
+ var doc = new DOMParser().parseFromString(trustedHTMLHandler(ev.htmlBefore), 'text/html');
27
+ var styles = doc.querySelectorAll('style');
28
+ styles.forEach(function (style) {
29
+ var text = (style === null || style === void 0 ? void 0 : style.innerHTML.trim()) || '';
30
+ var index = 0;
31
+ var _loop_1 = function () {
32
+ var indexAt = text.indexOf('@', index + 1);
33
+ var indexCurlyEnd = text.indexOf('}', indexAt);
34
+ var indexCurlyStart = text.indexOf('{', indexAt);
35
+ index = indexAt;
36
+ // 1.
37
+ var metadataName = text
38
+ .substring(indexAt + 1, indexCurlyStart)
39
+ .replace(FORMATING_REGEX, '')
40
+ .replace('list', '')
41
+ .trimRight()
42
+ .trimLeft();
43
+ // 2.
44
+ var dataName = text
45
+ .substring(indexCurlyStart, indexCurlyEnd + 1)
46
+ .trimLeft()
47
+ .trimRight();
48
+ var record = {};
49
+ // 3.
50
+ var entries = dataName.split(';');
51
+ entries.forEach(function (entry) {
52
+ // 4.
53
+ var _a = __read(entry.split(':'), 2), key = _a[0], value = _a[1];
54
+ if (key && value) {
55
+ var formatedKey = key.replace(FORMATING_REGEX, '').trimRight().trimLeft();
56
+ var formatedValue = value.replace(FORMATING_REGEX, '').trimRight().trimLeft();
57
+ // 5.
58
+ record[formatedKey] = formatedValue;
59
+ }
60
+ });
61
+ var data = {
62
+ 'mso-level-number-format': record['mso-level-number-format'],
63
+ 'mso-level-start-at': record['mso-level-start-at'] || '1',
64
+ 'mso-level-text': record['mso-level-text'],
65
+ };
66
+ if (getObjectKeys(data).some(function (key) { return !!data[key]; })) {
67
+ metadataMap.set(metadataName, data);
68
+ }
69
+ };
70
+ while (index >= 0) {
71
+ _loop_1();
72
+ }
73
+ });
74
+ return metadataMap;
75
+ }
76
76
  //# sourceMappingURL=getStyleMetadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getStyleMetadata.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/getStyleMetadata.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,C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jB,IAAM,MAAM,GAA2B,EAAE,CAAC;YAE1C,KAAK;YACL,IAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,CAAC,OAAO,CAAC,UAAA,KAAK;gBACjB,KAAK;gBACC,IAAA,KAAA,OAAe,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAA,EAA9B,GAAG,QAAA,EAAE,KAAK,QAAoB,CAAC;gBACtC,IAAI,GAAG,IAAI,KAAK,EAAE;oBACd,IAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC;oBAC5E,IAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC;oBAChF,KAAK;oBACL,MAAM,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC;iBACvC;YACL,CAAC,CAAC,CAAC;YAEH,IAAM,IAAI,GAAiB;gBACvB,yBAAyB,EAAE,MAAM,CAAC,yBAAyB,CAAC;gBAC5D,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAI,GAAG;gBACzD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,CAAC;aAC7C,CAAC;YACF,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAX,CAAW,CAAC,EAAE;gBAC9C,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;aACvC;;QAzCL,OAAO,KAAK,IAAI,CAAC;;SA0ChB;IACL,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACvB,CAAC","sourcesContent":["import { getObjectKeys } from 'roosterjs-content-model-dom';\nimport type { WordMetadata } from './WordMetadata';\nimport type { BeforePasteEvent } from 'roosterjs-content-model-types';\n\nconst FORMATING_REGEX = /[\\n\\t'{}\"]+/g;\n\n/**\n * @internal\n * Word Desktop content has a style tag that contains data for the lists.\n * So this function query that style tag and extract the data from the innerHTML, since it is not available from the HTMLStyleElement.sheet.\n *\n * The format is like:\n * example of style element content\n * @list l0:level1 {\n * styleTag: styleValue;\n * ...\n * }\n *\n * To extract the data:\n * 1. Substring the value of the style selector, using @ index and { index\n * 2. Substring the value of the style rules by Substring the content between { and }\n * 3. Split the value of the rules using ; as separator { styleTag: styleValue; styleTag1: StyleValue1 } = ['styleTag: styleValue', 'styleTag1: StyleValue1']\n * 4. Split the value of the rule using : as separator: styleTag: styleValue = [styleTag, styleValue]\n * 5. Save data in record and only use the required information.\n *\n */\nexport default function getStyleMetadata(\n ev: BeforePasteEvent,\n trustedHTMLHandler: (val: string) => string\n) {\n const metadataMap: Map<string, WordMetadata> = new Map();\n const doc = new DOMParser().parseFromString(trustedHTMLHandler(ev.htmlBefore), 'text/html');\n const styles = doc.querySelectorAll('style');\n\n styles.forEach(style => {\n const text = style?.innerHTML.trim() || '';\n\n let index = 0;\n while (index >= 0) {\n const indexAt = text.indexOf('@', index + 1);\n const indexCurlyEnd = text.indexOf('}', indexAt);\n const indexCurlyStart = text.indexOf('{', indexAt);\n index = indexAt;\n\n // 1.\n const metadataName = text\n .substring(indexAt + 1, indexCurlyStart)\n .replace(FORMATING_REGEX, '')\n .replace('list', '')\n .trimRight()\n .trimLeft();\n\n // 2.\n const dataName = text\n .substring(indexCurlyStart, indexCurlyEnd + 1)\n .trimLeft()\n .trimRight();\n const record: Record<string, string> = {};\n\n // 3.\n const entries = dataName.split(';');\n entries.forEach(entry => {\n // 4.\n const [key, value] = entry.split(':');\n if (key && value) {\n const formatedKey = key.replace(FORMATING_REGEX, '').trimRight().trimLeft();\n const formatedValue = value.replace(FORMATING_REGEX, '').trimRight().trimLeft();\n // 5.\n record[formatedKey] = formatedValue;\n }\n });\n\n const data: WordMetadata = {\n 'mso-level-number-format': record['mso-level-number-format'],\n 'mso-level-start-at': record['mso-level-start-at'] || '1',\n 'mso-level-text': record['mso-level-text'],\n };\n if (getObjectKeys(data).some(key => !!data[key])) {\n metadataMap.set(metadataName, data);\n }\n }\n });\n return metadataMap;\n}\n"]}
1
+ {"version":3,"file":"getStyleMetadata.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/getStyleMetadata.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI5D,IAAM,eAAe,GAAG,cAAc,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACpC,EAAoB,EACpB,kBAA2C;IAE3C,IAAM,WAAW,GAA8B,IAAI,GAAG,EAAE,CAAC;IACzD,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,CAAC;IAC5F,IAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE7C,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;QAChB,IAAM,IAAI,GAAG,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC,IAAI,EAAE,KAAI,EAAE,CAAC;QAE3C,IAAI,KAAK,GAAG,CAAC,CAAC;;YAEV,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC7C,IAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACjD,IAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACnD,KAAK,GAAG,OAAO,CAAC;YAEhB,KAAK;YACL,IAAM,YAAY,GAAG,IAAI;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GAAG,IAAI,OAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAX,CAAW,CAAC,EAAE;gBAC9C,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;aACvC;;QAzCL,OAAO,KAAK,IAAI,CAAC;;SA0ChB;IACL,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACvB,CAAC","sourcesContent":["import { getObjectKeys } from 'roosterjs-content-model-dom';\r\nimport type { WordMetadata } from './WordMetadata';\r\nimport type { BeforePasteEvent } from 'roosterjs-content-model-types';\r\n\r\nconst FORMATING_REGEX = /[\\n\\t'{}\"]+/g;\r\n\r\n/**\r\n * @internal\r\n * Word Desktop content has a style tag that contains data for the lists.\r\n * So this function query that style tag and extract the data from the innerHTML, since it is not available from the HTMLStyleElement.sheet.\r\n *\r\n * The format is like:\r\n * example of style element content\r\n * @list l0:level1 {\r\n * styleTag: styleValue;\r\n * ...\r\n * }\r\n *\r\n * To extract the data:\r\n * 1. Substring the value of the style selector, using @ index and { index\r\n * 2. Substring the value of the style rules by Substring the content between { and }\r\n * 3. Split the value of the rules using ; as separator { styleTag: styleValue; styleTag1: StyleValue1 } = ['styleTag: styleValue', 'styleTag1: StyleValue1']\r\n * 4. Split the value of the rule using : as separator: styleTag: styleValue = [styleTag, styleValue]\r\n * 5. Save data in record and only use the required information.\r\n *\r\n */\r\nexport default function getStyleMetadata(\r\n ev: BeforePasteEvent,\r\n trustedHTMLHandler: (val: string) => string\r\n) {\r\n const metadataMap: Map<string, WordMetadata> = new Map();\r\n const doc = new DOMParser().parseFromString(trustedHTMLHandler(ev.htmlBefore), 'text/html');\r\n const styles = doc.querySelectorAll('style');\r\n\r\n styles.forEach(style => {\r\n const text = style?.innerHTML.trim() || '';\r\n\r\n let index = 0;\r\n while (index >= 0) {\r\n const indexAt = text.indexOf('@', index + 1);\r\n const indexCurlyEnd = text.indexOf('}', indexAt);\r\n const indexCurlyStart = text.indexOf('{', indexAt);\r\n index = indexAt;\r\n\r\n // 1.\r\n const metadataName = text\r\n .substring(indexAt + 1, indexCurlyStart)\r\n .replace(FORMATING_REGEX, '')\r\n .replace('list', '')\r\n .trimRight()\r\n .trimLeft();\r\n\r\n // 2.\r\n const dataName = text\r\n .substring(indexCurlyStart, indexCurlyEnd + 1)\r\n .trimLeft()\r\n .trimRight();\r\n const record: Record<string, string> = {};\r\n\r\n // 3.\r\n const entries = dataName.split(';');\r\n entries.forEach(entry => {\r\n // 4.\r\n const [key, value] = entry.split(':');\r\n if (key && value) {\r\n const formatedKey = key.replace(FORMATING_REGEX, '').trimRight().trimLeft();\r\n const formatedValue = value.replace(FORMATING_REGEX, '').trimRight().trimLeft();\r\n // 5.\r\n record[formatedKey] = formatedValue;\r\n }\r\n });\r\n\r\n const data: WordMetadata = {\r\n 'mso-level-number-format': record['mso-level-number-format'],\r\n 'mso-level-start-at': record['mso-level-start-at'] || '1',\r\n 'mso-level-text': record['mso-level-text'],\r\n };\r\n if (getObjectKeys(data).some(key => !!data[key])) {\r\n metadataMap.set(metadataName, data);\r\n }\r\n }\r\n });\r\n return metadataMap;\r\n}\r\n"]}
@@ -1,7 +1,7 @@
1
- import type { BeforePasteEvent } from 'roosterjs-content-model-types';
2
- /**
3
- * @internal
4
- * Handles Pasted content when source is Word Desktop
5
- * @param ev ContentModelBeforePasteEvent
6
- */
7
- export declare function processPastedContentFromWordDesktop(ev: BeforePasteEvent, trustedHTMLHandler: (text: string) => string): void;
1
+ import type { BeforePasteEvent } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ * Handles Pasted content when source is Word Desktop
5
+ * @param ev BeforePasteEvent
6
+ */
7
+ export declare function processPastedContentFromWordDesktop(ev: BeforePasteEvent, trustedHTMLHandler: (text: string) => string): void;
@@ -1,55 +1,55 @@
1
- import addParser from '../utils/addParser';
2
- import getStyleMetadata from './getStyleMetadata';
3
- import { getStyles } from '../utils/getStyles';
4
- import { processWordComments } from './processWordComments';
5
- import { processWordList } from './processWordLists';
6
- import { removeNegativeTextIndentParser } from './removeNegativeTextIndentParser';
7
- import { setProcessor } from '../utils/setProcessor';
8
- var PERCENTAGE_REGEX = /%/;
9
- var DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE = 120;
10
- /**
11
- * @internal
12
- * Handles Pasted content when source is Word Desktop
13
- * @param ev ContentModelBeforePasteEvent
14
- */
15
- export function processPastedContentFromWordDesktop(ev, trustedHTMLHandler) {
16
- var metadataMap = getStyleMetadata(ev, trustedHTMLHandler);
17
- setProcessor(ev.domToModelOption, 'element', wordDesktopElementProcessor(metadataMap));
18
- addParser(ev.domToModelOption, 'block', removeNonValidLineHeight);
19
- addParser(ev.domToModelOption, 'block', removeNegativeTextIndentParser);
20
- addParser(ev.domToModelOption, 'listLevel', listLevelParser);
21
- addParser(ev.domToModelOption, 'container', wordTableParser);
22
- addParser(ev.domToModelOption, 'table', wordTableParser);
23
- }
24
- var wordDesktopElementProcessor = function (metadataKey) {
25
- return function (group, element, context) {
26
- var styles = getStyles(element);
27
- // Process Word Lists or Word Commands, otherwise use the default processor on this element.
28
- if (!(processWordList(styles, group, element, context, metadataKey) ||
29
- processWordComments(styles, element))) {
30
- context.defaultElementProcessors.element(group, element, context);
31
- }
32
- };
33
- };
34
- function removeNonValidLineHeight(format, element, context, defaultStyle) {
35
- //If the line height is less than the browser default line height, line between the text is going to be too narrow
36
- var parsedLineHeight;
37
- if (PERCENTAGE_REGEX.test(element.style.lineHeight) &&
38
- !isNaN((parsedLineHeight = parseInt(element.style.lineHeight))) &&
39
- parsedLineHeight < DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE) {
40
- format.lineHeight = defaultStyle.lineHeight;
41
- }
42
- }
43
- function listLevelParser(format, element, context, defaultStyle) {
44
- if (element.style.marginLeft != '') {
45
- format.marginLeft = defaultStyle.marginLeft;
46
- }
47
- format.marginBottom = undefined;
48
- }
49
- var wordTableParser = function (format) {
50
- var _a;
51
- if ((_a = format.marginLeft) === null || _a === void 0 ? void 0 : _a.startsWith('-')) {
52
- delete format.marginLeft;
53
- }
54
- };
1
+ import addParser from '../utils/addParser';
2
+ import getStyleMetadata from './getStyleMetadata';
3
+ import { getStyles } from '../utils/getStyles';
4
+ import { processWordComments } from './processWordComments';
5
+ import { processWordList } from './processWordLists';
6
+ import { removeNegativeTextIndentParser } from './removeNegativeTextIndentParser';
7
+ import { setProcessor } from '../utils/setProcessor';
8
+ var PERCENTAGE_REGEX = /%/;
9
+ var DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE = 120;
10
+ /**
11
+ * @internal
12
+ * Handles Pasted content when source is Word Desktop
13
+ * @param ev BeforePasteEvent
14
+ */
15
+ export function processPastedContentFromWordDesktop(ev, trustedHTMLHandler) {
16
+ var metadataMap = getStyleMetadata(ev, trustedHTMLHandler);
17
+ setProcessor(ev.domToModelOption, 'element', wordDesktopElementProcessor(metadataMap));
18
+ addParser(ev.domToModelOption, 'block', removeNonValidLineHeight);
19
+ addParser(ev.domToModelOption, 'block', removeNegativeTextIndentParser);
20
+ addParser(ev.domToModelOption, 'listLevel', listLevelParser);
21
+ addParser(ev.domToModelOption, 'container', wordTableParser);
22
+ addParser(ev.domToModelOption, 'table', wordTableParser);
23
+ }
24
+ var wordDesktopElementProcessor = function (metadataKey) {
25
+ return function (group, element, context) {
26
+ var styles = getStyles(element);
27
+ // Process Word Lists or Word Commands, otherwise use the default processor on this element.
28
+ if (!(processWordList(styles, group, element, context, metadataKey) ||
29
+ processWordComments(styles, element))) {
30
+ context.defaultElementProcessors.element(group, element, context);
31
+ }
32
+ };
33
+ };
34
+ function removeNonValidLineHeight(format, element, context, defaultStyle) {
35
+ //If the line height is less than the browser default line height, line between the text is going to be too narrow
36
+ var parsedLineHeight;
37
+ if (PERCENTAGE_REGEX.test(element.style.lineHeight) &&
38
+ !isNaN((parsedLineHeight = parseInt(element.style.lineHeight))) &&
39
+ parsedLineHeight < DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE) {
40
+ format.lineHeight = defaultStyle.lineHeight;
41
+ }
42
+ }
43
+ function listLevelParser(format, element, context, defaultStyle) {
44
+ if (element.style.marginLeft != '') {
45
+ format.marginLeft = defaultStyle.marginLeft;
46
+ }
47
+ format.marginBottom = undefined;
48
+ }
49
+ var wordTableParser = function (format) {
50
+ var _a;
51
+ if ((_a = format.marginLeft) === null || _a === void 0 ? void 0 : _a.startsWith('-')) {
52
+ delete format.marginLeft;
53
+ }
54
+ };
55
55
  //# sourceMappingURL=processPastedContentFromWordDesktop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processPastedContentFromWordDesktop.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAYrD,IAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,IAAM,sCAAsC,GAAG,GAAG,CAAC;AAEnD;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CAC/C,EAAoB,EACpB,kBAA4C;IAE5C,IAAM,WAAW,GAA8B,gBAAgB,CAAC,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAExF,YAAY,CAAC,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,2BAA2B,CAAC,WAAW,CAAC,CAAC,CAAC;IACvF,SAAS,CAAC,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC;IAClE,SAAS,CAAC,EAAE,CAA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K,CAAC,UAAU,IAAI,EAAE,EAAE;QAChC,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;KAC/C;IAED,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;AACpC,CAAC;AAED,IAAM,eAAe,GAA0C,UAAC,MAAM;;IAClE,IAAI,MAAA,MAAM,CAAC,UAAU,0CAAE,UAAU,CAAC,GAAG,CAAC,EAAE;QACpC,OAAO,MAAM,CAAC,UAAU,CAAC;KAC5B;AACL,CAAC,CAAC","sourcesContent":["import addParser from '../utils/addParser';\nimport getStyleMetadata from './getStyleMetadata';\nimport { getStyles } from '../utils/getStyles';\nimport { processWordComments } from './processWordComments';\nimport { processWordList } from './processWordLists';\nimport { removeNegativeTextIndentParser } from './removeNegativeTextIndentParser';\nimport { setProcessor } from '../utils/setProcessor';\nimport type { WordMetadata } from './WordMetadata';\nimport type {\n BeforePasteEvent,\n ContentModelBlockFormat,\n ContentModelListItemLevelFormat,\n ContentModelTableFormat,\n DomToModelContext,\n ElementProcessor,\n FormatParser,\n} from 'roosterjs-content-model-types';\n\nconst PERCENTAGE_REGEX = /%/;\nconst DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE = 120;\n\n/**\n * @internal\n * Handles Pasted content when source is Word Desktop\n * @param ev ContentModelBeforePasteEvent\n */\nexport function processPastedContentFromWordDesktop(\n ev: BeforePasteEvent,\n trustedHTMLHandler: (text: string) => string\n) {\n const metadataMap: Map<string, WordMetadata> = getStyleMetadata(ev, trustedHTMLHandler);\n\n setProcessor(ev.domToModelOption, 'element', wordDesktopElementProcessor(metadataMap));\n addParser(ev.domToModelOption, 'block', removeNonValidLineHeight);\n addParser(ev.domToModelOption, 'block', removeNegativeTextIndentParser);\n addParser(ev.domToModelOption, 'listLevel', listLevelParser);\n addParser(ev.domToModelOption, 'container', wordTableParser);\n addParser(ev.domToModelOption, 'table', wordTableParser);\n}\n\nconst wordDesktopElementProcessor = (\n metadataKey: Map<string, WordMetadata>\n): ElementProcessor<HTMLElement> => {\n return (group, element, context) => {\n const styles = getStyles(element);\n // Process Word Lists or Word Commands, otherwise use the default processor on this element.\n if (\n !(\n processWordList(styles, group, element, context, metadataKey) ||\n processWordComments(styles, element)\n )\n ) {\n context.defaultElementProcessors.element(group, element, context);\n }\n };\n};\n\nfunction removeNonValidLineHeight(\n format: ContentModelBlockFormat,\n element: HTMLElement,\n context: DomToModelContext,\n defaultStyle: Readonly<Partial<CSSStyleDeclaration>>\n): void {\n //If the line height is less than the browser default line height, line between the text is going to be too narrow\n let parsedLineHeight: number;\n if (\n PERCENTAGE_REGEX.test(element.style.lineHeight) &&\n !isNaN((parsedLineHeight = parseInt(element.style.lineHeight))) &&\n parsedLineHeight < DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE\n ) {\n format.lineHeight = defaultStyle.lineHeight;\n }\n}\n\nfunction listLevelParser(\n format: ContentModelListItemLevelFormat,\n element: HTMLElement,\n context: DomToModelContext,\n defaultStyle: Readonly<Partial<CSSStyleDeclaration>>\n): void {\n if (element.style.marginLeft != '') {\n format.marginLeft = defaultStyle.marginLeft;\n }\n\n format.marginBottom = undefined;\n}\n\nconst wordTableParser: FormatParser<ContentModelTableFormat> = (format): void => {\n if (format.marginLeft?.startsWith('-')) {\n delete format.marginLeft;\n }\n};\n"]}
1
+ {"version":3,"file":"processPastedContentFromWordDesktop.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;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EAC/B,OAAoB,EACpB,OAA0B,EAC1B,YAAoD;IAEpD,kHAAkH;IAClH,IAAI,gBAAwB,CAAC;IAC7B,IACI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;QAC/C,CAAC,KAAK,CAAC,CAAC,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/D,gBAAgB,GAAG,sCAAsC,EAC3D;QACE,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;KAC/C;AACL,CAAC;AAED,SAAS,eAAe,CACpB,MAAuC,EACvC,OAAoB,EACpB,OAA0B,EAC1B,YAAoD;IAEpD,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE;QAChC,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;KAC/C;IAED,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;AACpC,CAAC;AAED,IAAM,eAAe,GAA0C,UAAC,MAAM;;IAClE,IAAI,MAAA,MAAM,CAAC,UAAU,0CAAE,UAAU,CAAC,GAAG,CAAC,EAAE;QACpC,OAAO,MAAM,CAAC,UAAU,CAAC;KAC5B;AACL,CAAC,CAAC","sourcesContent":["import addParser from '../utils/addParser';\r\nimport getStyleMetadata from './getStyleMetadata';\r\nimport { getStyles } from '../utils/getStyles';\r\nimport { processWordComments } from './processWordComments';\r\nimport { processWordList } from './processWordLists';\r\nimport { removeNegativeTextIndentParser } from './removeNegativeTextIndentParser';\r\nimport { setProcessor } from '../utils/setProcessor';\r\nimport type { WordMetadata } from './WordMetadata';\r\nimport type {\r\n BeforePasteEvent,\r\n ContentModelBlockFormat,\r\n ContentModelListItemLevelFormat,\r\n ContentModelTableFormat,\r\n DomToModelContext,\r\n ElementProcessor,\r\n FormatParser,\r\n} from 'roosterjs-content-model-types';\r\n\r\nconst PERCENTAGE_REGEX = /%/;\r\nconst DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE = 120;\r\n\r\n/**\r\n * @internal\r\n * Handles Pasted content when source is Word Desktop\r\n * @param ev BeforePasteEvent\r\n */\r\nexport function processPastedContentFromWordDesktop(\r\n ev: BeforePasteEvent,\r\n trustedHTMLHandler: (text: string) => string\r\n) {\r\n const metadataMap: Map<string, WordMetadata> = getStyleMetadata(ev, trustedHTMLHandler);\r\n\r\n setProcessor(ev.domToModelOption, 'element', wordDesktopElementProcessor(metadataMap));\r\n addParser(ev.domToModelOption, 'block', removeNonValidLineHeight);\r\n addParser(ev.domToModelOption, 'block', removeNegativeTextIndentParser);\r\n addParser(ev.domToModelOption, 'listLevel', listLevelParser);\r\n addParser(ev.domToModelOption, 'container', wordTableParser);\r\n addParser(ev.domToModelOption, 'table', wordTableParser);\r\n}\r\n\r\nconst wordDesktopElementProcessor = (\r\n metadataKey: Map<string, WordMetadata>\r\n): ElementProcessor<HTMLElement> => {\r\n return (group, element, context) => {\r\n const styles = getStyles(element);\r\n // Process Word Lists or Word Commands, otherwise use the default processor on this element.\r\n if (\r\n !(\r\n processWordList(styles, group, element, context, metadataKey) ||\r\n processWordComments(styles, element)\r\n )\r\n ) {\r\n context.defaultElementProcessors.element(group, element, context);\r\n }\r\n };\r\n};\r\n\r\nfunction removeNonValidLineHeight(\r\n format: ContentModelBlockFormat,\r\n element: HTMLElement,\r\n context: DomToModelContext,\r\n defaultStyle: Readonly<Partial<CSSStyleDeclaration>>\r\n): void {\r\n //If the line height is less than the browser default line height, line between the text is going to be too narrow\r\n let parsedLineHeight: number;\r\n if (\r\n PERCENTAGE_REGEX.test(element.style.lineHeight) &&\r\n !isNaN((parsedLineHeight = parseInt(element.style.lineHeight))) &&\r\n parsedLineHeight < DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE\r\n ) {\r\n format.lineHeight = defaultStyle.lineHeight;\r\n }\r\n}\r\n\r\nfunction listLevelParser(\r\n format: ContentModelListItemLevelFormat,\r\n element: HTMLElement,\r\n context: DomToModelContext,\r\n defaultStyle: Readonly<Partial<CSSStyleDeclaration>>\r\n): void {\r\n if (element.style.marginLeft != '') {\r\n format.marginLeft = defaultStyle.marginLeft;\r\n }\r\n\r\n format.marginBottom = undefined;\r\n}\r\n\r\nconst wordTableParser: FormatParser<ContentModelTableFormat> = (format): void => {\r\n if (format.marginLeft?.startsWith('-')) {\r\n delete format.marginLeft;\r\n }\r\n};\r\n"]}
@@ -1,7 +1,7 @@
1
- /**
2
- * @internal
3
- * Check whether the element contain Word attributes related to comments and if it does we should no process
4
- * this element.
5
- * @returns
6
- */
7
- export declare function processWordComments(styles: Record<string, string>, element: HTMLElement): boolean;
1
+ /**
2
+ * @internal
3
+ * Check whether the element contain Word attributes related to comments and if it does we should no process
4
+ * this element.
5
+ * @returns
6
+ */
7
+ export declare function processWordComments(styles: Record<string, string>, element: HTMLElement): boolean;
@@ -1,18 +1,18 @@
1
- import { isElementOfType } from 'roosterjs-content-model-dom';
2
- var MSO_COMMENT_ANCHOR_HREF_REGEX = /#_msocom_/;
3
- var MSO_SPECIAL_CHARACTER = 'mso-special-character';
4
- var MSO_SPECIAL_CHARACTER_COMMENT = 'comment';
5
- var MSO_ELEMENT = 'mso-element';
6
- var MSO_ELEMENT_COMMENT_LIST = 'comment-list';
7
- /**
8
- * @internal
9
- * Check whether the element contain Word attributes related to comments and if it does we should no process
10
- * this element.
11
- * @returns
12
- */
13
- export function processWordComments(styles, element) {
14
- return (styles[MSO_SPECIAL_CHARACTER] == MSO_SPECIAL_CHARACTER_COMMENT ||
15
- (isElementOfType(element, 'a') && MSO_COMMENT_ANCHOR_HREF_REGEX.test(element.href)) ||
16
- styles[MSO_ELEMENT] == MSO_ELEMENT_COMMENT_LIST);
17
- }
1
+ import { isElementOfType } from 'roosterjs-content-model-dom';
2
+ var MSO_COMMENT_ANCHOR_HREF_REGEX = /#_msocom_/;
3
+ var MSO_SPECIAL_CHARACTER = 'mso-special-character';
4
+ var MSO_SPECIAL_CHARACTER_COMMENT = 'comment';
5
+ var MSO_ELEMENT = 'mso-element';
6
+ var MSO_ELEMENT_COMMENT_LIST = 'comment-list';
7
+ /**
8
+ * @internal
9
+ * Check whether the element contain Word attributes related to comments and if it does we should no process
10
+ * this element.
11
+ * @returns
12
+ */
13
+ export function processWordComments(styles, element) {
14
+ return (styles[MSO_SPECIAL_CHARACTER] == MSO_SPECIAL_CHARACTER_COMMENT ||
15
+ (isElementOfType(element, 'a') && MSO_COMMENT_ANCHOR_HREF_REGEX.test(element.href)) ||
16
+ styles[MSO_ELEMENT] == MSO_ELEMENT_COMMENT_LIST);
17
+ }
18
18
  //# sourceMappingURL=processWordComments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processWordComments.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordComments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,IAAM,6BAA6B,GAAG,WAAW,CAAC;AAClD,IAAM,qBAAqB,GAAG,uBAAuB,CAAC;AACtD,IAAM,6BAA6B,GAAG,SAAS,CAAC;AAChD,IAAM,WAAW,GAAG,aAAa,CAAC;AAClC,IAAM,wBAAwB,GAAG,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA8B,EAAE,OAAoB;IACpF,OAAO,CACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,6BAA6B;QAC9D,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnF,MAAM,CAAC,WAAW,CAAC,IAAI,wBAAwB,CAClD,CAAC;AACN,CAAC","sourcesContent":["import { isElementOfType } from 'roosterjs-content-model-dom';\n\nconst MSO_COMMENT_ANCHOR_HREF_REGEX = /#_msocom_/;\nconst MSO_SPECIAL_CHARACTER = 'mso-special-character';\nconst MSO_SPECIAL_CHARACTER_COMMENT = 'comment';\nconst MSO_ELEMENT = 'mso-element';\nconst MSO_ELEMENT_COMMENT_LIST = 'comment-list';\n\n/**\n * @internal\n * Check whether the element contain Word attributes related to comments and if it does we should no process\n * this element.\n * @returns\n */\nexport function processWordComments(styles: Record<string, string>, element: HTMLElement) {\n return (\n styles[MSO_SPECIAL_CHARACTER] == MSO_SPECIAL_CHARACTER_COMMENT ||\n (isElementOfType(element, 'a') && MSO_COMMENT_ANCHOR_HREF_REGEX.test(element.href)) ||\n styles[MSO_ELEMENT] == MSO_ELEMENT_COMMENT_LIST\n );\n}\n"]}
1
+ {"version":3,"file":"processWordComments.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordComments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,IAAM,6BAA6B,GAAG,WAAW,CAAC;AAClD,IAAM,qBAAqB,GAAG,uBAAuB,CAAC;AACtD,IAAM,6BAA6B,GAAG,SAAS,CAAC;AAChD,IAAM,WAAW,GAAG,aAAa,CAAC;AAClC,IAAM,wBAAwB,GAAG,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA8B,EAAE,OAAoB;IACpF,OAAO,CACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,6BAA6B;QAC9D,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnF,MAAM,CAAC,WAAW,CAAC,IAAI,wBAAwB,CAClD,CAAC;AACN,CAAC","sourcesContent":["import { isElementOfType } from 'roosterjs-content-model-dom';\r\n\r\nconst MSO_COMMENT_ANCHOR_HREF_REGEX = /#_msocom_/;\r\nconst MSO_SPECIAL_CHARACTER = 'mso-special-character';\r\nconst MSO_SPECIAL_CHARACTER_COMMENT = 'comment';\r\nconst MSO_ELEMENT = 'mso-element';\r\nconst MSO_ELEMENT_COMMENT_LIST = 'comment-list';\r\n\r\n/**\r\n * @internal\r\n * Check whether the element contain Word attributes related to comments and if it does we should no process\r\n * this element.\r\n * @returns\r\n */\r\nexport function processWordComments(styles: Record<string, string>, element: HTMLElement) {\r\n return (\r\n styles[MSO_SPECIAL_CHARACTER] == MSO_SPECIAL_CHARACTER_COMMENT ||\r\n (isElementOfType(element, 'a') && MSO_COMMENT_ANCHOR_HREF_REGEX.test(element.href)) ||\r\n styles[MSO_ELEMENT] == MSO_ELEMENT_COMMENT_LIST\r\n );\r\n}\r\n"]}
@@ -1,11 +1,11 @@
1
- import type { WordMetadata } from './WordMetadata';
2
- import type { ContentModelBlockGroup, DomToModelContext } from 'roosterjs-content-model-types';
3
- /**
4
- * @internal
5
- * @param styles
6
- * @param group
7
- * @param element
8
- * @param context
9
- * @returns
10
- */
11
- export declare function processWordList(styles: Record<string, string>, group: ContentModelBlockGroup, element: HTMLElement, context: DomToModelContext, metadata: Map<string, WordMetadata>): boolean;
1
+ import type { WordMetadata } from './WordMetadata';
2
+ import type { ContentModelBlockGroup, DomToModelContext } from 'roosterjs-content-model-types';
3
+ /**
4
+ * @internal
5
+ * @param styles
6
+ * @param group
7
+ * @param element
8
+ * @param context
9
+ * @returns
10
+ */
11
+ export declare function processWordList(styles: Record<string, string>, group: ContentModelBlockGroup, element: HTMLElement, context: DomToModelContext, metadata: Map<string, WordMetadata>): boolean;