roosterjs-content-model-types 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/lib/editor/IStandaloneEditor.d.ts +99 -0
  2. package/lib/editor/IStandaloneEditor.js +3 -0
  3. package/lib/editor/IStandaloneEditor.js.map +1 -0
  4. package/lib/editor/StandaloneEditorCore.d.ts +466 -0
  5. package/lib/editor/StandaloneEditorCore.js +3 -0
  6. package/lib/editor/StandaloneEditorCore.js.map +1 -0
  7. package/lib/editor/StandaloneEditorCorePlugins.d.ts +40 -0
  8. package/lib/editor/StandaloneEditorCorePlugins.js +3 -0
  9. package/lib/editor/StandaloneEditorCorePlugins.js.map +1 -0
  10. package/lib/editor/StandaloneEditorOptions.d.ts +78 -0
  11. package/lib/editor/StandaloneEditorOptions.js +3 -0
  12. package/lib/editor/StandaloneEditorOptions.js.map +1 -0
  13. package/lib/enum/BorderOperations.d.ts +36 -0
  14. package/lib/enum/BorderOperations.js +3 -0
  15. package/lib/enum/BorderOperations.js.map +1 -0
  16. package/lib/enum/DeleteResult.d.ts +20 -0
  17. package/lib/enum/DeleteResult.js +3 -0
  18. package/lib/enum/DeleteResult.js.map +1 -0
  19. package/lib/enum/EntityOperation.d.ts +51 -0
  20. package/lib/enum/EntityOperation.js +3 -0
  21. package/lib/enum/EntityOperation.js.map +1 -0
  22. package/lib/enum/InsertEntityPosition.d.ts +8 -0
  23. package/lib/enum/InsertEntityPosition.js +3 -0
  24. package/lib/enum/InsertEntityPosition.js.map +1 -0
  25. package/lib/enum/PasteType.d.ts +20 -0
  26. package/lib/enum/PasteType.js +3 -0
  27. package/lib/enum/PasteType.js.map +1 -0
  28. package/lib/enum/TableOperation.d.ts +136 -0
  29. package/lib/enum/TableOperation.js +3 -0
  30. package/lib/enum/TableOperation.js.map +1 -0
  31. package/lib/event/ContentModelBeforePasteEvent.d.ts +27 -0
  32. package/lib/event/ContentModelBeforePasteEvent.js +3 -0
  33. package/lib/event/ContentModelBeforePasteEvent.js.map +1 -0
  34. package/lib/event/ContentModelContentChangedEvent.d.ts +49 -0
  35. package/lib/event/ContentModelContentChangedEvent.js +3 -0
  36. package/lib/event/ContentModelContentChangedEvent.js.map +1 -0
  37. package/lib/format/formatParts/MarginFormat.d.ts +8 -0
  38. package/lib/format/formatParts/MarginFormat.js.map +1 -1
  39. package/lib/format/metadata/ListMetadataFormat.d.ts +4 -146
  40. package/lib/format/metadata/ListMetadataFormat.js +0 -145
  41. package/lib/format/metadata/ListMetadataFormat.js.map +1 -1
  42. package/lib/format/metadata/TableMetadataFormat.d.ts +2 -75
  43. package/lib/format/metadata/TableMetadataFormat.js +0 -75
  44. package/lib/format/metadata/TableMetadataFormat.js.map +1 -1
  45. package/lib/index.d.ts +31 -2
  46. package/lib/index.js +0 -6
  47. package/lib/index.js.map +1 -1
  48. package/lib/parameter/Border.d.ts +18 -0
  49. package/lib/parameter/Border.js +3 -0
  50. package/lib/parameter/Border.js.map +1 -0
  51. package/lib/parameter/ContentModelFormatState.d.ts +147 -0
  52. package/lib/parameter/ContentModelFormatState.js +3 -0
  53. package/lib/parameter/ContentModelFormatState.js.map +1 -0
  54. package/lib/parameter/DeleteSelectionStep.d.ts +49 -0
  55. package/lib/parameter/DeleteSelectionStep.js +3 -0
  56. package/lib/parameter/DeleteSelectionStep.js.map +1 -0
  57. package/lib/parameter/EditorEnvironment.d.ts +17 -0
  58. package/lib/parameter/EditorEnvironment.js +3 -0
  59. package/lib/parameter/EditorEnvironment.js.map +1 -0
  60. package/lib/parameter/FormatWithContentModelContext.d.ts +57 -0
  61. package/lib/parameter/FormatWithContentModelContext.js +3 -0
  62. package/lib/parameter/FormatWithContentModelContext.js.map +1 -0
  63. package/lib/parameter/FormatWithContentModelOptions.d.ts +42 -0
  64. package/lib/parameter/FormatWithContentModelOptions.js +3 -0
  65. package/lib/parameter/FormatWithContentModelOptions.js.map +1 -0
  66. package/lib/parameter/ImageFormatState.d.ts +25 -0
  67. package/lib/parameter/ImageFormatState.js +3 -0
  68. package/lib/parameter/ImageFormatState.js.map +1 -0
  69. package/lib/parameter/InsertEntityOptions.d.ts +21 -0
  70. package/lib/parameter/InsertEntityOptions.js +3 -0
  71. package/lib/parameter/InsertEntityOptions.js.map +1 -0
  72. package/lib/pluginState/ContentModelCachePluginState.d.ts +20 -0
  73. package/lib/pluginState/ContentModelCachePluginState.js +3 -0
  74. package/lib/pluginState/ContentModelCachePluginState.js.map +1 -0
  75. package/lib/pluginState/ContentModelFormatPluginState.d.ts +31 -0
  76. package/lib/pluginState/ContentModelFormatPluginState.js +3 -0
  77. package/lib/pluginState/ContentModelFormatPluginState.js.map +1 -0
  78. package/lib/pluginState/DOMEventPluginState.d.ts +30 -0
  79. package/lib/pluginState/DOMEventPluginState.js +3 -0
  80. package/lib/pluginState/DOMEventPluginState.js.map +1 -0
  81. package/lib/pluginState/EntityPluginState.d.ts +26 -0
  82. package/lib/pluginState/EntityPluginState.js +3 -0
  83. package/lib/pluginState/EntityPluginState.js.map +1 -0
  84. package/lib/pluginState/LifecyclePluginState.d.ts +18 -0
  85. package/lib/pluginState/LifecyclePluginState.js +3 -0
  86. package/lib/pluginState/LifecyclePluginState.js.map +1 -0
  87. package/lib/pluginState/SelectionPluginState.d.ts +30 -0
  88. package/lib/pluginState/SelectionPluginState.js +3 -0
  89. package/lib/pluginState/SelectionPluginState.js.map +1 -0
  90. package/lib/pluginState/StandaloneEditorPluginState.d.ts +49 -0
  91. package/lib/pluginState/StandaloneEditorPluginState.js +3 -0
  92. package/lib/pluginState/StandaloneEditorPluginState.js.map +1 -0
  93. package/lib/selection/InsertPoint.d.ts +25 -0
  94. package/lib/selection/InsertPoint.js +3 -0
  95. package/lib/selection/InsertPoint.js.map +1 -0
  96. package/lib/selection/TableSelectionContext.d.ts +22 -0
  97. package/lib/selection/TableSelectionContext.js +3 -0
  98. package/lib/selection/TableSelectionContext.js.map +1 -0
  99. package/lib-amd/editor/IStandaloneEditor.d.ts +99 -0
  100. package/lib-amd/editor/IStandaloneEditor.js +5 -0
  101. package/lib-amd/editor/IStandaloneEditor.js.map +1 -0
  102. package/lib-amd/editor/StandaloneEditorCore.d.ts +466 -0
  103. package/lib-amd/editor/StandaloneEditorCore.js +5 -0
  104. package/lib-amd/editor/StandaloneEditorCore.js.map +1 -0
  105. package/lib-amd/editor/StandaloneEditorCorePlugins.d.ts +40 -0
  106. package/lib-amd/editor/StandaloneEditorCorePlugins.js +5 -0
  107. package/lib-amd/editor/StandaloneEditorCorePlugins.js.map +1 -0
  108. package/lib-amd/editor/StandaloneEditorOptions.d.ts +78 -0
  109. package/lib-amd/editor/StandaloneEditorOptions.js +5 -0
  110. package/lib-amd/editor/StandaloneEditorOptions.js.map +1 -0
  111. package/lib-amd/enum/BorderOperations.d.ts +36 -0
  112. package/lib-amd/enum/BorderOperations.js +5 -0
  113. package/lib-amd/enum/BorderOperations.js.map +1 -0
  114. package/lib-amd/enum/DeleteResult.d.ts +20 -0
  115. package/lib-amd/enum/DeleteResult.js +5 -0
  116. package/lib-amd/enum/DeleteResult.js.map +1 -0
  117. package/lib-amd/enum/EntityOperation.d.ts +51 -0
  118. package/lib-amd/enum/EntityOperation.js +5 -0
  119. package/lib-amd/enum/EntityOperation.js.map +1 -0
  120. package/lib-amd/enum/InsertEntityPosition.d.ts +8 -0
  121. package/lib-amd/enum/InsertEntityPosition.js +5 -0
  122. package/lib-amd/enum/InsertEntityPosition.js.map +1 -0
  123. package/lib-amd/enum/PasteType.d.ts +20 -0
  124. package/lib-amd/enum/PasteType.js +5 -0
  125. package/lib-amd/enum/PasteType.js.map +1 -0
  126. package/lib-amd/enum/TableOperation.d.ts +136 -0
  127. package/lib-amd/enum/TableOperation.js +5 -0
  128. package/lib-amd/enum/TableOperation.js.map +1 -0
  129. package/lib-amd/event/ContentModelBeforePasteEvent.d.ts +27 -0
  130. package/lib-amd/event/ContentModelBeforePasteEvent.js +5 -0
  131. package/lib-amd/event/ContentModelBeforePasteEvent.js.map +1 -0
  132. package/lib-amd/event/ContentModelContentChangedEvent.d.ts +49 -0
  133. package/lib-amd/event/ContentModelContentChangedEvent.js +5 -0
  134. package/lib-amd/event/ContentModelContentChangedEvent.js.map +1 -0
  135. package/lib-amd/format/formatParts/MarginFormat.d.ts +8 -0
  136. package/lib-amd/format/formatParts/MarginFormat.js.map +1 -1
  137. package/lib-amd/format/metadata/ListMetadataFormat.d.ts +4 -146
  138. package/lib-amd/format/metadata/ListMetadataFormat.js +0 -145
  139. package/lib-amd/format/metadata/ListMetadataFormat.js.map +1 -1
  140. package/lib-amd/format/metadata/TableMetadataFormat.d.ts +2 -75
  141. package/lib-amd/format/metadata/TableMetadataFormat.js +0 -75
  142. package/lib-amd/format/metadata/TableMetadataFormat.js.map +1 -1
  143. package/lib-amd/index.d.ts +31 -2
  144. package/lib-amd/index.js +1 -5
  145. package/lib-amd/index.js.map +1 -1
  146. package/lib-amd/parameter/Border.d.ts +18 -0
  147. package/lib-amd/parameter/Border.js +5 -0
  148. package/lib-amd/parameter/Border.js.map +1 -0
  149. package/lib-amd/parameter/ContentModelFormatState.d.ts +147 -0
  150. package/lib-amd/parameter/ContentModelFormatState.js +5 -0
  151. package/lib-amd/parameter/ContentModelFormatState.js.map +1 -0
  152. package/lib-amd/parameter/DeleteSelectionStep.d.ts +49 -0
  153. package/lib-amd/parameter/DeleteSelectionStep.js +5 -0
  154. package/lib-amd/parameter/DeleteSelectionStep.js.map +1 -0
  155. package/lib-amd/parameter/EditorEnvironment.d.ts +17 -0
  156. package/lib-amd/parameter/EditorEnvironment.js +5 -0
  157. package/lib-amd/parameter/EditorEnvironment.js.map +1 -0
  158. package/lib-amd/parameter/FormatWithContentModelContext.d.ts +57 -0
  159. package/lib-amd/parameter/FormatWithContentModelContext.js +5 -0
  160. package/lib-amd/parameter/FormatWithContentModelContext.js.map +1 -0
  161. package/lib-amd/parameter/FormatWithContentModelOptions.d.ts +42 -0
  162. package/lib-amd/parameter/FormatWithContentModelOptions.js +5 -0
  163. package/lib-amd/parameter/FormatWithContentModelOptions.js.map +1 -0
  164. package/lib-amd/parameter/ImageFormatState.d.ts +25 -0
  165. package/lib-amd/parameter/ImageFormatState.js +5 -0
  166. package/lib-amd/parameter/ImageFormatState.js.map +1 -0
  167. package/lib-amd/parameter/InsertEntityOptions.d.ts +21 -0
  168. package/lib-amd/parameter/InsertEntityOptions.js +5 -0
  169. package/lib-amd/parameter/InsertEntityOptions.js.map +1 -0
  170. package/lib-amd/pluginState/ContentModelCachePluginState.d.ts +20 -0
  171. package/lib-amd/pluginState/ContentModelCachePluginState.js +5 -0
  172. package/lib-amd/pluginState/ContentModelCachePluginState.js.map +1 -0
  173. package/lib-amd/pluginState/ContentModelFormatPluginState.d.ts +31 -0
  174. package/lib-amd/pluginState/ContentModelFormatPluginState.js +5 -0
  175. package/lib-amd/pluginState/ContentModelFormatPluginState.js.map +1 -0
  176. package/lib-amd/pluginState/DOMEventPluginState.d.ts +30 -0
  177. package/lib-amd/pluginState/DOMEventPluginState.js +5 -0
  178. package/lib-amd/pluginState/DOMEventPluginState.js.map +1 -0
  179. package/lib-amd/pluginState/EntityPluginState.d.ts +26 -0
  180. package/lib-amd/pluginState/EntityPluginState.js +5 -0
  181. package/lib-amd/pluginState/EntityPluginState.js.map +1 -0
  182. package/lib-amd/pluginState/LifecyclePluginState.d.ts +18 -0
  183. package/lib-amd/pluginState/LifecyclePluginState.js +5 -0
  184. package/lib-amd/pluginState/LifecyclePluginState.js.map +1 -0
  185. package/lib-amd/pluginState/SelectionPluginState.d.ts +30 -0
  186. package/lib-amd/pluginState/SelectionPluginState.js +5 -0
  187. package/lib-amd/pluginState/SelectionPluginState.js.map +1 -0
  188. package/lib-amd/pluginState/StandaloneEditorPluginState.d.ts +49 -0
  189. package/lib-amd/pluginState/StandaloneEditorPluginState.js +5 -0
  190. package/lib-amd/pluginState/StandaloneEditorPluginState.js.map +1 -0
  191. package/lib-amd/selection/InsertPoint.d.ts +25 -0
  192. package/lib-amd/selection/InsertPoint.js +5 -0
  193. package/lib-amd/selection/InsertPoint.js.map +1 -0
  194. package/lib-amd/selection/TableSelectionContext.d.ts +22 -0
  195. package/lib-amd/selection/TableSelectionContext.js +5 -0
  196. package/lib-amd/selection/TableSelectionContext.js.map +1 -0
  197. package/lib-mjs/editor/IStandaloneEditor.d.ts +99 -0
  198. package/lib-mjs/editor/IStandaloneEditor.js +2 -0
  199. package/lib-mjs/editor/IStandaloneEditor.js.map +1 -0
  200. package/lib-mjs/editor/StandaloneEditorCore.d.ts +466 -0
  201. package/lib-mjs/editor/StandaloneEditorCore.js +2 -0
  202. package/lib-mjs/editor/StandaloneEditorCore.js.map +1 -0
  203. package/lib-mjs/editor/StandaloneEditorCorePlugins.d.ts +40 -0
  204. package/lib-mjs/editor/StandaloneEditorCorePlugins.js +2 -0
  205. package/lib-mjs/editor/StandaloneEditorCorePlugins.js.map +1 -0
  206. package/lib-mjs/editor/StandaloneEditorOptions.d.ts +78 -0
  207. package/lib-mjs/editor/StandaloneEditorOptions.js +2 -0
  208. package/lib-mjs/editor/StandaloneEditorOptions.js.map +1 -0
  209. package/lib-mjs/enum/BorderOperations.d.ts +36 -0
  210. package/lib-mjs/enum/BorderOperations.js +2 -0
  211. package/lib-mjs/enum/BorderOperations.js.map +1 -0
  212. package/lib-mjs/enum/DeleteResult.d.ts +20 -0
  213. package/lib-mjs/enum/DeleteResult.js +2 -0
  214. package/lib-mjs/enum/DeleteResult.js.map +1 -0
  215. package/lib-mjs/enum/EntityOperation.d.ts +51 -0
  216. package/lib-mjs/enum/EntityOperation.js +2 -0
  217. package/lib-mjs/enum/EntityOperation.js.map +1 -0
  218. package/lib-mjs/enum/InsertEntityPosition.d.ts +8 -0
  219. package/lib-mjs/enum/InsertEntityPosition.js +2 -0
  220. package/lib-mjs/enum/InsertEntityPosition.js.map +1 -0
  221. package/lib-mjs/enum/PasteType.d.ts +20 -0
  222. package/lib-mjs/enum/PasteType.js +2 -0
  223. package/lib-mjs/enum/PasteType.js.map +1 -0
  224. package/lib-mjs/enum/TableOperation.d.ts +136 -0
  225. package/lib-mjs/enum/TableOperation.js +2 -0
  226. package/lib-mjs/enum/TableOperation.js.map +1 -0
  227. package/lib-mjs/event/ContentModelBeforePasteEvent.d.ts +27 -0
  228. package/lib-mjs/event/ContentModelBeforePasteEvent.js +2 -0
  229. package/lib-mjs/event/ContentModelBeforePasteEvent.js.map +1 -0
  230. package/lib-mjs/event/ContentModelContentChangedEvent.d.ts +49 -0
  231. package/lib-mjs/event/ContentModelContentChangedEvent.js +2 -0
  232. package/lib-mjs/event/ContentModelContentChangedEvent.js.map +1 -0
  233. package/lib-mjs/format/formatParts/MarginFormat.d.ts +8 -0
  234. package/lib-mjs/format/formatParts/MarginFormat.js.map +1 -1
  235. package/lib-mjs/format/metadata/ListMetadataFormat.d.ts +4 -146
  236. package/lib-mjs/format/metadata/ListMetadataFormat.js +1 -144
  237. package/lib-mjs/format/metadata/ListMetadataFormat.js.map +1 -1
  238. package/lib-mjs/format/metadata/TableMetadataFormat.d.ts +2 -75
  239. package/lib-mjs/format/metadata/TableMetadataFormat.js +1 -74
  240. package/lib-mjs/format/metadata/TableMetadataFormat.js.map +1 -1
  241. package/lib-mjs/index.d.ts +31 -2
  242. package/lib-mjs/index.js +1 -2
  243. package/lib-mjs/index.js.map +1 -1
  244. package/lib-mjs/parameter/Border.d.ts +18 -0
  245. package/lib-mjs/parameter/Border.js +2 -0
  246. package/lib-mjs/parameter/Border.js.map +1 -0
  247. package/lib-mjs/parameter/ContentModelFormatState.d.ts +147 -0
  248. package/lib-mjs/parameter/ContentModelFormatState.js +2 -0
  249. package/lib-mjs/parameter/ContentModelFormatState.js.map +1 -0
  250. package/lib-mjs/parameter/DeleteSelectionStep.d.ts +49 -0
  251. package/lib-mjs/parameter/DeleteSelectionStep.js +2 -0
  252. package/lib-mjs/parameter/DeleteSelectionStep.js.map +1 -0
  253. package/lib-mjs/parameter/EditorEnvironment.d.ts +17 -0
  254. package/lib-mjs/parameter/EditorEnvironment.js +2 -0
  255. package/lib-mjs/parameter/EditorEnvironment.js.map +1 -0
  256. package/lib-mjs/parameter/FormatWithContentModelContext.d.ts +57 -0
  257. package/lib-mjs/parameter/FormatWithContentModelContext.js +2 -0
  258. package/lib-mjs/parameter/FormatWithContentModelContext.js.map +1 -0
  259. package/lib-mjs/parameter/FormatWithContentModelOptions.d.ts +42 -0
  260. package/lib-mjs/parameter/FormatWithContentModelOptions.js +2 -0
  261. package/lib-mjs/parameter/FormatWithContentModelOptions.js.map +1 -0
  262. package/lib-mjs/parameter/ImageFormatState.d.ts +25 -0
  263. package/lib-mjs/parameter/ImageFormatState.js +2 -0
  264. package/lib-mjs/parameter/ImageFormatState.js.map +1 -0
  265. package/lib-mjs/parameter/InsertEntityOptions.d.ts +21 -0
  266. package/lib-mjs/parameter/InsertEntityOptions.js +2 -0
  267. package/lib-mjs/parameter/InsertEntityOptions.js.map +1 -0
  268. package/lib-mjs/pluginState/ContentModelCachePluginState.d.ts +20 -0
  269. package/lib-mjs/pluginState/ContentModelCachePluginState.js +2 -0
  270. package/lib-mjs/pluginState/ContentModelCachePluginState.js.map +1 -0
  271. package/lib-mjs/pluginState/ContentModelFormatPluginState.d.ts +31 -0
  272. package/lib-mjs/pluginState/ContentModelFormatPluginState.js +2 -0
  273. package/lib-mjs/pluginState/ContentModelFormatPluginState.js.map +1 -0
  274. package/lib-mjs/pluginState/DOMEventPluginState.d.ts +30 -0
  275. package/lib-mjs/pluginState/DOMEventPluginState.js +2 -0
  276. package/lib-mjs/pluginState/DOMEventPluginState.js.map +1 -0
  277. package/lib-mjs/pluginState/EntityPluginState.d.ts +26 -0
  278. package/lib-mjs/pluginState/EntityPluginState.js +2 -0
  279. package/lib-mjs/pluginState/EntityPluginState.js.map +1 -0
  280. package/lib-mjs/pluginState/LifecyclePluginState.d.ts +18 -0
  281. package/lib-mjs/pluginState/LifecyclePluginState.js +2 -0
  282. package/lib-mjs/pluginState/LifecyclePluginState.js.map +1 -0
  283. package/lib-mjs/pluginState/SelectionPluginState.d.ts +30 -0
  284. package/lib-mjs/pluginState/SelectionPluginState.js +2 -0
  285. package/lib-mjs/pluginState/SelectionPluginState.js.map +1 -0
  286. package/lib-mjs/pluginState/StandaloneEditorPluginState.d.ts +49 -0
  287. package/lib-mjs/pluginState/StandaloneEditorPluginState.js +2 -0
  288. package/lib-mjs/pluginState/StandaloneEditorPluginState.js.map +1 -0
  289. package/lib-mjs/selection/InsertPoint.d.ts +25 -0
  290. package/lib-mjs/selection/InsertPoint.js +2 -0
  291. package/lib-mjs/selection/InsertPoint.js.map +1 -0
  292. package/lib-mjs/selection/TableSelectionContext.d.ts +22 -0
  293. package/lib-mjs/selection/TableSelectionContext.js +2 -0
  294. package/lib-mjs/selection/TableSelectionContext.js.map +1 -0
  295. package/package.json +5 -2
