roosterjs-content-model-types 9.13.0 → 9.15.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 (88) hide show
  1. package/lib/context/ModelToDomContext.d.ts +2 -1
  2. package/lib/context/ModelToDomContext.js.map +1 -1
  3. package/lib/context/RewriteFromModel.d.ts +22 -0
  4. package/lib/context/RewriteFromModel.js +3 -0
  5. package/lib/context/RewriteFromModel.js.map +1 -0
  6. package/lib/editor/EditorCore.d.ts +13 -2
  7. package/lib/editor/EditorCore.js.map +1 -1
  8. package/lib/editor/EditorOptions.d.ts +7 -1
  9. package/lib/editor/EditorOptions.js.map +1 -1
  10. package/lib/event/EditorReadyEvent.d.ts +2 -1
  11. package/lib/event/EditorReadyEvent.js.map +1 -1
  12. package/lib/event/PluginEvent.d.ts +2 -1
  13. package/lib/event/PluginEvent.js.map +1 -1
  14. package/lib/event/PluginEventType.d.ts +4 -0
  15. package/lib/event/PluginEventType.js.map +1 -1
  16. package/lib/event/RewriteFromModelEvent.d.ts +7 -0
  17. package/lib/event/RewriteFromModelEvent.js +3 -0
  18. package/lib/event/RewriteFromModelEvent.js.map +1 -0
  19. package/lib/index.d.ts +3 -0
  20. package/lib/index.js.map +1 -1
  21. package/lib/parameter/ConflictFormatSolution.d.ts +7 -0
  22. package/lib/parameter/ConflictFormatSolution.js +3 -0
  23. package/lib/parameter/ConflictFormatSolution.js.map +1 -0
  24. package/lib/parameter/FormatContentModelContext.d.ts +15 -1
  25. package/lib/parameter/FormatContentModelContext.js.map +1 -1
  26. package/lib/pluginState/FormatPluginState.d.ts +6 -1
  27. package/lib/pluginState/FormatPluginState.js.map +1 -1
  28. package/lib/pluginState/LifecyclePluginState.d.ts +5 -0
  29. package/lib/pluginState/LifecyclePluginState.js.map +1 -1
  30. package/lib-amd/context/ModelToDomContext.d.ts +2 -1
  31. package/lib-amd/context/ModelToDomContext.js.map +1 -1
  32. package/lib-amd/context/RewriteFromModel.d.ts +22 -0
  33. package/lib-amd/context/RewriteFromModel.js +5 -0
  34. package/lib-amd/context/RewriteFromModel.js.map +1 -0
  35. package/lib-amd/editor/EditorCore.d.ts +13 -2
  36. package/lib-amd/editor/EditorCore.js.map +1 -1
  37. package/lib-amd/editor/EditorOptions.d.ts +7 -1
  38. package/lib-amd/editor/EditorOptions.js.map +1 -1
  39. package/lib-amd/event/EditorReadyEvent.d.ts +2 -1
  40. package/lib-amd/event/EditorReadyEvent.js.map +1 -1
  41. package/lib-amd/event/PluginEvent.d.ts +2 -1
  42. package/lib-amd/event/PluginEvent.js.map +1 -1
  43. package/lib-amd/event/PluginEventType.d.ts +4 -0
  44. package/lib-amd/event/PluginEventType.js.map +1 -1
  45. package/lib-amd/event/RewriteFromModelEvent.d.ts +7 -0
  46. package/lib-amd/event/RewriteFromModelEvent.js +5 -0
  47. package/lib-amd/event/RewriteFromModelEvent.js.map +1 -0
  48. package/lib-amd/index.d.ts +3 -0
  49. package/lib-amd/index.js.map +1 -1
  50. package/lib-amd/parameter/ConflictFormatSolution.d.ts +7 -0
  51. package/lib-amd/parameter/ConflictFormatSolution.js +5 -0
  52. package/lib-amd/parameter/ConflictFormatSolution.js.map +1 -0
  53. package/lib-amd/parameter/FormatContentModelContext.d.ts +15 -1
  54. package/lib-amd/parameter/FormatContentModelContext.js.map +1 -1
  55. package/lib-amd/pluginState/FormatPluginState.d.ts +6 -1
  56. package/lib-amd/pluginState/FormatPluginState.js.map +1 -1
  57. package/lib-amd/pluginState/LifecyclePluginState.d.ts +5 -0
  58. package/lib-amd/pluginState/LifecyclePluginState.js.map +1 -1
  59. package/lib-mjs/context/ModelToDomContext.d.ts +2 -1
  60. package/lib-mjs/context/ModelToDomContext.js.map +1 -1
  61. package/lib-mjs/context/RewriteFromModel.d.ts +22 -0
  62. package/lib-mjs/context/RewriteFromModel.js +2 -0
  63. package/lib-mjs/context/RewriteFromModel.js.map +1 -0
  64. package/lib-mjs/editor/EditorCore.d.ts +13 -2
  65. package/lib-mjs/editor/EditorCore.js.map +1 -1
  66. package/lib-mjs/editor/EditorOptions.d.ts +7 -1
  67. package/lib-mjs/editor/EditorOptions.js.map +1 -1
  68. package/lib-mjs/event/EditorReadyEvent.d.ts +2 -1
  69. package/lib-mjs/event/EditorReadyEvent.js.map +1 -1
  70. package/lib-mjs/event/PluginEvent.d.ts +2 -1
  71. package/lib-mjs/event/PluginEvent.js.map +1 -1
  72. package/lib-mjs/event/PluginEventType.d.ts +4 -0
  73. package/lib-mjs/event/PluginEventType.js.map +1 -1
  74. package/lib-mjs/event/RewriteFromModelEvent.d.ts +7 -0
  75. package/lib-mjs/event/RewriteFromModelEvent.js +2 -0
  76. package/lib-mjs/event/RewriteFromModelEvent.js.map +1 -0
  77. package/lib-mjs/index.d.ts +3 -0
  78. package/lib-mjs/index.js.map +1 -1
  79. package/lib-mjs/parameter/ConflictFormatSolution.d.ts +7 -0
  80. package/lib-mjs/parameter/ConflictFormatSolution.js +2 -0
  81. package/lib-mjs/parameter/ConflictFormatSolution.js.map +1 -0
  82. package/lib-mjs/parameter/FormatContentModelContext.d.ts +15 -1
  83. package/lib-mjs/parameter/FormatContentModelContext.js.map +1 -1
  84. package/lib-mjs/pluginState/FormatPluginState.d.ts +6 -1
  85. package/lib-mjs/pluginState/FormatPluginState.js.map +1 -1
  86. package/lib-mjs/pluginState/LifecyclePluginState.d.ts +5 -0
  87. package/lib-mjs/pluginState/LifecyclePluginState.js.map +1 -1
  88. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import type { RewriteFromModelContext } from './RewriteFromModel';
1
2
  import type { EditorContext } from './EditorContext';
2
3
  import type { ModelToDomFormatContext } from './ModelToDomFormatContext';
3
4
  import type { ModelToDomSelectionContext } from './ModelToDomSelectionContext';
@@ -5,5 +6,5 @@ import type { ModelToDomSettings } from './ModelToDomSettings';
5
6
  /**
6
7
  * Context of Model to DOM conversion, used for generate HTML DOM tree according to current context
7
8
  */
