roosterjs-content-model-plugins 0.21.2 → 0.21.4

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 (280) hide show
  1. package/lib/edit/ContentModelEditPlugin.d.ts +35 -35
  2. package/lib/edit/ContentModelEditPlugin.js +75 -75
  3. package/lib/edit/ContentModelEditPlugin.js.map +1 -1
  4. package/lib/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  5. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js +19 -19
  6. package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  7. package/lib/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  8. package/lib/edit/deleteSteps/deleteCollapsedSelection.js +90 -90
  9. package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  10. package/lib/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  11. package/lib/edit/deleteSteps/deleteWordSelection.js +170 -170
  12. package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  13. package/lib/edit/handleKeyboardEventCommon.d.ts +15 -15
  14. package/lib/edit/handleKeyboardEventCommon.js +54 -54
  15. package/lib/edit/handleKeyboardEventCommon.js.map +1 -1
  16. package/lib/edit/keyboardDelete.d.ts +8 -8
  17. package/lib/edit/keyboardDelete.js +67 -67
  18. package/lib/edit/keyboardDelete.js.map +1 -1
  19. package/lib/edit/keyboardInput.d.ts +5 -5
  20. package/lib/edit/keyboardInput.js +50 -49
  21. package/lib/edit/keyboardInput.js.map +1 -1
  22. package/lib/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  23. package/lib/edit/utils/getLeafSiblingBlock.js +75 -75
  24. package/lib/edit/utils/getLeafSiblingBlock.js.map +1 -1
  25. package/lib/entityDelimiter/EntityDelimiterPlugin.d.ts +35 -35
  26. package/lib/entityDelimiter/EntityDelimiterPlugin.js +256 -254
  27. package/lib/entityDelimiter/EntityDelimiterPlugin.js.map +1 -1
  28. package/lib/index.d.ts +3 -3
  29. package/lib/index.js +9 -9
  30. package/lib/index.js.map +1 -1
  31. package/lib/paste/ContentModelPastePlugin.d.ts +42 -42
  32. package/lib/paste/ContentModelPastePlugin.js +148 -148
  33. package/lib/paste/ContentModelPastePlugin.js.map +1 -1
  34. package/lib/paste/Excel/processPastedContentFromExcel.d.ts +13 -13
  35. package/lib/paste/Excel/processPastedContentFromExcel.js +82 -82
  36. package/lib/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  37. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  38. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js +19 -19
  39. package/lib/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  40. package/lib/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  41. package/lib/paste/WacComponents/processPastedContentWacComponents.js +207 -207
  42. package/lib/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  43. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +12 -12
  44. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +69 -69
  45. package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  46. package/lib/paste/WordDesktop/processWordComments.d.ts +7 -7
  47. package/lib/paste/WordDesktop/processWordComments.js +21 -21
  48. package/lib/paste/WordDesktop/processWordComments.js.map +1 -1
  49. package/lib/paste/WordDesktop/processWordLists.d.ts +10 -10
  50. package/lib/paste/WordDesktop/processWordLists.js +154 -154
  51. package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
  52. package/lib/paste/pasteSourceValidations/constants.d.ts +17 -17
  53. package/lib/paste/pasteSourceValidations/constants.js +21 -21
  54. package/lib/paste/pasteSourceValidations/constants.js.map +1 -1
  55. package/lib/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  56. package/lib/paste/pasteSourceValidations/documentContainWacElements.js +24 -24
  57. package/lib/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  58. package/lib/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  59. package/lib/paste/pasteSourceValidations/getPasteSource.js +43 -43
  60. package/lib/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  61. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  62. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js +16 -16
  63. package/lib/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  64. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  65. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js +18 -18
  66. package/lib/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  67. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  68. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js +14 -14
  69. package/lib/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  70. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  71. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +14 -14
  72. package/lib/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  73. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  74. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js +18 -18
  75. package/lib/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  76. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  77. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js +18 -18
  78. package/lib/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  79. package/lib/paste/utils/addParser.d.ts +5 -5
  80. package/lib/paste/utils/addParser.js +16 -16
  81. package/lib/paste/utils/addParser.js.map +1 -1
  82. package/lib/paste/utils/deprecatedColorParser.d.ts +5 -5
  83. package/lib/paste/utils/deprecatedColorParser.js +19 -19
  84. package/lib/paste/utils/deprecatedColorParser.js.map +1 -1
  85. package/lib/paste/utils/getStyles.d.ts +6 -6
  86. package/lib/paste/utils/getStyles.js +22 -22
  87. package/lib/paste/utils/getStyles.js.map +1 -1
  88. package/lib/paste/utils/linkParser.d.ts +5 -5
  89. package/lib/paste/utils/linkParser.js +27 -27
  90. package/lib/paste/utils/linkParser.js.map +1 -1
  91. package/lib/paste/utils/setProcessor.d.ts +5 -5
  92. package/lib/paste/utils/setProcessor.js +13 -13
  93. package/lib/paste/utils/setProcessor.js.map +1 -1
  94. package/lib-amd/edit/ContentModelEditPlugin.d.ts +35 -35
  95. package/lib-amd/edit/ContentModelEditPlugin.js +75 -75
  96. package/lib-amd/edit/ContentModelEditPlugin.js.map +1 -1
  97. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  98. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js +20 -20
  99. package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  100. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  101. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +89 -89
  102. package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  103. package/lib-amd/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  104. package/lib-amd/edit/deleteSteps/deleteWordSelection.js +169 -169
  105. package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  106. package/lib-amd/edit/handleKeyboardEventCommon.d.ts +15 -15
  107. package/lib-amd/edit/handleKeyboardEventCommon.js +55 -55
  108. package/lib-amd/edit/handleKeyboardEventCommon.js.map +1 -1
  109. package/lib-amd/edit/keyboardDelete.d.ts +8 -8
  110. package/lib-amd/edit/keyboardDelete.js +63 -63
  111. package/lib-amd/edit/keyboardDelete.js.map +1 -1
  112. package/lib-amd/edit/keyboardInput.d.ts +5 -5
  113. package/lib-amd/edit/keyboardInput.js +50 -49
  114. package/lib-amd/edit/keyboardInput.js.map +1 -1
  115. package/lib-amd/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  116. package/lib-amd/edit/utils/getLeafSiblingBlock.js +75 -75
  117. package/lib-amd/edit/utils/getLeafSiblingBlock.js.map +1 -1
  118. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.d.ts +35 -35
  119. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js +255 -253
  120. package/lib-amd/entityDelimiter/EntityDelimiterPlugin.js.map +1 -1
  121. package/lib-amd/index.d.ts +3 -3
  122. package/lib-amd/index.js +8 -8
  123. package/lib-amd/index.js.map +1 -1
  124. package/lib-amd/paste/ContentModelPastePlugin.d.ts +42 -42
  125. package/lib-amd/paste/ContentModelPastePlugin.js +140 -140
  126. package/lib-amd/paste/ContentModelPastePlugin.js.map +1 -1
  127. package/lib-amd/paste/Excel/processPastedContentFromExcel.d.ts +13 -13
  128. package/lib-amd/paste/Excel/processPastedContentFromExcel.js +80 -80
  129. package/lib-amd/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  130. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  131. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js +20 -20
  132. package/lib-amd/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  133. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  134. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js +206 -206
  135. package/lib-amd/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  136. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +12 -12
  137. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +64 -64
  138. package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  139. package/lib-amd/paste/WordDesktop/processWordComments.d.ts +7 -7
  140. package/lib-amd/paste/WordDesktop/processWordComments.js +22 -22
  141. package/lib-amd/paste/WordDesktop/processWordComments.js.map +1 -1
  142. package/lib-amd/paste/WordDesktop/processWordLists.d.ts +10 -10
  143. package/lib-amd/paste/WordDesktop/processWordLists.js +153 -153
  144. package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
  145. package/lib-amd/paste/pasteSourceValidations/constants.d.ts +17 -17
  146. package/lib-amd/paste/pasteSourceValidations/constants.js +23 -23
  147. package/lib-amd/paste/pasteSourceValidations/constants.js.map +1 -1
  148. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  149. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js +26 -26
  150. package/lib-amd/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  151. package/lib-amd/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  152. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js +38 -38
  153. package/lib-amd/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  154. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  155. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js +18 -18
  156. package/lib-amd/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  157. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  158. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js +20 -20
  159. package/lib-amd/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  160. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  161. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js +16 -16
  162. package/lib-amd/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  163. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  164. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +16 -16
  165. package/lib-amd/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  166. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  167. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js +20 -20
  168. package/lib-amd/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  169. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  170. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js +20 -20
  171. package/lib-amd/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  172. package/lib-amd/paste/utils/addParser.d.ts +5 -5
  173. package/lib-amd/paste/utils/addParser.js +18 -18
  174. package/lib-amd/paste/utils/addParser.js.map +1 -1
  175. package/lib-amd/paste/utils/deprecatedColorParser.d.ts +5 -5
  176. package/lib-amd/paste/utils/deprecatedColorParser.js +20 -20
  177. package/lib-amd/paste/utils/deprecatedColorParser.js.map +1 -1
  178. package/lib-amd/paste/utils/getStyles.d.ts +6 -6
  179. package/lib-amd/paste/utils/getStyles.js +24 -24
  180. package/lib-amd/paste/utils/getStyles.js.map +1 -1
  181. package/lib-amd/paste/utils/linkParser.d.ts +5 -5
  182. package/lib-amd/paste/utils/linkParser.js +28 -28
  183. package/lib-amd/paste/utils/linkParser.js.map +1 -1
  184. package/lib-amd/paste/utils/setProcessor.d.ts +5 -5
  185. package/lib-amd/paste/utils/setProcessor.js +15 -15
  186. package/lib-amd/paste/utils/setProcessor.js.map +1 -1
  187. package/lib-mjs/edit/ContentModelEditPlugin.d.ts +35 -35
  188. package/lib-mjs/edit/ContentModelEditPlugin.js +72 -72
  189. package/lib-mjs/edit/ContentModelEditPlugin.js.map +1 -1
  190. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.d.ts +5 -5
  191. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js +15 -15
  192. package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
  193. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.d.ts +9 -9
  194. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +87 -87
  195. package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
  196. package/lib-mjs/edit/deleteSteps/deleteWordSelection.d.ts +9 -9
  197. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js +167 -167
  198. package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
  199. package/lib-mjs/edit/handleKeyboardEventCommon.d.ts +15 -15
  200. package/lib-mjs/edit/handleKeyboardEventCommon.js +48 -48
  201. package/lib-mjs/edit/handleKeyboardEventCommon.js.map +1 -1
  202. package/lib-mjs/edit/keyboardDelete.d.ts +8 -8
  203. package/lib-mjs/edit/keyboardDelete.js +63 -63
  204. package/lib-mjs/edit/keyboardDelete.js.map +1 -1
  205. package/lib-mjs/edit/keyboardInput.d.ts +5 -5
  206. package/lib-mjs/edit/keyboardInput.js +46 -45
  207. package/lib-mjs/edit/keyboardInput.js.map +1 -1
  208. package/lib-mjs/edit/utils/getLeafSiblingBlock.d.ts +23 -23
  209. package/lib-mjs/edit/utils/getLeafSiblingBlock.js +71 -71
  210. package/lib-mjs/edit/utils/getLeafSiblingBlock.js.map +1 -1
  211. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.d.ts +35 -35
  212. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js +252 -250
  213. package/lib-mjs/entityDelimiter/EntityDelimiterPlugin.js.map +1 -1
  214. package/lib-mjs/index.d.ts +3 -3
  215. package/lib-mjs/index.js +3 -3
  216. package/lib-mjs/index.js.map +1 -1
  217. package/lib-mjs/paste/ContentModelPastePlugin.d.ts +42 -42
  218. package/lib-mjs/paste/ContentModelPastePlugin.js +145 -145
  219. package/lib-mjs/paste/ContentModelPastePlugin.js.map +1 -1
  220. package/lib-mjs/paste/Excel/processPastedContentFromExcel.d.ts +13 -13
  221. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js +77 -77
  222. package/lib-mjs/paste/Excel/processPastedContentFromExcel.js.map +1 -1
  223. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.d.ts +7 -7
  224. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js +15 -15
  225. package/lib-mjs/paste/PowerPoint/processPastedContentFromPowerPoint.js.map +1 -1
  226. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.d.ts +9 -9
  227. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js +203 -203
  228. package/lib-mjs/paste/WacComponents/processPastedContentWacComponents.js.map +1 -1
  229. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.d.ts +12 -12
  230. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +64 -64
  231. package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
  232. package/lib-mjs/paste/WordDesktop/processWordComments.d.ts +7 -7
  233. package/lib-mjs/paste/WordDesktop/processWordComments.js +17 -17
  234. package/lib-mjs/paste/WordDesktop/processWordComments.js.map +1 -1
  235. package/lib-mjs/paste/WordDesktop/processWordLists.d.ts +10 -10
  236. package/lib-mjs/paste/WordDesktop/processWordLists.js +150 -150
  237. package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
  238. package/lib-mjs/paste/pasteSourceValidations/constants.d.ts +17 -17
  239. package/lib-mjs/paste/pasteSourceValidations/constants.js +18 -18
  240. package/lib-mjs/paste/pasteSourceValidations/constants.js.map +1 -1
  241. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.d.ts +8 -8
  242. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js +20 -20
  243. package/lib-mjs/paste/pasteSourceValidations/documentContainWacElements.js.map +1 -1
  244. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.d.ts +27 -27
  245. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js +39 -39
  246. package/lib-mjs/paste/pasteSourceValidations/getPasteSource.js.map +1 -1
  247. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.d.ts +8 -8
  248. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js +12 -12
  249. package/lib-mjs/paste/pasteSourceValidations/isExcelDesktopDocument.js.map +1 -1
  250. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.d.ts +8 -8
  251. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js +14 -14
  252. package/lib-mjs/paste/pasteSourceValidations/isExcelOnlineDocument.js.map +1 -1
  253. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.d.ts +8 -8
  254. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js +10 -10
  255. package/lib-mjs/paste/pasteSourceValidations/isGoogleSheetDocument.js.map +1 -1
  256. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.d.ts +8 -8
  257. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js +10 -10
  258. package/lib-mjs/paste/pasteSourceValidations/isPowerPointDesktopDocument.js.map +1 -1
  259. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.d.ts +8 -8
  260. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js +14 -14
  261. package/lib-mjs/paste/pasteSourceValidations/isWordDesktopDocument.js.map +1 -1
  262. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.d.ts +9 -9
  263. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js +14 -14
  264. package/lib-mjs/paste/pasteSourceValidations/shouldConvertToSingleImage.js.map +1 -1
  265. package/lib-mjs/paste/utils/addParser.d.ts +5 -5
  266. package/lib-mjs/paste/utils/addParser.js +13 -13
  267. package/lib-mjs/paste/utils/addParser.js.map +1 -1
  268. package/lib-mjs/paste/utils/deprecatedColorParser.d.ts +5 -5
  269. package/lib-mjs/paste/utils/deprecatedColorParser.js +15 -15
  270. package/lib-mjs/paste/utils/deprecatedColorParser.js.map +1 -1
  271. package/lib-mjs/paste/utils/getStyles.d.ts +6 -6
  272. package/lib-mjs/paste/utils/getStyles.js +18 -18
  273. package/lib-mjs/paste/utils/getStyles.js.map +1 -1
  274. package/lib-mjs/paste/utils/linkParser.d.ts +5 -5
  275. package/lib-mjs/paste/utils/linkParser.js +23 -23
  276. package/lib-mjs/paste/utils/linkParser.js.map +1 -1
  277. package/lib-mjs/paste/utils/setProcessor.d.ts +5 -5
  278. package/lib-mjs/paste/utils/setProcessor.js +9 -9
  279. package/lib-mjs/paste/utils/setProcessor.js.map +1 -1
  280. package/package.json +1 -1
