roosterjs-content-model-core 0.20.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/lib/constants/BulletListType.d.ts +49 -0
  2. package/lib/constants/BulletListType.js +53 -0
  3. package/lib/constants/BulletListType.js.map +1 -0
  4. package/lib/constants/NumberingListType.d.ts +93 -0
  5. package/lib/constants/NumberingListType.js +97 -0
  6. package/lib/constants/NumberingListType.js.map +1 -0
  7. package/lib/constants/TableBorderFormat.d.ts +81 -0
  8. package/lib/constants/TableBorderFormat.js +85 -0
  9. package/lib/constants/TableBorderFormat.js.map +1 -0
  10. package/lib/coreApi/createContentModel.js.map +1 -1
  11. package/lib/coreApi/formatContentModel.js +12 -40
  12. package/lib/coreApi/formatContentModel.js.map +1 -1
  13. package/lib/coreApi/getDOMSelection.js.map +1 -1
  14. package/lib/coreApi/getVisibleViewport.d.ts +7 -0
  15. package/lib/coreApi/getVisibleViewport.js +65 -0
  16. package/lib/coreApi/getVisibleViewport.js.map +1 -0
  17. package/lib/coreApi/setContentModel.js +1 -1
  18. package/lib/coreApi/setContentModel.js.map +1 -1
  19. package/lib/coreApi/switchShadowEdit.d.ts +2 -2
  20. package/lib/coreApi/switchShadowEdit.js +5 -8
  21. package/lib/coreApi/switchShadowEdit.js.map +1 -1
  22. package/lib/corePlugin/ContentModelCachePlugin.d.ts +4 -49
  23. package/lib/corePlugin/ContentModelCachePlugin.js +10 -10
  24. package/lib/corePlugin/ContentModelCachePlugin.js.map +1 -1
  25. package/lib/corePlugin/ContentModelCopyPastePlugin.d.ts +4 -37
  26. package/lib/corePlugin/ContentModelCopyPastePlugin.js +9 -8
  27. package/lib/corePlugin/ContentModelCopyPastePlugin.js.map +1 -1
  28. package/lib/corePlugin/ContentModelFormatPlugin.d.ts +4 -55
  29. package/lib/corePlugin/ContentModelFormatPlugin.js +11 -9
  30. package/lib/corePlugin/ContentModelFormatPlugin.js.map +1 -1
  31. package/lib/corePlugin/DOMEventPlugin.d.ts +9 -0
  32. package/lib/corePlugin/DOMEventPlugin.js +216 -0
  33. package/lib/corePlugin/DOMEventPlugin.js.map +1 -0
  34. package/lib/corePlugin/EntityPlugin.d.ts +7 -0
  35. package/lib/corePlugin/EntityPlugin.js +208 -0
  36. package/lib/corePlugin/EntityPlugin.js.map +1 -0
  37. package/lib/corePlugin/LifecyclePlugin.d.ts +9 -0
  38. package/lib/corePlugin/LifecyclePlugin.js +139 -0
  39. package/lib/corePlugin/LifecyclePlugin.js.map +1 -0
  40. package/lib/corePlugin/SelectionPlugin.d.ts +8 -0
  41. package/lib/corePlugin/SelectionPlugin.js +105 -0
  42. package/lib/corePlugin/SelectionPlugin.js.map +1 -0
  43. package/lib/corePlugin/createStandaloneEditorCorePlugins.d.ts +7 -0
  44. package/lib/corePlugin/createStandaloneEditorCorePlugins.js +28 -0
  45. package/lib/corePlugin/createStandaloneEditorCorePlugins.js.map +1 -0
  46. package/lib/corePlugin/utils/findAllEntities.d.ts +5 -0
  47. package/lib/corePlugin/utils/findAllEntities.js +43 -0
  48. package/lib/corePlugin/utils/findAllEntities.js.map +1 -0
  49. package/lib/editor/DarkColorHandlerImpl.d.ts +47 -0
  50. package/lib/editor/DarkColorHandlerImpl.js +158 -0
  51. package/lib/editor/DarkColorHandlerImpl.js.map +1 -0
  52. package/lib/editor/createStandaloneEditorCore.d.ts +12 -0
  53. package/lib/editor/createStandaloneEditorCore.js +62 -0
  54. package/lib/editor/createStandaloneEditorCore.js.map +1 -0
  55. package/lib/editor/createStandaloneEditorDefaultSettings.d.ts +7 -0
  56. package/lib/editor/createStandaloneEditorDefaultSettings.js +38 -0
  57. package/lib/editor/createStandaloneEditorDefaultSettings.js.map +1 -0
  58. package/lib/editor/standaloneCoreApiMap.d.ts +6 -0
  59. package/lib/editor/standaloneCoreApiMap.js +26 -0
  60. package/lib/editor/standaloneCoreApiMap.js.map +1 -0
  61. package/lib/index.d.ts +6 -6
  62. package/lib/index.js +13 -13
  63. package/lib/index.js.map +1 -1
  64. package/lib/metadata/updateListMetadata.js +33 -32
  65. package/lib/metadata/updateListMetadata.js.map +1 -1
  66. package/lib/metadata/updateTableMetadata.js +2 -2
  67. package/lib/metadata/updateTableMetadata.js.map +1 -1
  68. package/lib/publicApi/model/createModelFromHtml.d.ts +10 -0
  69. package/lib/publicApi/model/createModelFromHtml.js +22 -0
  70. package/lib/publicApi/model/createModelFromHtml.js.map +1 -0
  71. package/lib/publicApi/model/isBold.d.ts +5 -0
  72. package/lib/publicApi/model/isBold.js +12 -0
  73. package/lib/publicApi/model/isBold.js.map +1 -0
  74. package/lib/publicApi/model/paste.js +3 -1
  75. package/lib/publicApi/model/paste.js.map +1 -1
  76. package/lib/publicApi/table/applyTableFormat.js +16 -14
  77. package/lib/publicApi/table/applyTableFormat.js.map +1 -1
  78. package/lib/publicApi/table/setTableCellBackgroundColor.js +56 -9
  79. package/lib/publicApi/table/setTableCellBackgroundColor.js.map +1 -1
  80. package/lib-amd/constants/BulletListType.d.ts +49 -0
  81. package/lib-amd/constants/BulletListType.js +55 -0
  82. package/lib-amd/constants/BulletListType.js.map +1 -0
  83. package/lib-amd/constants/NumberingListType.d.ts +93 -0
  84. package/lib-amd/constants/NumberingListType.js +99 -0
  85. package/lib-amd/constants/NumberingListType.js.map +1 -0
  86. package/lib-amd/constants/TableBorderFormat.d.ts +81 -0
  87. package/lib-amd/constants/TableBorderFormat.js +87 -0
  88. package/lib-amd/constants/TableBorderFormat.js.map +1 -0
  89. package/lib-amd/coreApi/createContentModel.js.map +1 -1
  90. package/lib-amd/coreApi/formatContentModel.js +12 -40
  91. package/lib-amd/coreApi/formatContentModel.js.map +1 -1
  92. package/lib-amd/coreApi/getDOMSelection.js.map +1 -1
  93. package/lib-amd/coreApi/getVisibleViewport.d.ts +7 -0
  94. package/lib-amd/coreApi/getVisibleViewport.js +66 -0
  95. package/lib-amd/coreApi/getVisibleViewport.js.map +1 -0
  96. package/lib-amd/coreApi/setContentModel.js +1 -1
  97. package/lib-amd/coreApi/setContentModel.js.map +1 -1
  98. package/lib-amd/coreApi/switchShadowEdit.d.ts +2 -2
  99. package/lib-amd/coreApi/switchShadowEdit.js +5 -9
  100. package/lib-amd/coreApi/switchShadowEdit.js.map +1 -1
  101. package/lib-amd/corePlugin/ContentModelCachePlugin.d.ts +4 -49
  102. package/lib-amd/corePlugin/ContentModelCachePlugin.js +10 -11
  103. package/lib-amd/corePlugin/ContentModelCachePlugin.js.map +1 -1
  104. package/lib-amd/corePlugin/ContentModelCopyPastePlugin.d.ts +4 -37
  105. package/lib-amd/corePlugin/ContentModelCopyPastePlugin.js +9 -8
  106. package/lib-amd/corePlugin/ContentModelCopyPastePlugin.js.map +1 -1
  107. package/lib-amd/corePlugin/ContentModelFormatPlugin.d.ts +4 -55
  108. package/lib-amd/corePlugin/ContentModelFormatPlugin.js +11 -10
  109. package/lib-amd/corePlugin/ContentModelFormatPlugin.js.map +1 -1
  110. package/lib-amd/corePlugin/DOMEventPlugin.d.ts +9 -0
  111. package/lib-amd/corePlugin/DOMEventPlugin.js +216 -0
  112. package/lib-amd/corePlugin/DOMEventPlugin.js.map +1 -0
  113. package/lib-amd/corePlugin/EntityPlugin.d.ts +7 -0
  114. package/lib-amd/corePlugin/EntityPlugin.js +208 -0
  115. package/lib-amd/corePlugin/EntityPlugin.js.map +1 -0
  116. package/lib-amd/corePlugin/LifecyclePlugin.d.ts +9 -0
  117. package/lib-amd/corePlugin/LifecyclePlugin.js +139 -0
  118. package/lib-amd/corePlugin/LifecyclePlugin.js.map +1 -0
  119. package/lib-amd/corePlugin/SelectionPlugin.d.ts +8 -0
  120. package/lib-amd/corePlugin/SelectionPlugin.js +107 -0
  121. package/lib-amd/corePlugin/SelectionPlugin.js.map +1 -0
  122. package/lib-amd/corePlugin/createStandaloneEditorCorePlugins.d.ts +7 -0
  123. package/lib-amd/corePlugin/createStandaloneEditorCorePlugins.js +23 -0
  124. package/lib-amd/corePlugin/createStandaloneEditorCorePlugins.js.map +1 -0
  125. package/lib-amd/corePlugin/utils/findAllEntities.d.ts +5 -0
  126. package/lib-amd/corePlugin/utils/findAllEntities.js +45 -0
  127. package/lib-amd/corePlugin/utils/findAllEntities.js.map +1 -0
  128. package/lib-amd/editor/DarkColorHandlerImpl.d.ts +47 -0
  129. package/lib-amd/editor/DarkColorHandlerImpl.js +159 -0
  130. package/lib-amd/editor/DarkColorHandlerImpl.js.map +1 -0
  131. package/lib-amd/editor/createStandaloneEditorCore.d.ts +12 -0
  132. package/lib-amd/editor/createStandaloneEditorCore.js +59 -0
  133. package/lib-amd/editor/createStandaloneEditorCore.js.map +1 -0
  134. package/lib-amd/editor/createStandaloneEditorDefaultSettings.d.ts +7 -0
  135. package/lib-amd/editor/createStandaloneEditorDefaultSettings.js +37 -0
  136. package/lib-amd/editor/createStandaloneEditorDefaultSettings.js.map +1 -0
  137. package/lib-amd/editor/standaloneCoreApiMap.d.ts +6 -0
  138. package/lib-amd/editor/standaloneCoreApiMap.js +20 -0
  139. package/lib-amd/editor/standaloneCoreApiMap.js.map +1 -0
  140. package/lib-amd/index.d.ts +6 -6
  141. package/lib-amd/index.js +8 -8
  142. package/lib-amd/index.js.map +1 -1
  143. package/lib-amd/metadata/updateListMetadata.js +32 -32
  144. package/lib-amd/metadata/updateListMetadata.js.map +1 -1
  145. package/lib-amd/metadata/updateTableMetadata.js +2 -2
  146. package/lib-amd/metadata/updateTableMetadata.js.map +1 -1
  147. package/lib-amd/publicApi/model/createModelFromHtml.d.ts +10 -0
  148. package/lib-amd/publicApi/model/createModelFromHtml.js +23 -0
  149. package/lib-amd/publicApi/model/createModelFromHtml.js.map +1 -0
  150. package/lib-amd/publicApi/model/isBold.d.ts +5 -0
  151. package/lib-amd/publicApi/model/isBold.js +14 -0
  152. package/lib-amd/publicApi/model/isBold.js.map +1 -0
  153. package/lib-amd/publicApi/model/paste.js +3 -1
  154. package/lib-amd/publicApi/model/paste.js.map +1 -1
  155. package/lib-amd/publicApi/table/applyTableFormat.js +16 -14
  156. package/lib-amd/publicApi/table/applyTableFormat.js.map +1 -1
  157. package/lib-amd/publicApi/table/setTableCellBackgroundColor.js +56 -9
  158. package/lib-amd/publicApi/table/setTableCellBackgroundColor.js.map +1 -1
  159. package/lib-mjs/constants/BulletListType.d.ts +49 -0
  160. package/lib-mjs/constants/BulletListType.js +50 -0
  161. package/lib-mjs/constants/BulletListType.js.map +1 -0
  162. package/lib-mjs/constants/NumberingListType.d.ts +93 -0
  163. package/lib-mjs/constants/NumberingListType.js +94 -0
  164. package/lib-mjs/constants/NumberingListType.js.map +1 -0
  165. package/lib-mjs/constants/TableBorderFormat.d.ts +81 -0
  166. package/lib-mjs/constants/TableBorderFormat.js +82 -0
  167. package/lib-mjs/constants/TableBorderFormat.js.map +1 -0
  168. package/lib-mjs/coreApi/createContentModel.js.map +1 -1
  169. package/lib-mjs/coreApi/formatContentModel.js +12 -40
  170. package/lib-mjs/coreApi/formatContentModel.js.map +1 -1
  171. package/lib-mjs/coreApi/getDOMSelection.js.map +1 -1
  172. package/lib-mjs/coreApi/getVisibleViewport.d.ts +7 -0
  173. package/lib-mjs/coreApi/getVisibleViewport.js +61 -0
  174. package/lib-mjs/coreApi/getVisibleViewport.js.map +1 -0
  175. package/lib-mjs/coreApi/setContentModel.js +1 -1
  176. package/lib-mjs/coreApi/setContentModel.js.map +1 -1
  177. package/lib-mjs/coreApi/switchShadowEdit.d.ts +2 -2
  178. package/lib-mjs/coreApi/switchShadowEdit.js +5 -8
  179. package/lib-mjs/coreApi/switchShadowEdit.js.map +1 -1
  180. package/lib-mjs/corePlugin/ContentModelCachePlugin.d.ts +4 -49
  181. package/lib-mjs/corePlugin/ContentModelCachePlugin.js +9 -9
  182. package/lib-mjs/corePlugin/ContentModelCachePlugin.js.map +1 -1
  183. package/lib-mjs/corePlugin/ContentModelCopyPastePlugin.d.ts +4 -37
  184. package/lib-mjs/corePlugin/ContentModelCopyPastePlugin.js +8 -7
  185. package/lib-mjs/corePlugin/ContentModelCopyPastePlugin.js.map +1 -1
  186. package/lib-mjs/corePlugin/ContentModelFormatPlugin.d.ts +4 -55
  187. package/lib-mjs/corePlugin/ContentModelFormatPlugin.js +10 -8
  188. package/lib-mjs/corePlugin/ContentModelFormatPlugin.js.map +1 -1
  189. package/lib-mjs/corePlugin/DOMEventPlugin.d.ts +9 -0
  190. package/lib-mjs/corePlugin/DOMEventPlugin.js +212 -0
  191. package/lib-mjs/corePlugin/DOMEventPlugin.js.map +1 -0
  192. package/lib-mjs/corePlugin/EntityPlugin.d.ts +7 -0
  193. package/lib-mjs/corePlugin/EntityPlugin.js +204 -0
  194. package/lib-mjs/corePlugin/EntityPlugin.js.map +1 -0
  195. package/lib-mjs/corePlugin/LifecyclePlugin.d.ts +9 -0
  196. package/lib-mjs/corePlugin/LifecyclePlugin.js +135 -0
  197. package/lib-mjs/corePlugin/LifecyclePlugin.js.map +1 -0
  198. package/lib-mjs/corePlugin/SelectionPlugin.d.ts +8 -0
  199. package/lib-mjs/corePlugin/SelectionPlugin.js +101 -0
  200. package/lib-mjs/corePlugin/SelectionPlugin.js.map +1 -0
  201. package/lib-mjs/corePlugin/createStandaloneEditorCorePlugins.d.ts +7 -0
  202. package/lib-mjs/corePlugin/createStandaloneEditorCorePlugins.js +24 -0
  203. package/lib-mjs/corePlugin/createStandaloneEditorCorePlugins.js.map +1 -0
  204. package/lib-mjs/corePlugin/utils/findAllEntities.d.ts +5 -0
  205. package/lib-mjs/corePlugin/utils/findAllEntities.js +39 -0
  206. package/lib-mjs/corePlugin/utils/findAllEntities.js.map +1 -0
  207. package/lib-mjs/editor/DarkColorHandlerImpl.d.ts +47 -0
  208. package/lib-mjs/editor/DarkColorHandlerImpl.js +155 -0
  209. package/lib-mjs/editor/DarkColorHandlerImpl.js.map +1 -0
  210. package/lib-mjs/editor/createStandaloneEditorCore.d.ts +12 -0
  211. package/lib-mjs/editor/createStandaloneEditorCore.js +57 -0
  212. package/lib-mjs/editor/createStandaloneEditorCore.js.map +1 -0
  213. package/lib-mjs/editor/createStandaloneEditorDefaultSettings.d.ts +7 -0
  214. package/lib-mjs/editor/createStandaloneEditorDefaultSettings.js +34 -0
  215. package/lib-mjs/editor/createStandaloneEditorDefaultSettings.js.map +1 -0
  216. package/lib-mjs/editor/standaloneCoreApiMap.d.ts +6 -0
  217. package/lib-mjs/editor/standaloneCoreApiMap.js +23 -0
  218. package/lib-mjs/editor/standaloneCoreApiMap.js.map +1 -0
  219. package/lib-mjs/index.d.ts +6 -6
  220. package/lib-mjs/index.js +6 -6
  221. package/lib-mjs/index.js.map +1 -1
  222. package/lib-mjs/metadata/updateListMetadata.js +2 -1
  223. package/lib-mjs/metadata/updateListMetadata.js.map +1 -1
  224. package/lib-mjs/metadata/updateTableMetadata.js +2 -2
  225. package/lib-mjs/metadata/updateTableMetadata.js.map +1 -1
  226. package/lib-mjs/publicApi/model/createModelFromHtml.d.ts +10 -0
  227. package/lib-mjs/publicApi/model/createModelFromHtml.js +18 -0
  228. package/lib-mjs/publicApi/model/createModelFromHtml.js.map +1 -0
  229. package/lib-mjs/publicApi/model/isBold.d.ts +5 -0
  230. package/lib-mjs/publicApi/model/isBold.js +8 -0
  231. package/lib-mjs/publicApi/model/isBold.js.map +1 -0
  232. package/lib-mjs/publicApi/model/paste.js +5 -3
  233. package/lib-mjs/publicApi/model/paste.js.map +1 -1
  234. package/lib-mjs/publicApi/table/applyTableFormat.js +16 -14
  235. package/lib-mjs/publicApi/table/applyTableFormat.js.map +1 -1
  236. package/lib-mjs/publicApi/table/setTableCellBackgroundColor.js +56 -9
  237. package/lib-mjs/publicApi/table/setTableCellBackgroundColor.js.map +1 -1
  238. package/package.json +3 -4
  239. package/lib/corePlugin/ContentModelTypeInContainerPlugin.d.ts +0 -23
  240. package/lib/corePlugin/ContentModelTypeInContainerPlugin.js +0 -32
  241. package/lib/corePlugin/ContentModelTypeInContainerPlugin.js.map +0 -1
  242. package/lib/editor/createContentModelEditorCore.d.ts +0 -6
  243. package/lib/editor/createContentModelEditorCore.js +0 -50
  244. package/lib/editor/createContentModelEditorCore.js.map +0 -1
  245. package/lib/editor/promoteToContentModelEditorCore.d.ts +0 -8
  246. package/lib/editor/promoteToContentModelEditorCore.js +0 -72
  247. package/lib/editor/promoteToContentModelEditorCore.js.map +0 -1
  248. package/lib-amd/corePlugin/ContentModelTypeInContainerPlugin.d.ts +0 -23
  249. package/lib-amd/corePlugin/ContentModelTypeInContainerPlugin.js +0 -34
  250. package/lib-amd/corePlugin/ContentModelTypeInContainerPlugin.js.map +0 -1
  251. package/lib-amd/editor/createContentModelEditorCore.d.ts +0 -6
  252. package/lib-amd/editor/createContentModelEditorCore.js +0 -44
  253. package/lib-amd/editor/createContentModelEditorCore.js.map +0 -1
  254. package/lib-amd/editor/promoteToContentModelEditorCore.d.ts +0 -8
  255. package/lib-amd/editor/promoteToContentModelEditorCore.js +0 -64
  256. package/lib-amd/editor/promoteToContentModelEditorCore.js.map +0 -1
  257. package/lib-mjs/corePlugin/ContentModelTypeInContainerPlugin.d.ts +0 -23
  258. package/lib-mjs/corePlugin/ContentModelTypeInContainerPlugin.js +0 -29
  259. package/lib-mjs/corePlugin/ContentModelTypeInContainerPlugin.js.map +0 -1
  260. package/lib-mjs/editor/createContentModelEditorCore.d.ts +0 -6
  261. package/lib-mjs/editor/createContentModelEditorCore.js +0 -46
  262. package/lib-mjs/editor/createContentModelEditorCore.js.map +0 -1
  263. package/lib-mjs/editor/promoteToContentModelEditorCore.d.ts +0 -8
  264. package/lib-mjs/editor/promoteToContentModelEditorCore.js +0 -68
  265. package/lib-mjs/editor/promoteToContentModelEditorCore.js.map +0 -1
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Enum used to control the different types of bullet list
3
+ */
4
+ export declare const BulletListType: {
5
+ /**
6
+ * Minimum value of the enum
7
+ */
8
+ Min: number;
9
+ /**
10
+ * Bullet triggered by *
11
+ */
12
+ Disc: number;
13
+ /**
14
+ * Bullet triggered by -
15
+ */
16
+ Dash: number;
17
+ /**
18
+ * Bullet triggered by --
19
+ */
20
+ Square: number;
21
+ /**
22
+ * Bullet triggered by >
23
+ */
24
+ ShortArrow: number;
25
+ /**
26
+ * Bullet triggered by ->
27
+ */
28
+ LongArrow: number;
29
+ /**
30
+ * Bullet triggered by =>
31
+ */
32
+ UnfilledArrow: number;
33
+ /**
34
+ * Bullet triggered by —
35
+ */
36
+ Hyphen: number;
37
+ /**
38
+ * Bullet triggered by -->
39
+ */
40
+ DoubleLongArrow: number;
41
+ /**
42
+ * Bullet type circle
43
+ */
44
+ Circle: number;
45
+ /**
46
+ * Maximum value of the enum
47
+ */
48
+ Max: number;
49
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BulletListType = void 0;
4
+ /**
5
+ * Enum used to control the different types of bullet list
6
+ */
7
+ exports.BulletListType = {
8
+ /**
9
+ * Minimum value of the enum
10
+ */
11
+ Min: 1,
12
+ /**
13
+ * Bullet triggered by *
14
+ */
15
+ Disc: 1,
16
+ /**
17
+ * Bullet triggered by -
18
+ */
19
+ Dash: 2,
20
+ /**
21
+ * Bullet triggered by --
22
+ */
23
+ Square: 3,
24
+ /**
25
+ * Bullet triggered by >
26
+ */
27
+ ShortArrow: 4,
28
+ /**
29
+ * Bullet triggered by ->
30
+ */
31
+ LongArrow: 5,
32
+ /**
33
+ * Bullet triggered by =>
34
+ */
35
+ UnfilledArrow: 6,
36
+ /**
37
+ * Bullet triggered by —
38
+ */
39
+ Hyphen: 7,
40
+ /**
41
+ * Bullet triggered by -->
42
+ */
43
+ DoubleLongArrow: 8,
44
+ /**
45
+ * Bullet type circle
46
+ */
47
+ Circle: 9,
48
+ /**
49
+ * Maximum value of the enum
50
+ */
51
+ Max: 9,
52
+ };
53
+ //# sourceMappingURL=BulletListType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BulletListType.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/constants/BulletListType.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,cAAc,GAAG;IAC1B;;OAEG;IACH,GAAG,EAAE,CAAC;IACN;;OAEG;IACH,IAAI,EAAE,CAAC;IACP;;OAEG;IACH,IAAI,EAAE,CAAC;IACP;;OAEG;IACH,MAAM,EAAE,CAAC;IACT;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,CAAC;IACZ;;OAEG;IACH,aAAa,EAAE,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,CAAC;IACT;;OAEG;IACH,eAAe,EAAE,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,CAAC;IACT;;OAEG;IACH,GAAG,EAAE,CAAC;CACT,CAAC","sourcesContent":["/**\n * Enum used to control the different types of bullet list\n */\nexport const BulletListType = {\n /**\n * Minimum value of the enum\n */\n Min: 1,\n /**\n * Bullet triggered by *\n */\n Disc: 1,\n /**\n * Bullet triggered by -\n */\n Dash: 2,\n /**\n * Bullet triggered by --\n */\n Square: 3,\n /**\n * Bullet triggered by >\n */\n ShortArrow: 4,\n /**\n * Bullet triggered by ->\n */\n LongArrow: 5,\n /**\n * Bullet triggered by =>\n */\n UnfilledArrow: 6,\n /**\n * Bullet triggered by —\n */\n Hyphen: 7,\n /**\n * Bullet triggered by -->\n */\n DoubleLongArrow: 8,\n /**\n * Bullet type circle\n */\n Circle: 9,\n /**\n * Maximum value of the enum\n */\n Max: 9,\n};\n"]}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Enum used to control the different types of numbering list
3
+ */
4
+ export declare const NumberingListType: {
5
+ /**
6
+ * Minimum value of the enum
7
+ */
8
+ Min: number;
9
+ /**
10
+ * Numbering triggered by 1.
11
+ */
12
+ Decimal: number;
13
+ /**
14
+ * Numbering triggered by 1-
15
+ */
16
+ DecimalDash: number;
17
+ /**
18
+ * Numbering triggered by 1)
19
+ */
20
+ DecimalParenthesis: number;
21
+ /**
22
+ * Numbering triggered by (1)
23
+ */
24
+ DecimalDoubleParenthesis: number;
25
+ /**
26
+ * Numbering triggered by a.
27
+ */
28
+ LowerAlpha: number;
29
+ /**
30
+ * Numbering triggered by a)
31
+ */
32
+ LowerAlphaParenthesis: number;
33
+ /**
34
+ * Numbering triggered by (a)
35
+ */
36
+ LowerAlphaDoubleParenthesis: number;
37
+ /**
38
+ * Numbering triggered by a-
39
+ */
40
+ LowerAlphaDash: number;
41
+ /**
42
+ * Numbering triggered by A.
43
+ */
44
+ UpperAlpha: number;
45
+ /**
46
+ * Numbering triggered by A)
47
+ */
48
+ UpperAlphaParenthesis: number;
49
+ /**
50
+ * Numbering triggered by (A)
51
+ */
52
+ UpperAlphaDoubleParenthesis: number;
53
+ /**
54
+ * Numbering triggered by A-
55
+ */
56
+ UpperAlphaDash: number;
57
+ /**
58
+ * Numbering triggered by i.
59
+ */
60
+ LowerRoman: number;
61
+ /**
62
+ * Numbering triggered by i)
63
+ */
64
+ LowerRomanParenthesis: number;
65
+ /**
66
+ * Numbering triggered by (i)
67
+ */
68
+ LowerRomanDoubleParenthesis: number;
69
+ /**
70
+ * Numbering triggered by i-
71
+ */
72
+ LowerRomanDash: number;
73
+ /**
74
+ * Numbering triggered by I.
75
+ */
76
+ UpperRoman: number;
77
+ /**
78
+ * Numbering triggered by I)
79
+ */
80
+ UpperRomanParenthesis: number;
81
+ /**
82
+ * Numbering triggered by (I)
83
+ */
84
+ UpperRomanDoubleParenthesis: number;
85
+ /**
86
+ * Numbering triggered by I-
87
+ */
88
+ UpperRomanDash: number;
89
+ /**
90
+ * Maximum value of the enum
91
+ */
92
+ Max: number;
93
+ };
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NumberingListType = void 0;
4
+ /**
5
+ * Enum used to control the different types of numbering list
6
+ */
7
+ exports.NumberingListType = {
8
+ /**
9
+ * Minimum value of the enum
10
+ */
11
+ Min: 1,
12
+ /**
13
+ * Numbering triggered by 1.
14
+ */
15
+ Decimal: 1,
16
+ /**
17
+ * Numbering triggered by 1-
18
+ */
19
+ DecimalDash: 2,
20
+ /**
21
+ * Numbering triggered by 1)
22
+ */
23
+ DecimalParenthesis: 3,
24
+ /**
25
+ * Numbering triggered by (1)
26
+ */
27
+ DecimalDoubleParenthesis: 4,
28
+ /**
29
+ * Numbering triggered by a.
30
+ */
31
+ LowerAlpha: 5,
32
+ /**
33
+ * Numbering triggered by a)
34
+ */
35
+ LowerAlphaParenthesis: 6,
36
+ /**
37
+ * Numbering triggered by (a)
38
+ */
39
+ LowerAlphaDoubleParenthesis: 7,
40
+ /**
41
+ * Numbering triggered by a-
42
+ */
43
+ LowerAlphaDash: 8,
44
+ /**
45
+ * Numbering triggered by A.
46
+ */
47
+ UpperAlpha: 9,
48
+ /**
49
+ * Numbering triggered by A)
50
+ */
51
+ UpperAlphaParenthesis: 10,
52
+ /**
53
+ * Numbering triggered by (A)
54
+ */
55
+ UpperAlphaDoubleParenthesis: 11,
56
+ /**
57
+ * Numbering triggered by A-
58
+ */
59
+ UpperAlphaDash: 12,
60
+ /**
61
+ * Numbering triggered by i.
62
+ */
63
+ LowerRoman: 13,
64
+ /**
65
+ * Numbering triggered by i)
66
+ */
67
+ LowerRomanParenthesis: 14,
68
+ /**
69
+ * Numbering triggered by (i)
70
+ */
71
+ LowerRomanDoubleParenthesis: 15,
72
+ /**
73
+ * Numbering triggered by i-
74
+ */
75
+ LowerRomanDash: 16,
76
+ /**
77
+ * Numbering triggered by I.
78
+ */
79
+ UpperRoman: 17,
80
+ /**
81
+ * Numbering triggered by I)
82
+ */
83
+ UpperRomanParenthesis: 18,
84
+ /**
85
+ * Numbering triggered by (I)
86
+ */
87
+ UpperRomanDoubleParenthesis: 19,
88
+ /**
89
+ * Numbering triggered by I-
90
+ */
91
+ UpperRomanDash: 20,
92
+ /**
93
+ * Maximum value of the enum
94
+ */
95
+ Max: 20,
96
+ };
97
+ //# sourceMappingURL=NumberingListType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberingListType.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/constants/NumberingListType.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAC7B;;OAEG;IACH,GAAG,EAAE,CAAC;IACN;;OAEG;IACH,OAAO,EAAE,CAAC;IACV;;OAEG;IACH,WAAW,EAAE,CAAC;IACd;;OAEG;IACH,kBAAkB,EAAE,CAAC;IACrB;;OAEG;IACH,wBAAwB,EAAE,CAAC;IAC3B;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,qBAAqB,EAAE,CAAC;IACxB;;OAEG;IACH,2BAA2B,EAAE,CAAC;IAC9B;;OAEG;IACH,cAAc,EAAE,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,qBAAqB,EAAE,EAAE;IACzB;;OAEG;IACH,2BAA2B,EAAE,EAAE;IAC/B;;OAEG;IACH,cAAc,EAAE,EAAE;IAClB;;OAEG;IACH,UAAU,EAAE,EAAE;IACd;;OAEG;IACH,qBAAqB,EAAE,EAAE;IACzB;;OAEG;IACH,2BAA2B,EAAE,EAAE;IAC/B;;OAEG;IACH,cAAc,EAAE,EAAE;IAClB;;OAEG;IACH,UAAU,EAAE,EAAE;IACd;;OAEG;IACH,qBAAqB,EAAE,EAAE;IACzB;;OAEG;IACH,2BAA2B,EAAE,EAAE;IAC/B;;OAEG;IACH,cAAc,EAAE,EAAE;IAClB;;OAEG;IACH,GAAG,EAAE,EAAE;CACV,CAAC","sourcesContent":["/**\n * Enum used to control the different types of numbering list\n */\nexport const NumberingListType = {\n /**\n * Minimum value of the enum\n */\n Min: 1,\n /**\n * Numbering triggered by 1.\n */\n Decimal: 1,\n /**\n * Numbering triggered by 1-\n */\n DecimalDash: 2,\n /**\n * Numbering triggered by 1)\n */\n DecimalParenthesis: 3,\n /**\n * Numbering triggered by (1)\n */\n DecimalDoubleParenthesis: 4,\n /**\n * Numbering triggered by a.\n */\n LowerAlpha: 5,\n /**\n * Numbering triggered by a)\n */\n LowerAlphaParenthesis: 6,\n /**\n * Numbering triggered by (a)\n */\n LowerAlphaDoubleParenthesis: 7,\n /**\n * Numbering triggered by a-\n */\n LowerAlphaDash: 8,\n /**\n * Numbering triggered by A.\n */\n UpperAlpha: 9,\n /**\n * Numbering triggered by A)\n */\n UpperAlphaParenthesis: 10,\n /**\n * Numbering triggered by (A)\n */\n UpperAlphaDoubleParenthesis: 11,\n /**\n * Numbering triggered by A-\n */\n UpperAlphaDash: 12,\n /**\n * Numbering triggered by i.\n */\n LowerRoman: 13,\n /**\n * Numbering triggered by i)\n */\n LowerRomanParenthesis: 14,\n /**\n * Numbering triggered by (i)\n */\n LowerRomanDoubleParenthesis: 15,\n /**\n * Numbering triggered by i-\n */\n LowerRomanDash: 16,\n /**\n * Numbering triggered by I.\n */\n UpperRoman: 17,\n /**\n * Numbering triggered by I)\n */\n UpperRomanParenthesis: 18,\n /**\n * Numbering triggered by (I)\n */\n UpperRomanDoubleParenthesis: 19,\n /**\n * Numbering triggered by I-\n */\n UpperRomanDash: 20,\n /**\n * Maximum value of the enum\n */\n Max: 20,\n};\n"]}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Table format border
3
+ */
4
+ export declare const TableBorderFormat: {
5
+ /**
6
+ * Minimum value
7
+ */
8
+ Min: number;
9
+ /**
10
+ * All border of the table are displayed
11
+ * __ __ __
12
+ * |__|__|__|
13
+ * |__|__|__|
14
+ * |__|__|__|
15
+ */
16
+ Default: number;
17
+ /**
18
+ * Middle vertical border are not displayed
19
+ * __ __ __
20
+ * |__ __ __|
21
+ * |__ __ __|
22
+ * |__ __ __|
23
+ */
24
+ ListWithSideBorders: number;
25
+ /**
26
+ * All borders except header rows borders are displayed
27
+ * __ __ __
28
+ * __|__|__
29
+ * __|__|__
30
+ */
31
+ NoHeaderBorders: number;
32
+ /**
33
+ * The left and right border of the table are not displayed
34
+ * __ __ __
35
+ * __|__|__
36
+ * __|__|__
37
+ * __|__|__
38
+ */
39
+ NoSideBorders: number;
40
+ /**
41
+ * Only the borders that divides the header row, first column and externals are displayed
42
+ * __ __ __
43
+ * |__ __ __|
44
+ * | | |
45
+ * |__|__ __|
46
+ */
47
+ FirstColumnHeaderExternal: number;
48
+ /**
49
+ * The header row has no vertical border, except for the first one
50
+ * The first column has no horizontal border, except for the first one
51
+ * __ __ __
52
+ * |__ __ __
53
+ * | |__|__|
54
+ * | |__|__|
55
+ */
56
+ EspecialType1: number;
57
+ /**
58
+ * The header row has no vertical border, except for the first one
59
+ * The only horizontal border of the table is the top and bottom of header row
60
+ * __ __ __
61
+ * |__ __ __
62
+ * | | |
63
+ * | | |
64
+ */
65
+ EspecialType2: number;
66
+ /**
67
+ * The only borders are the bottom of header row and the right border of first column
68
+ * __ __ __
69
+ * |
70
+ * |
71
+ */
72
+ EspecialType3: number;
73
+ /**
74
+ * No border
75
+ */
76
+ Clear: number;
77
+ /**
78
+ * Maximum value
79
+ */
80
+ Max: number;
81
+ };
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableBorderFormat = void 0;
4
+ /**
5
+ * Table format border
6
+ */
7
+ exports.TableBorderFormat = {
8
+ /**
9
+ * Minimum value
10
+ */
11
+ Min: 0,
12
+ /**
13
+ * All border of the table are displayed
14
+ * __ __ __
15
+ * |__|__|__|
16
+ * |__|__|__|
17
+ * |__|__|__|
18
+ */
19
+ Default: 0,
20
+ /**
21
+ * Middle vertical border are not displayed
22
+ * __ __ __
23
+ * |__ __ __|
24
+ * |__ __ __|
25
+ * |__ __ __|
26
+ */
27
+ ListWithSideBorders: 1,
28
+ /**
29
+ * All borders except header rows borders are displayed
30
+ * __ __ __
31
+ * __|__|__
32
+ * __|__|__
33
+ */
34
+ NoHeaderBorders: 2,
35
+ /**
36
+ * The left and right border of the table are not displayed
37
+ * __ __ __
38
+ * __|__|__
39
+ * __|__|__
40
+ * __|__|__
41
+ */
42
+ NoSideBorders: 3,
43
+ /**
44
+ * Only the borders that divides the header row, first column and externals are displayed
45
+ * __ __ __
46
+ * |__ __ __|
47
+ * | | |
48
+ * |__|__ __|
49
+ */
50
+ FirstColumnHeaderExternal: 4,
51
+ /**
52
+ * The header row has no vertical border, except for the first one
53
+ * The first column has no horizontal border, except for the first one
54
+ * __ __ __
55
+ * |__ __ __
56
+ * | |__|__|
57
+ * | |__|__|
58
+ */
59
+ EspecialType1: 5,
60
+ /**
61
+ * The header row has no vertical border, except for the first one
62
+ * The only horizontal border of the table is the top and bottom of header row
63
+ * __ __ __
64
+ * |__ __ __
65
+ * | | |
66
+ * | | |
67
+ */
68
+ EspecialType2: 6,
69
+ /**
70
+ * The only borders are the bottom of header row and the right border of first column
71
+ * __ __ __
72
+ * |
73
+ * |
74
+ */
75
+ EspecialType3: 7,
76
+ /**
77
+ * No border
78
+ */
79
+ Clear: 8,
80
+ /**
81
+ * Maximum value
82
+ */
83
+ Max: 8,
84
+ };
85
+ //# sourceMappingURL=TableBorderFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableBorderFormat.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/constants/TableBorderFormat.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAC7B;;OAEG;IACH,GAAG,EAAE,CAAC;IAEN;;;;;;OAMG;IACH,OAAO,EAAE,CAAC;IAEV;;;;;;OAMG;IACH,mBAAmB,EAAE,CAAC;IAEtB;;;;;OAKG;IACH,eAAe,EAAE,CAAC;IAElB;;;;;;OAMG;IACH,aAAa,EAAE,CAAC;IAEhB;;;;;;OAMG;IACH,yBAAyB,EAAE,CAAC;IAE5B;;;;;;;OAOG;IACH,aAAa,EAAE,CAAC;IAEhB;;;;;;;OAOG;IACH,aAAa,EAAE,CAAC;IAEhB;;;;;OAKG;IACH,aAAa,EAAE,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,CAAC;IAER;;OAEG;IACH,GAAG,EAAE,CAAC;CACT,CAAC","sourcesContent":["/**\n * Table format border\n */\nexport const TableBorderFormat = {\n /**\n * Minimum value\n */\n Min: 0,\n\n /**\n * All border of the table are displayed\n * __ __ __\n * |__|__|__|\n * |__|__|__|\n * |__|__|__|\n */\n Default: 0,\n\n /**\n * Middle vertical border are not displayed\n * __ __ __\n * |__ __ __|\n * |__ __ __|\n * |__ __ __|\n */\n ListWithSideBorders: 1,\n\n /**\n * All borders except header rows borders are displayed\n * __ __ __\n * __|__|__\n * __|__|__\n */\n NoHeaderBorders: 2,\n\n /**\n * The left and right border of the table are not displayed\n * __ __ __\n * __|__|__\n * __|__|__\n * __|__|__\n */\n NoSideBorders: 3,\n\n /**\n * Only the borders that divides the header row, first column and externals are displayed\n * __ __ __\n * |__ __ __|\n * | | |\n * |__|__ __|\n */\n FirstColumnHeaderExternal: 4,\n\n /**\n * The header row has no vertical border, except for the first one\n * The first column has no horizontal border, except for the first one\n * __ __ __\n * |__ __ __\n * | |__|__|\n * | |__|__|\n */\n EspecialType1: 5,\n\n /**\n * The header row has no vertical border, except for the first one\n * The only horizontal border of the table is the top and bottom of header row\n * __ __ __\n * |__ __ __\n * | | |\n * | | |\n */\n EspecialType2: 6,\n\n /**\n * The only borders are the bottom of header row and the right border of first column\n * __ __ __\n * |\n * |\n */\n EspecialType3: 7,\n\n /**\n * No border\n */\n Clear: 8,\n\n /**\n * Maximum value\n */\n Max: 8,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createContentModel.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/coreApi/createContentModel.ts"],"names":[],"mappings":";;;;AAAA,4DAA2D;AAC3D,2EAIqC;AASrC;;;;;;GAMG;AACI,IAAM,kBAAkB,GAAuB,UAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB;IAClF,IAAI,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IAEpE,IAAI,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;QAClD,6EAA6E;QAC7E,WAAW,GAAG,IAAA,uBAAU,EAAC,WAAW,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;KACzE;IAED,IAAI,WAAW,EAAE;QACb,OAAO,WAAW,CAAC;KACtB;SAAM;QACH,IAAM,SAAS,GAAG,iBAAiB,IAAI,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;QACnF,IAAM,KAAK,GAAG,0BAA0B,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAElE,IAAI,CAAC,MAAM,IAAI,CAAC,iBAAiB,EAAE;YAC/B,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC;SAC1C;QAED,OAAO,KAAK,CAAC;KAChB;AACL,CAAC,CAAC;AArBW,QAAA,kBAAkB,sBAqB7B;AAEF,SAAS,0BAA0B,CAC/B,IAAuC,EACvC,SAAwB,EACxB,MAAyB;IAEzB,IAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACzD,IAAM,iBAAiB,GAAG,MAAM;QAC5B,CAAC,CAAC,qDAAuB,sEAAC,aAAa,uBAAK,CAAC,IAAI,CAAC,wBAAwB,IAAI,EAAE,CAAC,YAAE,MAAM,WACzF,CAAC,CAAC,IAAA,+DAAiC,EAAC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;IAErF,OAAO,IAAA,+CAAiB,EAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { cloneModel } from '../publicApi/model/cloneModel';\nimport {\n createDomToModelContext,\n createDomToModelContextWithConfig,\n domToContentModel,\n} from 'roosterjs-content-model-dom';\nimport type { EditorCore } from 'roosterjs-editor-types';\nimport type {\n DOMSelection,\n DomToModelOption,\n CreateContentModel,\n StandaloneEditorCore,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Create Content Model from DOM tree in this editor\n * @param core The editor core object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed, use this selection range instead of current selection in editor\n */\nexport const createContentModel: CreateContentModel = (core, option, selectionOverride) => {\n let cachedModel = selectionOverride ? null : core.cache.cachedModel;\n\n if (cachedModel && core.lifecycle.shadowEditFragment) {\n // When in shadow edit, use a cloned model so we won't pollute the cached one\n cachedModel = cloneModel(cachedModel, { includeCachedElement: true });\n }\n\n if (cachedModel) {\n return cachedModel;\n } else {\n const selection = selectionOverride || core.api.getDOMSelection(core) || undefined;\n const model = internalCreateContentModel(core, selection, option);\n\n if (!option && !selectionOverride) {\n core.cache.cachedModel = model;\n core.cache.cachedSelection = selection;\n }\n\n return model;\n }\n};\n\nfunction internalCreateContentModel(\n core: StandaloneEditorCore & EditorCore,\n selection?: DOMSelection,\n option?: DomToModelOption\n) {\n const editorContext = core.api.createEditorContext(core);\n const domToModelContext = option\n ? createDomToModelContext(editorContext, ...(core.defaultDomToModelOptions || []), option)\n : createDomToModelContextWithConfig(core.defaultDomToModelConfig, editorContext);\n\n return domToContentModel(core.contentDiv, domToModelContext, selection);\n}\n"]}
1
+ {"version":3,"file":"createContentModel.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/coreApi/createContentModel.ts"],"names":[],"mappings":";;;;AAAA,4DAA2D;AAC3D,2EAIqC;AAQrC;;;;;;GAMG;AACI,IAAM,kBAAkB,GAAuB,UAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB;IAClF,IAAI,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IAEpE,IAAI,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;QAClD,6EAA6E;QAC7E,WAAW,GAAG,IAAA,uBAAU,EAAC,WAAW,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;KACzE;IAED,IAAI,WAAW,EAAE;QACb,OAAO,WAAW,CAAC;KACtB;SAAM;QACH,IAAM,SAAS,GAAG,iBAAiB,IAAI,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;QACnF,IAAM,KAAK,GAAG,0BAA0B,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAElE,IAAI,CAAC,MAAM,IAAI,CAAC,iBAAiB,EAAE;YAC/B,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC;SAC1C;QAED,OAAO,KAAK,CAAC;KAChB;AACL,CAAC,CAAC;AArBW,QAAA,kBAAkB,sBAqB7B;AAEF,SAAS,0BAA0B,CAC/B,IAA0B,EAC1B,SAAwB,EACxB,MAAyB;IAEzB,IAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACzD,IAAM,iBAAiB,GAAG,MAAM;QAC5B,CAAC,CAAC,qDAAuB,sEAAC,aAAa,uBAAK,CAAC,IAAI,CAAC,wBAAwB,IAAI,EAAE,CAAC,YAAE,MAAM,WACzF,CAAC,CAAC,IAAA,+DAAiC,EAAC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;IAErF,OAAO,IAAA,+CAAiB,EAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { cloneModel } from '../publicApi/model/cloneModel';\nimport {\n createDomToModelContext,\n createDomToModelContextWithConfig,\n domToContentModel,\n} from 'roosterjs-content-model-dom';\nimport type {\n DOMSelection,\n DomToModelOption,\n CreateContentModel,\n StandaloneEditorCore,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Create Content Model from DOM tree in this editor\n * @param core The editor core object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed, use this selection range instead of current selection in editor\n */\nexport const createContentModel: CreateContentModel = (core, option, selectionOverride) => {\n let cachedModel = selectionOverride ? null : core.cache.cachedModel;\n\n if (cachedModel && core.lifecycle.shadowEditFragment) {\n // When in shadow edit, use a cloned model so we won't pollute the cached one\n cachedModel = cloneModel(cachedModel, { includeCachedElement: true });\n }\n\n if (cachedModel) {\n return cachedModel;\n } else {\n const selection = selectionOverride || core.api.getDOMSelection(core) || undefined;\n const model = internalCreateContentModel(core, selection, option);\n\n if (!option && !selectionOverride) {\n core.cache.cachedModel = model;\n core.cache.cachedSelection = selection;\n }\n\n return model;\n }\n};\n\nfunction internalCreateContentModel(\n core: StandaloneEditorCore,\n selection?: DOMSelection,\n option?: DomToModelOption\n) {\n const editorContext = core.api.createEditorContext(core);\n const domToModelContext = option\n ? createDomToModelContext(editorContext, ...(core.defaultDomToModelOptions || []), option)\n : createDomToModelContextWithConfig(core.defaultDomToModelConfig, editorContext);\n\n return domToContentModel(core.contentDiv, domToModelContext, selection);\n}\n"]}
@@ -25,8 +25,6 @@ var formatContentModel = function (core, formatter, options) {
25
25
  var selection;
26
26
  if (formatter(model, context)) {
27
27
  var writeBack = function () {
28
- handleNewEntities(core, context);
29
- handleDeletedEntities(core, context);
30
28
  handleImages(core, context);
31
29
  selection =
32
30
  core.api.setContentModel(core, model, undefined /*options*/, onNodeCreated) ||
@@ -50,6 +48,17 @@ var formatContentModel = function (core, formatter, options) {
50
48
  additionalData: {
51
49
  formatApiName: apiName,
52
50
  },
51
+ changedEntities: context.newEntities
52
+ .map(function (entity) { return ({
53
+ entity: entity,
54
+ operation: 'newEntity',
55
+ rawEvent: rawEvent,
56
+ }); })
57
+ .concat(context.deletedEntities.map(function (entry) { return ({
58
+ entity: entry.entity,
59
+ operation: entry.operation,
60
+ rawEvent: rawEvent,
61
+ }); })),
53
62
  };
54
63
  core.api.triggerEvent(core, eventData, true /*broadcast*/);
55
64
  }
@@ -62,46 +71,9 @@ var formatContentModel = function (core, formatter, options) {
62
71
  }
63
72
  };
64
73
  exports.formatContentModel = formatContentModel;
65
- function handleNewEntities(core, context) {
66
- // TODO: Ideally we can trigger NewEntity event here. But to be compatible with original editor code, we don't do it here for now.
67
- // Once Content Model Editor can be standalone, we can change this behavior to move triggering NewEntity event code
68
- // from EntityPlugin to here
69
- if (core.lifecycle.isDarkMode) {
70
- context.newEntities.forEach(function (entity) {
71
- core.api.transformColor(core, entity.wrapper, true /*includeSelf*/, null /*callback*/, 0 /* LightToDark */);
72
- });
73
- }
74
- }
75
- // This is only used for compatibility with old editor
76
- // TODO: Remove this map once we have standalone editor
77
- var EntityOperationMap = {
78
- overwrite: 6 /* Overwrite */,
79
- removeFromEnd: 5 /* RemoveFromEnd */,
80
- removeFromStart: 4 /* RemoveFromStart */,
81
- };
82
- function handleDeletedEntities(core, context) {
83
- context.deletedEntities.forEach(function (_a) {
84
- var _b = _a.entity, wrapper = _b.wrapper, _c = _b.entityFormat, id = _c.id, entityType = _c.entityType, isReadonly = _c.isReadonly, operation = _a.operation;
85
- if (id && entityType) {
86
- // TODO: Revisit this entity parameter for standalone editor, we may just directly pass ContentModelEntity object instead
87
- var entity = {
88
- id: id,
89
- type: entityType,
90
- isReadonly: !!isReadonly,
91
- wrapper: wrapper,
92
- };
93
- core.api.triggerEvent(core, {
94
- eventType: 15 /* EntityOperation */,
95
- entity: entity,
96
- operation: EntityOperationMap[operation],
97
- rawEvent: context.rawEvent,
98
- }, false /*broadcast*/);
99
- }
100
- });
101
- }
102
74
  function handleImages(core, context) {
103
75
  if (context.newImages.length > 0) {
104
- var viewport = core.getVisibleViewport();
76
+ var viewport = core.api.getVisibleViewport(core);
105
77
  if (viewport) {
106
78
  var left = viewport.left, right = viewport.right;
107
79
  var minMaxImageSize = 10;
@@ -1 +1 @@
1
- {"version":3,"file":"formatContentModel.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/coreApi/formatContentModel.ts"],"names":[],"mappings":";;;;AAAA,0DAAyD;AAYzD;;;;;;;;;GASG;AACI,IAAM,kBAAkB,GAAuB,UAAC,IAAI,EAAE,SAAS,EAAE,OAAO;IACrE,IAAA,KACF,OAAO,IAAI,EAAE,EADT,OAAO,aAAA,EAAE,aAAa,mBAAA,EAAE,aAAa,mBAAA,EAAE,YAAY,kBAAA,EAAE,QAAQ,cAAA,EAAE,iBAAiB,uBACvE,CAAC;IAElB,IAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IACzF,IAAM,OAAO,GAAkC;QAC3C,WAAW,EAAE,EAAE;QACf,eAAe,EAAE,EAAE;QACnB,QAAQ,UAAA;QACR,SAAS,EAAE,EAAE;KAChB,CAAC;IACF,IAAI,SAAmC,CAAC;IAExC,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;QAC3B,IAAM,SAAS,GAAG;YACd,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACjC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACrC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAE5B,SAAS;gBACL,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC;oBAC3E,SAAS,CAAC;YAEd,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAClD,CAAC,CAAC;QAEF,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC1B,SAAS,EAAE,CAAC;SACf;aAAM;YACH,IAAI,CAAC,GAAG,CAAC,eAAe,CACpB,I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e,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,UAAA,KAAK;gBAC3B,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAM,UAAQ,OAAI,CAAC;YAC5C,CAAC,CAAC,CAAC;SACN;KACJ;AACL,CAAC;AAED,SAAS,mBAAmB,CACxB,IAA0B,EAC1B,OAAsC,EACtC,SAA+B;;IAE/B,IAAM,aAAa,GACf,OAAO,CAAC,gBAAgB,IAAI,UAAU;QAClC,CAAC,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,aAAa,0CAAE,MAAM;QACnC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAEnC,IAAI,aAAa,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,KAAI,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;QAC1E,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG;YACxB,MAAM,4BAAO,aAAa,CAAE;YAC5B,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,cAAc;YAC5C,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,WAAW;SACzC,CAAC;KACL;AACL,CAAC","sourcesContent":["import { ChangeSource } from '../constants/ChangeSource';\nimport { ColorTransformDirection, EntityOperation, PluginEventType } from 'roosterjs-editor-types';\nimport type { EditorCore, Entity } from 'roosterjs-editor-types';\nimport type {\n ContentModelContentChangedEvent,\n DOMSelection,\n EntityRemovalOperation,\n FormatContentModel,\n FormatWithContentModelContext,\n StandaloneEditorCore,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The StandaloneEditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatWithContentModelOptions\n */\nexport const formatContentModel: FormatContentModel = (core, formatter, options) => {\n const { apiName, onNodeCreated, getChangeData, changeSource, rawEvent, selectionOverride } =\n options || {};\n\n const model = core.api.createContentModel(core, undefined /*option*/, selectionOverride);\n const context: FormatWithContentModelContext = {\n newEntities: [],\n deletedEntities: [],\n rawEvent,\n newImages: [],\n };\n let selection: DOMSelection | undefined;\n\n if (formatter(model, context)) {\n const writeBack = () => {\n handleNewEntities(core, context);\n handleDeletedEntities(core, context);\n handleImages(core, context);\n\n selection =\n core.api.setContentModel(core, model, undefined /*options*/, onNodeCreated) ||\n undefined;\n\n handlePendingFormat(core, context, selection);\n };\n\n if (context.skipUndoSnapshot) {\n writeBack();\n } else {\n core.api.addUndoSnapshot(\n core,\n writeBack,\n null /*changeSource, passing undefined here to avoid triggering ContentChangedEvent. We will trigger it using it with Content Model below */,\n false /*canUndoByBackspace*/,\n {\n formatApiName: apiName,\n }\n );\n }\n\n const eventData: ContentModelContentChangedEvent = {\n eventType: PluginEventType.ContentChanged,\n contentModel: context.clearModelCache ? undefined : model,\n selection: context.clearModelCache ? undefined : selection,\n source: changeSource || ChangeSource.Format,\n data: getChangeData?.(),\n additionalData: {\n formatApiName: apiName,\n },\n };\n core.api.triggerEvent(core, eventData, true /*broadcast*/);\n } else {\n if (context.clearModelCache) {\n core.cache.cachedModel = undefined;\n core.cache.cachedSelection = undefined;\n }\n\n handlePendingFormat(core, context, core.api.getDOMSelection(core));\n }\n};\n\nfunction handleNewEntities(core: EditorCore, context: FormatWithContentModelContext) {\n // TODO: Ideally we can trigger NewEntity event here. But to be compatible with original editor code, we don't do it here for now.\n // Once Content Model Editor can be standalone, we can change this behavior to move triggering NewEntity event code\n // from EntityPlugin to here\n\n if (core.lifecycle.isDarkMode) {\n context.newEntities.forEach(entity => {\n core.api.transformColor(\n core,\n entity.wrapper,\n true /*includeSelf*/,\n null /*callback*/,\n ColorTransformDirection.LightToDark\n );\n });\n }\n}\n\n// This is only used for compatibility with old editor\n// TODO: Remove this map once we have standalone editor\nconst EntityOperationMap: Record<EntityRemovalOperation, EntityOperation> = {\n overwrite: EntityOperation.Overwrite,\n removeFromEnd: EntityOperation.RemoveFromEnd,\n removeFromStart: EntityOperation.RemoveFromStart,\n};\n\nfunction handleDeletedEntities(core: EditorCore, context: FormatWithContentModelContext) {\n context.deletedEntities.forEach(\n ({\n entity: {\n wrapper,\n entityFormat: { id, entityType, isReadonly },\n },\n operation,\n }) => {\n if (id && entityType) {\n // TODO: Revisit this entity parameter for standalone editor, we may just directly pass ContentModelEntity object instead\n const entity: Entity = {\n id,\n type: entityType,\n isReadonly: !!isReadonly,\n wrapper,\n };\n core.api.triggerEvent(\n core,\n {\n eventType: PluginEventType.EntityOperation,\n entity,\n operation: EntityOperationMap[operation],\n rawEvent: context.rawEvent,\n },\n false /*broadcast*/\n );\n }\n }\n );\n}\n\nfunction handleImages(core: EditorCore, context: FormatWithContentModelContext) {\n if (context.newImages.length > 0) {\n const viewport = core.getVisibleViewport();\n\n if (viewport) {\n const { left, right } = viewport;\n const minMaxImageSize = 10;\n const maxWidth = Math.max(right - left, minMaxImageSize);\n context.newImages.forEach(image => {\n image.format.maxWidth = `${maxWidth}px`;\n });\n }\n }\n}\n\nfunction handlePendingFormat(\n core: StandaloneEditorCore,\n context: FormatWithContentModelContext,\n selection?: DOMSelection | null\n) {\n const pendingFormat =\n context.newPendingFormat == 'preserve'\n ? core.format.pendingFormat?.format\n : context.newPendingFormat;\n\n if (pendingFormat && selection?.type == 'range' && selection.range.collapsed) {\n core.format.pendingFormat = {\n format: { ...pendingFormat },\n posContainer: selection.range.startContainer,\n posOffset: selection.range.startOffset,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"formatContentModel.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/coreApi/formatContentModel.ts"],"names":[],"mappings":";;;;AAAA,0DAAyD;AAWzD;;;;;;;;;GASG;AACI,IAAM,kBAAkB,GAAuB,UAAC,IAAI,EAAE,SAAS,EAAE,OAAO;IACrE,IAAA,KACF,OAAO,IAAI,EAAE,EADT,OAAO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AAG,EAAE,CAAC;YAC3B,IAAM,UAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,eAAe,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,UAAA,KAAK;gBAC3B,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAM,UAAQ,OAAI,CAAC;YAC5C,CAAC,CAAC,CAAC;SACN;KACJ;AACL,CAAC;AAED,SAAS,mBAAmB,CACxB,IAA0B,EAC1B,OAAsC,EACtC,SAA+B;;IAE/B,IAAM,aAAa,GACf,OAAO,CAAC,gBAAgB,IAAI,UAAU;QAClC,CAAC,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,aAAa,0CAAE,MAAM;QACnC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAEnC,IAAI,aAAa,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,KAAI,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;QAC1E,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG;YACxB,MAAM,4BAAO,aAAa,CAAE;YAC5B,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,cAAc;YAC5C,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,WAAW;SACzC,CAAC;KACL;AACL,CAAC","sourcesContent":["import { ChangeSource } from '../constants/ChangeSource';\nimport { PluginEventType } from 'roosterjs-editor-types';\nimport type {\n ChangedEntity,\n ContentModelContentChangedEvent,\n DOMSelection,\n FormatContentModel,\n FormatWithContentModelContext,\n StandaloneEditorCore,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The StandaloneEditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatWithContentModelOptions\n */\nexport const formatContentModel: FormatContentModel = (core, formatter, options) => {\n const { apiName, onNodeCreated, getChangeData, changeSource, rawEvent, selectionOverride } =\n options || {};\n\n const model = core.api.createContentModel(core, undefined /*option*/, selectionOverride);\n const context: FormatWithContentModelContext = {\n newEntities: [],\n deletedEntities: [],\n rawEvent,\n newImages: [],\n };\n let selection: DOMSelection | undefined;\n\n if (formatter(model, context)) {\n const writeBack = () => {\n handleImages(core, context);\n\n selection =\n core.api.setContentModel(core, model, undefined /*options*/, onNodeCreated) ||\n undefined;\n\n handlePendingFormat(core, context, selection);\n };\n\n if (context.skipUndoSnapshot) {\n writeBack();\n } else {\n core.api.addUndoSnapshot(\n core,\n writeBack,\n null /*changeSource, passing undefined here to avoid triggering ContentChangedEvent. We will trigger it using it with Content Model below */,\n false /*canUndoByBackspace*/,\n {\n formatApiName: apiName,\n }\n );\n }\n\n const eventData: ContentModelContentChangedEvent = {\n eventType: PluginEventType.ContentChanged,\n contentModel: context.clearModelCache ? undefined : model,\n selection: context.clearModelCache ? undefined : selection,\n source: changeSource || ChangeSource.Format,\n data: getChangeData?.(),\n additionalData: {\n formatApiName: apiName,\n },\n changedEntities: context.newEntities\n .map(\n (entity): ChangedEntity => ({\n entity,\n operation: 'newEntity',\n rawEvent,\n })\n )\n .concat(\n context.deletedEntities.map(entry => ({\n entity: entry.entity,\n operation: entry.operation,\n rawEvent,\n }))\n ),\n };\n core.api.triggerEvent(core, eventData, true /*broadcast*/);\n } else {\n if (context.clearModelCache) {\n core.cache.cachedModel = undefined;\n core.cache.cachedSelection = undefined;\n }\n\n handlePendingFormat(core, context, core.api.getDOMSelection(core));\n }\n};\n\nfunction handleImages(core: StandaloneEditorCore, context: FormatWithContentModelContext) {\n if (context.newImages.length > 0) {\n const viewport = core.api.getVisibleViewport(core);\n\n if (viewport) {\n const { left, right } = viewport;\n const minMaxImageSize = 10;\n const maxWidth = Math.max(right - left, minMaxImageSize);\n context.newImages.forEach(image => {\n image.format.maxWidth = `${maxWidth}px`;\n });\n }\n }\n}\n\nfunction handlePendingFormat(\n core: StandaloneEditorCore,\n context: FormatWithContentModelContext,\n selection?: DOMSelection | null\n) {\n const pendingFormat =\n context.newPendingFormat == 'preserve'\n ? core.format.pendingFormat?.format\n : context.newPendingFormat;\n\n if (pendingFormat && selection?.type == 'range' && selection.range.collapsed) {\n core.format.pendingFormat = {\n format: { ...pendingFormat },\n posContainer: selection.range.startContainer,\n posOffset: selection.range.startOffset,\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getDOMSelection.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/coreApi/getDOMSelection.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACI,IAAM,eAAe,GAAoB,UAAA,IAAI;;IAChD,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,eAAe,mCAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEF,SAAS,eAAe,CAAC,IAAgB;IACrC,sEAAsE;IACtE,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,OAAO,CAAC,IAAI,kBAA8B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QACjE,OAAO;YACH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC3B,CAAC;KACL;SAAM,IAAI,OAAO,CAAC,IAAI,0BAAsC,IAAI,OAAO,CAAC,WAAW,EAAE;QAClF,OAAO;YACH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAC5C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC1C,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YACzC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SAC1C,CAAC;KACL;SAAM,IAAI,OAAO,CAAC,IAAI,0BAAsC,EAAE;QAC3D,OAAO;YACH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC;KACL;SAAM;QACH,OAAO,IAAI,CAAC;KACf;AACL,CAAC","sourcesContent":["import { SelectionRangeTypes } from 'roosterjs-editor-types';\nimport type { EditorCore } from 'roosterjs-editor-types';\nimport type { DOMSelection, GetDOMSelection } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const getDOMSelection: GetDOMSelection = core => {\n return core.cache.cachedSelection ?? getNewSelection(core);\n};\n\nfunction getNewSelection(core: EditorCore): DOMSelection | null {\n // TODO: Get rid of getSelectionRangeEx when we have standalone editor\n const rangeEx = core.api.getSelectionRangeEx(core);\n\n if (rangeEx.type == SelectionRangeTypes.Normal && rangeEx.ranges[0]) {\n return {\n type: 'range',\n range: rangeEx.ranges[0],\n };\n } else if (rangeEx.type == SelectionRangeTypes.TableSelection && rangeEx.coordinates) {\n return {\n type: 'table',\n table: rangeEx.table,\n firstColumn: rangeEx.coordinates.firstCell.x,\n lastColumn: rangeEx.coordinates.lastCell.x,\n firstRow: rangeEx.coordinates.firstCell.y,\n lastRow: rangeEx.coordinates.lastCell.y,\n };\n } else if (rangeEx.type == SelectionRangeTypes.ImageSelection) {\n return {\n type: 'image',\n image: rangeEx.image,\n };\n } else {\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"getDOMSelection.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-core/lib/coreApi/getDOMSelection.ts"],"names":[],"mappings":";;;AAOA;;GAEG;AACI,IAAM,eAAe,GAAoB,UAAA,IAAI;;IAChD,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,eAAe,mCAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEF,SAAS,eAAe,CAAC,IAA0B;IAC/C,sEAAsE;IACtE,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,OAAO,CAAC,IAAI,kBAA8B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QACjE,OAAO;YACH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC3B,CAAC;KACL;SAAM,IAAI,OAAO,CAAC,IAAI,0BAAsC,IAAI,OAAO,CAAC,WAAW,EAAE;QAClF,OAAO;YACH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAC5C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC1C,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YACzC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SAC1C,CAAC;KACL;SAAM,IAAI,OAAO,CAAC,IAAI,0BAAsC,EAAE;QAC3D,OAAO;YACH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC;KACL;SAAM;QACH,OAAO,IAAI,CAAC;KACf;AACL,CAAC","sourcesContent":["import { SelectionRangeTypes } from 'roosterjs-editor-types';\nimport type {\n DOMSelection,\n GetDOMSelection,\n StandaloneEditorCore,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const getDOMSelection: GetDOMSelection = core => {\n return core.cache.cachedSelection ?? getNewSelection(core);\n};\n\nfunction getNewSelection(core: StandaloneEditorCore): DOMSelection | null {\n // TODO: Get rid of getSelectionRangeEx when we have standalone editor\n const rangeEx = core.api.getSelectionRangeEx(core);\n\n if (rangeEx.type == SelectionRangeTypes.Normal && rangeEx.ranges[0]) {\n return {\n type: 'range',\n range: rangeEx.ranges[0],\n };\n } else if (rangeEx.type == SelectionRangeTypes.TableSelection && rangeEx.coordinates) {\n return {\n type: 'table',\n table: rangeEx.table,\n firstColumn: rangeEx.coordinates.firstCell.x,\n lastColumn: rangeEx.coordinates.lastCell.x,\n firstRow: rangeEx.coordinates.firstCell.y,\n lastRow: rangeEx.coordinates.lastCell.y,\n };\n } else if (rangeEx.type == SelectionRangeTypes.ImageSelection) {\n return {\n type: 'image',\n image: rangeEx.image,\n };\n } else {\n return null;\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import type { GetVisibleViewport } from 'roosterjs-content-model-types';
2
+ /**
3
+ * @internal
4
+ * Retrieves the rect of the visible viewport of the editor.
5
+ * @param core The StandaloneEditorCore object
6
+ */
7
+ export declare const getVisibleViewport: GetVisibleViewport;