8
- export interface ModelToDomContext extends EditorContext, ModelToDomSelectionContext, ModelToDomFormatContext, ModelToDomSettings {
9
+ export interface ModelToDomContext extends EditorContext, ModelToDomSelectionContext, ModelToDomFormatContext, ModelToDomSettings, RewriteFromModelContext {
9
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ModelToDomContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/ModelToDomContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { EditorContext } from './EditorContext';\nimport type { ModelToDomFormatContext } from './ModelToDomFormatContext';\nimport type { ModelToDomSelectionContext } from './ModelToDomSelectionContext';\nimport type { ModelToDomSettings } from './ModelToDomSettings';\n\n/**\n * Context of Model to DOM conversion, used for generate HTML DOM tree according to current context\n */\nexport interface ModelToDomContext\n extends EditorContext,\n ModelToDomSelectionContext,\n ModelToDomFormatContext,\n ModelToDomSettings {}\n"]}
1
+ {"version":3,"file":"ModelToDomContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/ModelToDomContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { RewriteFromModelContext } from './RewriteFromModel';\nimport type { EditorContext } from './EditorContext';\nimport type { ModelToDomFormatContext } from './ModelToDomFormatContext';\nimport type { ModelToDomSelectionContext } from './ModelToDomSelectionContext';\nimport type { ModelToDomSettings } from './ModelToDomSettings';\n\n/**\n * Context of Model to DOM conversion, used for generate HTML DOM tree according to current context\n */\nexport interface ModelToDomContext\n extends EditorContext,\n ModelToDomSelectionContext,\n ModelToDomFormatContext,\n ModelToDomSettings,\n RewriteFromModelContext {}\n"]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Represents added and removed block elements during content model to dom conversion
3
+ */
4
+ export interface RewriteFromModel {
5
+ /**
6
+ * Added block elements
7
+ */
8
+ addedBlockElements: HTMLElement[];
9
+ /**
10
+ * Removed block elements
11
+ */
12
+ removedBlockElements: HTMLElement[];
13
+ }
14
+ /**
15
+ * Context object used by contentModelToDom to record added and removed block elements
16
+ */
17
+ export interface RewriteFromModelContext {
18
+ /**
19
+ * DOM modification object
20
+ */
21
+ rewriteFromModel: RewriteFromModel;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RewriteFromModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RewriteFromModel.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/RewriteFromModel.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents added and removed block elements during content model to dom conversion\n */\nexport interface RewriteFromModel {\n /**\n * Added block elements\n */\n addedBlockElements: HTMLElement[];\n\n /**\n * Removed block elements\n */\n removedBlockElements: HTMLElement[];\n}\n\n/**\n * Context object used by contentModelToDom to record added and removed block elements\n */\nexport interface RewriteFromModelContext {\n /**\n * DOM modification object\n */\n rewriteFromModel: RewriteFromModel;\n}\n"]}
@@ -7,7 +7,7 @@ import type { DOMEventRecord } from '../parameter/DOMEventRecord';
7
7
  import type { Snapshot } from '../parameter/Snapshot';
8
8
  import type { EntityState } from '../parameter/FormatContentModelContext';
9
9
  import type { DarkColorHandler } from '../context/DarkColorHandler';
10
- import type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';
10
+ import type { ContentModelDocument, ReadonlyContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';
11
11
  import type { DOMSelection } from '../selection/DOMSelection';
12
12
  import type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';
13
13
  import type { EditorContext } from '../context/EditorContext';
@@ -42,8 +42,10 @@ export declare type GetDOMSelection = (core: EditorCore) => DOMSelection | null;
42
42
  * @param model The content model to set
43
43
  * @param option Additional options to customize the behavior of Content Model to DOM conversion
44
44
  * @param onNodeCreated An optional callback that will be called when a DOM node is created
45
+ * @param isInitializing True means editor is being initialized then it will save modification nodes onto
46
+ * lifecycleState instead of triggering events, false means other cases
45
47
  */
46
- export declare type SetContentModel = (core: EditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null;
48
+ export declare type SetContentModel = (core: EditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated, isInitializing?: boolean) => DOMSelection | null;
47
49
  /**
48
50
  * Set current DOM selection from editor. This is the replacement of core API select
49
51
  * @param core The EditorCore object
@@ -157,6 +159,9 @@ export interface CoreApiMap {
157
159
  * @param core The EditorCore object
158
160
  * @param model The content model to set
159
161
  * @param option Additional options to customize the behavior of Content Model to DOM conversion
162
+ * @param onNodeCreated An optional callback that will be called when a DOM node is created
163
+ * @param isInitializing True means editor is being initialized then it will save modification nodes onto
164
+ * lifecycleState instead of triggering events, false means other cases
160
165
  */
161
166
  setContentModel: SetContentModel;
162
167
  /**
@@ -293,6 +298,12 @@ export interface EditorCore extends PluginState {
293
298
  * @param error The error object we got
294
299
  */
295
300
  readonly disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;
301
+ /**
302
+ * An optional callback function that will be invoked before write content model back to editor.
303
+ * This is used for make sure model can satisfy some customized requirement
304
+ * @param model The model to fix up
305
+ */
306
+ readonly onFixUpModel?: (model: ReadonlyContentModelDocument) => void;
296
307
  /**
297
308
  * Enabled experimental features
298
309
  */
@@ -1 +1 @@
1
- {"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEvent } from '../event/PluginEvent';\nimport type { PluginState } from '../pluginState/PluginState';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The EditorCore object\n * @param saveIndex True to allow saving index info into node using domIndexer, otherwise false\n */\nexport type CreateEditorContext = (core: EditorCore, saveIndex: boolean) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\nexport type CreateContentModel = (\n core: EditorCore,\n option?: DomToModelOptionForCreateModel,\n selectionOverride?: DOMSelection | 'none'\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\nexport type GetDOMSelection = (core: EditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The EditorCore 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: EditorCore,\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 EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\nexport type SetDOMSelection = (\n core: EditorCore,\n selection: DOMSelection | null,\n skipSelectionChangedEvent?: boolean\n) => void;\n\n/**\n * Set a new logical root (most likely due to focus change)\n * @param core The EditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot or null to use physicalRoot as logical root)\n */\nexport type SetLogicalRoot = (core: EditorCore, logicalRoot: HTMLDivElement | null) => 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 EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\nexport type FormatContentModel = (\n core: EditorCore,\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOptions?: DomToModelOptionForCreateModel\n) => void;\n\n/**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\nexport type SwitchShadowEdit = (core: EditorCore, isOn: boolean) => void;\n\n/**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\nexport type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;\n\n/**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\nexport type AddUndoSnapshot = (\n core: EditorCore,\n canUndoByBackspace: boolean,\n entityStates?: EntityState[]\n) => Snapshot | null;\n\n/**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\nexport type GetVisibleViewport = (core: EditorCore) => Rect | null;\n\n/**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\nexport type Focus = (core: EditorCore) => void;\n\n/**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\nexport type AttachDomEvent = (\n core: EditorCore,\n eventMap: Record<string, DOMEventRecord>\n) => () => void;\n\n/**\n * Restore an undo snapshot into editor\n * @param core The EditorCore object\n * @param step Steps to move, can be 0, positive or negative\n */\nexport type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot) => void;\n\n/**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to remove existing rules\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule. It also accepts pseudo classes \"before\" and \"after\" to create pseudo class rule \"::before\"\n * and \"::after\" to the editor root element itself\n * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only\n */\nexport type SetEditorStyle = (\n core: EditorCore,\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[],\n maxRuleLength?: number\n) => void;\n\n/**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\nexport type Announce = (core: EditorCore, announceData: AnnounceData) => void;\n\n/**\n * The interface for the map of core API for Editor.\n * Editor can call call API from this map under EditorCore object\n */\nexport interface CoreApiMap {\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore 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 EditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The EditorCore 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 EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\n setDOMSelection: SetDOMSelection;\n\n /**\n * Set a new logical root (most likely due to focus change)\n * @param core The StandaloneEditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot)\n */\n setLogicalRoot: SetLogicalRoot;\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 EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel: FormatContentModel;\n\n /**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore 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 EditorCore object\n */\n getVisibleViewport: GetVisibleViewport;\n\n /**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\n focus: Focus;\n\n /**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n addUndoSnapshot: AddUndoSnapshot;\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 * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent: AttachDomEvent;\n\n /**\n * Trigger a plugin event\n * @param core The EditorCore 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 * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule.\n */\n setEditorStyle: SetEditorStyle;\n\n /**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\n announce: Announce;\n}\n\n/**\n * Represents the core data structure of an editor\n */\nexport interface EditorCore extends PluginState {\n /**\n * The root DIV element of this editor (formerly contentDiv)\n */\n readonly physicalRoot: HTMLDivElement;\n\n /**\n * The content DIV element that operations should be applied to\n * By default, the logical root is the same as the physical root,\n * but if nested editors are used, the logical root changes to that of the inner editor\n */\n logicalRoot: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: CoreApiMap;\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: CoreApiMap;\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 * A helper class to provide DOM access APIs\n */\n readonly domHelper: DOMHelper;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n readonly disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * Enabled experimental features\n */\n readonly experimentalFeatures: ReadonlyArray<string>;\n}\n"]}
1
+ {"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEvent } from '../event/PluginEvent';\nimport type { PluginState } from '../pluginState/PluginState';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type {\n ContentModelDocument,\n ReadonlyContentModelDocument,\n} from '../contentModel/blockGroup/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The EditorCore object\n * @param saveIndex True to allow saving index info into node using domIndexer, otherwise false\n */\nexport type CreateEditorContext = (core: EditorCore, saveIndex: boolean) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\nexport type CreateContentModel = (\n core: EditorCore,\n option?: DomToModelOptionForCreateModel,\n selectionOverride?: DOMSelection | 'none'\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\nexport type GetDOMSelection = (core: EditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The EditorCore 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 * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\nexport type SetContentModel = (\n core: EditorCore,\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated,\n isInitializing?: boolean\n) => DOMSelection | null;\n\n/**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\nexport type SetDOMSelection = (\n core: EditorCore,\n selection: DOMSelection | null,\n skipSelectionChangedEvent?: boolean\n) => void;\n\n/**\n * Set a new logical root (most likely due to focus change)\n * @param core The EditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot or null to use physicalRoot as logical root)\n */\nexport type SetLogicalRoot = (core: EditorCore, logicalRoot: HTMLDivElement | null) => 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 EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\nexport type FormatContentModel = (\n core: EditorCore,\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOptions?: DomToModelOptionForCreateModel\n) => void;\n\n/**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\nexport type SwitchShadowEdit = (core: EditorCore, isOn: boolean) => void;\n\n/**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\nexport type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;\n\n/**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\nexport type AddUndoSnapshot = (\n core: EditorCore,\n canUndoByBackspace: boolean,\n entityStates?: EntityState[]\n) => Snapshot | null;\n\n/**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\nexport type GetVisibleViewport = (core: EditorCore) => Rect | null;\n\n/**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\nexport type Focus = (core: EditorCore) => void;\n\n/**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\nexport type AttachDomEvent = (\n core: EditorCore,\n eventMap: Record<string, DOMEventRecord>\n) => () => void;\n\n/**\n * Restore an undo snapshot into editor\n * @param core The EditorCore object\n * @param step Steps to move, can be 0, positive or negative\n */\nexport type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot) => void;\n\n/**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to remove existing rules\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule. It also accepts pseudo classes \"before\" and \"after\" to create pseudo class rule \"::before\"\n * and \"::after\" to the editor root element itself\n * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only\n */\nexport type SetEditorStyle = (\n core: EditorCore,\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[],\n maxRuleLength?: number\n) => void;\n\n/**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\nexport type Announce = (core: EditorCore, announceData: AnnounceData) => void;\n\n/**\n * The interface for the map of core API for Editor.\n * Editor can call call API from this map under EditorCore object\n */\nexport interface CoreApiMap {\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore 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 EditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The EditorCore 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 * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\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 EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\n setDOMSelection: SetDOMSelection;\n\n /**\n * Set a new logical root (most likely due to focus change)\n * @param core The StandaloneEditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot)\n */\n setLogicalRoot: SetLogicalRoot;\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 EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel: FormatContentModel;\n\n /**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore 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 EditorCore object\n */\n getVisibleViewport: GetVisibleViewport;\n\n /**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\n focus: Focus;\n\n /**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n addUndoSnapshot: AddUndoSnapshot;\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 * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent: AttachDomEvent;\n\n /**\n * Trigger a plugin event\n * @param core The EditorCore 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 * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule.\n */\n setEditorStyle: SetEditorStyle;\n\n /**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\n announce: Announce;\n}\n\n/**\n * Represents the core data structure of an editor\n */\nexport interface EditorCore extends PluginState {\n /**\n * The root DIV element of this editor (formerly contentDiv)\n */\n readonly physicalRoot: HTMLDivElement;\n\n /**\n * The content DIV element that operations should be applied to\n * By default, the logical root is the same as the physical root,\n * but if nested editors are used, the logical root changes to that of the inner editor\n */\n logicalRoot: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: CoreApiMap;\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: CoreApiMap;\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 * A helper class to provide DOM access APIs\n */\n readonly domHelper: DOMHelper;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n readonly disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * An optional callback function that will be invoked before write content model back to editor.\n * This is used for make sure model can satisfy some customized requirement\n * @param model The model to fix up\n */\n readonly onFixUpModel?: (model: ReadonlyContentModelDocument) => void;\n\n /**\n * Enabled experimental features\n */\n readonly experimentalFeatures: ReadonlyArray<string>;\n}\n"]}
@@ -7,7 +7,7 @@ import type { ContentModelSegmentFormat } from '../contentModel/format/ContentMo
7
7
  import type { CoreApiMap } from './EditorCore';
8
8
  import type { DomToModelOption } from '../context/DomToModelOption';
9
9
  import type { ModelToDomOption } from '../context/ModelToDomOption';
10
- import type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';
10
+ import type { ContentModelDocument, ReadonlyContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';
11
11
  import type { Snapshots } from '../parameter/Snapshot';
12
12
  import type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';
13
13
  /**
@@ -59,6 +59,12 @@ export interface ContentModelOptions {
59
59
  * Default value is the computed style of editor content DIV
60
60
  */
61
61
  defaultSegmentFormat?: ContentModelSegmentFormat;
62
+ /**
63
+ * An optional callback function that will be invoked before write content model back to editor.
64
+ * This is used for make sure model can satisfy some customized requirement
65
+ * @param model The model to fix up
66
+ */
67
+ onFixUpModel?: (model: ReadonlyContentModelDocument) => void;
62
68
  /**
63
69
  * @deprecated
64
70
  */
@@ -1 +1 @@
1
- {"version":3,"file":"EditorOptions.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PasteTypeOrGetter } from '../parameter/PasteTypeOrGetter';\nimport type { ExperimentalFeature } from './ExperimentalFeature';\nimport type { KnownAnnounceStrings } from '../parameter/AnnounceData';\nimport type { Colors, ColorTransformFunction } from '../context/DarkColorHandler';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { CoreApiMap } from './EditorCore';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { Snapshots } from '../parameter/Snapshot';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\n\n/**\n * Options for colors and dark mode\n */\nexport interface ColorOptions {\n /**\n * A util function to transform light mode color to dark mode color\n * Default value is to return the original light color\n */\n getDarkColor?: ColorTransformFunction;\n\n /**\n * A util function to generate color key for dark mode color.\n * By default, the color key is generated from the light mode color. For example,\n * color \"#123456\" will have the key \"--darkColor__123456\", and\n * color \"rgb(0,0,0)\" will have key \"--darkColor_rgb_0_0_0_\".\n * Pass in this function to customize this behavior.\n * The return value must be a valid CSS variable, starts with \"--\"\n */\n generateColorKey?: ColorTransformFunction;\n\n /**\n * Existing known color pairs\n */\n knownColors?: Record<string, Colors>;\n\n /**\n * Whether to skip the adjust editor process when for light/dark mode\n */\n doNotAdjustEditorColor?: boolean;\n\n /**\n * If the editor is currently in dark mode\n */\n inDarkMode?: boolean;\n}\n\n/**\n * Options for Content Model\n */\nexport interface ContentModelOptions {\n /**\n * Default options used for DOM to Content Model conversion\n */\n defaultDomToModelOptions?: DomToModelOption;\n\n /**\n * Default options used for Content Model to DOM conversion\n */\n defaultModelToDomOptions?: ModelToDomOption;\n\n /**\n * Default format of editor content. This will be applied to empty content.\n * If there is already content inside editor, format of existing content will not be changed.\n * Default value is the computed style of editor content DIV\n */\n defaultSegmentFormat?: ContentModelSegmentFormat;\n\n /**\n * @deprecated\n */\n disableCache?: boolean;\n}\n\n/**\n * Options for selection\n */\nexport interface SelectionOptions {\n /**\n * Color of the border of a selectedImage. Default color: '#DB626C'\n */\n imageSelectionBorderColor?: string;\n\n /**\n * Background color of a selected table cell. Default color: '#C6C6C6'\n */\n tableCellSelectionBackgroundColor?: string;\n}\n\n/**\n * Options for paste\n */\nexport interface PasteOptions {\n /**\n * Allowed custom content type when paste besides text/plain, text/html and images\n * Only text types are supported, and do not add \"text/\" prefix to the type values\n */\n allowedCustomPasteType?: string[];\n\n /**\n * Default paste type or function that returns the paste type. By default will use the normal (as-is) paste type.\n */\n defaultPasteType?: PasteTypeOrGetter;\n}\n\n/**\n * Options for editor fundamental data structure\n */\nexport interface EditorBaseOptions {\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: (ExperimentalFeature | string)[];\n\n /**\n * List of plugins.\n * The order of plugins here determines in what order each event will be dispatched.\n * Plugins not appear in this list will not be added to editor, including built-in plugins.\n * Default value is empty array.\n */\n plugins?: EditorPlugin[];\n\n /**\n * The scroll container to get scroll event from.\n * By default, the scroll container will be the same with editor content DIV\n */\n scrollContainer?: HTMLElement;\n\n /**\n * Customized trusted type handler used for sanitizing HTML string before assign to DOM tree\n * This is required when trusted-type Content-Security-Policy (CSP) is enabled.\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types\n */\n trustedHTMLHandler?: TrustedHTMLHandler;\n\n /**\n * A function map to override default core API implementation\n * Default value is null\n */\n coreApiOverride?: Partial<CoreApiMap>;\n\n /**\n * Initial Content Model\n */\n initialModel?: ContentModelDocument;\n\n /**\n * Undo snapshot. Use this parameter to provide an external storage of undo snapshots\n */\n snapshots?: Snapshots;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * A callback to help get string template to announce, used for accessibility\n * @param key The key of known announce data\n * @returns A template string to announce, use placeholder such as \"{0}\" for variables if necessary\n */\n announcerStringGetter?: (key: KnownAnnounceStrings) => string;\n}\n\n/**\n * Options for editor\n */\nexport interface EditorOptions\n extends EditorBaseOptions,\n ColorOptions,\n ContentModelOptions,\n SelectionOptions,\n PasteOptions {}\n"]}
1
+ {"version":3,"file":"EditorOptions.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PasteTypeOrGetter } from '../parameter/PasteTypeOrGetter';\nimport type { ExperimentalFeature } from './ExperimentalFeature';\nimport type { KnownAnnounceStrings } from '../parameter/AnnounceData';\nimport type { Colors, ColorTransformFunction } from '../context/DarkColorHandler';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { CoreApiMap } from './EditorCore';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type {\n ContentModelDocument,\n ReadonlyContentModelDocument,\n} from '../contentModel/blockGroup/ContentModelDocument';\nimport type { Snapshots } from '../parameter/Snapshot';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\n\n/**\n * Options for colors and dark mode\n */\nexport interface ColorOptions {\n /**\n * A util function to transform light mode color to dark mode color\n * Default value is to return the original light color\n */\n getDarkColor?: ColorTransformFunction;\n\n /**\n * A util function to generate color key for dark mode color.\n * By default, the color key is generated from the light mode color. For example,\n * color \"#123456\" will have the key \"--darkColor__123456\", and\n * color \"rgb(0,0,0)\" will have key \"--darkColor_rgb_0_0_0_\".\n * Pass in this function to customize this behavior.\n * The return value must be a valid CSS variable, starts with \"--\"\n */\n generateColorKey?: ColorTransformFunction;\n\n /**\n * Existing known color pairs\n */\n knownColors?: Record<string, Colors>;\n\n /**\n * Whether to skip the adjust editor process when for light/dark mode\n */\n doNotAdjustEditorColor?: boolean;\n\n /**\n * If the editor is currently in dark mode\n */\n inDarkMode?: boolean;\n}\n\n/**\n * Options for Content Model\n */\nexport interface ContentModelOptions {\n /**\n * Default options used for DOM to Content Model conversion\n */\n defaultDomToModelOptions?: DomToModelOption;\n\n /**\n * Default options used for Content Model to DOM conversion\n */\n defaultModelToDomOptions?: ModelToDomOption;\n\n /**\n * Default format of editor content. This will be applied to empty content.\n * If there is already content inside editor, format of existing content will not be changed.\n * Default value is the computed style of editor content DIV\n */\n defaultSegmentFormat?: ContentModelSegmentFormat;\n\n /**\n * An optional callback function that will be invoked before write content model back to editor.\n * This is used for make sure model can satisfy some customized requirement\n * @param model The model to fix up\n */\n onFixUpModel?: (model: ReadonlyContentModelDocument) => void;\n\n /**\n * @deprecated\n */\n disableCache?: boolean;\n}\n\n/**\n * Options for selection\n */\nexport interface SelectionOptions {\n /**\n * Color of the border of a selectedImage. Default color: '#DB626C'\n */\n imageSelectionBorderColor?: string;\n\n /**\n * Background color of a selected table cell. Default color: '#C6C6C6'\n */\n tableCellSelectionBackgroundColor?: string;\n}\n\n/**\n * Options for paste\n */\nexport interface PasteOptions {\n /**\n * Allowed custom content type when paste besides text/plain, text/html and images\n * Only text types are supported, and do not add \"text/\" prefix to the type values\n */\n allowedCustomPasteType?: string[];\n\n /**\n * Default paste type or function that returns the paste type. By default will use the normal (as-is) paste type.\n */\n defaultPasteType?: PasteTypeOrGetter;\n}\n\n/**\n * Options for editor fundamental data structure\n */\nexport interface EditorBaseOptions {\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: (ExperimentalFeature | string)[];\n\n /**\n * List of plugins.\n * The order of plugins here determines in what order each event will be dispatched.\n * Plugins not appear in this list will not be added to editor, including built-in plugins.\n * Default value is empty array.\n */\n plugins?: EditorPlugin[];\n\n /**\n * The scroll container to get scroll event from.\n * By default, the scroll container will be the same with editor content DIV\n */\n scrollContainer?: HTMLElement;\n\n /**\n * Customized trusted type handler used for sanitizing HTML string before assign to DOM tree\n * This is required when trusted-type Content-Security-Policy (CSP) is enabled.\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types\n */\n trustedHTMLHandler?: TrustedHTMLHandler;\n\n /**\n * A function map to override default core API implementation\n * Default value is null\n */\n coreApiOverride?: Partial<CoreApiMap>;\n\n /**\n * Initial Content Model\n */\n initialModel?: ContentModelDocument;\n\n /**\n * Undo snapshot. Use this parameter to provide an external storage of undo snapshots\n */\n snapshots?: Snapshots;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * A callback to help get string template to announce, used for accessibility\n * @param key The key of known announce data\n * @returns A template string to announce, use placeholder such as \"{0}\" for variables if necessary\n */\n announcerStringGetter?: (key: KnownAnnounceStrings) => string;\n}\n\n/**\n * Options for editor\n */\nexport interface EditorOptions\n extends EditorBaseOptions,\n ColorOptions,\n ContentModelOptions,\n SelectionOptions,\n PasteOptions {}\n"]}
@@ -1,6 +1,7 @@
1
+ import type { RewriteFromModel } from '../context/RewriteFromModel';
1
2
  import type { BasePluginEvent } from './BasePluginEvent';
2
3
  /**
3
4
  * Provides a chance for plugin to change the content before it is pasted into editor.
4
5
  */
5
- export interface EditorReadyEvent extends BasePluginEvent<'editorReady'> {
6
+ export interface EditorReadyEvent extends RewriteFromModel, BasePluginEvent<'editorReady'> {
6
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EditorReadyEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/EditorReadyEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { BasePluginEvent } from './BasePluginEvent';\n\n/**\n * Provides a chance for plugin to change the content before it is pasted into editor.\n */\nexport interface EditorReadyEvent extends BasePluginEvent<'editorReady'> {}\n"]}
1
+ {"version":3,"file":"EditorReadyEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/EditorReadyEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { RewriteFromModel } from '../context/RewriteFromModel';\nimport type { BasePluginEvent } from './BasePluginEvent';\n\n/**\n * Provides a chance for plugin to change the content before it is pasted into editor.\n */\nexport interface EditorReadyEvent extends RewriteFromModel, BasePluginEvent<'editorReady'> {}\n"]}
@@ -5,6 +5,7 @@ import type { BeforePasteEvent } from './BeforePasteEvent';
5
5
  import type { BeforeSetContentEvent } from './BeforeSetContentEvent';
6
6
  import type { ContentChangedEvent } from './ContentChangedEvent';
7
7
  import type { ContextMenuEvent } from './ContextMenuEvent';
8
+ import type { RewriteFromModelEvent } from './RewriteFromModelEvent';
8
9
  import type { EditImageEvent } from './EditImageEvent';
9
10
  import type { EditorInputEvent } from './EditorInputEvent';
10
11
  import type { EditorReadyEvent } from './EditorReadyEvent';
@@ -20,4 +21,4 @@ import type { ZoomChangedEvent } from './ZoomChangedEvent';
20
21
  /**
21
22
  * Editor plugin event interface
22
23
  */
23
- export declare type PluginEvent = BeforeCutCopyEvent | BeforeDisposeEvent | BeforeKeyboardEditingEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent;
24
+ export declare type PluginEvent = BeforeCutCopyEvent | BeforeDisposeEvent | BeforeKeyboardEditingEvent | BeforePasteEvent | BeforeSetContentEvent | CompositionEndEvent | ContentChangedEvent | ContextMenuEvent | RewriteFromModelEvent | EditImageEvent | EditorReadyEvent | EnterShadowEditEvent | EntityOperationEvent | ExtractContentWithDomEvent | EditorInputEvent | KeyDownEvent | KeyPressEvent | KeyUpEvent | LeaveShadowEditEvent | LogicalRootChangedEvent | MouseDownEvent | MouseUpEvent | ScrollEvent | SelectionChangedEvent | ZoomChangedEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"PluginEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/PluginEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { BeforeCutCopyEvent } from './BeforeCutCopyEvent';\nimport type { BeforeDisposeEvent } from './BeforeDisposeEvent';\nimport type { BeforeKeyboardEditingEvent } from './BeforeKeyboardEditingEvent';\nimport type { BeforePasteEvent } from './BeforePasteEvent';\nimport type { BeforeSetContentEvent } from './BeforeSetContentEvent';\nimport type { ContentChangedEvent } from './ContentChangedEvent';\nimport type { ContextMenuEvent } from './ContextMenuEvent';\nimport type { EditImageEvent } from './EditImageEvent';\nimport type { EditorInputEvent } from './EditorInputEvent';\nimport type { EditorReadyEvent } from './EditorReadyEvent';\nimport type { EntityOperationEvent } from './EntityOperationEvent';\nimport type { ExtractContentWithDomEvent } from './ExtractContentWithDomEvent';\nimport type { CompositionEndEvent, KeyDownEvent, KeyPressEvent, KeyUpEvent } from './KeyboardEvent';\nimport type { LogicalRootChangedEvent } from './LogicalRootChangedEvent';\nimport type { MouseDownEvent, MouseUpEvent } from './MouseEvent';\nimport type { ScrollEvent } from './ScrollEvent';\nimport type { SelectionChangedEvent } from './SelectionChangedEvent';\nimport type { EnterShadowEditEvent, LeaveShadowEditEvent } from './ShadowEditEvent';\nimport type { ZoomChangedEvent } from './ZoomChangedEvent';\n\n/**\n * Editor plugin event interface\n */\nexport type PluginEvent =\n | BeforeCutCopyEvent\n | BeforeDisposeEvent\n | BeforeKeyboardEditingEvent\n | BeforePasteEvent\n | BeforeSetContentEvent\n | CompositionEndEvent\n | ContentChangedEvent\n | ContextMenuEvent\n | EditImageEvent\n | EditorReadyEvent\n | EnterShadowEditEvent\n | EntityOperationEvent\n | ExtractContentWithDomEvent\n | EditorInputEvent\n | KeyDownEvent\n | KeyPressEvent\n | KeyUpEvent\n | LeaveShadowEditEvent\n | LogicalRootChangedEvent\n | MouseDownEvent\n | MouseUpEvent\n | ScrollEvent\n | SelectionChangedEvent\n | ZoomChangedEvent;\n"]}
1
+ {"version":3,"file":"PluginEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/PluginEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { BeforeCutCopyEvent } from './BeforeCutCopyEvent';\nimport type { BeforeDisposeEvent } from './BeforeDisposeEvent';\nimport type { BeforeKeyboardEditingEvent } from './BeforeKeyboardEditingEvent';\nimport type { BeforePasteEvent } from './BeforePasteEvent';\nimport type { BeforeSetContentEvent } from './BeforeSetContentEvent';\nimport type { ContentChangedEvent } from './ContentChangedEvent';\nimport type { ContextMenuEvent } from './ContextMenuEvent';\nimport type { RewriteFromModelEvent } from './RewriteFromModelEvent';\nimport type { EditImageEvent } from './EditImageEvent';\nimport type { EditorInputEvent } from './EditorInputEvent';\nimport type { EditorReadyEvent } from './EditorReadyEvent';\nimport type { EntityOperationEvent } from './EntityOperationEvent';\nimport type { ExtractContentWithDomEvent } from './ExtractContentWithDomEvent';\nimport type { CompositionEndEvent, KeyDownEvent, KeyPressEvent, KeyUpEvent } from './KeyboardEvent';\nimport type { LogicalRootChangedEvent } from './LogicalRootChangedEvent';\nimport type { MouseDownEvent, MouseUpEvent } from './MouseEvent';\nimport type { ScrollEvent } from './ScrollEvent';\nimport type { SelectionChangedEvent } from './SelectionChangedEvent';\nimport type { EnterShadowEditEvent, LeaveShadowEditEvent } from './ShadowEditEvent';\nimport type { ZoomChangedEvent } from './ZoomChangedEvent';\n\n/**\n * Editor plugin event interface\n */\nexport type PluginEvent =\n | BeforeCutCopyEvent\n | BeforeDisposeEvent\n | BeforeKeyboardEditingEvent\n | BeforePasteEvent\n | BeforeSetContentEvent\n | CompositionEndEvent\n | ContentChangedEvent\n | ContextMenuEvent\n | RewriteFromModelEvent\n | EditImageEvent\n | EditorReadyEvent\n | EnterShadowEditEvent\n | EntityOperationEvent\n | ExtractContentWithDomEvent\n | EditorInputEvent\n | KeyDownEvent\n | KeyPressEvent\n | KeyUpEvent\n | LeaveShadowEditEvent\n | LogicalRootChangedEvent\n | MouseDownEvent\n | MouseUpEvent\n | ScrollEvent\n | SelectionChangedEvent\n | ZoomChangedEvent;\n"]}
@@ -90,6 +90,10 @@ export declare type PluginEventType =
90
90
  * Zoom scale value is changed, triggered by Editor.setZoomScale() when set a different scale number