@@ -0,0 +1,99 @@
1
+ import type { CompatiblePluginEventType } from 'roosterjs-editor-types/lib/compatibleTypes';
2
+ import type { ContentModelDocument } from '../group/ContentModelDocument';
3
+ import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';
4
+ import type { DOMSelection } from '../selection/DOMSelection';
5
+ import type { DomToModelOption } from '../context/DomToModelOption';
6
+ import type { EditorEnvironment } from '../parameter/EditorEnvironment';
7
+ import type { ModelToDomOption } from '../context/ModelToDomOption';
8
+ import type { OnNodeCreated } from '../context/ModelToDomSettings';
9
+ import type { ContentModelFormatter, FormatWithContentModelOptions } from '../parameter/FormatWithContentModelOptions';
10
+ import type { EditorUndoState, PluginEventData, PluginEventFromType, PluginEventType } from 'roosterjs-editor-types';
11
+ /**
12
+ * An interface of standalone Content Model editor.
13
+ * (This interface is still under development, and may still be changed in the future with some breaking changes)
14
+ */
15
+ export interface IStandaloneEditor {
16
+ /**
17
+ * Create Content Model from DOM tree in this editor
18
+ * @param rootNode Optional start node. If provided, Content Model will be created from this node (including itself),
19
+ * otherwise it will create Content Model for the whole content in editor.
20
+ * @param option The options to customize the behavior of DOM to Content Model conversion
21
+ * @param selectionOverride When specified, use this selection to override existing selection inside editor
22
+ */
23
+ createContentModel(option?: DomToModelOption, selectionOverride?: DOMSelection): ContentModelDocument;
24
+ /**
25
+ * Set content with content model
26
+ * @param model The content model to set
27
+ * @param option Additional options to customize the behavior of Content Model to DOM conversion
28
+ * @param onNodeCreated An optional callback that will be called when a DOM node is created
29
+ */
30
+ setContentModel(model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated): DOMSelection | null;
31
+ /**
32
+ * Get current running environment, such as if editor is running on Mac
33
+ */
34
+ getEnvironment(): EditorEnvironment;
35
+ /**
36
+ * Get current DOM selection.
37
+ * This is the replacement of IEditor.getSelectionRangeEx.
38
+ */
39
+ getDOMSelection(): DOMSelection | null;
40
+ /**
41
+ * Set DOMSelection into editor content.
42
+ * This is the replacement of IEditor.select.
43
+ * @param selection The selection to set
44
+ */
45
+ setDOMSelection(selection: DOMSelection): void;
46
+ /**
47
+ * The general API to do format change with Content Model
48
+ * It will grab a Content Model for current editor content, and invoke a callback function
49
+ * to do format change. Then according to the return value, write back the modified content model into editor.
50
+ * If there is cached model, it will be used and updated.
51
+ * @param formatter Formatter function, see ContentModelFormatter
52
+ * @param options More options, see FormatWithContentModelOptions
53
+ */
54
+ formatContentModel(formatter: ContentModelFormatter, options?: FormatWithContentModelOptions): void;
55
+ /**
56
+ * Get pending format of editor if any, or return null
57
+ */
58
+ getPendingFormat(): ContentModelSegmentFormat | null;
59
+ /**
60
+ * Get whether this editor is disposed
61
+ * @returns True if editor is disposed, otherwise false
62
+ */
63
+ isDisposed(): boolean;
64
+ /**
65
+ * Get document which contains this editor
66
+ * @returns The HTML document which contains this editor
67
+ */
68
+ getDocument(): Document;
69
+ /**
70
+ * Focus to this editor, the selection was restored to where it was before, no unexpected scroll.
71
+ */
72
+ focus(): void;
73
+ /**
74
+ * Trigger an event to be dispatched to all plugins
75
+ * @param eventType Type of the event
76
+ * @param data data of the event with given type, this is the rest part of PluginEvent with the given type
77
+ * @param broadcast indicates if the event needs to be dispatched to all plugins
78
+ * True means to all, false means to allow exclusive handling from one plugin unless no one wants that
79
+ * @returns the event object which is really passed into plugins. Some plugin may modify the event object so
80
+ * the result of this function provides a chance to read the modified result
81
+ */
82
+ triggerPluginEvent<T extends PluginEventType | CompatiblePluginEventType>(eventType: T, data: PluginEventData<T>, broadcast?: boolean): PluginEventFromType<T>;
83
+ /**
84
+ * Whether there is an available undo/redo snapshot
85
+ */
86
+ getUndoState(): EditorUndoState;
87
+ /**
88
+ * Check if the editor is in dark mode
89
+ * @returns True if the editor is in dark mode, otherwise false
90
+ */
91
+ isDarkMode(): boolean;
92
+ /**
93
+ * Get current zoom scale, default value is 1
94
+ * When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale
95
+ * to let editor behave correctly especially for those mouse drag/drop behaviors
96
+ * @returns current zoom scale number
97
+ */
98
+ getZoomScale(): number;
99
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IStandaloneEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IStandaloneEditor.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/editor/IStandaloneEditor.ts"],"names":[],"mappings":"","sourcesContent":["import type { CompatiblePluginEventType } from 'roosterjs-editor-types/lib/compatibleTypes';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type {\n ContentModelFormatter,\n FormatWithContentModelOptions,\n} from '../parameter/FormatWithContentModelOptions';\nimport type {\n EditorUndoState,\n PluginEventData,\n PluginEventFromType,\n PluginEventType,\n} from 'roosterjs-editor-types';\n\n/**\n * An interface of standalone Content Model editor.\n * (This interface is still under development, and may still be changed in the future with some breaking changes)\n */\nexport interface IStandaloneEditor {\n /**\n * Create Content Model from DOM tree in this editor\n * @param rootNode Optional start node. If provided, Content Model will be created from this node (including itself),\n * otherwise it will create Content Model for the whole content in editor.\n * @param option The options to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When specified, use this selection to override existing selection inside editor\n */\n createContentModel(\n option?: DomToModelOption,\n selectionOverride?: DOMSelection\n ): ContentModelDocument;\n\n /**\n * Set content with content model\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n */\n setContentModel(\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated\n ): DOMSelection | null;\n\n /**\n * Get current running environment, such as if editor is running on Mac\n */\n getEnvironment(): EditorEnvironment;\n\n /**\n * Get current DOM selection.\n * This is the replacement of IEditor.getSelectionRangeEx.\n */\n getDOMSelection(): DOMSelection | null;\n\n /**\n * Set DOMSelection into editor content.\n * This is the replacement of IEditor.select.\n * @param selection The selection to set\n */\n setDOMSelection(selection: DOMSelection): void;\n\n /**\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 formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatWithContentModelOptions\n */\n formatContentModel(\n formatter: ContentModelFormatter,\n options?: FormatWithContentModelOptions\n ): void;\n\n /**\n * Get pending format of editor if any, or return null\n */\n getPendingFormat(): ContentModelSegmentFormat | null;\n\n //#region Editor API copied from legacy editor, will be ported to use Content Model instead\n\n /**\n * Get whether this editor is disposed\n * @returns True if editor is disposed, otherwise false\n */\n isDisposed(): boolean;\n\n /**\n * Get document which contains this editor\n * @returns The HTML document which contains this editor\n */\n getDocument(): Document;\n\n /**\n * Focus to this editor, the selection was restored to where it was before, no unexpected scroll.\n */\n focus(): void;\n\n /**\n * Trigger an event to be dispatched to all plugins\n * @param eventType Type of the event\n * @param data data of the event with given type, this is the rest part of PluginEvent with the given type\n * @param broadcast indicates if the event needs to be dispatched to all plugins\n * True means to all, false means to allow exclusive handling from one plugin unless no one wants that\n * @returns the event object which is really passed into plugins. Some plugin may modify the event object so\n * the result of this function provides a chance to read the modified result\n */\n triggerPluginEvent<T extends PluginEventType | CompatiblePluginEventType>(\n eventType: T,\n data: PluginEventData<T>,\n broadcast?: boolean\n ): PluginEventFromType<T>;\n\n /**\n * Whether there is an available undo/redo snapshot\n */\n getUndoState(): EditorUndoState;\n\n /**\n * Check if the editor is in dark mode\n * @returns True if the editor is in dark mode, otherwise false\n */\n isDarkMode(): boolean;\n\n /**\n * Get current zoom scale, default value is 1\n * When editor is put under a zoomed container, need to pass the zoom scale number using EditorOptions.zoomScale\n * to let editor behave correctly especially for those mouse drag/drop behaviors\n * @returns current zoom scale number\n */\n getZoomScale(): number;\n\n //#endregion\n}\n"]}
@@ -0,0 +1,466 @@
1
+ import type { CompatibleColorTransformDirection, CompatibleGetContentMode } from 'roosterjs-editor-types/lib/compatibleTypes';
2
+ import type { ColorTransformDirection, ContentChangedData, ContentMetadata, DOMEventHandler, DarkColorHandler, EditorPlugin, GetContentMode, ImageSelectionRange, InsertOption, NodePosition, PluginEvent, PositionType, Rect, SelectionPath, SelectionRangeEx, StyleBasedFormatState, TableSelection, TableSelectionRange, TrustedHTMLHandler } from 'roosterjs-editor-types';
3
+ import type { ContentModelDocument } from '../group/ContentModelDocument';
4
+ import type { StandaloneEditorCorePluginState, UnportedCorePluginState } from '../pluginState/StandaloneEditorPluginState';
5
+ import type { DOMSelection } from '../selection/DOMSelection';
6
+ import type { DomToModelOption } from '../context/DomToModelOption';
7
+ import type { DomToModelSettings } from '../context/DomToModelSettings';
8
+ import type { EditorContext } from '../context/EditorContext';
9
+ import type { EditorEnvironment } from '../parameter/EditorEnvironment';
10
+ import type { ModelToDomOption } from '../context/ModelToDomOption';
11
+ import type { ModelToDomSettings, OnNodeCreated } from '../context/ModelToDomSettings';
12
+ import type { ContentModelFormatter, FormatWithContentModelOptions } from '../parameter/FormatWithContentModelOptions';
13
+ /**
14
+ * Create a EditorContext object used by ContentModel API
15
+ * @param core The StandaloneEditorCore object
16
+ */
17
+ export declare type CreateEditorContext = (core: StandaloneEditorCore) => EditorContext;
18
+ /**
19
+ * Create Content Model from DOM tree in this editor
20
+ * @param core The StandaloneEditorCore object
21
+ * @param option The option to customize the behavior of DOM to Content Model conversion
22
+ * @param selectionOverride When passed, use this selection range instead of current selection in editor
23
+ */
24
+ export declare type CreateContentModel = (core: StandaloneEditorCore, option?: DomToModelOption, selectionOverride?: DOMSelection) => ContentModelDocument;
25
+ /**
26
+ * Get current DOM selection from editor
27
+ * @param core The StandaloneEditorCore object
28
+ */
29
+ export declare type GetDOMSelection = (core: StandaloneEditorCore) => DOMSelection | null;
30
+ /**
31
+ * Set content with content model. This is the replacement of core API getSelectionRangeEx
32
+ * @param core The StandaloneEditorCore object
33
+ * @param model The content model to set
34
+ * @param option Additional options to customize the behavior of Content Model to DOM conversion
35
+ * @param onNodeCreated An optional callback that will be called when a DOM node is created
36
+ */
37
+ export declare type SetContentModel = (core: StandaloneEditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
38
+ /**
39
+ * Set current DOM selection from editor. This is the replacement of core API select
40
+ * @param core The StandaloneEditorCore object
41
+ * @param selection The selection to set
42
+ */
43
+ export declare type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;
44
+ /**
45
+ * The general API to do format change with Content Model
46
+ * It will grab a Content Model for current editor content, and invoke a callback function
47
+ * to do format change. Then according to the return value, write back the modified content model into editor.
48
+ * If there is cached model, it will be used and updated.
49
+ * @param core The StandaloneEditorCore object
50
+ * @param formatter Formatter function, see ContentModelFormatter
51
+ * @param options More options, see FormatWithContentModelOptions
52
+ */
53
+ export declare type FormatContentModel = (core: StandaloneEditorCore, formatter: ContentModelFormatter, options?: FormatWithContentModelOptions) => void;
54
+ /**
55
+ * Switch the Shadow Edit mode of editor On/Off
56
+ * @param core The StandaloneEditorCore object
57
+ * @param isOn True to switch On, False to switch Off
58
+ */
59
+ export declare type SwitchShadowEdit = (core: StandaloneEditorCore, isOn: boolean) => void;
60
+ /**
61
+ * TODO: Remove this Core API and use setDOMSelection instead
62
+ * Select content according to the given information.
63
+ * There are a bunch of allowed combination of parameters. See IEditor.select for more details
64
+ * @param core The editor core object
65
+ * @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
66
+ * @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
67
+ * @param arg3 (optional) A Node
68
+ * @param arg4 (optional) An offset number, or a PositionType
69
+ */
70
+ export declare type Select = (core: StandaloneEditorCore, arg1: Range | SelectionRangeEx | NodePosition | Node | SelectionPath | null, arg2?: NodePosition | number | PositionType | TableSelection | null, arg3?: Node, arg4?: number | PositionType) => boolean;
71
+ /**
72
+ * Trigger a plugin event
73
+ * @param core The StandaloneEditorCore object
74
+ * @param pluginEvent The event object to trigger
75
+ * @param broadcast Set to true to skip the shouldHandleEventExclusively check
76
+ */
77
+ export declare type TriggerEvent = (core: StandaloneEditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;
78
+ /**
79
+ * Get current selection range
80
+ * @param core The StandaloneEditorCore object
81
+ * @returns A Range object of the selection range
82
+ */
83
+ export declare type GetSelectionRangeEx = (core: StandaloneEditorCore) => SelectionRangeEx;
84
+ /**
85
+ * Edit and transform color of elements between light mode and dark mode
86
+ * @param core The StandaloneEditorCore object
87
+ * @param rootNode The root HTML node to transform
88
+ * @param includeSelf True to transform the root node as well, otherwise false
89
+ * @param callback The callback function to invoke before do color transformation
90
+ * @param direction To specify the transform direction, light to dark, or dark to light
91
+ * @param forceTransform By default this function will only work when editor core is in dark mode.
92
+ * Pass true to this value to force do color transformation even editor core is in light mode
93
+ * @param fromDarkModel Whether the given content is already in dark mode
94
+ */
95
+ export declare type TransformColor = (core: StandaloneEditorCore, rootNode: Node | null, includeSelf: boolean, callback: (() => void) | null, direction: ColorTransformDirection | CompatibleColorTransformDirection, forceTransform?: boolean, fromDarkMode?: boolean) => void;
96
+ /**
97
+ * Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
98
+ * Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
99
+ * @param core The StandaloneEditorCore object
100
+ * @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
101
+ * @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
102
+ * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
103
+ * @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
104
+ */
105
+ export declare type AddUndoSnapshot = (core: StandaloneEditorCore, callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null, changeSource: string | null, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
106
+ /**
107
+ * Retrieves the rect of the visible viewport of the editor.
108
+ * @param core The StandaloneEditorCore object
109
+ */
110
+ export declare type GetVisibleViewport = (core: StandaloneEditorCore) => Rect | null;
111
+ /**
112
+ * Change the editor selection to the given range
113
+ * @param core The StandaloneEditorCore object
114
+ * @param range The range to select
115
+ * @param skipSameRange When set to true, do nothing if the given range is the same with current selection
116
+ * in editor, otherwise it will always remove current selection range and set to the given one.
117
+ * This parameter is always treated as true in Edge to avoid some weird runtime exception.
118
+ */
119
+ export declare type SelectRange = (core: StandaloneEditorCore, range: Range, skipSameRange?: boolean) => boolean;
120
+ /**
121
+ * Select a table and save data of the selected range
122
+ * @param core The StandaloneEditorCore object
123
+ * @param image image to select
124
+ * @returns true if successful
125
+ */
126
+ export declare type SelectImage = (core: StandaloneEditorCore, image: HTMLImageElement | null) => ImageSelectionRange | null;
127
+ /**
128
+ * Select a table and save data of the selected range
129
+ * @param core The StandaloneEditorCore object
130
+ * @param table table to select
131
+ * @param coordinates first and last cell of the selection, if this parameter is null, instead of
132
+ * selecting, will unselect the table.
133
+ * @returns true if successful
134
+ */
135
+ export declare type SelectTable = (core: StandaloneEditorCore, table: HTMLTableElement | null, coordinates?: TableSelection) => TableSelectionRange | null;
136
+ /**
137
+ * Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered
138
+ * if triggerContentChangedEvent is set to true
139
+ * @param core The StandaloneEditorCore object
140
+ * @param content HTML content to set in
141
+ * @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
142
+ */
143
+ export declare type SetContent = (core: StandaloneEditorCore, content: string, triggerContentChangedEvent: boolean, metadata?: ContentMetadata) => void;
144
+ /**
145
+ * Get current or cached selection range
146
+ * @param core The StandaloneEditorCore object
147
+ * @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
148
+ * @returns A Range object of the selection range
149
+ */
150
+ export declare type GetSelectionRange = (core: StandaloneEditorCore, tryGetFromCache: boolean) => Range | null;
151
+ /**
152
+ * Check if the editor has focus now
153
+ * @param core The StandaloneEditorCore object
154
+ * @returns True if the editor has focus, otherwise false
155
+ */
156
+ export declare type HasFocus = (core: StandaloneEditorCore) => boolean;
157
+ /**
158
+ * Focus to editor. If there is a cached selection range, use it as current selection
159
+ * @param core The StandaloneEditorCore object
160
+ */
161
+ export declare type Focus = (core: StandaloneEditorCore) => void;
162
+ /**
163
+ * Insert a DOM node into editor content
164
+ * @param core The StandaloneEditorCore object. No op if null.
165
+ * @param option An insert option object to specify how to insert the node
166
+ */
167
+ export declare type InsertNode = (core: StandaloneEditorCore, node: Node, option: InsertOption | null) => boolean;
168
+ /**
169
+ * Attach a DOM event to the editor content DIV
170
+ * @param core The StandaloneEditorCore object
171
+ * @param eventMap A map from event name to its handler
172
+ */
173
+ export declare type AttachDomEvent = (core: StandaloneEditorCore, eventMap: Record<string, DOMEventHandler>) => () => void;
174
+ /**
175
+ * Get current editor content as HTML string
176
+ * @param core The StandaloneEditorCore object
177
+ * @param mode specify what kind of HTML content to retrieve
178
+ * @returns HTML string representing current editor content
179
+ */
180
+ export declare type GetContent = (core: StandaloneEditorCore, mode: GetContentMode | CompatibleGetContentMode) => string;
181
+ /**
182
+ * Get style based format state from current selection, including font name/size and colors
183
+ * @param core The StandaloneEditorCore objects
184
+ * @param node The node to get style from
185
+ */
186
+ export declare type GetStyleBasedFormatState = (core: StandaloneEditorCore, node: Node | null) => StyleBasedFormatState;
187
+ /**
188
+ * Restore an undo snapshot into editor
189
+ * @param core The StandaloneEditorCore object
190
+ * @param step Steps to move, can be 0, positive or negative
191
+ */
192
+ export declare type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;
193
+ /**
194
+ * Ensure user will type into a container element rather than into the editor content DIV directly
195
+ * @param core The StandaloneEditorCore object.
196
+ * @param position The position that user is about to type to
197
+ * @param keyboardEvent Optional keyboard event object
198
+ * @param deprecated Deprecated parameter, not used
199
+ */
200
+ export declare type EnsureTypeInContainer = (core: StandaloneEditorCore, position: NodePosition, keyboardEvent?: KeyboardEvent, deprecated?: boolean) => void;
201
+ /**
202
+ * Temp interface
203
+ * TODO: Port other core API
204
+ */
205
+ export interface PortedCoreApiMap {
206
+ /**
207
+ * Create a EditorContext object used by ContentModel API
208
+ * @param core The StandaloneEditorCore object
209
+ */
210
+ createEditorContext: CreateEditorContext;
211
+ /**
212
+ * Create Content Model from DOM tree in this editor
213
+ * @param core The StandaloneEditorCore object
214
+ * @param option The option to customize the behavior of DOM to Content Model conversion
215
+ */
216
+ createContentModel: CreateContentModel;
217
+ /**
218
+ * Get current DOM selection from editor
219
+ * @param core The StandaloneEditorCore object
220
+ */
221
+ getDOMSelection: GetDOMSelection;
222
+ /**
223
+ * Set content with content model
224
+ * @param core The StandaloneEditorCore object
225
+ * @param model The content model to set
226
+ * @param option Additional options to customize the behavior of Content Model to DOM conversion
227
+ */
228
+ setContentModel: SetContentModel;
229
+ /**
230
+ * Set current DOM selection from editor. This is the replacement of core API select
231
+ * @param core The StandaloneEditorCore object
232
+ * @param selection The selection to set
233
+ */
234
+ setDOMSelection: SetDOMSelection;
235
+ /**
236
+ * The general API to do format change with Content Model
237
+ * It will grab a Content Model for current editor content, and invoke a callback function
238
+ * to do format change. Then according to the return value, write back the modified content model into editor.
239
+ * If there is cached model, it will be used and updated.
240
+ * @param core The StandaloneEditorCore object
241
+ * @param formatter Formatter function, see ContentModelFormatter
242
+ * @param options More options, see FormatWithContentModelOptions
243
+ */
244
+ formatContentModel: FormatContentModel;
245
+ /**
246
+ * Switch the Shadow Edit mode of editor On/Off
247
+ * @param core The StandaloneEditorCore object
248
+ * @param isOn True to switch On, False to switch Off
249
+ */
250
+ switchShadowEdit: SwitchShadowEdit;
251
+ /**
252
+ * Retrieves the rect of the visible viewport of the editor.
253
+ * @param core The StandaloneEditorCore object
254
+ */
255
+ getVisibleViewport: GetVisibleViewport;
256
+ }
257
+ /**
258
+ * Temp interface
259
+ * TODO: Port these core API
260
+ */
261
+ export interface UnportedCoreApiMap {
262
+ /**
263
+ * Select content according to the given information.
264
+ * There are a bunch of allowed combination of parameters. See IEditor.select for more details
265
+ * @param core The editor core object
266
+ * @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
267
+ * @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null
268
+ * @param arg3 (optional) A Node
269
+ * @param arg4 (optional) An offset number, or a PositionType
270
+ */
271
+ select: Select;
272
+ /**
273
+ * Trigger a plugin event
274
+ * @param core The StandaloneEditorCore object
275
+ * @param pluginEvent The event object to trigger
276
+ * @param broadcast Set to true to skip the shouldHandleEventExclusively check
277
+ */
278
+ triggerEvent: TriggerEvent;
279
+ /**
280
+ * Get current or cached selection range
281
+ * @param core The StandaloneEditorCore object
282
+ * @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
283
+ * @returns A Range object of the selection range
284
+ */
285
+ getSelectionRangeEx: GetSelectionRangeEx;
286
+ /**
287
+ * Edit and transform color of elements between light mode and dark mode
288
+ * @param core The StandaloneEditorCore object
289
+ * @param rootNode The root HTML element to transform
290
+ * @param includeSelf True to transform the root node as well, otherwise false
291
+ * @param callback The callback function to invoke before do color transformation
292
+ * @param direction To specify the transform direction, light to dark, or dark to light
293
+ * @param forceTransform By default this function will only work when editor core is in dark mode.
294
+ * Pass true to this value to force do color transformation even editor core is in light mode
295
+ * @param fromDarkModel Whether the given content is already in dark mode
296
+ */
297
+ transformColor: TransformColor;
298
+ /**
299
+ * Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.
300
+ * Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.
301
+ * @param core The StandaloneEditorCore object
302
+ * @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
303
+ * @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
304
+ * @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).
305
+ */
306
+ addUndoSnapshot: AddUndoSnapshot;
307
+ /**
308
+ * Change the editor selection to the given range
309
+ * @param core The StandaloneEditorCore object
310
+ * @param range The range to select
311
+ * @param skipSameRange When set to true, do nothing if the given range is the same with current selection
312
+ * in editor, otherwise it will always remove current selection range and set to the given one.
313
+ * This parameter is always treated as true in Edge to avoid some weird runtime exception.
314
+ */
315
+ selectRange: SelectRange;
316
+ /**
317
+ * Select a image and save data of the selected range
318
+ * @param core The StandaloneEditorCore object
319
+ * @param image image to select
320
+ * @param imageId the id of the image element
321
+ * @returns true if successful
322
+ */
323
+ selectImage: SelectImage;
324
+ /**
325
+ * Select a table and save data of the selected range
326
+ * @param core The StandaloneEditorCore object
327
+ * @param table table to select
328
+ * @param coordinates first and last cell of the selection, if this parameter is null, instead of
329
+ * selecting, will unselect the table.
330
+ * @param shouldAddStyles Whether need to update the style elements
331
+ * @returns true if successful
332
+ */
333
+ selectTable: SelectTable;
334
+ /**
335
+ * Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered
336
+ * if triggerContentChangedEvent is set to true
337
+ * @param core The StandaloneEditorCore object
338
+ * @param content HTML content to set in
339
+ * @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true
340
+ */
341
+ setContent: SetContent;
342
+ /**
343
+ * Get current or cached selection range
344
+ * @param core The StandaloneEditorCore object
345
+ * @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now
346
+ * @returns A Range object of the selection range
347
+ */
348
+ getSelectionRange: GetSelectionRange;
349
+ /**
350
+ * Check if the editor has focus now
351
+ * @param core The StandaloneEditorCore object
352
+ * @returns True if the editor has focus, otherwise false
353
+ */
354
+ hasFocus: HasFocus;
355
+ /**
356
+ * Focus to editor. If there is a cached selection range, use it as current selection
357
+ * @param core The StandaloneEditorCore object
358
+ */
359
+ focus: Focus;
360
+ /**
361
+ * Insert a DOM node into editor content
362
+ * @param core The StandaloneEditorCore object. No op if null.
363
+ * @param option An insert option object to specify how to insert the node
364
+ */
365
+ insertNode: InsertNode;
366
+ /**
367
+ * Attach a DOM event to the editor content DIV
368
+ * @param core The StandaloneEditorCore object
369
+ * @param eventName The DOM event name
370
+ * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered
371
+ * @param beforeDispatch Optional callback function to be invoked when the DOM event is triggered before trigger plugin event
372
+ */
373
+ attachDomEvent: AttachDomEvent;
374
+ /**
375
+ * Get current editor content as HTML string
376
+ * @param core The StandaloneEditorCore object
377
+ * @param mode specify what kind of HTML content to retrieve
378
+ * @returns HTML string representing current editor content
379
+ */
380
+ getContent: GetContent;
381
+ /**
382
+ * Get style based format state from current selection, including font name/size and colors
383
+ * @param core The StandaloneEditorCore objects
384
+ * @param node The node to get style from
385
+ */
386
+ getStyleBasedFormatState: GetStyleBasedFormatState;
387
+ /**
388
+ * Restore an undo snapshot into editor
389
+ * @param core The editor core object
390
+ * @param step Steps to move, can be 0, positive or negative
391
+ */
392
+ restoreUndoSnapshot: RestoreUndoSnapshot;
393
+ /**
394
+ * Ensure user will type into a container element rather than into the editor content DIV directly
395
+ * @param core The EditorCore object.
396
+ * @param position The position that user is about to type to
397
+ * @param keyboardEvent Optional keyboard event object
398
+ * @param deprecated Deprecated parameter, not used
399
+ */
400
+ ensureTypeInContainer: EnsureTypeInContainer;
401
+ }
402
+ /**
403
+ * The interface for the map of core API for Content Model editor.
404
+ * Editor can call call API from this map under StandaloneEditorCore object
405
+ */
406
+ export interface StandaloneCoreApiMap extends PortedCoreApiMap, UnportedCoreApiMap {
407
+ }
408
+ /**
409
+ * Represents the core data structure of a Content Model editor
410
+ */
411
+ export interface StandaloneEditorCore extends StandaloneEditorCorePluginState, UnportedCorePluginState, StandaloneEditorDefaultSettings {
412
+ /**
413
+ * The content DIV element of this editor
414
+ */
415
+ readonly contentDiv: HTMLDivElement;
416
+ /**
417
+ * Core API map of this editor
418
+ */
419
+ readonly api: StandaloneCoreApiMap;
420
+ /**
421
+ * Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.
422
+ */
423
+ readonly originalApi: StandaloneCoreApiMap;
424
+ /**
425
+ * An array of editor plugins.
426
+ */
427
+ readonly plugins: EditorPlugin[];
428
+ /**
429
+ * Editor running environment
430
+ */
431
+ readonly environment: EditorEnvironment;
432
+ /**
433
+ * Dark model handler for the editor, used for variable-based solution.
434
+ * If keep it null, editor will still use original dataset-based dark mode solution.
435
+ */
436
+ readonly darkColorHandler: DarkColorHandler;
437
+ /**
438
+ * A handler to convert HTML string to a trust HTML string.
439
+ * By default it will just return the original HTML string directly.
440
+ * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
441
+ */
442
+ readonly trustedHTMLHandler: TrustedHTMLHandler;
443
+ }
444
+ /**
445
+ * Default DOM and Content Model conversion settings for an editor
446
+ */
447
+ export interface StandaloneEditorDefaultSettings {
448
+ /**
449
+ * Default DOM to Content Model options
450
+ */
451
+ defaultDomToModelOptions: (DomToModelOption | undefined)[];
452
+ /**
453
+ * Default Content Model to DOM options
454
+ */
455
+ defaultModelToDomOptions: (ModelToDomOption | undefined)[];
456
+ /**
457
+ * Default DOM to Content Model config, calculated from defaultDomToModelOptions,
458
+ * will be used for creating content model if there is no other customized options
459
+ */
460
+ defaultDomToModelConfig: DomToModelSettings;
461
+ /**
462
+ * Default Content Model to DOM config, calculated from defaultModelToDomOptions,
463
+ * will be used for setting content model if there is no other customized options
464
+ */
465
+ defaultModelToDomConfig: ModelToDomSettings;
466
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=StandaloneEditorCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StandaloneEditorCore.js","sourceRoot":"","sources":["../../../../packages-content-model/roosterjs-content-model-types/lib/editor/StandaloneEditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n CompatibleColorTransformDirection,\n CompatibleGetContentMode,\n} from 'roosterjs-editor-types/lib/compatibleTypes';\nimport type {\n ColorTransformDirection,\n ContentChangedData,\n ContentMetadata,\n DOMEventHandler,\n DarkColorHandler,\n EditorPlugin,\n GetContentMode,\n ImageSelectionRange,\n InsertOption,\n NodePosition,\n PluginEvent,\n PositionType,\n Rect,\n SelectionPath,\n SelectionRangeEx,\n StyleBasedFormatState,\n TableSelection,\n TableSelectionRange,\n TrustedHTMLHandler,\n} from 'roosterjs-editor-types';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type {\n StandaloneEditorCorePluginState,\n UnportedCorePluginState,\n} from '../pluginState/StandaloneEditorPluginState';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { DomToModelSettings } from '../context/DomToModelSettings';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { ModelToDomSettings, OnNodeCreated } from '../context/ModelToDomSettings';\nimport type {\n ContentModelFormatter,\n FormatWithContentModelOptions,\n} from '../parameter/FormatWithContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The StandaloneEditorCore object\n */\nexport type CreateEditorContext = (core: StandaloneEditorCore) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The StandaloneEditorCore 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 type CreateContentModel = (\n core: StandaloneEditorCore,\n option?: DomToModelOption,\n selectionOverride?: DOMSelection\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The StandaloneEditorCore object\n */\nexport type GetDOMSelection = (core: StandaloneEditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The StandaloneEditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n */\nexport type SetContentModel = (\n core: StandaloneEditorCore,\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated\n) => DOMSelection | null;\n\n/**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The StandaloneEditorCore object\n * @param selection The selection to set\n */\nexport type SetDOMSelection = (core: StandaloneEditorCore, selection: DOMSelection) => void;\n\n/**\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 type FormatContentModel = (\n core: StandaloneEditorCore,\n formatter: ContentModelFormatter,\n options?: FormatWithContentModelOptions\n) => void;\n\n/**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The StandaloneEditorCore object\n * @param isOn True to switch On, False to switch Off\n */\nexport type SwitchShadowEdit = (core: StandaloneEditorCore, isOn: boolean) => void;\n\n/**\n * TODO: Remove this Core API and use setDOMSelection instead\n * Select content according to the given information.\n * There are a bunch of allowed combination of parameters. See IEditor.select for more details\n * @param core The editor core object\n * @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path\n * @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null\n * @param arg3 (optional) A Node\n * @param arg4 (optional) An offset number, or a PositionType\n */\nexport type Select = (\n core: StandaloneEditorCore,\n arg1: Range | SelectionRangeEx | NodePosition | Node | SelectionPath | null,\n arg2?: NodePosition | number | PositionType | TableSelection | null,\n arg3?: Node,\n arg4?: number | PositionType\n) => boolean;\n\n/**\n * Trigger a plugin event\n * @param core The StandaloneEditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\nexport type TriggerEvent = (\n core: StandaloneEditorCore,\n pluginEvent: PluginEvent,\n broadcast: boolean\n) => void;\n\n/**\n * Get current selection range\n * @param core The StandaloneEditorCore object\n * @returns A Range object of the selection range\n */\nexport type GetSelectionRangeEx = (core: StandaloneEditorCore) => SelectionRangeEx;\n\n/**\n * Edit and transform color of elements between light mode and dark mode\n * @param core The StandaloneEditorCore object\n * @param rootNode The root HTML node to transform\n * @param includeSelf True to transform the root node as well, otherwise false\n * @param callback The callback function to invoke before do color transformation\n * @param direction To specify the transform direction, light to dark, or dark to light\n * @param forceTransform By default this function will only work when editor core is in dark mode.\n * Pass true to this value to force do color transformation even editor core is in light mode\n * @param fromDarkModel Whether the given content is already in dark mode\n */\nexport type TransformColor = (\n core: StandaloneEditorCore,\n rootNode: Node | null,\n includeSelf: boolean,\n callback: (() => void) | null,\n direction: ColorTransformDirection | CompatibleColorTransformDirection,\n forceTransform?: boolean,\n fromDarkMode?: boolean\n) => void;\n\n/**\n * Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.\n * Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.\n * @param core The StandaloneEditorCore object\n * @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.\n * @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.\n */\nexport type AddUndoSnapshot = (\n core: StandaloneEditorCore,\n callback: ((start: NodePosition | null, end: NodePosition | null) => any) | null,\n changeSource: string | null,\n canUndoByBackspace: boolean,\n additionalData?: ContentChangedData\n) => void;\n\n/**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The StandaloneEditorCore object\n */\nexport type GetVisibleViewport = (core: StandaloneEditorCore) => Rect | null;\n\n/**\n * Change the editor selection to the given range\n * @param core The StandaloneEditorCore object\n * @param range The range to select\n * @param skipSameRange When set to true, do nothing if the given range is the same with current selection\n * in editor, otherwise it will always remove current selection range and set to the given one.\n * This parameter is always treated as true in Edge to avoid some weird runtime exception.\n */\nexport type SelectRange = (\n core: StandaloneEditorCore,\n range: Range,\n skipSameRange?: boolean\n) => boolean;\n\n/**\n * Select a table and save data of the selected range\n * @param core The StandaloneEditorCore object\n * @param image image to select\n * @returns true if successful\n */\nexport type SelectImage = (\n core: StandaloneEditorCore,\n image: HTMLImageElement | null\n) => ImageSelectionRange | null;\n\n/**\n * Select a table and save data of the selected range\n * @param core The StandaloneEditorCore object\n * @param table table to select\n * @param coordinates first and last cell of the selection, if this parameter is null, instead of\n * selecting, will unselect the table.\n * @returns true if successful\n */\nexport type SelectTable = (\n core: StandaloneEditorCore,\n table: HTMLTableElement | null,\n coordinates?: TableSelection\n) => TableSelectionRange | null;\n\n/**\n * Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered\n * if triggerContentChangedEvent is set to true\n * @param core The StandaloneEditorCore object\n * @param content HTML content to set in\n * @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true\n */\nexport type SetContent = (\n core: StandaloneEditorCore,\n content: string,\n triggerContentChangedEvent: boolean,\n metadata?: ContentMetadata\n) => void;\n\n/**\n * Get current or cached selection range\n * @param core The StandaloneEditorCore object\n * @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now\n * @returns A Range object of the selection range\n */\nexport type GetSelectionRange = (\n core: StandaloneEditorCore,\n tryGetFromCache: boolean\n) => Range | null;\n\n/**\n * Check if the editor has focus now\n * @param core The StandaloneEditorCore object\n * @returns True if the editor has focus, otherwise false\n */\nexport type HasFocus = (core: StandaloneEditorCore) => boolean;\n\n/**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The StandaloneEditorCore object\n */\nexport type Focus = (core: StandaloneEditorCore) => void;\n\n/**\n * Insert a DOM node into editor content\n * @param core The StandaloneEditorCore object. No op if null.\n * @param option An insert option object to specify how to insert the node\n */\nexport type InsertNode = (\n core: StandaloneEditorCore,\n node: Node,\n option: InsertOption | null\n) => boolean;\n\n/**\n * Attach a DOM event to the editor content DIV\n * @param core The StandaloneEditorCore object\n * @param eventMap A map from event name to its handler\n */\nexport type AttachDomEvent = (\n core: StandaloneEditorCore,\n eventMap: Record<string, DOMEventHandler>\n) => () => void;\n\n/**\n * Get current editor content as HTML string\n * @param core The StandaloneEditorCore object\n * @param mode specify what kind of HTML content to retrieve\n * @returns HTML string representing current editor content\n */\nexport type GetContent = (\n core: StandaloneEditorCore,\n mode: GetContentMode | CompatibleGetContentMode\n) => string;\n\n/**\n * Get style based format state from current selection, including font name/size and colors\n * @param core The StandaloneEditorCore objects\n * @param node The node to get style from\n */\nexport type GetStyleBasedFormatState = (\n core: StandaloneEditorCore,\n node: Node | null\n) => StyleBasedFormatState;\n\n/**\n * Restore an undo snapshot into editor\n * @param core The StandaloneEditorCore object\n * @param step Steps to move, can be 0, positive or negative\n */\nexport type RestoreUndoSnapshot = (core: StandaloneEditorCore, step: number) => void;\n\n/**\n * Ensure user will type into a container element rather than into the editor content DIV directly\n * @param core The StandaloneEditorCore object.\n * @param position The position that user is about to type to\n * @param keyboardEvent Optional keyboard event object\n * @param deprecated Deprecated parameter, not used\n */\nexport type EnsureTypeInContainer = (\n core: StandaloneEditorCore,\n position: NodePosition,\n keyboardEvent?: KeyboardEvent,\n deprecated?: boolean\n) => void;\n\n/**\n * Temp interface\n * TODO: Port other core API\n */\nexport interface PortedCoreApiMap {\n /**\n * Create a EditorContext object used by ContentModel API\n * @param core The StandaloneEditorCore object\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The StandaloneEditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n */\n createContentModel: CreateContentModel;\n\n /**\n * Get current DOM selection from editor\n * @param core The StandaloneEditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The StandaloneEditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n */\n setContentModel: SetContentModel;\n\n /**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The StandaloneEditorCore object\n * @param selection The selection to set\n */\n setDOMSelection: SetDOMSelection;\n\n /**\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 */\n formatContentModel: FormatContentModel;\n\n /**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The StandaloneEditorCore object\n * @param isOn True to switch On, False to switch Off\n */\n switchShadowEdit: SwitchShadowEdit;\n\n /**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The StandaloneEditorCore object\n */\n getVisibleViewport: GetVisibleViewport;\n}\n\n/**\n * Temp interface\n * TODO: Port these core API\n */\nexport interface UnportedCoreApiMap {\n /**\n * Select content according to the given information.\n * There are a bunch of allowed combination of parameters. See IEditor.select for more details\n * @param core The editor core object\n * @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path\n * @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection, or null\n * @param arg3 (optional) A Node\n * @param arg4 (optional) An offset number, or a PositionType\n */\n select: Select;\n\n /**\n * Trigger a plugin event\n * @param core The StandaloneEditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\n triggerEvent: TriggerEvent;\n\n /**\n * Get current or cached selection range\n * @param core The StandaloneEditorCore object\n * @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now\n * @returns A Range object of the selection range\n */\n getSelectionRangeEx: GetSelectionRangeEx;\n\n /**\n * Edit and transform color of elements between light mode and dark mode\n * @param core The StandaloneEditorCore object\n * @param rootNode The root HTML element to transform\n * @param includeSelf True to transform the root node as well, otherwise false\n * @param callback The callback function to invoke before do color transformation\n * @param direction To specify the transform direction, light to dark, or dark to light\n * @param forceTransform By default this function will only work when editor core is in dark mode.\n * Pass true to this value to force do color transformation even editor core is in light mode\n * @param fromDarkModel Whether the given content is already in dark mode\n */\n transformColor: TransformColor;\n\n /**\n * Call an editing callback with adding undo snapshots around, and trigger a ContentChanged event if change source is specified.\n * Undo snapshot will not be added if this call is nested inside another addUndoSnapshot() call.\n * @param core The StandaloneEditorCore object\n * @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.\n * @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent\n * @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).\n */\n addUndoSnapshot: AddUndoSnapshot;\n\n /**\n * Change the editor selection to the given range\n * @param core The StandaloneEditorCore object\n * @param range The range to select\n * @param skipSameRange When set to true, do nothing if the given range is the same with current selection\n * in editor, otherwise it will always remove current selection range and set to the given one.\n * This parameter is always treated as true in Edge to avoid some weird runtime exception.\n */\n selectRange: SelectRange;\n\n /**\n * Select a image and save data of the selected range\n * @param core The StandaloneEditorCore object\n * @param image image to select\n * @param imageId the id of the image element\n * @returns true if successful\n */\n selectImage: SelectImage;\n\n /**\n * Select a table and save data of the selected range\n * @param core The StandaloneEditorCore object\n * @param table table to select\n * @param coordinates first and last cell of the selection, if this parameter is null, instead of\n * selecting, will unselect the table.\n * @param shouldAddStyles Whether need to update the style elements\n * @returns true if successful\n */\n selectTable: SelectTable;\n\n /**\n * Set HTML content to this editor. All existing content will be replaced. A ContentChanged event will be triggered\n * if triggerContentChangedEvent is set to true\n * @param core The StandaloneEditorCore object\n * @param content HTML content to set in\n * @param triggerContentChangedEvent True to trigger a ContentChanged event. Default value is true\n */\n setContent: SetContent;\n\n /**\n * Get current or cached selection range\n * @param core The StandaloneEditorCore object\n * @param tryGetFromCache Set to true to retrieve the selection range from cache if editor doesn't own the focus now\n * @returns A Range object of the selection range\n */\n getSelectionRange: GetSelectionRange;\n\n /**\n * Check if the editor has focus now\n * @param core The StandaloneEditorCore object\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus: HasFocus;\n\n /**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The StandaloneEditorCore object\n */\n focus: Focus;\n\n /**\n * Insert a DOM node into editor content\n * @param core The StandaloneEditorCore object. No op if null.\n * @param option An insert option object to specify how to insert the node\n */\n insertNode: InsertNode;\n\n /**\n * Attach a DOM event to the editor content DIV\n * @param core The StandaloneEditorCore object\n * @param eventName The DOM event name\n * @param pluginEventType Optional event type. When specified, editor will trigger a plugin event with this name when the DOM event is triggered\n * @param beforeDispatch Optional callback function to be invoked when the DOM event is triggered before trigger plugin event\n */\n attachDomEvent: AttachDomEvent;\n\n /**\n * Get current editor content as HTML string\n * @param core The StandaloneEditorCore object\n * @param mode specify what kind of HTML content to retrieve\n * @returns HTML string representing current editor content\n */\n getContent: GetContent;\n\n /**\n * Get style based format state from current selection, including font name/size and colors\n * @param core The StandaloneEditorCore objects\n * @param node The node to get style from\n */\n getStyleBasedFormatState: GetStyleBasedFormatState;\n\n /**\n * Restore an undo snapshot into editor\n * @param core The editor core object\n * @param step Steps to move, can be 0, positive or negative\n */\n restoreUndoSnapshot: RestoreUndoSnapshot;\n\n /**\n * Ensure user will type into a container element rather than into the editor content DIV directly\n * @param core The EditorCore object.\n * @param position The position that user is about to type to\n * @param keyboardEvent Optional keyboard event object\n * @param deprecated Deprecated parameter, not used\n */\n ensureTypeInContainer: EnsureTypeInContainer;\n}\n\n/**\n * The interface for the map of core API for Content Model editor.\n * Editor can call call API from this map under StandaloneEditorCore object\n */\nexport interface StandaloneCoreApiMap extends PortedCoreApiMap, UnportedCoreApiMap {}\n\n/**\n * Represents the core data structure of a Content Model editor\n */\nexport interface StandaloneEditorCore\n extends StandaloneEditorCorePluginState,\n UnportedCorePluginState,\n StandaloneEditorDefaultSettings {\n /**\n * The content DIV element of this editor\n */\n readonly contentDiv: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: StandaloneCoreApiMap;\n\n /**\n * Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.\n */\n readonly originalApi: StandaloneCoreApiMap;\n\n /**\n * An array of editor plugins.\n */\n readonly plugins: EditorPlugin[];\n\n /**\n * Editor running environment\n */\n readonly environment: EditorEnvironment;\n\n /**\n * Dark model handler for the editor, used for variable-based solution.\n * If keep it null, editor will still use original dataset-based dark mode solution.\n */\n readonly darkColorHandler: DarkColorHandler;\n\n /**\n * A handler to convert HTML string to a trust HTML string.\n * By default it will just return the original HTML string directly.\n * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n */\n readonly trustedHTMLHandler: TrustedHTMLHandler;\n}\n\n/**\n * Default DOM and Content Model conversion settings for an editor\n */\nexport interface StandaloneEditorDefaultSettings {\n /**\n * Default DOM to Content Model options\n */\n defaultDomToModelOptions: (DomToModelOption | undefined)[];\n\n /**\n * Default Content Model to DOM options\n */\n defaultModelToDomOptions: (ModelToDomOption | undefined)[];\n\n /**\n * Default DOM to Content Model config, calculated from defaultDomToModelOptions,\n * will be used for creating content model if there is no other customized options\n */\n defaultDomToModelConfig: DomToModelSettings;\n\n /**\n * Default Content Model to DOM config, calculated from defaultModelToDomOptions,\n * will be used for setting content model if there is no other customized options\n */\n defaultModelToDomConfig: ModelToDomSettings;\n}\n"]}