@@ -1,81 +1,81 @@
1
- define(["require", "exports", "tslib", "../utils/addParser", "roosterjs-content-model-dom", "../utils/setProcessor"], function (require, exports, tslib_1, addParser_1, roosterjs_content_model_dom_1, setProcessor_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.excelHandler = exports.processPastedContentFromExcel = void 0;
5
- var LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i;
6
- var LAST_TR_END_REGEX = /<\/\s*tr\s*>((?!<\/\s*table\s*>)[\s\S])*$/i;
7
- var LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;
8
- var LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;
9
- var DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';
10
- /**
11
- * @internal
12
- * Convert pasted content from Excel, add borders when source doc doesn't have a border
13
- * @param event The BeforePaste event
14
- */
15
- function processPastedContentFromExcel(event, trustedHTMLHandler) {
16
- var fragment = event.fragment, htmlBefore = event.htmlBefore, clipboardData = event.clipboardData;
17
- var html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;
18
- if (html && clipboardData.html != html) {
19
- var doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');
20
- (0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
21
- }
22
- // For Excel Online
23
- var firstChild = fragment.firstChild;
24
- if ((0, roosterjs_content_model_dom_1.isNodeOfType)(firstChild, 'ELEMENT_NODE') &&
25
- firstChild.tagName == 'div' &&
26
- firstChild.firstChild) {
27
- var tableFound = Array.from(firstChild.childNodes).every(function (child) {
28
- // Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag
29
- var tagName = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE') && child.tagName;
30
- return tagName == 'META'
31
- ? true
32
- : tagName == 'TABLE'
33
- ? child == firstChild.lastChild
34
- : false;
35
- });
36
- // Extract Table from Div
37
- if (tableFound && firstChild.lastChild) {
38
- event.fragment.replaceChildren(firstChild.lastChild);
39
- }
40
- }
41
- (0, addParser_1.default)(event.domToModelOption, 'tableCell', function (format, element) {
42
- if (element.style.borderStyle === 'none') {
43
- format.borderBottom = DEFAULT_BORDER_STYLE;
44
- format.borderLeft = DEFAULT_BORDER_STYLE;
45
- format.borderRight = DEFAULT_BORDER_STYLE;
46
- format.borderTop = DEFAULT_BORDER_STYLE;
47
- }
48
- });
49
- (0, setProcessor_1.setProcessor)(event.domToModelOption, 'child', function (group, element, context) {
50
- var segmentFormat = (0, tslib_1.__assign)({}, context.segmentFormat);
51
- if (group.blockGroupType === 'TableCell' && group.format.textColor) {
52
- context.segmentFormat.textColor = group.format.textColor;
53
- }
54
- context.defaultElementProcessors.child(group, element, context);
55
- if (group.blockGroupType === 'TableCell' && group.format.textColor) {
56
- context.segmentFormat = segmentFormat;
57
- delete group.format.textColor;
58
- }
59
- });
60
- }
61
- exports.processPastedContentFromExcel = processPastedContentFromExcel;
62
- /**
63
- * @internal Export for test only
64
- * @param html Source html
65
- */
66
- function excelHandler(html, htmlBefore) {
67
- if (html.match(LAST_TD_END_REGEX)) {
68
- var trMatch = htmlBefore.match(LAST_TR_REGEX);
69
- var tr = trMatch ? trMatch[0] : '<TR>';
70
- html = tr + html + '</TR>';
71
- }
72
- if (html.match(LAST_TR_END_REGEX)) {
73
- var tableMatch = htmlBefore.match(LAST_TABLE_REGEX);
74
- var table = tableMatch ? tableMatch[0] : '<TABLE>';
75
- html = table + html + '</TABLE>';
76
- }
77
- return html;
78
- }
79
- exports.excelHandler = excelHandler;
80
- });
1
+ define(["require", "exports", "tslib", "../utils/addParser", "roosterjs-content-model-dom", "../utils/setProcessor"], function (require, exports, tslib_1, addParser_1, roosterjs_content_model_dom_1, setProcessor_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.excelHandler = exports.processPastedContentFromExcel = void 0;
5
+ var LAST_TD_END_REGEX = /<\/\s*td\s*>((?!<\/\s*tr\s*>)[\s\S])*$/i;
6
+ var LAST_TR_END_REGEX = /<\/\s*tr\s*>((?!<\/\s*table\s*>)[\s\S])*$/i;
7
+ var LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;
8
+ var LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;
9
+ var DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';
10
+ /**
11
+ * @internal
12
+ * Convert pasted content from Excel, add borders when source doc doesn't have a border
13
+ * @param event The BeforePaste event
14
+ */
15
+ function processPastedContentFromExcel(event, trustedHTMLHandler) {
16
+ var fragment = event.fragment, htmlBefore = event.htmlBefore, clipboardData = event.clipboardData;
17
+ var html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;
18
+ if (html && clipboardData.html != html) {
19
+ var doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');
20
+ (0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
21
+ }
22
+ // For Excel Online
23
+ var firstChild = fragment.firstChild;
24
+ if ((0, roosterjs_content_model_dom_1.isNodeOfType)(firstChild, 'ELEMENT_NODE') &&
25
+ firstChild.tagName == 'div' &&
26
+ firstChild.firstChild) {
27
+ var tableFound = Array.from(firstChild.childNodes).every(function (child) {
28
+ // Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag
29
+ var tagName = (0, roosterjs_content_model_dom_1.isNodeOfType)(child, 'ELEMENT_NODE') && child.tagName;
30
+ return tagName == 'META'
31
+ ? true
32
+ : tagName == 'TABLE'
33
+ ? child == firstChild.lastChild
34
+ : false;
35
+ });
36
+ // Extract Table from Div
37
+ if (tableFound && firstChild.lastChild) {
38
+ event.fragment.replaceChildren(firstChild.lastChild);
39
+ }
40
+ }
41
+ (0, addParser_1.default)(event.domToModelOption, 'tableCell', function (format, element) {
42
+ if (element.style.borderStyle === 'none') {
43
+ format.borderBottom = DEFAULT_BORDER_STYLE;
44
+ format.borderLeft = DEFAULT_BORDER_STYLE;
45
+ format.borderRight = DEFAULT_BORDER_STYLE;
46
+ format.borderTop = DEFAULT_BORDER_STYLE;
47
+ }
48
+ });
49
+ (0, setProcessor_1.setProcessor)(event.domToModelOption, 'child', function (group, element, context) {
50
+ var segmentFormat = (0, tslib_1.__assign)({}, context.segmentFormat);
51
+ if (group.blockGroupType === 'TableCell' && group.format.textColor) {
52
+ context.segmentFormat.textColor = group.format.textColor;
53
+ }
54
+ context.defaultElementProcessors.child(group, element, context);
55
+ if (group.blockGroupType === 'TableCell' && group.format.textColor) {
56
+ context.segmentFormat = segmentFormat;
57
+ delete group.format.textColor;
58
+ }
59
+ });
60
+ }
61
+ exports.processPastedContentFromExcel = processPastedContentFromExcel;
62
+ /**
63
+ * @internal Export for test only
64
+ * @param html Source html
65
+ */
66
+ function excelHandler(html, htmlBefore) {
67
+ if (html.match(LAST_TD_END_REGEX)) {
68
+ var trMatch = htmlBefore.match(LAST_TR_REGEX);
69
+ var tr = trMatch ? trMatch[0] : '<TR>';
70
+ html = tr + html + '</TR>';
71
+ }
72
+ if (html.match(LAST_TR_END_REGEX)) {
73
+ var tableMatch = htmlBefore.match(LAST_TABLE_REGEX);
74
+ var table = tableMatch ? tableMatch[0] : '<TABLE>';
75
+ html = table + html + '</TABLE>';
76
+ }
77
+ return html;
78
+ }
79
+ exports.excelHandler = excelHandler;
80
+ });
81
81
  //# sourceMappingURL=processPastedContentFromExcel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts"],"names":[],"mappings":";;;;IAMA,IAAM,iBAAiB,GAAG,yCAAyC,CAAC;IACpE,IAAM,iBAAiB,GAAG,4CAA4C,CAAC;IACvE,IAAM,aAAa,GAAG,iBAAiB,CAAC;IACxC,IAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,IAAM,oBAAoB,GAAG,mBAAmB,CAAC;IAEjD;;;;OAIG;IAEH,SAAgB,6BAA6B,CACzC,KAAmC,EACnC,kBAAsC;QAE9B,IAAA,QAAQ,GAAgC,KAAK,SAArC,EAAE,UAAU,GAAoB,KAAK,WAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QACtD,IAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE3F,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,IAAI,IAAI,EAAE;YACpC,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;YACnF,IAAA,4CAAc,EAAC,QAAQ,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,CAAC;SACvC;QAED,mBAAmB;QACnB,IAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACvC,IACI,IAAA,0CAAY,EAAC,UAAU,EAAE,cAAc,CAAC;YACxC,UAAU,CAAC,OAAO,IAAI,KAAK;YAC3B,UAAU,CAAC,UAAU,EACvB;YACE,IAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,UAAC,KAAW;gBACnE,4FAA4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,IAAI,KAAK,CAAC,cAAc,KAAK,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;gBAChE,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;gBACtC,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;aACjC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IA1DD,sEA0DC;IAED;;;OAGG;IAEH,SAAgB,YAAY,CAAC,IAAY,EAAE,UAAkB;QACzD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAChD,IAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACzC,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE;YAC/B,IAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtD,IAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACrD,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;SACpC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAbD,oCAaC","sourcesContent":["import addParser from '../utils/addParser';\nimport { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';\nimport { setProcessor } from '../utils/setProcessor';\nimport type { TrustedHTMLHandler } from 'roosterjs-editor-types';\nimport type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-types';\n\nconst LAST_TD_END_REGEX = /<\\/\\s*td\\s*>((?!<\\/\\s*tr\\s*>)[\\s\\S])*$/i;\nconst LAST_TR_END_REGEX = /<\\/\\s*tr\\s*>((?!<\\/\\s*table\\s*>)[\\s\\S])*$/i;\nconst LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;\nconst LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;\nconst DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';\n\n/**\n * @internal\n * Convert pasted content from Excel, add borders when source doc doesn't have a border\n * @param event The BeforePaste event\n */\n\nexport function processPastedContentFromExcel(\n event: ContentModelBeforePasteEvent,\n trustedHTMLHandler: TrustedHTMLHandler\n) {\n const { fragment, htmlBefore, clipboardData } = event;\n const html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;\n\n if (html && clipboardData.html != html) {\n const doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');\n moveChildNodes(fragment, doc?.body);\n }\n\n // For Excel Online\n const firstChild = fragment.firstChild;\n if (\n isNodeOfType(firstChild, 'ELEMENT_NODE') &&\n firstChild.tagName == 'div' &&\n firstChild.firstChild\n ) {\n const tableFound = Array.from(firstChild.childNodes).every((child: Node) => {\n // Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag\n const tagName = isNodeOfType(child, 'ELEMENT_NODE') && child.tagName;\n\n return tagName == 'META'\n ? true\n : tagName == 'TABLE'\n ? child == firstChild.lastChild\n : false;\n });\n\n // Extract Table from Div\n if (tableFound && firstChild.lastChild) {\n event.fragment.replaceChildren(firstChild.lastChild);\n }\n }\n\n addParser(event.domToModelOption, 'tableCell', (format, element) => {\n if (element.style.borderStyle === 'none') {\n format.borderBottom = DEFAULT_BORDER_STYLE;\n format.borderLeft = DEFAULT_BORDER_STYLE;\n format.borderRight = DEFAULT_BORDER_STYLE;\n format.borderTop = DEFAULT_BORDER_STYLE;\n }\n });\n\n setProcessor(event.domToModelOption, 'child', (group, element, context) => {\n const segmentFormat = { ...context.segmentFormat };\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\n context.segmentFormat.textColor = group.format.textColor;\n }\n\n context.defaultElementProcessors.child(group, element, context);\n\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\n context.segmentFormat = segmentFormat;\n delete group.format.textColor;\n }\n });\n}\n\n/**\n * @internal Export for test only\n * @param html Source html\n */\n\nexport function excelHandler(html: string, htmlBefore: string): string {\n if (html.match(LAST_TD_END_REGEX)) {\n const trMatch = htmlBefore.match(LAST_TR_REGEX);\n const tr = trMatch ? trMatch[0] : '<TR>';\n html = tr + html + '</TR>';\n }\n if (html.match(LAST_TR_END_REGEX)) {\n const tableMatch = htmlBefore.match(LAST_TABLE_REGEX);\n const table = tableMatch ? tableMatch[0] : '<TABLE>';\n html = table + html + '</TABLE>';\n }\n\n return html;\n}\n"]}
1
+ {"version":3,"file":"processPastedContentFromExcel.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/Excel/processPastedContentFromExcel.ts"],"names":[],"mappings":";;;;IAMA,IAAM,iBAAiB,GAAG,yCAAyC,CAAC;IACpE,IAAM,iBAAiB,GAAG,4CAA4C,CAAC;IACvE,IAAM,aAAa,GAAG,iBAAiB,CAAC;IACxC,IAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,IAAM,oBAAoB,GAAG,mBAAmB,CAAC;IAEjD;;;;OAIG;IAEH,SAAgB,6BAA6B,CACzC,KAAmC,EACnC,kBAAsC;QAE9B,IAAA,QAAQ,GAAgC,KAAK,SAArC,EAAE,UAAU,GAAoB,KAAK,WAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QACtD,IAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE3F,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,IAAI,IAAI,EAAE;YACpC,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;YACnF,IAAA,4CAAc,EAAC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C;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAbD,oCAaC","sourcesContent":["import addParser from '../utils/addParser';\r\nimport { isNodeOfType, moveChildNodes } from 'roosterjs-content-model-dom';\r\nimport { setProcessor } from '../utils/setProcessor';\r\nimport type { TrustedHTMLHandler } from 'roosterjs-editor-types';\r\nimport type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-types';\r\n\r\nconst LAST_TD_END_REGEX = /<\\/\\s*td\\s*>((?!<\\/\\s*tr\\s*>)[\\s\\S])*$/i;\r\nconst LAST_TR_END_REGEX = /<\\/\\s*tr\\s*>((?!<\\/\\s*table\\s*>)[\\s\\S])*$/i;\r\nconst LAST_TR_REGEX = /<tr[^>]*>[^<]*/i;\r\nconst LAST_TABLE_REGEX = /<table[^>]*>[^<]*/i;\r\nconst DEFAULT_BORDER_STYLE = 'solid 1px #d4d4d4';\r\n\r\n/**\r\n * @internal\r\n * Convert pasted content from Excel, add borders when source doc doesn't have a border\r\n * @param event The BeforePaste event\r\n */\r\n\r\nexport function processPastedContentFromExcel(\r\n event: ContentModelBeforePasteEvent,\r\n trustedHTMLHandler: TrustedHTMLHandler\r\n) {\r\n const { fragment, htmlBefore, clipboardData } = event;\r\n const html = clipboardData.html ? excelHandler(clipboardData.html, htmlBefore) : undefined;\r\n\r\n if (html && clipboardData.html != html) {\r\n const doc = new DOMParser().parseFromString(trustedHTMLHandler(html), 'text/html');\r\n moveChildNodes(fragment, doc?.body);\r\n }\r\n\r\n // For Excel Online\r\n const firstChild = fragment.firstChild;\r\n if (\r\n isNodeOfType(firstChild, 'ELEMENT_NODE') &&\r\n firstChild.tagName == 'div' &&\r\n firstChild.firstChild\r\n ) {\r\n const tableFound = Array.from(firstChild.childNodes).every((child: Node) => {\r\n // Tables pasted from Excel Online should be of the format: 0 to N META tags and 1 TABLE tag\r\n const tagName = isNodeOfType(child, 'ELEMENT_NODE') && child.tagName;\r\n\r\n return tagName == 'META'\r\n ? true\r\n : tagName == 'TABLE'\r\n ? child == firstChild.lastChild\r\n : false;\r\n });\r\n\r\n // Extract Table from Div\r\n if (tableFound && firstChild.lastChild) {\r\n event.fragment.replaceChildren(firstChild.lastChild);\r\n }\r\n }\r\n\r\n addParser(event.domToModelOption, 'tableCell', (format, element) => {\r\n if (element.style.borderStyle === 'none') {\r\n format.borderBottom = DEFAULT_BORDER_STYLE;\r\n format.borderLeft = DEFAULT_BORDER_STYLE;\r\n format.borderRight = DEFAULT_BORDER_STYLE;\r\n format.borderTop = DEFAULT_BORDER_STYLE;\r\n }\r\n });\r\n\r\n setProcessor(event.domToModelOption, 'child', (group, element, context) => {\r\n const segmentFormat = { ...context.segmentFormat };\r\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\r\n context.segmentFormat.textColor = group.format.textColor;\r\n }\r\n\r\n context.defaultElementProcessors.child(group, element, context);\r\n\r\n if (group.blockGroupType === 'TableCell' && group.format.textColor) {\r\n context.segmentFormat = segmentFormat;\r\n delete group.format.textColor;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * @internal Export for test only\r\n * @param html Source html\r\n */\r\n\r\nexport function excelHandler(html: string, htmlBefore: string): string {\r\n if (html.match(LAST_TD_END_REGEX)) {\r\n const trMatch = htmlBefore.match(LAST_TR_REGEX);\r\n const tr = trMatch ? trMatch[0] : '<TR>';\r\n html = tr + html + '</TR>';\r\n }\r\n if (html.match(LAST_TR_END_REGEX)) {\r\n const tableMatch = htmlBefore.match(LAST_TABLE_REGEX);\r\n const table = tableMatch ? tableMatch[0] : '<TABLE>';\r\n html = table + html + '</TABLE>';\r\n }\r\n\r\n return html;\r\n}\r\n"]}
@@ -1,7 +1,7 @@
1
- import type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';
2
- /**
3
- * @internal
4
- * Convert pasted content from PowerPoint
5
- * @param event The BeforePaste event
6
- */
7
- export declare function processPastedContentFromPowerPoint(event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler): void;
1
+ import type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';
2
+ /**
3
+ * @internal
4
+ * Convert pasted content from PowerPoint
5
+ * @param event The BeforePaste event
6
+ */
7
+ export declare function processPastedContentFromPowerPoint(event: BeforePasteEvent, trustedHTMLHandler: TrustedHTMLHandler): void;
@@ -1,21 +1,21 @@
1
- define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.processPastedContentFromPowerPoint = void 0;
5
- /**
6
- * @internal
7
- * Convert pasted content from PowerPoint
8
- * @param event The BeforePaste event
9
- */
10
- function processPastedContentFromPowerPoint(event, trustedHTMLHandler) {
11
- var fragment = event.fragment, clipboardData = event.clipboardData;
12
- if (clipboardData.html && !clipboardData.text && clipboardData.image) {
13
- // It is possible that PowerPoint copied both image and HTML but not plain text.
14
- // We always prefer HTML if any.
15
- var doc = new DOMParser().parseFromString(trustedHTMLHandler(clipboardData.html), 'text/html');
16
- (0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
17
- }
18
- }
19
- exports.processPastedContentFromPowerPoint = processPastedContentFromPowerPoint;
20
- });
1
+ define(["require", "exports", "roosterjs-content-model-dom"], function (require, exports, roosterjs_content_model_dom_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.processPastedContentFromPowerPoint = void 0;
5
+ /**
6
+ * @internal
7
+ * Convert pasted content from PowerPoint
8
+ * @param event The BeforePaste event
9
+ */
10
+ function processPastedContentFromPowerPoint(event, trustedHTMLHandler) {
11
+ var fragment = event.fragment, clipboardData = event.clipboardData;
12
+ if (clipboardData.html && !clipboardData.text && clipboardData.image) {
13
+ // It is possible that PowerPoint copied both image and HTML but not plain text.
14
+ // We always prefer HTML if any.
15
+ var doc = new DOMParser().parseFromString(trustedHTMLHandler(clipboardData.html), 'text/html');
16
+ (0, roosterjs_content_model_dom_1.moveChildNodes)(fragment, doc === null || doc === void 0 ? void 0 : doc.body);
17
+ }
18
+ }
19
+ exports.processPastedContentFromPowerPoint = processPastedContentFromPowerPoint;
20
+ });
21
21
  //# sourceMappingURL=processPastedContentFromPowerPoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processPastedContentFromPowerPoint.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/PowerPoint/processPastedContentFromPowerPoint.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IAEH,SAAgB,kCAAkC,CAC9C,KAAuB,EACvB,kBAAsC;QAE9B,IAAA,QAAQ,GAAoB,KAAK,SAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QAE1C,IAAI,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,EAAE;YAClE,gFAAgF;YAChF,gCAAgC;YAChC,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CACvC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,EACtC,WAAW,CACd,CAAC;YAEF,IAAA,4CAAc,EAAC,QAAQ,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,CAAC;SACvC;IACL,CAAC;IAhBD,gFAgBC","sourcesContent":["import { moveChildNodes } from 'roosterjs-content-model-dom';\nimport type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';\n\n/**\n * @internal\n * Convert pasted content from PowerPoint\n * @param event The BeforePaste event\n */\n\nexport function processPastedContentFromPowerPoint(\n event: BeforePasteEvent,\n trustedHTMLHandler: TrustedHTMLHandler\n) {\n const { fragment, clipboardData } = event;\n\n if (clipboardData.html && !clipboardData.text && clipboardData.image) {\n // It is possible that PowerPoint copied both image and HTML but not plain text.\n // We always prefer HTML if any.\n const doc = new DOMParser().parseFromString(\n trustedHTMLHandler(clipboardData.html),\n 'text/html'\n );\n\n moveChildNodes(fragment, doc?.body);\n }\n}\n"]}