91
91
  */
92
92
  | 'zoomChanged'
93
+ /**
94
+ * Rewrite result information from Content Model
95
+ */
96
+ | 'rewriteFromModel'
93
97
  /**
94
98
  * EXPERIMENTAL FEATURE
95
99
  * Editor changed the selection.
@@ -1 +1 @@
1
- {"version":3,"file":"PluginEventType.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/PluginEventType.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type of plugin events\n */\nexport type PluginEventType =\n /**\n * HTML KeyDown event\n */\n | 'keyDown'\n\n /**\n * HTML KeyPress event\n */\n | 'keyPress'\n\n /**\n * HTML KeyUp event\n */\n | 'keyUp'\n\n /**\n * HTML Input / TextInput event\n */\n | 'input'\n\n /**\n * HTML CompositionEnd event\n */\n | 'compositionEnd'\n\n /**\n * HTML MouseDown event\n */\n | 'mouseDown'\n\n /**\n * HTML MouseUp event\n */\n | 'mouseUp'\n\n /**\n * Content changed event\n */\n | 'contentChanged'\n\n /**\n * Extract Content with a DOM tree event\n * This event is triggered when getContent() is called with triggerExtractContentEvent = true\n * Plugin can handle this event to remove the UI only markups to return clean HTML\n * by operating on a cloned DOM tree\n */\n | 'extractContentWithDom'\n\n /**\n * Before Paste event, provide a chance to change copied content\n */\n | 'beforeCutCopy'\n\n /**\n * Before Paste event, provide a chance to change paste content\n */\n | 'beforePaste'\n\n /**\n * Let plugin know editor is ready now\n */\n | 'editorReady'\n\n /**\n * Let plugin know editor is about to dispose\n */\n | 'beforeDispose'\n\n /**\n * Scroll event triggered by scroll container\n */\n | 'scroll'\n\n /**\n * Operating on an entity. See enum EntityOperation for more details about each operation\n */\n | 'entityOperation'\n\n /**\n * HTML ContextMenu event\n */\n | 'contextMenu'\n\n /**\n * Editor has entered shadow edit mode\n */\n | 'enteredShadowEdit'\n\n /**\n * Editor is about to leave shadow edit mode\n */\n | 'leavingShadowEdit'\n\n /**\n * Content of image is being changed from client side\n */\n | 'editImage'\n\n /**\n * Content of editor is about to be cleared by SetContent API, handle this event to cache anything you need\n * before it is gone\n */\n | 'beforeSetContent'\n\n /**\n * Zoom scale value is changed, triggered by Editor.setZoomScale() when set a different scale number\n */\n | 'zoomChanged'\n\n /**\n * EXPERIMENTAL FEATURE\n * Editor changed the selection.\n */\n | 'selectionChanged'\n\n /**\n * EXPERIMENTAL FEATURE\n * The logical root changed\n */\n | 'logicalRootChanged'\n\n /**\n * EXPERIMENTAL FEATURE\n * Editor content is about to be changed by keyboard event.\n * This is only used by Content Model editing\n */\n | 'beforeKeyboardEditing';\n"]}
1
+ {"version":3,"file":"PluginEventType.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/PluginEventType.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type of plugin events\n */\nexport type PluginEventType =\n /**\n * HTML KeyDown event\n */\n | 'keyDown'\n\n /**\n * HTML KeyPress event\n */\n | 'keyPress'\n\n /**\n * HTML KeyUp event\n */\n | 'keyUp'\n\n /**\n * HTML Input / TextInput event\n */\n | 'input'\n\n /**\n * HTML CompositionEnd event\n */\n | 'compositionEnd'\n\n /**\n * HTML MouseDown event\n */\n | 'mouseDown'\n\n /**\n * HTML MouseUp event\n */\n | 'mouseUp'\n\n /**\n * Content changed event\n */\n | 'contentChanged'\n\n /**\n * Extract Content with a DOM tree event\n * This event is triggered when getContent() is called with triggerExtractContentEvent = true\n * Plugin can handle this event to remove the UI only markups to return clean HTML\n * by operating on a cloned DOM tree\n */\n | 'extractContentWithDom'\n\n /**\n * Before Paste event, provide a chance to change copied content\n */\n | 'beforeCutCopy'\n\n /**\n * Before Paste event, provide a chance to change paste content\n */\n | 'beforePaste'\n\n /**\n * Let plugin know editor is ready now\n */\n | 'editorReady'\n\n /**\n * Let plugin know editor is about to dispose\n */\n | 'beforeDispose'\n\n /**\n * Scroll event triggered by scroll container\n */\n | 'scroll'\n\n /**\n * Operating on an entity. See enum EntityOperation for more details about each operation\n */\n | 'entityOperation'\n\n /**\n * HTML ContextMenu event\n */\n | 'contextMenu'\n\n /**\n * Editor has entered shadow edit mode\n */\n | 'enteredShadowEdit'\n\n /**\n * Editor is about to leave shadow edit mode\n */\n | 'leavingShadowEdit'\n\n /**\n * Content of image is being changed from client side\n */\n | 'editImage'\n\n /**\n * Content of editor is about to be cleared by SetContent API, handle this event to cache anything you need\n * before it is gone\n */\n | 'beforeSetContent'\n\n /**\n * Zoom scale value is changed, triggered by Editor.setZoomScale() when set a different scale number\n */\n | 'zoomChanged'\n\n /**\n * Rewrite result information from Content Model\n */\n | 'rewriteFromModel'\n\n /**\n * EXPERIMENTAL FEATURE\n * Editor changed the selection.\n */\n | 'selectionChanged'\n\n /**\n * EXPERIMENTAL FEATURE\n * The logical root changed\n */\n | 'logicalRootChanged'\n\n /**\n * EXPERIMENTAL FEATURE\n * Editor content is about to be changed by keyboard event.\n * This is only used by Content Model editing\n */\n | 'beforeKeyboardEditing';\n"]}
@@ -0,0 +1,7 @@
1
+ import type { RewriteFromModel } from '../context/RewriteFromModel';
2
+ import type { BasePluginEvent } from './BasePluginEvent';
3
+ /**
4
+ * The event triggered when Content Model modifies editor DOM tree, provides added and removed block level elements
5
+ */
6
+ export interface RewriteFromModelEvent extends RewriteFromModel, BasePluginEvent<'rewriteFromModel'> {
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RewriteFromModelEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RewriteFromModelEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/RewriteFromModelEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { RewriteFromModel } from '../context/RewriteFromModel';\nimport type { BasePluginEvent } from './BasePluginEvent';\n\n/**\n * The event triggered when Content Model modifies editor DOM tree, provides added and removed block level elements\n */\nexport interface RewriteFromModelEvent\n extends RewriteFromModel,\n BasePluginEvent<'rewriteFromModel'> {}\n"]}
package/lib/index.d.ts CHANGED
@@ -107,6 +107,7 @@ export { DomToModelFormatContext, DomToModelDecoratorContext, DomToModelListForm
107
107
  export { ModelToDomContext } from './context/ModelToDomContext';
108
108
  export { ModelToDomBlockAndSegmentNode, ModelToDomRegularSelection, ModelToDomSelectionContext, } from './context/ModelToDomSelectionContext';
109
109
  export { ModelToDomListStackItem, ModelToDomListContext, ModelToDomFormatContext, } from './context/ModelToDomFormatContext';
110
+ export { RewriteFromModel, RewriteFromModelContext } from './context/RewriteFromModel';
110
111
  export { ContentModelHandler, ContentModelSegmentHandler, ContentModelBlockHandler, } from './context/ContentModelHandler';
111
112
  export { DomToModelOption, DomToModelOptionForSanitizing, DomToModelOptionForCreateModel, } from './context/DomToModelOption';
112
113
  export { ModelToDomOption } from './context/ModelToDomOption';
@@ -163,6 +164,7 @@ export { TypeOfBlockGroup } from './parameter/TypeOfBlockGroup';
163
164
  export { OperationalBlocks, ReadonlyOperationalBlocks } from './parameter/OperationalBlocks';
164
165
  export { ParsedTable, ParsedTableCell } from './parameter/ParsedTable';
165
166
  export { ModelToTextCallback, ModelToTextCallbacks, ModelToTextChecker, } from './parameter/ModelToTextCallbacks';
167
+ export { ConflictFormatSolution } from './parameter/ConflictFormatSolution';
166
168
  export { BasePluginEvent, BasePluginDomEvent } from './event/BasePluginEvent';
167
169
  export { BeforeCutCopyEvent } from './event/BeforeCutCopyEvent';
168
170
  export { BeforeDisposeEvent } from './event/BeforeDisposeEvent';
@@ -171,6 +173,7 @@ export { BeforePasteEvent, MergePastedContentFunc } from './event/BeforePasteEve
171
173
  export { BeforeSetContentEvent } from './event/BeforeSetContentEvent';
172
174
  export { ContentChangedEvent, ChangedEntity } from './event/ContentChangedEvent';
173
175
  export { ContextMenuEvent } from './event/ContextMenuEvent';
176
+ export { RewriteFromModelEvent } from './event/RewriteFromModelEvent';
174
177
  export { EditImageEvent } from './event/EditImageEvent';
175
178
  export { EditorReadyEvent } from './event/EditorReadyEvent';
176
179
  export { EntityOperationEvent, Entity } from './event/EntityOperationEvent';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-types/lib/index.ts"],"names":[],"mappings":"","sourcesContent":["export { ContentModelSegmentFormat } from './contentModel/format/ContentModelSegmentFormat';\nexport {\n ContentModelWithFormat,\n ReadonlyContentModelWithFormat,\n} from './contentModel/format/ContentModelWithFormat';\nexport { ContentModelTableFormat } from './contentModel/format/ContentModelTableFormat';\nexport {\n ContentModelWithDataset,\n ReadonlyContentModelWithDataset,\n ShallowMutableContentModelWithDataset,\n} from './contentModel/format/ContentModelWithDataset';\nexport { ContentModelBlockFormat } from './contentModel/format/ContentModelBlockFormat';\nexport { ContentModelTableCellFormat } from './contentModel/format/ContentModelTableCellFormat';\nexport { ContentModelListItemFormat } from './contentModel/format/ContentModelListItemFormat';\nexport { ContentModelListItemLevelFormat } from './contentModel/format/ContentModelListItemLevelFormat';\nexport { ContentModelHyperLinkFormat } from './contentModel/format/ContentModelHyperLinkFormat';\nexport { ContentModelCodeFormat } from './contentModel/format/ContentModelCodeFormat';\nexport { ContentModelFormatContainerFormat } from './contentModel/format/ContentModelFormatContainerFormat';\nexport { ContentModelDividerFormat } from './contentModel/format/ContentModelDividerFormat';\nexport { ContentModelFormatBase } from './contentModel/format/ContentModelFormatBase';\nexport { ContentModelFormatMap } from './contentModel/format/ContentModelFormatMap';\nexport { ContentModelImageFormat } from './contentModel/format/ContentModelImageFormat';\nexport { ContentModelEntityFormat } from './contentModel/format/ContentModelEntityFormat';\nexport { FormatHandlerTypeMap, FormatKey } from './contentModel/format/FormatHandlerTypeMap';\n\nexport { BackgroundColorFormat } from './contentModel/format/formatParts/BackgroundColorFormat';\nexport { BoldFormat } from './contentModel/format/formatParts/BoldFormat';\nexport { FontFamilyFormat } from './contentModel/format/formatParts/FontFamilyFormat';\nexport { FontSizeFormat } from './contentModel/format/formatParts/FontSizeFormat';\nexport { ItalicFormat } from './contentModel/format/formatParts/ItalicFormat';\nexport { LetterSpacingFormat } from './contentModel/format/formatParts/LetterSpacingFormat';\nexport { LineHeightFormat } from './contentModel/format/formatParts/LineHeightFormat';\nexport { StrikeFormat } from './contentModel/format/formatParts/StrikeFormat';\nexport { SuperOrSubScriptFormat } from './contentModel/format/formatParts/SuperOrSubScriptFormat';\nexport { TextColorFormat } from './contentModel/format/formatParts/TextColorFormat';\nexport { UnderlineFormat } from './contentModel/format/formatParts/UnderlineFormat';\nexport { BorderBoxFormat } from './contentModel/format/formatParts/BorderBoxFormat';\nexport { VerticalAlignFormat } from './contentModel/format/formatParts/VerticalAlignFormat';\nexport { WordBreakFormat } from './contentModel/format/formatParts/WordBreakFormat';\nexport { BorderFormat } from './contentModel/format/formatParts/BorderFormat';\nexport { DirectionFormat } from './contentModel/format/formatParts/DirectionFormat';\nexport { HtmlAlignFormat } from './contentModel/format/formatParts/HtmlAlignFormat';\nexport { MarginFormat } from './contentModel/format/formatParts/MarginFormat';\nexport { PaddingFormat } from './contentModel/format/formatParts/PaddingFormat';\nexport { TextAlignFormat } from './contentModel/format/formatParts/TextAlignFormat';\nexport { TextIndentFormat } from './contentModel/format/formatParts/TextIndentFormat';\nexport { WhiteSpaceFormat } from './contentModel/format/formatParts/WhiteSpaceFormat';\nexport { DisplayFormat } from './contentModel/format/formatParts/DisplayFormat';\nexport { IdFormat } from './contentModel/format/formatParts/IdFormat';\nexport { SpacingFormat } from './contentModel/format/formatParts/SpacingFormat';\nexport { TableLayoutFormat } from './contentModel/format/formatParts/TableLayoutFormat';\nexport { LinkFormat } from './contentModel/format/formatParts/LinkFormat';\nexport { SizeFormat } from './contentModel/format/formatParts/SizeFormat';\nexport { BoxShadowFormat } from './contentModel/format/formatParts/BoxShadowFormat';\nexport { ListThreadFormat } from './contentModel/format/formatParts/ListThreadFormat';\nexport { ListStyleFormat } from './contentModel/format/formatParts/ListStyleFormat';\nexport { FloatFormat } from './contentModel/format/formatParts/FloatFormat';\nexport { EntityInfoFormat } from './contentModel/format/formatParts/EntityInfoFormat';\n\nexport { DatasetFormat, ReadonlyDatasetFormat } from './contentModel/format/metadata/DatasetFormat';\nexport { TableMetadataFormat } from './contentModel/format/metadata/TableMetadataFormat';\nexport { ListMetadataFormat } from './contentModel/format/metadata/ListMetadataFormat';\nexport {\n ImageResizeMetadataFormat,\n ImageCropMetadataFormat,\n ImageMetadataFormat,\n ImageRotateMetadataFormat,\n ImageFlipMetadataFormat,\n} from './contentModel/format/metadata/ImageMetadataFormat';\nexport { TableCellMetadataFormat } from './contentModel/format/metadata/TableCellMetadataFormat';\n\nexport { ContentModelBlockGroupType } from './contentModel/blockGroup/BlockGroupType';\nexport { ContentModelBlockType } from './contentModel/block/BlockType';\nexport { ContentModelSegmentType } from './contentModel/segment/SegmentType';\n\nexport {\n EntityLifecycleOperation,\n EntityOperation,\n EntityRemovalOperation,\n} from './enum/EntityOperation';\nexport {\n TableOperation,\n TableVerticalInsertOperation,\n TableHorizontalInsertOperation,\n TableDeleteOperation,\n TableVerticalMergeOperation,\n TableHorizontalMergeOperation,\n TableCellMergeOperation,\n TableSplitOperation,\n TableAlignOperation,\n TableCellHorizontalAlignOperation,\n TableCellVerticalAlignOperation,\n} from './enum/TableOperation';\nexport { PasteType } from './enum/PasteType';\nexport { BorderOperations } from './enum/BorderOperations';\nexport { DeleteResult } from './enum/DeleteResult';\nexport { InsertEntityPosition } from './enum/InsertEntityPosition';\nexport { ExportContentMode } from './enum/ExportContentMode';\n\nexport {\n ContentModelBlock,\n ReadonlyContentModelBlock,\n ShallowMutableContentModelBlock,\n} from './contentModel/block/ContentModelBlock';\nexport {\n ContentModelParagraph,\n ContentModelParagraphCommon,\n ReadonlyContentModelParagraph,\n ShallowMutableContentModelParagraph,\n} from './contentModel/block/ContentModelParagraph';\nexport {\n ContentModelTable,\n ReadonlyContentModelTable,\n ShallowMutableContentModelTable,\n} from './contentModel/block/ContentModelTable';\nexport {\n ContentModelDivider,\n ContentModelDividerCommon,\n ReadonlyContentModelDivider,\n} from './contentModel/block/ContentModelDivider';\nexport {\n ContentModelBlockBase,\n ContentModelBlockBaseCommon,\n ReadonlyContentModelBlockBase,\n ShallowMutableContentModelBlockBase,\n} from './contentModel/block/ContentModelBlockBase';\nexport { ContentModelBlockWithCache } from './contentModel/common/ContentModelBlockWithCache';\nexport {\n ContentModelTableRow,\n ContentModelTableRowCommon,\n ReadonlyContentModelTableRow,\n ShallowMutableContentModelTableRow,\n} from './contentModel/block/ContentModelTableRow';\n\nexport { ContentModelEntity } from './contentModel/entity/ContentModelEntity';\n\nexport {\n ContentModelDocument,\n ContentModelDocumentCommon,\n ReadonlyContentModelDocument,\n ShallowMutableContentModelDocument,\n} from './contentModel/blockGroup/ContentModelDocument';\nexport {\n ContentModelBlockGroupBase,\n ContentModelBlockGroupBaseCommon,\n ReadonlyContentModelBlockGroupBase,\n ShallowMutableContentModelBlockGroupBase,\n} from './contentModel/blockGroup/ContentModelBlockGroupBase';\nexport {\n ContentModelFormatContainer,\n ContentModelFormatContainerCommon,\n ReadonlyContentModelFormatContainer,\n ShallowMutableContentModelFormatContainer,\n} from './contentModel/blockGroup/ContentModelFormatContainer';\nexport {\n ContentModelGeneralBlock,\n ContentModelGeneralBlockCommon,\n ReadonlyContentModelGeneralBlock,\n ShallowMutableContentModelGeneralBlock,\n} from './contentModel/blockGroup/ContentModelGeneralBlock';\nexport {\n ContentModelListItem,\n ReadonlyContentModelListItem,\n ShallowMutableContentModelListItem,\n} from './contentModel/blockGroup/ContentModelListItem';\nexport {\n ContentModelTableCell,\n ContentModelTableCellCommon,\n ReadonlyContentModelTableCell,\n ShallowMutableContentModelTableCell,\n} from './contentModel/blockGroup/ContentModelTableCell';\nexport {\n ContentModelBlockGroup,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelBlockGroup,\n} from './contentModel/blockGroup/ContentModelBlockGroup';\n\nexport { ContentModelBr, ReadonlyContentModelBr } from './contentModel/segment/ContentModelBr';\nexport {\n ContentModelGeneralSegment,\n ReadonlyContentModelGeneralSegment,\n ShallowMutableContentModelGeneralSegment,\n} from './contentModel/segment/ContentModelGeneralSegment';\nexport {\n ContentModelImage,\n ContentModelImageCommon,\n ReadonlyContentModelImage,\n} from './contentModel/segment/ContentModelImage';\nexport {\n ContentModelText,\n ContentModelTextCommon,\n ReadonlyContentModelText,\n} from './contentModel/segment/ContentModelText';\nexport {\n ContentModelSelectionMarker,\n ReadonlyContentModelSelectionMarker,\n} from './contentModel/segment/ContentModelSelectionMarker';\nexport {\n ContentModelSegmentBase,\n ContentModelSegmentBaseCommon,\n ReadonlyContentModelSegmentBase,\n ShallowMutableContentModelSegmentBase,\n} from './contentModel/segment/ContentModelSegmentBase';\nexport {\n ContentModelSegment,\n ReadonlyContentModelSegment,\n ShallowMutableContentModelSegment,\n} from './contentModel/segment/ContentModelSegment';\n\nexport {\n ContentModelCode,\n ReadonlyContentModelCode,\n} from './contentModel/decorator/ContentModelCode';\nexport {\n ContentModelLink,\n ReadonlyContentModelLink,\n} from './contentModel/decorator/ContentModelLink';\nexport {\n ContentModelParagraphDecorator,\n ContentModelParagraphDecoratorCommon,\n ReadonlyContentModelParagraphDecorator,\n} from './contentModel/decorator/ContentModelParagraphDecorator';\nexport {\n ContentModelDecorator,\n ReadonlyContentModelDecorator,\n} from './contentModel/decorator/ContentModelDecorator';\nexport {\n ContentModelListLevel,\n ContentModelListLevelCommon,\n ReadonlyContentModelListLevel,\n} from './contentModel/decorator/ContentModelListLevel';\n\nexport {\n Selectable,\n ReadonlySelectable,\n ShallowMutableSelectable,\n} from './contentModel/common/Selectable';\nexport { MutableMark, ShallowMutableMark, ReadonlyMark } from './contentModel/common/MutableMark';\nexport { MutableType } from './contentModel/common/MutableType';\n\nexport {\n DOMSelection,\n SelectionType,\n SelectionBase,\n ImageSelection,\n RangeSelection,\n TableSelection,\n DOMInsertPoint,\n} from './selection/DOMSelection';\nexport { InsertPoint } from './selection/InsertPoint';\nexport {\n TableSelectionContext,\n ReadonlyTableSelectionContext,\n} from './selection/TableSelectionContext';\nexport { TableSelectionCoordinates } from './selection/TableSelectionCoordinates';\n\nexport {\n ContentModelHandlerMap,\n DefaultImplicitFormatMap,\n FormatAppliers,\n FormatAppliersPerCategory,\n OnNodeCreated,\n ModelToDomSettings,\n FormatApplier,\n ApplyMetadata,\n MetadataApplier,\n MetadataAppliers,\n TextFormatApplier,\n ElementFormatAppliersPerCategory,\n} from './context/ModelToDomSettings';\nexport {\n DefaultStyleMap,\n ElementProcessorMap,\n FormatParsers,\n FormatParsersPerCategory,\n DomToModelSettings,\n FormatParser,\n TextFormatParser,\n ElementFormatParserPerCategory,\n} from './context/DomToModelSettings';\nexport { DomToModelContext } from './context/DomToModelContext';\nexport { ElementProcessor } from './context/ElementProcessor';\nexport { DomToModelSelectionContext } from './context/DomToModelSelectionContext';\nexport { EditorContext } from './context/EditorContext';\nexport {\n DomToModelFormatContext,\n DomToModelDecoratorContext,\n DomToModelListFormat,\n} from './context/DomToModelFormatContext';\nexport { ModelToDomContext } from './context/ModelToDomContext';\nexport {\n ModelToDomBlockAndSegmentNode,\n ModelToDomRegularSelection,\n ModelToDomSelectionContext,\n} from './context/ModelToDomSelectionContext';\nexport {\n ModelToDomListStackItem,\n ModelToDomListContext,\n ModelToDomFormatContext,\n} from './context/ModelToDomFormatContext';\nexport {\n ContentModelHandler,\n ContentModelSegmentHandler,\n ContentModelBlockHandler,\n} from './context/ContentModelHandler';\nexport {\n DomToModelOption,\n DomToModelOptionForSanitizing,\n DomToModelOptionForCreateModel,\n} from './context/DomToModelOption';\nexport { ModelToDomOption } from './context/ModelToDomOption';\nexport { DomIndexer } from './context/DomIndexer';\nexport { TextMutationObserver } from './context/TextMutationObserver';\n\nexport { DefinitionType } from './metadata/DefinitionType';\nexport {\n ArrayItemType,\n DefinitionBase,\n StringDefinition,\n NumberDefinition,\n BooleanDefinition,\n ArrayDefinition,\n ObjectPropertyDefinition,\n ObjectDefinition,\n Definition,\n} from './metadata/Definition';\nexport { DarkColorHandler, Colors, ColorTransformFunction } from './context/DarkColorHandler';\n\nexport { IEditor } from './editor/IEditor';\nexport { ExperimentalFeature } from './editor/ExperimentalFeature';\nexport {\n EditorOptions,\n ColorOptions,\n ContentModelOptions,\n SelectionOptions,\n PasteOptions,\n EditorBaseOptions,\n} from './editor/EditorOptions';\nexport {\n CreateContentModel,\n CreateEditorContext,\n GetDOMSelection,\n SetContentModel,\n SetDOMSelection,\n SetLogicalRoot,\n FormatContentModel,\n CoreApiMap,\n EditorCore,\n SwitchShadowEdit,\n TriggerEvent,\n AddUndoSnapshot,\n Focus,\n AttachDomEvent,\n RestoreUndoSnapshot,\n GetVisibleViewport,\n SetEditorStyle,\n Announce,\n} from './editor/EditorCore';\nexport { EditorCorePlugins } from './editor/EditorCorePlugins';\nexport { EditorPlugin } from './editor/EditorPlugin';\nexport { PluginWithState } from './editor/PluginWithState';\nexport { ContextMenuProvider } from './editor/ContextMenuProvider';\n\nexport {\n CachePluginState,\n RangeSelectionForCache,\n CacheSelection,\n} from './pluginState/CachePluginState';\nexport { FormatPluginState, PendingFormat } from './pluginState/FormatPluginState';\nexport { CopyPastePluginState } from './pluginState/CopyPastePluginState';\nexport { DOMEventPluginState } from './pluginState/DOMEventPluginState';\nexport { LifecyclePluginState } from './pluginState/LifecyclePluginState';\nexport { EntityPluginState, KnownEntityItem } from './pluginState/EntityPluginState';\nexport {\n SelectionPluginState,\n TableSelectionInfo,\n TableCellCoordinate,\n} from './pluginState/SelectionPluginState';\nexport { UndoPluginState } from './pluginState/UndoPluginState';\nexport {\n PluginKey,\n KeyOfStatePlugin,\n TypeOfStatePlugin,\n StatePluginKeys,\n GenericPluginState,\n PluginState,\n} from './pluginState/PluginState';\nexport { ContextMenuPluginState } from './pluginState/ContextMenuPluginState';\n\nexport { AutoLinkOptions } from './parameter/AutoLinkOptions';\nexport { EditorEnvironment, ContentModelSettings } from './parameter/EditorEnvironment';\nexport {\n EntityState,\n DeletedEntity,\n FormatContentModelContext,\n} from './parameter/FormatContentModelContext';\nexport {\n FormatContentModelOptions,\n ContentModelFormatter,\n} from './parameter/FormatContentModelOptions';\nexport { ContentModelFormatState } from './parameter/ContentModelFormatState';\nexport { PasteTypeOrGetter } from './parameter/PasteTypeOrGetter';\nexport { ImageFormatState } from './parameter/ImageFormatState';\nexport { Border } from './parameter/Border';\nexport { InsertEntityOptions } from './parameter/InsertEntityOptions';\nexport {\n DeleteSelectionContext,\n DeleteSelectionResult,\n DeleteSelectionStep,\n ValidDeleteSelectionContext,\n} from './parameter/DeleteSelectionStep';\nexport {\n SnapshotSelectionBase,\n RangeSnapshotSelection,\n ImageSnapshotSelection,\n TableSnapshotSelection,\n SnapshotSelection,\n Snapshot,\n Snapshots,\n} from './parameter/Snapshot';\nexport { SnapshotsManager } from './parameter/SnapshotsManager';\nexport { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRecord';\nexport { EdgeLinkPreview } from './parameter/EdgeLinkPreview';\nexport { ClipboardData } from './parameter/ClipboardData';\nexport { AnnounceData, KnownAnnounceStrings } from './parameter/AnnounceData';\nexport { TrustedHTMLHandler } from './parameter/TrustedHTMLHandler';\nexport { Rect } from './parameter/Rect';\nexport { ValueSanitizer } from './parameter/ValueSanitizer';\nexport { DOMHelper } from './parameter/DOMHelper';\nexport { ImageEditOperation, ImageEditor } from './parameter/ImageEditor';\nexport { CachedElementHandler, CloneModelOptions } from './parameter/CloneModelOptions';\nexport { LinkData } from './parameter/LinkData';\nexport { MergeModelOption } from './parameter/MergeModelOption';\nexport {\n IterateSelectionsCallback,\n IterateSelectionsOption,\n ReadonlyIterateSelectionsCallback,\n} from './parameter/IterateSelectionsOption';\nexport { NodeTypeMap } from './parameter/NodeTypeMap';\nexport { TypeOfBlockGroup } from './parameter/TypeOfBlockGroup';\nexport { OperationalBlocks, ReadonlyOperationalBlocks } from './parameter/OperationalBlocks';\nexport { ParsedTable, ParsedTableCell } from './parameter/ParsedTable';\nexport {\n ModelToTextCallback,\n ModelToTextCallbacks,\n ModelToTextChecker,\n} from './parameter/ModelToTextCallbacks';\n\nexport { BasePluginEvent, BasePluginDomEvent } from './event/BasePluginEvent';\nexport { BeforeCutCopyEvent } from './event/BeforeCutCopyEvent';\nexport { BeforeDisposeEvent } from './event/BeforeDisposeEvent';\nexport { BeforeKeyboardEditingEvent } from './event/BeforeKeyboardEditingEvent';\nexport { BeforePasteEvent, MergePastedContentFunc } from './event/BeforePasteEvent';\nexport { BeforeSetContentEvent } from './event/BeforeSetContentEvent';\nexport { ContentChangedEvent, ChangedEntity } from './event/ContentChangedEvent';\nexport { ContextMenuEvent } from './event/ContextMenuEvent';\nexport { EditImageEvent } from './event/EditImageEvent';\nexport { EditorReadyEvent } from './event/EditorReadyEvent';\nexport { EntityOperationEvent, Entity } from './event/EntityOperationEvent';\nexport { ExtractContentWithDomEvent } from './event/ExtractContentWithDomEvent';\nexport { EditorInputEvent } from './event/EditorInputEvent';\nexport {\n KeyDownEvent,\n KeyPressEvent,\n KeyUpEvent,\n CompositionEndEvent,\n} from './event/KeyboardEvent';\nexport { LogicalRootChangedEvent } from './event/LogicalRootChangedEvent';\nexport { MouseDownEvent, MouseUpEvent } from './event/MouseEvent';\nexport { PluginEvent } from './event/PluginEvent';\nexport {\n PluginEventData,\n PluginEventFromTypeGeneric,\n PluginEventFromType,\n PluginEventDataGeneric,\n} from './event/PluginEventData';\nexport { PluginEventType } from './event/PluginEventType';\nexport { ScrollEvent } from './event/ScrollEvent';\nexport { SelectionChangedEvent } from './event/SelectionChangedEvent';\nexport { EnterShadowEditEvent, LeaveShadowEditEvent } from './event/ShadowEditEvent';\nexport { ZoomChangedEvent } from './event/ZoomChangedEvent';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-types/lib/index.ts"],"names":[],"mappings":"","sourcesContent":["export { ContentModelSegmentFormat } from './contentModel/format/ContentModelSegmentFormat';\nexport {\n ContentModelWithFormat,\n ReadonlyContentModelWithFormat,\n} from './contentModel/format/ContentModelWithFormat';\nexport { ContentModelTableFormat } from './contentModel/format/ContentModelTableFormat';\nexport {\n ContentModelWithDataset,\n ReadonlyContentModelWithDataset,\n ShallowMutableContentModelWithDataset,\n} from './contentModel/format/ContentModelWithDataset';\nexport { ContentModelBlockFormat } from './contentModel/format/ContentModelBlockFormat';\nexport { ContentModelTableCellFormat } from './contentModel/format/ContentModelTableCellFormat';\nexport { ContentModelListItemFormat } from './contentModel/format/ContentModelListItemFormat';\nexport { ContentModelListItemLevelFormat } from './contentModel/format/ContentModelListItemLevelFormat';\nexport { ContentModelHyperLinkFormat } from './contentModel/format/ContentModelHyperLinkFormat';\nexport { ContentModelCodeFormat } from './contentModel/format/ContentModelCodeFormat';\nexport { ContentModelFormatContainerFormat } from './contentModel/format/ContentModelFormatContainerFormat';\nexport { ContentModelDividerFormat } from './contentModel/format/ContentModelDividerFormat';\nexport { ContentModelFormatBase } from './contentModel/format/ContentModelFormatBase';\nexport { ContentModelFormatMap } from './contentModel/format/ContentModelFormatMap';\nexport { ContentModelImageFormat } from './contentModel/format/ContentModelImageFormat';\nexport { ContentModelEntityFormat } from './contentModel/format/ContentModelEntityFormat';\nexport { FormatHandlerTypeMap, FormatKey } from './contentModel/format/FormatHandlerTypeMap';\n\nexport { BackgroundColorFormat } from './contentModel/format/formatParts/BackgroundColorFormat';\nexport { BoldFormat } from './contentModel/format/formatParts/BoldFormat';\nexport { FontFamilyFormat } from './contentModel/format/formatParts/FontFamilyFormat';\nexport { FontSizeFormat } from './contentModel/format/formatParts/FontSizeFormat';\nexport { ItalicFormat } from './contentModel/format/formatParts/ItalicFormat';\nexport { LetterSpacingFormat } from './contentModel/format/formatParts/LetterSpacingFormat';\nexport { LineHeightFormat } from './contentModel/format/formatParts/LineHeightFormat';\nexport { StrikeFormat } from './contentModel/format/formatParts/StrikeFormat';\nexport { SuperOrSubScriptFormat } from './contentModel/format/formatParts/SuperOrSubScriptFormat';\nexport { TextColorFormat } from './contentModel/format/formatParts/TextColorFormat';\nexport { UnderlineFormat } from './contentModel/format/formatParts/UnderlineFormat';\nexport { BorderBoxFormat } from './contentModel/format/formatParts/BorderBoxFormat';\nexport { VerticalAlignFormat } from './contentModel/format/formatParts/VerticalAlignFormat';\nexport { WordBreakFormat } from './contentModel/format/formatParts/WordBreakFormat';\nexport { BorderFormat } from './contentModel/format/formatParts/BorderFormat';\nexport { DirectionFormat } from './contentModel/format/formatParts/DirectionFormat';\nexport { HtmlAlignFormat } from './contentModel/format/formatParts/HtmlAlignFormat';\nexport { MarginFormat } from './contentModel/format/formatParts/MarginFormat';\nexport { PaddingFormat } from './contentModel/format/formatParts/PaddingFormat';\nexport { TextAlignFormat } from './contentModel/format/formatParts/TextAlignFormat';\nexport { TextIndentFormat } from './contentModel/format/formatParts/TextIndentFormat';\nexport { WhiteSpaceFormat } from './contentModel/format/formatParts/WhiteSpaceFormat';\nexport { DisplayFormat } from './contentModel/format/formatParts/DisplayFormat';\nexport { IdFormat } from './contentModel/format/formatParts/IdFormat';\nexport { SpacingFormat } from './contentModel/format/formatParts/SpacingFormat';\nexport { TableLayoutFormat } from './contentModel/format/formatParts/TableLayoutFormat';\nexport { LinkFormat } from './contentModel/format/formatParts/LinkFormat';\nexport { SizeFormat } from './contentModel/format/formatParts/SizeFormat';\nexport { BoxShadowFormat } from './contentModel/format/formatParts/BoxShadowFormat';\nexport { ListThreadFormat } from './contentModel/format/formatParts/ListThreadFormat';\nexport { ListStyleFormat } from './contentModel/format/formatParts/ListStyleFormat';\nexport { FloatFormat } from './contentModel/format/formatParts/FloatFormat';\nexport { EntityInfoFormat } from './contentModel/format/formatParts/EntityInfoFormat';\n\nexport { DatasetFormat, ReadonlyDatasetFormat } from './contentModel/format/metadata/DatasetFormat';\nexport { TableMetadataFormat } from './contentModel/format/metadata/TableMetadataFormat';\nexport { ListMetadataFormat } from './contentModel/format/metadata/ListMetadataFormat';\nexport {\n ImageResizeMetadataFormat,\n ImageCropMetadataFormat,\n ImageMetadataFormat,\n ImageRotateMetadataFormat,\n ImageFlipMetadataFormat,\n} from './contentModel/format/metadata/ImageMetadataFormat';\nexport { TableCellMetadataFormat } from './contentModel/format/metadata/TableCellMetadataFormat';\n\nexport { ContentModelBlockGroupType } from './contentModel/blockGroup/BlockGroupType';\nexport { ContentModelBlockType } from './contentModel/block/BlockType';\nexport { ContentModelSegmentType } from './contentModel/segment/SegmentType';\n\nexport {\n EntityLifecycleOperation,\n EntityOperation,\n EntityRemovalOperation,\n} from './enum/EntityOperation';\nexport {\n TableOperation,\n TableVerticalInsertOperation,\n TableHorizontalInsertOperation,\n TableDeleteOperation,\n TableVerticalMergeOperation,\n TableHorizontalMergeOperation,\n TableCellMergeOperation,\n TableSplitOperation,\n TableAlignOperation,\n TableCellHorizontalAlignOperation,\n TableCellVerticalAlignOperation,\n} from './enum/TableOperation';\nexport { PasteType } from './enum/PasteType';\nexport { BorderOperations } from './enum/BorderOperations';\nexport { DeleteResult } from './enum/DeleteResult';\nexport { InsertEntityPosition } from './enum/InsertEntityPosition';\nexport { ExportContentMode } from './enum/ExportContentMode';\n\nexport {\n ContentModelBlock,\n ReadonlyContentModelBlock,\n ShallowMutableContentModelBlock,\n} from './contentModel/block/ContentModelBlock';\nexport {\n ContentModelParagraph,\n ContentModelParagraphCommon,\n ReadonlyContentModelParagraph,\n ShallowMutableContentModelParagraph,\n} from './contentModel/block/ContentModelParagraph';\nexport {\n ContentModelTable,\n ReadonlyContentModelTable,\n ShallowMutableContentModelTable,\n} from './contentModel/block/ContentModelTable';\nexport {\n ContentModelDivider,\n ContentModelDividerCommon,\n ReadonlyContentModelDivider,\n} from './contentModel/block/ContentModelDivider';\nexport {\n ContentModelBlockBase,\n ContentModelBlockBaseCommon,\n ReadonlyContentModelBlockBase,\n ShallowMutableContentModelBlockBase,\n} from './contentModel/block/ContentModelBlockBase';\nexport { ContentModelBlockWithCache } from './contentModel/common/ContentModelBlockWithCache';\nexport {\n ContentModelTableRow,\n ContentModelTableRowCommon,\n ReadonlyContentModelTableRow,\n ShallowMutableContentModelTableRow,\n} from './contentModel/block/ContentModelTableRow';\n\nexport { ContentModelEntity } from './contentModel/entity/ContentModelEntity';\n\nexport {\n ContentModelDocument,\n ContentModelDocumentCommon,\n ReadonlyContentModelDocument,\n ShallowMutableContentModelDocument,\n} from './contentModel/blockGroup/ContentModelDocument';\nexport {\n ContentModelBlockGroupBase,\n ContentModelBlockGroupBaseCommon,\n ReadonlyContentModelBlockGroupBase,\n ShallowMutableContentModelBlockGroupBase,\n} from './contentModel/blockGroup/ContentModelBlockGroupBase';\nexport {\n ContentModelFormatContainer,\n ContentModelFormatContainerCommon,\n ReadonlyContentModelFormatContainer,\n ShallowMutableContentModelFormatContainer,\n} from './contentModel/blockGroup/ContentModelFormatContainer';\nexport {\n ContentModelGeneralBlock,\n ContentModelGeneralBlockCommon,\n ReadonlyContentModelGeneralBlock,\n ShallowMutableContentModelGeneralBlock,\n} from './contentModel/blockGroup/ContentModelGeneralBlock';\nexport {\n ContentModelListItem,\n ReadonlyContentModelListItem,\n ShallowMutableContentModelListItem,\n} from './contentModel/blockGroup/ContentModelListItem';\nexport {\n ContentModelTableCell,\n ContentModelTableCellCommon,\n ReadonlyContentModelTableCell,\n ShallowMutableContentModelTableCell,\n} from './contentModel/blockGroup/ContentModelTableCell';\nexport {\n ContentModelBlockGroup,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelBlockGroup,\n} from './contentModel/blockGroup/ContentModelBlockGroup';\n\nexport { ContentModelBr, ReadonlyContentModelBr } from './contentModel/segment/ContentModelBr';\nexport {\n ContentModelGeneralSegment,\n ReadonlyContentModelGeneralSegment,\n ShallowMutableContentModelGeneralSegment,\n} from './contentModel/segment/ContentModelGeneralSegment';\nexport {\n ContentModelImage,\n ContentModelImageCommon,\n ReadonlyContentModelImage,\n} from './contentModel/segment/ContentModelImage';\nexport {\n ContentModelText,\n ContentModelTextCommon,\n ReadonlyContentModelText,\n} from './contentModel/segment/ContentModelText';\nexport {\n ContentModelSelectionMarker,\n ReadonlyContentModelSelectionMarker,\n} from './contentModel/segment/ContentModelSelectionMarker';\nexport {\n ContentModelSegmentBase,\n ContentModelSegmentBaseCommon,\n ReadonlyContentModelSegmentBase,\n ShallowMutableContentModelSegmentBase,\n} from './contentModel/segment/ContentModelSegmentBase';\nexport {\n ContentModelSegment,\n ReadonlyContentModelSegment,\n ShallowMutableContentModelSegment,\n} from './contentModel/segment/ContentModelSegment';\n\nexport {\n ContentModelCode,\n ReadonlyContentModelCode,\n} from './contentModel/decorator/ContentModelCode';\nexport {\n ContentModelLink,\n ReadonlyContentModelLink,\n} from './contentModel/decorator/ContentModelLink';\nexport {\n ContentModelParagraphDecorator,\n ContentModelParagraphDecoratorCommon,\n ReadonlyContentModelParagraphDecorator,\n} from './contentModel/decorator/ContentModelParagraphDecorator';\nexport {\n ContentModelDecorator,\n ReadonlyContentModelDecorator,\n} from './contentModel/decorator/ContentModelDecorator';\nexport {\n ContentModelListLevel,\n ContentModelListLevelCommon,\n ReadonlyContentModelListLevel,\n} from './contentModel/decorator/ContentModelListLevel';\n\nexport {\n Selectable,\n ReadonlySelectable,\n ShallowMutableSelectable,\n} from './contentModel/common/Selectable';\nexport { MutableMark, ShallowMutableMark, ReadonlyMark } from './contentModel/common/MutableMark';\nexport { MutableType } from './contentModel/common/MutableType';\n\nexport {\n DOMSelection,\n SelectionType,\n SelectionBase,\n ImageSelection,\n RangeSelection,\n TableSelection,\n DOMInsertPoint,\n} from './selection/DOMSelection';\nexport { InsertPoint } from './selection/InsertPoint';\nexport {\n TableSelectionContext,\n ReadonlyTableSelectionContext,\n} from './selection/TableSelectionContext';\nexport { TableSelectionCoordinates } from './selection/TableSelectionCoordinates';\n\nexport {\n ContentModelHandlerMap,\n DefaultImplicitFormatMap,\n FormatAppliers,\n FormatAppliersPerCategory,\n OnNodeCreated,\n ModelToDomSettings,\n FormatApplier,\n ApplyMetadata,\n MetadataApplier,\n MetadataAppliers,\n TextFormatApplier,\n ElementFormatAppliersPerCategory,\n} from './context/ModelToDomSettings';\nexport {\n DefaultStyleMap,\n ElementProcessorMap,\n FormatParsers,\n FormatParsersPerCategory,\n DomToModelSettings,\n FormatParser,\n TextFormatParser,\n ElementFormatParserPerCategory,\n} from './context/DomToModelSettings';\nexport { DomToModelContext } from './context/DomToModelContext';\nexport { ElementProcessor } from './context/ElementProcessor';\nexport { DomToModelSelectionContext } from './context/DomToModelSelectionContext';\nexport { EditorContext } from './context/EditorContext';\nexport {\n DomToModelFormatContext,\n DomToModelDecoratorContext,\n DomToModelListFormat,\n} from './context/DomToModelFormatContext';\nexport { ModelToDomContext } from './context/ModelToDomContext';\nexport {\n ModelToDomBlockAndSegmentNode,\n ModelToDomRegularSelection,\n ModelToDomSelectionContext,\n} from './context/ModelToDomSelectionContext';\nexport {\n ModelToDomListStackItem,\n ModelToDomListContext,\n ModelToDomFormatContext,\n} from './context/ModelToDomFormatContext';\nexport { RewriteFromModel, RewriteFromModelContext } from './context/RewriteFromModel';\nexport {\n ContentModelHandler,\n ContentModelSegmentHandler,\n ContentModelBlockHandler,\n} from './context/ContentModelHandler';\nexport {\n DomToModelOption,\n DomToModelOptionForSanitizing,\n DomToModelOptionForCreateModel,\n} from './context/DomToModelOption';\nexport { ModelToDomOption } from './context/ModelToDomOption';\nexport { DomIndexer } from './context/DomIndexer';\nexport { TextMutationObserver } from './context/TextMutationObserver';\n\nexport { DefinitionType } from './metadata/DefinitionType';\nexport {\n ArrayItemType,\n DefinitionBase,\n StringDefinition,\n NumberDefinition,\n BooleanDefinition,\n ArrayDefinition,\n ObjectPropertyDefinition,\n ObjectDefinition,\n Definition,\n} from './metadata/Definition';\nexport { DarkColorHandler, Colors, ColorTransformFunction } from './context/DarkColorHandler';\n\nexport { IEditor } from './editor/IEditor';\nexport { ExperimentalFeature } from './editor/ExperimentalFeature';\nexport {\n EditorOptions,\n ColorOptions,\n ContentModelOptions,\n SelectionOptions,\n PasteOptions,\n EditorBaseOptions,\n} from './editor/EditorOptions';\nexport {\n CreateContentModel,\n CreateEditorContext,\n GetDOMSelection,\n SetContentModel,\n SetDOMSelection,\n SetLogicalRoot,\n FormatContentModel,\n CoreApiMap,\n EditorCore,\n SwitchShadowEdit,\n TriggerEvent,\n AddUndoSnapshot,\n Focus,\n AttachDomEvent,\n RestoreUndoSnapshot,\n GetVisibleViewport,\n SetEditorStyle,\n Announce,\n} from './editor/EditorCore';\nexport { EditorCorePlugins } from './editor/EditorCorePlugins';\nexport { EditorPlugin } from './editor/EditorPlugin';\nexport { PluginWithState } from './editor/PluginWithState';\nexport { ContextMenuProvider } from './editor/ContextMenuProvider';\n\nexport {\n CachePluginState,\n RangeSelectionForCache,\n CacheSelection,\n} from './pluginState/CachePluginState';\nexport { FormatPluginState, PendingFormat } from './pluginState/FormatPluginState';\nexport { CopyPastePluginState } from './pluginState/CopyPastePluginState';\nexport { DOMEventPluginState } from './pluginState/DOMEventPluginState';\nexport { LifecyclePluginState } from './pluginState/LifecyclePluginState';\nexport { EntityPluginState, KnownEntityItem } from './pluginState/EntityPluginState';\nexport {\n SelectionPluginState,\n TableSelectionInfo,\n TableCellCoordinate,\n} from './pluginState/SelectionPluginState';\nexport { UndoPluginState } from './pluginState/UndoPluginState';\nexport {\n PluginKey,\n KeyOfStatePlugin,\n TypeOfStatePlugin,\n StatePluginKeys,\n GenericPluginState,\n PluginState,\n} from './pluginState/PluginState';\nexport { ContextMenuPluginState } from './pluginState/ContextMenuPluginState';\n\nexport { AutoLinkOptions } from './parameter/AutoLinkOptions';\nexport { EditorEnvironment, ContentModelSettings } from './parameter/EditorEnvironment';\nexport {\n EntityState,\n DeletedEntity,\n FormatContentModelContext,\n} from './parameter/FormatContentModelContext';\nexport {\n FormatContentModelOptions,\n ContentModelFormatter,\n} from './parameter/FormatContentModelOptions';\nexport { ContentModelFormatState } from './parameter/ContentModelFormatState';\nexport { PasteTypeOrGetter } from './parameter/PasteTypeOrGetter';\nexport { ImageFormatState } from './parameter/ImageFormatState';\nexport { Border } from './parameter/Border';\nexport { InsertEntityOptions } from './parameter/InsertEntityOptions';\nexport {\n DeleteSelectionContext,\n DeleteSelectionResult,\n DeleteSelectionStep,\n ValidDeleteSelectionContext,\n} from './parameter/DeleteSelectionStep';\nexport {\n SnapshotSelectionBase,\n RangeSnapshotSelection,\n ImageSnapshotSelection,\n TableSnapshotSelection,\n SnapshotSelection,\n Snapshot,\n Snapshots,\n} from './parameter/Snapshot';\nexport { SnapshotsManager } from './parameter/SnapshotsManager';\nexport { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRecord';\nexport { EdgeLinkPreview } from './parameter/EdgeLinkPreview';\nexport { ClipboardData } from './parameter/ClipboardData';\nexport { AnnounceData, KnownAnnounceStrings } from './parameter/AnnounceData';\nexport { TrustedHTMLHandler } from './parameter/TrustedHTMLHandler';\nexport { Rect } from './parameter/Rect';\nexport { ValueSanitizer } from './parameter/ValueSanitizer';\nexport { DOMHelper } from './parameter/DOMHelper';\nexport { ImageEditOperation, ImageEditor } from './parameter/ImageEditor';\nexport { CachedElementHandler, CloneModelOptions } from './parameter/CloneModelOptions';\nexport { LinkData } from './parameter/LinkData';\nexport { MergeModelOption } from './parameter/MergeModelOption';\nexport {\n IterateSelectionsCallback,\n IterateSelectionsOption,\n ReadonlyIterateSelectionsCallback,\n} from './parameter/IterateSelectionsOption';\nexport { NodeTypeMap } from './parameter/NodeTypeMap';\nexport { TypeOfBlockGroup } from './parameter/TypeOfBlockGroup';\nexport { OperationalBlocks, ReadonlyOperationalBlocks } from './parameter/OperationalBlocks';\nexport { ParsedTable, ParsedTableCell } from './parameter/ParsedTable';\nexport {\n ModelToTextCallback,\n ModelToTextCallbacks,\n ModelToTextChecker,\n} from './parameter/ModelToTextCallbacks';\nexport { ConflictFormatSolution } from './parameter/ConflictFormatSolution';\n\nexport { BasePluginEvent, BasePluginDomEvent } from './event/BasePluginEvent';\nexport { BeforeCutCopyEvent } from './event/BeforeCutCopyEvent';\nexport { BeforeDisposeEvent } from './event/BeforeDisposeEvent';\nexport { BeforeKeyboardEditingEvent } from './event/BeforeKeyboardEditingEvent';\nexport { BeforePasteEvent, MergePastedContentFunc } from './event/BeforePasteEvent';\nexport { BeforeSetContentEvent } from './event/BeforeSetContentEvent';\nexport { ContentChangedEvent, ChangedEntity } from './event/ContentChangedEvent';\nexport { ContextMenuEvent } from './event/ContextMenuEvent';\nexport { RewriteFromModelEvent } from './event/RewriteFromModelEvent';\nexport { EditImageEvent } from './event/EditImageEvent';\nexport { EditorReadyEvent } from './event/EditorReadyEvent';\nexport { EntityOperationEvent, Entity } from './event/EntityOperationEvent';\nexport { ExtractContentWithDomEvent } from './event/ExtractContentWithDomEvent';\nexport { EditorInputEvent } from './event/EditorInputEvent';\nexport {\n KeyDownEvent,\n KeyPressEvent,\n KeyUpEvent,\n CompositionEndEvent,\n} from './event/KeyboardEvent';\nexport { LogicalRootChangedEvent } from './event/LogicalRootChangedEvent';\nexport { MouseDownEvent, MouseUpEvent } from './event/MouseEvent';\nexport { PluginEvent } from './event/PluginEvent';\nexport {\n PluginEventData,\n PluginEventFromTypeGeneric,\n PluginEventFromType,\n PluginEventDataGeneric,\n} from './event/PluginEventData';\nexport { PluginEventType } from './event/PluginEventType';\nexport { ScrollEvent } from './event/ScrollEvent';\nexport { SelectionChangedEvent } from './event/SelectionChangedEvent';\nexport { EnterShadowEditEvent, LeaveShadowEditEvent } from './event/ShadowEditEvent';\nexport { ZoomChangedEvent } from './event/ZoomChangedEvent';\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Specify how to handle conflicts when retrieving format state
3
+ * remove: removes the conflicting key from the result
4
+ * keepFirst: retains the first value of the conflicting key
5
+ * returnMultiple: sets 'Multiple' as the value if the conflicting value's type is string
6
+ */
7
+ export declare type ConflictFormatSolution = 'remove' | 'keepFirst' | 'returnMultiple';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ConflictFormatSolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConflictFormatSolution.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/ConflictFormatSolution.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Specify how to handle conflicts when retrieving format state\n * remove: removes the conflicting key from the result\n * keepFirst: retains the first value of the conflicting key\n * returnMultiple: sets 'Multiple' as the value if the conflicting value's type is string\n */\nexport type ConflictFormatSolution = 'remove' | 'keepFirst' | 'returnMultiple';\n"]}
@@ -3,6 +3,7 @@ import type { ContentModelEntity } from '../contentModel/entity/ContentModelEnti
3
3
  import type { ContentModelImage } from '../contentModel/segment/ContentModelImage';
4
4
  import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';
5
5
  import type { EntityRemovalOperation } from '../enum/EntityOperation';
6
+ import type { ContentModelBlockFormat } from '../contentModel/format/ContentModelBlockFormat';
6
7
  /**
7
8
  * State for an entity. This is used for storing entity undo snapshot
8
9
  */
@@ -40,11 +41,12 @@ export interface DeletedEntity {
40
41
  */
41
42
  export interface FormatContentModelContext {
42
43
  /**
43
- * New entities added during the format process
44
+ * New entities added during the format process. This value is only respected when autoDetectChangedEntities is not set to true
44
45
  */
45
46
  readonly newEntities: ContentModelEntity[];
46
47
  /**
47
48
  * Entities got deleted during formatting. Need to be set by the formatter function
49
+ * This value is only respected when autoDetectChangedEntities is not set to true
48
50
  */
49
51
  readonly deletedEntities: DeletedEntity[];
50
52
  /**
@@ -74,6 +76,14 @@ export interface FormatContentModelContext {
74
76
  * Otherwise, leave it there and editor will automatically decide if the original pending format is still available
75
77
  */
76
78
  newPendingFormat?: ContentModelSegmentFormat | 'preserve';
79
+ /**
80
+ * @optional
81
+ * Specify new pending format for paragraph
82
+ * To keep current format event selection position is changed, set this value to "preserved", editor will update pending format position to the new position
83
+ * To set a new pending format, set this property to the format object
84
+ * Otherwise, leave it there and editor will automatically decide if the original pending format is still available
85
+ */
86
+ newPendingParagraphFormat?: ContentModelBlockFormat | 'preserve';
77
87
  /**
78
88
  * @optional Entity states related to the format API that will be added together with undo snapshot.
79
89
  * When entity states are set, each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState
@@ -88,4 +98,8 @@ export interface FormatContentModelContext {
88
98
  * @optional Set this value to tell AnnouncePlugin to announce the given information
89
99
  */
90
100
  announceData?: AnnounceData | null;
101
+ /**
102
+ * @optional When set to true, EntityPlugin will detect any entity changes during this process, newEntities and deletedEntities will be ignored
103
+ */
104
+ autoDetectChangedEntities?: boolean;
91
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FormatContentModelContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/FormatContentModelContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from './AnnounceData';\nimport type { ContentModelEntity } from '../contentModel/entity/ContentModelEntity';\nimport type { ContentModelImage } from '../contentModel/segment/ContentModelImage';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { EntityRemovalOperation } from '../enum/EntityOperation';\n\n/**\n * State for an entity. This is used for storing entity undo snapshot\n */\nexport interface EntityState {\n /**\n * Type of the entity\n */\n type: string;\n\n /**\n * Id of the entity\n */\n id: string;\n\n /**\n * The state of this entity to store into undo snapshot.\n * The state can be any string, or a serialized JSON object.\n * We are using string here instead of a JSON object to make sure the whole state is serializable.\n */\n state: string;\n}\n\n/**\n * Represents an entity that is deleted by a specified entity operation\n */\nexport interface DeletedEntity {\n /**\n * The deleted entity\n */\n entity: ContentModelEntity;\n\n /**\n * The operation that causes this entity to be deleted\n */\n operation: EntityRemovalOperation;\n}\n\n/**\n * Context object for API formatWithContentModel\n */\nexport interface FormatContentModelContext {\n /**\n * New entities added during the format process\n */\n readonly newEntities: ContentModelEntity[];\n\n /**\n * Entities got deleted during formatting. Need to be set by the formatter function\n */\n readonly deletedEntities: DeletedEntity[];\n\n /**\n * Images inserted in the editor that needs to have their size adjusted\n */\n readonly newImages: ContentModelImage[];\n\n /**\n * Raw Event that triggers this format call\n */\n readonly rawEvent?: Event;\n\n /**\n * @optional\n * When pass true, skip adding undo snapshot when write Content Model back to DOM.\n * Need to be set by the formatter function\n */\n skipUndoSnapshot?: boolean;\n\n /**\n * @optional\n * When set to true, formatWithContentModel API will not keep cached Content Model. Next time when we need a Content Model, a new one will be created\n */\n clearModelCache?: boolean;\n\n /**\n * @optional\n * Specify new pending format.\n * To keep current format event selection position is changed, set this value to \"preserved\", editor will update pending format position to the new position\n * To set a new pending format, set this property to the format object\n * Otherwise, leave it there and editor will automatically decide if the original pending format is still available\n */\n newPendingFormat?: ContentModelSegmentFormat | 'preserve';\n\n /**\n * @optional Entity states related to the format API that will be added together with undo snapshot.\n * When entity states are set, each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n entityStates?: EntityState[];\n\n /**\n * @optional Set to true if this action can be undone when user press Backspace key (aka Auto Complete).\n */\n canUndoByBackspace?: boolean;\n\n /**\n * @optional Set this value to tell AnnouncePlugin to announce the given information\n */\n announceData?: AnnounceData | null;\n}\n"]}
1
+ {"version":3,"file":"FormatContentModelContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/FormatContentModelContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from './AnnounceData';\nimport type { ContentModelEntity } from '../contentModel/entity/ContentModelEntity';\nimport type { ContentModelImage } from '../contentModel/segment/ContentModelImage';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { EntityRemovalOperation } from '../enum/EntityOperation';\nimport type { ContentModelBlockFormat } from '../contentModel/format/ContentModelBlockFormat';\n\n/**\n * State for an entity. This is used for storing entity undo snapshot\n */\nexport interface EntityState {\n /**\n * Type of the entity\n */\n type: string;\n\n /**\n * Id of the entity\n */\n id: string;\n\n /**\n * The state of this entity to store into undo snapshot.\n * The state can be any string, or a serialized JSON object.\n * We are using string here instead of a JSON object to make sure the whole state is serializable.\n */\n state: string;\n}\n\n/**\n * Represents an entity that is deleted by a specified entity operation\n */\nexport interface DeletedEntity {\n /**\n * The deleted entity\n */\n entity: ContentModelEntity;\n\n /**\n * The operation that causes this entity to be deleted\n */\n operation: EntityRemovalOperation;\n}\n\n/**\n * Context object for API formatWithContentModel\n */\nexport interface FormatContentModelContext {\n /**\n * New entities added during the format process. This value is only respected when autoDetectChangedEntities is not set to true\n */\n readonly newEntities: ContentModelEntity[];\n\n /**\n * Entities got deleted during formatting. Need to be set by the formatter function\n * This value is only respected when autoDetectChangedEntities is not set to true\n */\n readonly deletedEntities: DeletedEntity[];\n\n /**\n * Images inserted in the editor that needs to have their size adjusted\n */\n readonly newImages: ContentModelImage[];\n\n /**\n * Raw Event that triggers this format call\n */\n readonly rawEvent?: Event;\n\n /**\n * @optional\n * When pass true, skip adding undo snapshot when write Content Model back to DOM.\n * Need to be set by the formatter function\n */\n skipUndoSnapshot?: boolean;\n\n /**\n * @optional\n * When set to true, formatWithContentModel API will not keep cached Content Model. Next time when we need a Content Model, a new one will be created\n */\n clearModelCache?: boolean;\n\n /**\n * @optional\n * Specify new pending format.\n * To keep current format event selection position is changed, set this value to \"preserved\", editor will update pending format position to the new position\n * To set a new pending format, set this property to the format object\n * Otherwise, leave it there and editor will automatically decide if the original pending format is still available\n */\n newPendingFormat?: ContentModelSegmentFormat | 'preserve';\n\n /**\n * @optional\n * Specify new pending format for paragraph\n * To keep current format event selection position is changed, set this value to \"preserved\", editor will update pending format position to the new position\n * To set a new pending format, set this property to the format object\n * Otherwise, leave it there and editor will automatically decide if the original pending format is still available\n */\n newPendingParagraphFormat?: ContentModelBlockFormat | 'preserve';\n\n /**\n * @optional Entity states related to the format API that will be added together with undo snapshot.\n * When entity states are set, each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n entityStates?: EntityState[];\n\n /**\n * @optional Set to true if this action can be undone when user press Backspace key (aka Auto Complete).\n */\n canUndoByBackspace?: boolean;\n\n /**\n * @optional Set this value to tell AnnouncePlugin to announce the given information\n */\n announceData?: AnnounceData | null;\n\n /**\n * @optional When set to true, EntityPlugin will detect any entity changes during this process, newEntities and deletedEntities will be ignored\n */\n autoDetectChangedEntities?: boolean;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { DOMInsertPoint } from '../selection/DOMSelection';
2
2
  import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';
3
+ import type { ContentModelBlockFormat } from '../contentModel/format/ContentModelBlockFormat';
3
4
  /**
4
5
  * Pending format holder interface
5
6
  */
@@ -7,7 +8,11 @@ export interface PendingFormat {
7
8
  /**
8
9
  * The pending format
9
10
  */
10
- format: ContentModelSegmentFormat;
11
+ format?: ContentModelSegmentFormat;
12
+ /**
13
+ * Customized format for paragraph
14
+ */
15
+ paragraphFormat?: ContentModelBlockFormat;
11
16
  /**
12
17
  * Insert point of pending format
13
18
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FormatPluginState.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/pluginState/FormatPluginState.ts"],"names":[],"mappings":"","sourcesContent":["import type { DOMInsertPoint } from '../selection/DOMSelection';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\n\n/**\n * Pending format holder interface\n */\nexport interface PendingFormat {\n /**\n * The pending format\n */\n format: ContentModelSegmentFormat;\n\n /**\n * Insert point of pending format\n */\n insertPoint: DOMInsertPoint;\n}\n\n/**\n * Plugin state for ContentModelFormatPlugin\n */\nexport interface FormatPluginState {\n /**\n * Default format of this editor\n */\n defaultFormat: ContentModelSegmentFormat;\n\n /**\n * Pending format\n */\n pendingFormat: PendingFormat | null;\n}\n"]}
1
+ {"version":3,"file":"FormatPluginState.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/pluginState/FormatPluginState.ts"],"names":[],"mappings":"","sourcesContent":["import type { DOMInsertPoint } from '../selection/DOMSelection';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { ContentModelBlockFormat } from '../contentModel/format/ContentModelBlockFormat';\n\n/**\n * Pending format holder interface\n */\nexport interface PendingFormat {\n /**\n * The pending format\n */\n format?: ContentModelSegmentFormat;\n\n /**\n * Customized format for paragraph\n */\n paragraphFormat?: ContentModelBlockFormat;\n\n /**\n * Insert point of pending format\n */\n insertPoint: DOMInsertPoint;\n}\n\n/**\n * Plugin state for ContentModelFormatPlugin\n */\nexport interface FormatPluginState {\n /**\n * Default format of this editor\n */\n defaultFormat: ContentModelSegmentFormat;\n\n /**\n * Pending format\n */\n pendingFormat: PendingFormat | null;\n}\n"]}