1
+ {"version":3,"file":"processPastedContentFromPowerPoint.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-plugins/lib/paste/PowerPoint/processPastedContentFromPowerPoint.ts"],"names":[],"mappings":";;;;IAGA;;;;OAIG;IAEH,SAAgB,kCAAkC,CAC9C,KAAuB,EACvB,kBAAsC;QAE9B,IAAA,QAAQ,GAAoB,KAAK,SAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QAE1C,IAAI,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,EAAE;YAClE,gFAAgF;YAChF,gCAAgC;YAChC,IAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CACvC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,EACtC,WAAW,CACd,CAAC;YAEF,IAAA,4CAAc,EAAC,QAAQ,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,CAAC;SACvC;IACL,CAAC;IAhBD,gFAgBC","sourcesContent":["import { moveChildNodes } from 'roosterjs-content-model-dom';\r\nimport type { BeforePasteEvent, TrustedHTMLHandler } from 'roosterjs-editor-types';\r\n\r\n/**\r\n * @internal\r\n * Convert pasted content from PowerPoint\r\n * @param event The BeforePaste event\r\n */\r\n\r\nexport function processPastedContentFromPowerPoint(\r\n event: BeforePasteEvent,\r\n trustedHTMLHandler: TrustedHTMLHandler\r\n) {\r\n const { fragment, clipboardData } = event;\r\n\r\n if (clipboardData.html && !clipboardData.text && clipboardData.image) {\r\n // It is possible that PowerPoint copied both image and HTML but not plain text.\r\n // We always prefer HTML if any.\r\n const doc = new DOMParser().parseFromString(\r\n trustedHTMLHandler(clipboardData.html),\r\n 'text/html'\r\n );\r\n\r\n moveChildNodes(fragment, doc?.body);\r\n }\r\n}\r\n"]}
@@ -1,9 +1,9 @@
1
- import type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-types';
2
- /**
3
- * @internal
4
- * Convert pasted content from Office Online
5
- * Once it is known that the document is from WAC
6
- * We need to remove the display property and margin from all the list item
7
- * @param ev ContentModelBeforePasteEvent
8
- */
9
- export declare function processPastedContentWacComponents(ev: ContentModelBeforePasteEvent): void;
1
+ import type { ContentModelBeforePasteEvent } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ * Convert pasted content from Office Online
5
+ * Once it is known that the document is from WAC
6
+ * We need to remove the display property and margin from all the list item
7
+ * @param ev ContentModelBeforePasteEvent
8
+ */
9
+ export declare function processPastedContentWacComponents(ev: ContentModelBeforePasteEvent): void;