roosterjs-content-model-types 9.0.0 → 9.2.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 (55) hide show
  1. package/lib/editor/EditorCore.d.ts +13 -0
  2. package/lib/editor/EditorCore.js.map +1 -1
  3. package/lib/editor/EditorOptions.d.ts +7 -0
  4. package/lib/editor/EditorOptions.js.map +1 -1
  5. package/lib/editor/IEditor.d.ts +6 -0
  6. package/lib/editor/IEditor.js.map +1 -1
  7. package/lib/event/ContentChangedEvent.d.ts +1 -1
  8. package/lib/event/ContentChangedEvent.js.map +1 -1
  9. package/lib/group/ContentModelDocument.d.ts +4 -0
  10. package/lib/group/ContentModelDocument.js.map +1 -1
  11. package/lib/index.d.ts +1 -1
  12. package/lib/index.js.map +1 -1
  13. package/lib/parameter/DOMHelper.d.ts +8 -0
  14. package/lib/parameter/DOMHelper.js.map +1 -1
  15. package/lib/parameter/FormatContentModelContext.d.ts +5 -0
  16. package/lib/parameter/FormatContentModelContext.js.map +1 -1
  17. package/lib/pluginState/LifecyclePluginState.d.ts +11 -0
  18. package/lib/pluginState/LifecyclePluginState.js.map +1 -1
  19. package/lib-amd/editor/EditorCore.d.ts +13 -0
  20. package/lib-amd/editor/EditorCore.js.map +1 -1
  21. package/lib-amd/editor/EditorOptions.d.ts +7 -0
  22. package/lib-amd/editor/EditorOptions.js.map +1 -1
  23. package/lib-amd/editor/IEditor.d.ts +6 -0
  24. package/lib-amd/editor/IEditor.js.map +1 -1
  25. package/lib-amd/event/ContentChangedEvent.d.ts +1 -1
  26. package/lib-amd/event/ContentChangedEvent.js.map +1 -1
  27. package/lib-amd/group/ContentModelDocument.d.ts +4 -0
  28. package/lib-amd/group/ContentModelDocument.js.map +1 -1
  29. package/lib-amd/index.d.ts +1 -1
  30. package/lib-amd/index.js.map +1 -1
  31. package/lib-amd/parameter/DOMHelper.d.ts +8 -0
  32. package/lib-amd/parameter/DOMHelper.js.map +1 -1
  33. package/lib-amd/parameter/FormatContentModelContext.d.ts +5 -0
  34. package/lib-amd/parameter/FormatContentModelContext.js.map +1 -1
  35. package/lib-amd/pluginState/LifecyclePluginState.d.ts +11 -0
  36. package/lib-amd/pluginState/LifecyclePluginState.js.map +1 -1
  37. package/lib-mjs/editor/EditorCore.d.ts +13 -0
  38. package/lib-mjs/editor/EditorCore.js.map +1 -1
  39. package/lib-mjs/editor/EditorOptions.d.ts +7 -0
  40. package/lib-mjs/editor/EditorOptions.js.map +1 -1
  41. package/lib-mjs/editor/IEditor.d.ts +6 -0
  42. package/lib-mjs/editor/IEditor.js.map +1 -1
  43. package/lib-mjs/event/ContentChangedEvent.d.ts +1 -1
  44. package/lib-mjs/event/ContentChangedEvent.js.map +1 -1
  45. package/lib-mjs/group/ContentModelDocument.d.ts +4 -0
  46. package/lib-mjs/group/ContentModelDocument.js.map +1 -1
  47. package/lib-mjs/index.d.ts +1 -1
  48. package/lib-mjs/index.js.map +1 -1
  49. package/lib-mjs/parameter/DOMHelper.d.ts +8 -0
  50. package/lib-mjs/parameter/DOMHelper.js.map +1 -1
  51. package/lib-mjs/parameter/FormatContentModelContext.d.ts +5 -0
  52. package/lib-mjs/parameter/FormatContentModelContext.js.map +1 -1
  53. package/lib-mjs/pluginState/LifecyclePluginState.d.ts +11 -0
  54. package/lib-mjs/pluginState/LifecyclePluginState.js.map +1 -1
  55. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import type { AnnounceData } from '../parameter/AnnounceData';
1
2
  import type { DOMHelper } from '../parameter/DOMHelper';
2
3
  import type { PluginEvent } from '../event/PluginEvent';
3
4
  import type { PluginState } from '../pluginState/PluginState';
@@ -121,6 +122,12 @@ export declare type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot)
121
122
  * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only
122
123
  */
123
124
  export declare type SetEditorStyle = (core: EditorCore, key: string, cssRule: string | null, subSelectors?: 'before' | 'after' | string[], maxRuleLength?: number) => void;
125
+ /**
126
+ * Announce the given data
127
+ * @param core The EditorCore object
128
+ * @param announceData Data to announce
129
+ */
130
+ export declare type Announce = (core: EditorCore, announceData: AnnounceData) => void;
124
131
  /**
125
132
  * The interface for the map of core API for Editor.
126
133
  * Editor can call call API from this map under EditorCore object
@@ -228,6 +235,12 @@ export interface CoreApiMap {
228
235
  * combined with root selector together to build a separate rule.
229
236
  */
230
237
  setEditorStyle: SetEditorStyle;
238
+ /**
239
+ * Announce the given data
240
+ * @param core The EditorCore object
241
+ * @param announceData Data to announce
242
+ */
243
+ announce: Announce;
231
244
  }
232
245
  /**
233
246
  * Represents the core data structure of an editor
@@ -1 +1 @@
1
- {"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import 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 '../group/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 * 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/**\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"]}
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 '../group/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"]}
@@ -1,3 +1,4 @@
1
+ import type { KnownAnnounceStrings } from '../parameter/AnnounceData';
1
2
  import type { PasteType } from '../enum/PasteType';
2
3
  import type { Colors, ColorTransformFunction } from '../context/DarkColorHandler';
3
4
  import type { EditorPlugin } from './EditorPlugin';
@@ -99,4 +100,10 @@ export interface EditorOptions {
99
100
  * Default paste type. By default will use the normal (as-is) paste type.
100
101
  */
101
102
  defaultPasteType?: PasteType;
103
+ /**
104
+ * A callback to help get string template to announce, used for accessibility
105
+ * @param key The key of known announce data
106
+ * @returns A template string to announce, use placeholder such as "{0}" for variables if necessary
107
+ */
108
+ announcerStringGetter?: (key: KnownAnnounceStrings) => string;
102
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EditorOptions.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PasteType } from '../enum/PasteType';\nimport type { Colors, ColorTransformFunction } from '../context/DarkColorHandler';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { CoreApiMap } from './EditorCore';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { Snapshots } from '../parameter/Snapshot';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\n\n/**\n * Options for editor\n */\nexport interface EditorOptions {\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 * Whether content model should be cached in order to improve editing performance.\n * Pass true to disable the cache.\n * @default false\n */\n disableCache?: boolean;\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 * 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 * 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 * 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 * 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 * Existing known color pairs\n */\n knownColors?: Record<string, Colors>;\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 * Color of the border of a selectedImage. Default color: '#DB626C'\n */\n imageSelectionBorderColor?: string;\n\n /**\n * Initial Content Model\n */\n initialModel?: ContentModelDocument;\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 * 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 * Default paste type. By default will use the normal (as-is) paste type.\n */\n defaultPasteType?: PasteType;\n}\n"]}
1
+ {"version":3,"file":"EditorOptions.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { KnownAnnounceStrings } from '../parameter/AnnounceData';\nimport type { PasteType } from '../enum/PasteType';\nimport type { Colors, ColorTransformFunction } from '../context/DarkColorHandler';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { CoreApiMap } from './EditorCore';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { Snapshots } from '../parameter/Snapshot';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\n\n/**\n * Options for editor\n */\nexport interface EditorOptions {\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 * Whether content model should be cached in order to improve editing performance.\n * Pass true to disable the cache.\n * @default false\n */\n disableCache?: boolean;\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 * 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 * 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 * 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 * 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 * Existing known color pairs\n */\n knownColors?: Record<string, Colors>;\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 * Color of the border of a selectedImage. Default color: '#DB626C'\n */\n imageSelectionBorderColor?: string;\n\n /**\n * Initial Content Model\n */\n initialModel?: ContentModelDocument;\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 * 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 * Default paste type. By default will use the normal (as-is) paste type.\n */\n defaultPasteType?: PasteType;\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"]}
@@ -1,3 +1,4 @@
1
+ import type { AnnounceData } from '../parameter/AnnounceData';
1
2
  import type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';
2
3
  import type { DOMHelper } from '../parameter/DOMHelper';
3
4
  import type { PluginEventData, PluginEventFromType } from '../event/PluginEventData';
@@ -175,4 +176,9 @@ export interface IEditor {
175
176
  * combined with root selector together to build a separate rule.
176
177
  */
177
178
  setEditorStyle(key: string, cssRule: string | null, subSelectors?: 'before' | 'after' | string[]): void;
179
+ /**
180
+ * Announce the given data
181
+ * @param announceData Data to announce
182
+ */
183
+ announce(announceData: AnnounceData): void;
178
184
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IEditor.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/IEditor.ts"],"names":[],"mappings":"","sourcesContent":["import type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEventData, PluginEventFromType } from '../event/PluginEventData';\nimport type { PluginEventType } from '../event/PluginEventType';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { SnapshotsManager } from '../parameter/SnapshotsManager';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\n\n/**\n * An interface of Editor, built on top of Content Model\n */\nexport interface IEditor {\n /**\n * Create Content Model from DOM tree in this editor\n * @param mode What kind of Content Model we want. Currently we support the following values:\n * - connected: Returns a connect Content Model object. \"Connected\" means if there is any entity inside editor, the returned Content Model will\n * contain the same wrapper element for entity. This option should only be used in some special cases. In most cases we should use \"disconnected\"\n * to get a fully disconnected Content Model so that any change to the model will not impact editor content.\n * - disconnected: Returns a disconnected clone of Content Model from editor which you can do any change on it and it won't impact the editor content.\n * If there is any entity in editor, the returned object will contain cloned copy of entity wrapper element.\n * If editor is in dark mode, the cloned entity will be converted back to light mode.\n * - clean: Similar with disconnected, this will return a disconnected model, the difference is \"clean\" mode will not include any selection info.\n * This is usually used for exporting content\n */\n getContentModelCopy(mode: 'connected' | 'disconnected' | 'clean'): ContentModelDocument;\n\n /**\n * Get current running environment, such as if editor is running on Mac\n */\n getEnvironment(): EditorEnvironment;\n\n /**\n * Get current DOM selection.\n * This is the replacement of IEditor.getSelectionRangeEx.\n */\n getDOMSelection(): DOMSelection | null;\n\n /**\n * Set DOMSelection into editor content.\n * This is the replacement of IEditor.select.\n * @param selection The selection to set\n */\n setDOMSelection(selection: DOMSelection | null): void;\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 or null to use physicalRoot as logical root)\n */\n setLogicalRoot(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 formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel(\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOption?: DomToModelOptionForCreateModel\n ): void;\n\n /**\n * Get pending format of editor if any, or return null\n */\n getPendingFormat(): ContentModelSegmentFormat | null;\n\n /**\n * Get whether this editor is disposed\n * @returns True if editor is disposed, otherwise false\n */\n isDisposed(): boolean;\n\n /**\n * Get a DOM Helper object to help access DOM tree in editor\n */\n getDOMHelper(): DOMHelper;\n\n /**\n * Get document which contains this editor\n * @returns The HTML document which contains this editor\n */\n getDocument(): Document;\n\n /**\n * Focus to this editor, the selection was restored to where it was before, no unexpected scroll.\n */\n focus(): void;\n\n /**\n * Trigger an event to be dispatched to all plugins\n * @param eventType Type of the event\n * @param data data of the event with given type, this is the rest part of PluginEvent with the given type\n * @param broadcast indicates if the event needs to be dispatched to all plugins\n * True means to all, false means to allow exclusive handling from one plugin unless no one wants that\n * @returns the event object which is really passed into plugins. Some plugin may modify the event object so\n * the result of this function provides a chance to read the modified result\n */\n triggerEvent<T extends PluginEventType>(\n eventType: T,\n data: PluginEventData<T>,\n broadcast?: boolean\n ): PluginEventFromType<T>;\n\n /**\n * Get undo snapshots manager\n */\n getSnapshotsManager(): SnapshotsManager;\n\n /**\n * Check if the editor is in dark mode\n * @returns True if the editor is in dark mode, otherwise false\n */\n isDarkMode(): boolean;\n\n /**\n * Set the dark mode state and transforms the content to match the new state.\n * @param isDarkMode The next status of dark mode. True if the editor should be in dark mode, false if not.\n */\n setDarkModeState(isDarkMode?: boolean): void;\n\n /**\n * Add a single undo snapshot to undo stack\n * @param entityState @optional State for entity if we want to add entity state for this snapshot\n */\n takeSnapshot(entityState?: EntityState): Snapshot | null;\n\n /**\n * Restore an undo snapshot into editor\n * @param snapshot The snapshot to restore\n */\n restoreSnapshot(snapshot: Snapshot): void;\n\n /**\n * Attach a DOM event to the editor content DIV\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent(eventMap: Record<string, DOMEventRecord>): () => void;\n\n /**\n * Check if editor is in Shadow Edit mode\n */\n isInShadowEdit(): boolean;\n\n /**\n * Make the editor in \"Shadow Edit\" mode.\n * In Shadow Edit mode, all format change will finally be ignored.\n * This can be used for building a live preview feature for format button, to allow user\n * see format result without really apply it.\n * This function can be called repeated. If editor is already in shadow edit mode, we can still\n * use this function to do more shadow edit operation.\n */\n startShadowEdit(): void;\n\n /**\n * Leave \"Shadow Edit\" mode, all changes made during shadow edit will be discarded\n */\n stopShadowEdit(): void;\n\n /**\n * Get a darkColorHandler object for this editor.\n */\n getColorManager(): DarkColorHandler;\n\n /**\n * Dispose this editor, dispose all plugins and custom data\n */\n dispose(): void;\n\n /**\n * Check if focus is in editor now\n * @returns true if focus is in editor, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Get a function to convert HTML string to trusted HTML string.\n * By default it will just return the input HTML directly. To override this behavior,\n * pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types\n */\n getTrustedHTMLHandler(): TrustedHTMLHandler;\n\n /**\n * Get the scroll container of the editor\n */\n getScrollContainer(): HTMLElement;\n\n /**\n * Retrieves the rect of the visible viewport of the editor.\n */\n getVisibleViewport(): Rect | null;\n\n /**\n * Add CSS rules for editor\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 clear 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.\n */\n setEditorStyle(\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[]\n ): void;\n}\n"]}
1
+ {"version":3,"file":"IEditor.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/IEditor.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEventData, PluginEventFromType } from '../event/PluginEventData';\nimport type { PluginEventType } from '../event/PluginEventType';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { SnapshotsManager } from '../parameter/SnapshotsManager';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\n\n/**\n * An interface of Editor, built on top of Content Model\n */\nexport interface IEditor {\n /**\n * Create Content Model from DOM tree in this editor\n * @param mode What kind of Content Model we want. Currently we support the following values:\n * - connected: Returns a connect Content Model object. \"Connected\" means if there is any entity inside editor, the returned Content Model will\n * contain the same wrapper element for entity. This option should only be used in some special cases. In most cases we should use \"disconnected\"\n * to get a fully disconnected Content Model so that any change to the model will not impact editor content.\n * - disconnected: Returns a disconnected clone of Content Model from editor which you can do any change on it and it won't impact the editor content.\n * If there is any entity in editor, the returned object will contain cloned copy of entity wrapper element.\n * If editor is in dark mode, the cloned entity will be converted back to light mode.\n * - clean: Similar with disconnected, this will return a disconnected model, the difference is \"clean\" mode will not include any selection info.\n * This is usually used for exporting content\n */\n getContentModelCopy(mode: 'connected' | 'disconnected' | 'clean'): ContentModelDocument;\n\n /**\n * Get current running environment, such as if editor is running on Mac\n */\n getEnvironment(): EditorEnvironment;\n\n /**\n * Get current DOM selection.\n * This is the replacement of IEditor.getSelectionRangeEx.\n */\n getDOMSelection(): DOMSelection | null;\n\n /**\n * Set DOMSelection into editor content.\n * This is the replacement of IEditor.select.\n * @param selection The selection to set\n */\n setDOMSelection(selection: DOMSelection | null): void;\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 or null to use physicalRoot as logical root)\n */\n setLogicalRoot(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 formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel(\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOption?: DomToModelOptionForCreateModel\n ): void;\n\n /**\n * Get pending format of editor if any, or return null\n */\n getPendingFormat(): ContentModelSegmentFormat | null;\n\n /**\n * Get whether this editor is disposed\n * @returns True if editor is disposed, otherwise false\n */\n isDisposed(): boolean;\n\n /**\n * Get a DOM Helper object to help access DOM tree in editor\n */\n getDOMHelper(): DOMHelper;\n\n /**\n * Get document which contains this editor\n * @returns The HTML document which contains this editor\n */\n getDocument(): Document;\n\n /**\n * Focus to this editor, the selection was restored to where it was before, no unexpected scroll.\n */\n focus(): void;\n\n /**\n * Trigger an event to be dispatched to all plugins\n * @param eventType Type of the event\n * @param data data of the event with given type, this is the rest part of PluginEvent with the given type\n * @param broadcast indicates if the event needs to be dispatched to all plugins\n * True means to all, false means to allow exclusive handling from one plugin unless no one wants that\n * @returns the event object which is really passed into plugins. Some plugin may modify the event object so\n * the result of this function provides a chance to read the modified result\n */\n triggerEvent<T extends PluginEventType>(\n eventType: T,\n data: PluginEventData<T>,\n broadcast?: boolean\n ): PluginEventFromType<T>;\n\n /**\n * Get undo snapshots manager\n */\n getSnapshotsManager(): SnapshotsManager;\n\n /**\n * Check if the editor is in dark mode\n * @returns True if the editor is in dark mode, otherwise false\n */\n isDarkMode(): boolean;\n\n /**\n * Set the dark mode state and transforms the content to match the new state.\n * @param isDarkMode The next status of dark mode. True if the editor should be in dark mode, false if not.\n */\n setDarkModeState(isDarkMode?: boolean): void;\n\n /**\n * Add a single undo snapshot to undo stack\n * @param entityState @optional State for entity if we want to add entity state for this snapshot\n */\n takeSnapshot(entityState?: EntityState): Snapshot | null;\n\n /**\n * Restore an undo snapshot into editor\n * @param snapshot The snapshot to restore\n */\n restoreSnapshot(snapshot: Snapshot): void;\n\n /**\n * Attach a DOM event to the editor content DIV\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent(eventMap: Record<string, DOMEventRecord>): () => void;\n\n /**\n * Check if editor is in Shadow Edit mode\n */\n isInShadowEdit(): boolean;\n\n /**\n * Make the editor in \"Shadow Edit\" mode.\n * In Shadow Edit mode, all format change will finally be ignored.\n * This can be used for building a live preview feature for format button, to allow user\n * see format result without really apply it.\n * This function can be called repeated. If editor is already in shadow edit mode, we can still\n * use this function to do more shadow edit operation.\n */\n startShadowEdit(): void;\n\n /**\n * Leave \"Shadow Edit\" mode, all changes made during shadow edit will be discarded\n */\n stopShadowEdit(): void;\n\n /**\n * Get a darkColorHandler object for this editor.\n */\n getColorManager(): DarkColorHandler;\n\n /**\n * Dispose this editor, dispose all plugins and custom data\n */\n dispose(): void;\n\n /**\n * Check if focus is in editor now\n * @returns true if focus is in editor, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Get a function to convert HTML string to trusted HTML string.\n * By default it will just return the input HTML directly. To override this behavior,\n * pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types\n */\n getTrustedHTMLHandler(): TrustedHTMLHandler;\n\n /**\n * Get the scroll container of the editor\n */\n getScrollContainer(): HTMLElement;\n\n /**\n * Retrieves the rect of the visible viewport of the editor.\n */\n getVisibleViewport(): Rect | null;\n\n /**\n * Add CSS rules for editor\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 clear 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.\n */\n setEditorStyle(\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[]\n ): void;\n\n /**\n * Announce the given data\n * @param announceData Data to announce\n */\n announce(announceData: AnnounceData): void;\n}\n"]}
@@ -55,7 +55,7 @@ export interface ContentChangedEvent extends BasePluginEvent<'contentChanged'> {
55
55
  */
56
56
  readonly formatApiName?: string;
57
57
  /**
58
- * @optional Announce data from this content changed event.
58
+ * @deprecated Call editor.announce(announceData) directly insteaad
59
59
  */
60
60
  readonly announceData?: AnnounceData;
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContentChangedEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/ContentChangedEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { BasePluginEvent } from './BasePluginEvent';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { ContentModelEntity } from '../entity/ContentModelEntity';\nimport type { EntityRemovalOperation } from '../enum/EntityOperation';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an entity that has been changed during a content change process\n */\nexport interface ChangedEntity {\n /**\n * The changed entity\n */\n entity: ContentModelEntity;\n\n /**\n * Operation that causes the change\n */\n operation: EntityRemovalOperation | 'newEntity';\n\n /**\n * @optional Raw DOM event that causes the change\n */\n rawEvent?: Event;\n}\n\n/**\n * Represents a change to the editor made by another plugin with content model inside\n */\nexport interface ContentChangedEvent extends BasePluginEvent<'contentChanged'> {\n /**\n * The content model that is applied which causes this content changed event\n */\n readonly contentModel?: ContentModelDocument;\n\n /**\n * Selection range applied to the document\n */\n readonly selection?: DOMSelection;\n\n /**\n * Entities got changed (added or removed) during the content change process\n */\n readonly changedEntities?: ChangedEntity[];\n\n /**\n * Entity states related to this event\n */\n readonly entityStates?: EntityState[];\n\n /**\n * Source of the change\n */\n readonly source: string;\n\n /**\n * Optional related data\n */\n readonly data?: any;\n\n /**\n * Optional property to store the format api name when using ChangeSource.Format\n */\n readonly formatApiName?: string;\n\n /**\n * @optional Announce data from this content changed event.\n */\n readonly announceData?: AnnounceData;\n}\n"]}
1
+ {"version":3,"file":"ContentChangedEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/ContentChangedEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { BasePluginEvent } from './BasePluginEvent';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { ContentModelEntity } from '../entity/ContentModelEntity';\nimport type { EntityRemovalOperation } from '../enum/EntityOperation';\nimport type { ContentModelDocument } from '../group/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an entity that has been changed during a content change process\n */\nexport interface ChangedEntity {\n /**\n * The changed entity\n */\n entity: ContentModelEntity;\n\n /**\n * Operation that causes the change\n */\n operation: EntityRemovalOperation | 'newEntity';\n\n /**\n * @optional Raw DOM event that causes the change\n */\n rawEvent?: Event;\n}\n\n/**\n * Represents a change to the editor made by another plugin with content model inside\n */\nexport interface ContentChangedEvent extends BasePluginEvent<'contentChanged'> {\n /**\n * The content model that is applied which causes this content changed event\n */\n readonly contentModel?: ContentModelDocument;\n\n /**\n * Selection range applied to the document\n */\n readonly selection?: DOMSelection;\n\n /**\n * Entities got changed (added or removed) during the content change process\n */\n readonly changedEntities?: ChangedEntity[];\n\n /**\n * Entity states related to this event\n */\n readonly entityStates?: EntityState[];\n\n /**\n * Source of the change\n */\n readonly source: string;\n\n /**\n * Optional related data\n */\n readonly data?: any;\n\n /**\n * Optional property to store the format api name when using ChangeSource.Format\n */\n readonly formatApiName?: string;\n\n /**\n * @deprecated Call editor.announce(announceData) directly insteaad\n */\n readonly announceData?: AnnounceData;\n}\n"]}
@@ -5,4 +5,8 @@ import type { ContentModelWithFormat } from '../format/ContentModelWithFormat';
5
5
  * Content Model document entry point
6
6
  */
7
7
  export interface ContentModelDocument extends ContentModelBlockGroupBase<'Document'>, Partial<ContentModelWithFormat<ContentModelSegmentFormat>> {
8
+ /**
9
+ * Whether the selection in model (if any) is a revert selection (end is before start)
10
+ */
11
+ hasRevertedRangeSelection?: boolean;
8
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContentModelDocument.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/group/ContentModelDocument.ts"],"names":[],"mappings":"","sourcesContent":["import type { ContentModelBlockGroupBase } from './ContentModelBlockGroupBase';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { ContentModelWithFormat } from '../format/ContentModelWithFormat';\n\n/**\n * Content Model document entry point\n */\nexport interface ContentModelDocument\n extends ContentModelBlockGroupBase<'Document'>,\n Partial<ContentModelWithFormat<ContentModelSegmentFormat>> {}\n"]}
1
+ {"version":3,"file":"ContentModelDocument.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/group/ContentModelDocument.ts"],"names":[],"mappings":"","sourcesContent":["import type { ContentModelBlockGroupBase } from './ContentModelBlockGroupBase';\nimport type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';\nimport type { ContentModelWithFormat } from '../format/ContentModelWithFormat';\n\n/**\n * Content Model document entry point\n */\nexport interface ContentModelDocument\n extends ContentModelBlockGroupBase<'Document'>,\n Partial<ContentModelWithFormat<ContentModelSegmentFormat>> {\n /**\n * Whether the selection in model (if any) is a revert selection (end is before start)\n */\n hasRevertedRangeSelection?: boolean;\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -115,7 +115,7 @@ export { ArrayItemType, DefinitionBase, StringDefinition, NumberDefinition, Bool
115
115
  export { DarkColorHandler, Colors, ColorTransformFunction } from './context/DarkColorHandler';
116
116
  export { IEditor } from './editor/IEditor';
117
117
  export { EditorOptions } from './editor/EditorOptions';
118
- export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, SetLogicalRoot, FormatContentModel, CoreApiMap, EditorCore, SwitchShadowEdit, TriggerEvent, AddUndoSnapshot, Focus, AttachDomEvent, RestoreUndoSnapshot, GetVisibleViewport, SetEditorStyle, } from './editor/EditorCore';
118
+ export { CreateContentModel, CreateEditorContext, GetDOMSelection, SetContentModel, SetDOMSelection, SetLogicalRoot, FormatContentModel, CoreApiMap, EditorCore, SwitchShadowEdit, TriggerEvent, AddUndoSnapshot, Focus, AttachDomEvent, RestoreUndoSnapshot, GetVisibleViewport, SetEditorStyle, Announce, } from './editor/EditorCore';
119
119
  export { EditorCorePlugins } from './editor/EditorCorePlugins';
120
120
  export { EditorPlugin } from './editor/EditorPlugin';
121
121
  export { PluginWithState } from './editor/PluginWithState';
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 './format/ContentModelSegmentFormat';\nexport { ContentModelWithFormat } from './format/ContentModelWithFormat';\nexport { ContentModelTableFormat } from './format/ContentModelTableFormat';\nexport { ContentModelWithDataset } from './format/ContentModelWithDataset';\nexport { ContentModelBlockFormat } from './format/ContentModelBlockFormat';\nexport { ContentModelTableCellFormat } from './format/ContentModelTableCellFormat';\nexport { ContentModelListItemFormat } from './format/ContentModelListItemFormat';\nexport { ContentModelListItemLevelFormat } from './format/ContentModelListItemLevelFormat';\nexport { ContentModelHyperLinkFormat } from './format/ContentModelHyperLinkFormat';\nexport { ContentModelCodeFormat } from './format/ContentModelCodeFormat';\nexport { ContentModelFormatContainerFormat } from './format/ContentModelFormatContainerFormat';\nexport { ContentModelDividerFormat } from './format/ContentModelDividerFormat';\nexport { ContentModelFormatBase } from './format/ContentModelFormatBase';\nexport { ContentModelFormatMap } from './format/ContentModelFormatMap';\nexport { ContentModelImageFormat } from './format/ContentModelImageFormat';\nexport { ContentModelEntityFormat } from './format/ContentModelEntityFormat';\nexport { FormatHandlerTypeMap, FormatKey } from './format/FormatHandlerTypeMap';\n\nexport { BackgroundColorFormat } from './format/formatParts/BackgroundColorFormat';\nexport { BoldFormat } from './format/formatParts/BoldFormat';\nexport { FontFamilyFormat } from './format/formatParts/FontFamilyFormat';\nexport { FontSizeFormat } from './format/formatParts/FontSizeFormat';\nexport { ItalicFormat } from './format/formatParts/ItalicFormat';\nexport { LetterSpacingFormat } from './format/formatParts/LetterSpacingFormat';\nexport { LineHeightFormat } from './format/formatParts/LineHeightFormat';\nexport { StrikeFormat } from './format/formatParts/StrikeFormat';\nexport { SuperOrSubScriptFormat } from './format/formatParts/SuperOrSubScriptFormat';\nexport { TextColorFormat } from './format/formatParts/TextColorFormat';\nexport { UnderlineFormat } from './format/formatParts/UnderlineFormat';\nexport { BorderBoxFormat } from './format/formatParts/BorderBoxFormat';\nexport { VerticalAlignFormat } from './format/formatParts/VerticalAlignFormat';\nexport { WordBreakFormat } from './format/formatParts/WordBreakFormat';\nexport { BorderFormat } from './format/formatParts/BorderFormat';\nexport { DirectionFormat } from './format/formatParts/DirectionFormat';\nexport { HtmlAlignFormat } from './format/formatParts/HtmlAlignFormat';\nexport { MarginFormat } from './format/formatParts/MarginFormat';\nexport { PaddingFormat } from './format/formatParts/PaddingFormat';\nexport { TextAlignFormat } from './format/formatParts/TextAlignFormat';\nexport { TextIndentFormat } from './format/formatParts/TextIndentFormat';\nexport { WhiteSpaceFormat } from './format/formatParts/WhiteSpaceFormat';\nexport { DisplayFormat } from './format/formatParts/DisplayFormat';\nexport { IdFormat } from './format/formatParts/IdFormat';\nexport { SpacingFormat } from './format/formatParts/SpacingFormat';\nexport { TableLayoutFormat } from './format/formatParts/TableLayoutFormat';\nexport { LinkFormat } from './format/formatParts/LinkFormat';\nexport { SizeFormat } from './format/formatParts/SizeFormat';\nexport { BoxShadowFormat } from './format/formatParts/BoxShadowFormat';\nexport { ListThreadFormat } from './format/formatParts/ListThreadFormat';\nexport { ListStyleFormat } from './format/formatParts/ListStyleFormat';\nexport { FloatFormat } from './format/formatParts/FloatFormat';\nexport { EntityInfoFormat } from './format/formatParts/EntityInfoFormat';\n\nexport { DatasetFormat } from './format/metadata/DatasetFormat';\nexport { TableMetadataFormat } from './format/metadata/TableMetadataFormat';\nexport { ListMetadataFormat } from './format/metadata/ListMetadataFormat';\nexport {\n ImageResizeMetadataFormat,\n ImageCropMetadataFormat,\n ImageMetadataFormat,\n ImageRotateMetadataFormat,\n} from './format/metadata/ImageMetadataFormat';\nexport { TableCellMetadataFormat } from './format/metadata/TableCellMetadataFormat';\n\nexport { ContentModelBlockGroupType } from './enum/BlockGroupType';\nexport { ContentModelBlockType } from './enum/BlockType';\nexport { ContentModelSegmentType } from './enum/SegmentType';\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 { ContentModelBlock } from './block/ContentModelBlock';\nexport { ContentModelParagraph } from './block/ContentModelParagraph';\nexport { ContentModelTable } from './block/ContentModelTable';\nexport { ContentModelDivider } from './block/ContentModelDivider';\nexport { ContentModelBlockBase } from './block/ContentModelBlockBase';\nexport { ContentModelBlockWithCache } from './block/ContentModelBlockWithCache';\nexport { ContentModelTableRow } from './block/ContentModelTableRow';\n\nexport { ContentModelEntity } from './entity/ContentModelEntity';\n\nexport { ContentModelDocument } from './group/ContentModelDocument';\nexport { ContentModelBlockGroupBase } from './group/ContentModelBlockGroupBase';\nexport { ContentModelFormatContainer } from './group/ContentModelFormatContainer';\nexport { ContentModelGeneralBlock } from './group/ContentModelGeneralBlock';\nexport { ContentModelListItem } from './group/ContentModelListItem';\nexport { ContentModelTableCell } from './group/ContentModelTableCell';\nexport { ContentModelBlockGroup } from './group/ContentModelBlockGroup';\n\nexport { ContentModelBr } from './segment/ContentModelBr';\nexport { ContentModelGeneralSegment } from './segment/ContentModelGeneralSegment';\nexport { ContentModelImage } from './segment/ContentModelImage';\nexport { ContentModelText } from './segment/ContentModelText';\nexport { ContentModelSelectionMarker } from './segment/ContentModelSelectionMarker';\nexport { ContentModelSegmentBase } from './segment/ContentModelSegmentBase';\nexport { ContentModelSegment } from './segment/ContentModelSegment';\n\nexport { ContentModelCode } from './decorator/ContentModelCode';\nexport { ContentModelLink } from './decorator/ContentModelLink';\nexport { ContentModelParagraphDecorator } from './decorator/ContentModelParagraphDecorator';\nexport { ContentModelDecorator } from './decorator/ContentModelDecorator';\nexport { ContentModelListLevel } from './decorator/ContentModelListLevel';\n\nexport { Selectable } from './selection/Selectable';\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 { TableSelectionContext } 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 { EditorOptions } 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} 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 { 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 { 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} from './parameter/IterateSelectionsOption';\nexport { NodeTypeMap } from './parameter/NodeTypeMap';\nexport { TypeOfBlockGroup } from './parameter/TypeOfBlockGroup';\nexport { OperationalBlocks } from './parameter/OperationalBlocks';\nexport { ParsedTable, ParsedTableCell } from './parameter/ParsedTable';\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 './format/ContentModelSegmentFormat';\nexport { ContentModelWithFormat } from './format/ContentModelWithFormat';\nexport { ContentModelTableFormat } from './format/ContentModelTableFormat';\nexport { ContentModelWithDataset } from './format/ContentModelWithDataset';\nexport { ContentModelBlockFormat } from './format/ContentModelBlockFormat';\nexport { ContentModelTableCellFormat } from './format/ContentModelTableCellFormat';\nexport { ContentModelListItemFormat } from './format/ContentModelListItemFormat';\nexport { ContentModelListItemLevelFormat } from './format/ContentModelListItemLevelFormat';\nexport { ContentModelHyperLinkFormat } from './format/ContentModelHyperLinkFormat';\nexport { ContentModelCodeFormat } from './format/ContentModelCodeFormat';\nexport { ContentModelFormatContainerFormat } from './format/ContentModelFormatContainerFormat';\nexport { ContentModelDividerFormat } from './format/ContentModelDividerFormat';\nexport { ContentModelFormatBase } from './format/ContentModelFormatBase';\nexport { ContentModelFormatMap } from './format/ContentModelFormatMap';\nexport { ContentModelImageFormat } from './format/ContentModelImageFormat';\nexport { ContentModelEntityFormat } from './format/ContentModelEntityFormat';\nexport { FormatHandlerTypeMap, FormatKey } from './format/FormatHandlerTypeMap';\n\nexport { BackgroundColorFormat } from './format/formatParts/BackgroundColorFormat';\nexport { BoldFormat } from './format/formatParts/BoldFormat';\nexport { FontFamilyFormat } from './format/formatParts/FontFamilyFormat';\nexport { FontSizeFormat } from './format/formatParts/FontSizeFormat';\nexport { ItalicFormat } from './format/formatParts/ItalicFormat';\nexport { LetterSpacingFormat } from './format/formatParts/LetterSpacingFormat';\nexport { LineHeightFormat } from './format/formatParts/LineHeightFormat';\nexport { StrikeFormat } from './format/formatParts/StrikeFormat';\nexport { SuperOrSubScriptFormat } from './format/formatParts/SuperOrSubScriptFormat';\nexport { TextColorFormat } from './format/formatParts/TextColorFormat';\nexport { UnderlineFormat } from './format/formatParts/UnderlineFormat';\nexport { BorderBoxFormat } from './format/formatParts/BorderBoxFormat';\nexport { VerticalAlignFormat } from './format/formatParts/VerticalAlignFormat';\nexport { WordBreakFormat } from './format/formatParts/WordBreakFormat';\nexport { BorderFormat } from './format/formatParts/BorderFormat';\nexport { DirectionFormat } from './format/formatParts/DirectionFormat';\nexport { HtmlAlignFormat } from './format/formatParts/HtmlAlignFormat';\nexport { MarginFormat } from './format/formatParts/MarginFormat';\nexport { PaddingFormat } from './format/formatParts/PaddingFormat';\nexport { TextAlignFormat } from './format/formatParts/TextAlignFormat';\nexport { TextIndentFormat } from './format/formatParts/TextIndentFormat';\nexport { WhiteSpaceFormat } from './format/formatParts/WhiteSpaceFormat';\nexport { DisplayFormat } from './format/formatParts/DisplayFormat';\nexport { IdFormat } from './format/formatParts/IdFormat';\nexport { SpacingFormat } from './format/formatParts/SpacingFormat';\nexport { TableLayoutFormat } from './format/formatParts/TableLayoutFormat';\nexport { LinkFormat } from './format/formatParts/LinkFormat';\nexport { SizeFormat } from './format/formatParts/SizeFormat';\nexport { BoxShadowFormat } from './format/formatParts/BoxShadowFormat';\nexport { ListThreadFormat } from './format/formatParts/ListThreadFormat';\nexport { ListStyleFormat } from './format/formatParts/ListStyleFormat';\nexport { FloatFormat } from './format/formatParts/FloatFormat';\nexport { EntityInfoFormat } from './format/formatParts/EntityInfoFormat';\n\nexport { DatasetFormat } from './format/metadata/DatasetFormat';\nexport { TableMetadataFormat } from './format/metadata/TableMetadataFormat';\nexport { ListMetadataFormat } from './format/metadata/ListMetadataFormat';\nexport {\n ImageResizeMetadataFormat,\n ImageCropMetadataFormat,\n ImageMetadataFormat,\n ImageRotateMetadataFormat,\n} from './format/metadata/ImageMetadataFormat';\nexport { TableCellMetadataFormat } from './format/metadata/TableCellMetadataFormat';\n\nexport { ContentModelBlockGroupType } from './enum/BlockGroupType';\nexport { ContentModelBlockType } from './enum/BlockType';\nexport { ContentModelSegmentType } from './enum/SegmentType';\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 { ContentModelBlock } from './block/ContentModelBlock';\nexport { ContentModelParagraph } from './block/ContentModelParagraph';\nexport { ContentModelTable } from './block/ContentModelTable';\nexport { ContentModelDivider } from './block/ContentModelDivider';\nexport { ContentModelBlockBase } from './block/ContentModelBlockBase';\nexport { ContentModelBlockWithCache } from './block/ContentModelBlockWithCache';\nexport { ContentModelTableRow } from './block/ContentModelTableRow';\n\nexport { ContentModelEntity } from './entity/ContentModelEntity';\n\nexport { ContentModelDocument } from './group/ContentModelDocument';\nexport { ContentModelBlockGroupBase } from './group/ContentModelBlockGroupBase';\nexport { ContentModelFormatContainer } from './group/ContentModelFormatContainer';\nexport { ContentModelGeneralBlock } from './group/ContentModelGeneralBlock';\nexport { ContentModelListItem } from './group/ContentModelListItem';\nexport { ContentModelTableCell } from './group/ContentModelTableCell';\nexport { ContentModelBlockGroup } from './group/ContentModelBlockGroup';\n\nexport { ContentModelBr } from './segment/ContentModelBr';\nexport { ContentModelGeneralSegment } from './segment/ContentModelGeneralSegment';\nexport { ContentModelImage } from './segment/ContentModelImage';\nexport { ContentModelText } from './segment/ContentModelText';\nexport { ContentModelSelectionMarker } from './segment/ContentModelSelectionMarker';\nexport { ContentModelSegmentBase } from './segment/ContentModelSegmentBase';\nexport { ContentModelSegment } from './segment/ContentModelSegment';\n\nexport { ContentModelCode } from './decorator/ContentModelCode';\nexport { ContentModelLink } from './decorator/ContentModelLink';\nexport { ContentModelParagraphDecorator } from './decorator/ContentModelParagraphDecorator';\nexport { ContentModelDecorator } from './decorator/ContentModelDecorator';\nexport { ContentModelListLevel } from './decorator/ContentModelListLevel';\n\nexport { Selectable } from './selection/Selectable';\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 { TableSelectionContext } 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 { EditorOptions } 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 { 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 { 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} from './parameter/IterateSelectionsOption';\nexport { NodeTypeMap } from './parameter/NodeTypeMap';\nexport { TypeOfBlockGroup } from './parameter/TypeOfBlockGroup';\nexport { OperationalBlocks } from './parameter/OperationalBlocks';\nexport { ParsedTable, ParsedTableCell } from './parameter/ParsedTable';\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"]}
@@ -66,4 +66,12 @@ export interface DOMHelper {
66
66
  * @returns True if the editor has focus, otherwise false
67
67
  */
68
68
  hasFocus(): boolean;
69
+ /**
70
+ * Check if the root element is in RTL mode
71
+ */
72
+ isRightToLeft(): boolean;
73
+ /**
74
+ * Get the width of the editable area of the editor content div
75
+ */
76
+ getClientWidth(): number;
69
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n */\n isNodeInEditor(node: Node): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n}\n"]}
1
+ {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n */\n isNodeInEditor(node: Node): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Check if the root element is in RTL mode\n */\n isRightToLeft(): boolean;\n\n /**\n * Get the width of the editable area of the editor content div\n */\n getClientWidth(): number;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { AnnounceData } from './AnnounceData';
1
2
  import type { ContentModelEntity } from '../entity/ContentModelEntity';
2
3
  import type { ContentModelImage } from '../segment/ContentModelImage';
3
4
  import type { ContentModelSegmentFormat } from '../format/ContentModelSegmentFormat';
@@ -83,4 +84,8 @@ export interface FormatContentModelContext {
83
84
  * @optional Set to true if this action can be undone when user press Backspace key (aka Auto Complete).
84
85
  */
85
86
  canUndoByBackspace?: boolean;
87
+ /**
88
+ * @optional Set this value to tell AnnouncePlugin to announce the given information
89
+ */
90
+ announceData?: AnnounceData | null;
86
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FormatContentModelContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/FormatContentModelContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { ContentModelEntity } from '../entity/ContentModelEntity';\nimport type { ContentModelImage } from '../segment/ContentModelImage';\nimport type { ContentModelSegmentFormat } from '../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"]}
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 '../entity/ContentModelEntity';\nimport type { ContentModelImage } from '../segment/ContentModelImage';\nimport type { ContentModelSegmentFormat } from '../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,3 +1,4 @@
1
+ import type { KnownAnnounceStrings } from '../parameter/AnnounceData';
1
2
  /**
2
3
  * The state object for LifecyclePlugin
3
4
  */
@@ -10,6 +11,16 @@ export interface LifecyclePluginState {
10
11
  * Cached document fragment for original content
11
12
  */
12
13
  shadowEditFragment: DocumentFragment | null;
14
+ /**
15
+ * The HTML container for announced string
16
+ */
17
+ announceContainer?: HTMLElement;
18
+ /**
19
+ * A callback to help get string template to announce, used for accessibility
20
+ * @param key The key of known announce data
21
+ * @returns A template string to announce, use placeholder such as "{0}" for variables if necessary
22
+ */
23
+ readonly announcerStringGetter?: (key: KnownAnnounceStrings) => string;
13
24
  /**
14
25
  * Style elements used for adding CSS rules for editor
15
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"LifecyclePluginState.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/pluginState/LifecyclePluginState.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The state object for LifecyclePlugin\n */\nexport interface LifecyclePluginState {\n /**\n * Whether editor is in dark mode\n */\n isDarkMode: boolean;\n\n /**\n * Cached document fragment for original content\n */\n shadowEditFragment: DocumentFragment | null;\n\n /**\n * Style elements used for adding CSS rules for editor\n */\n readonly styleElements: Record<string, HTMLStyleElement>;\n}\n"]}
1
+ {"version":3,"file":"LifecyclePluginState.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/pluginState/LifecyclePluginState.ts"],"names":[],"mappings":"","sourcesContent":["import type { KnownAnnounceStrings } from '../parameter/AnnounceData';\n\n/**\n * The state object for LifecyclePlugin\n */\nexport interface LifecyclePluginState {\n /**\n * Whether editor is in dark mode\n */\n isDarkMode: boolean;\n\n /**\n * Cached document fragment for original content\n */\n shadowEditFragment: DocumentFragment | null;\n\n /**\n * The HTML container for announced string\n */\n announceContainer?: HTMLElement;\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 readonly announcerStringGetter?: (key: KnownAnnounceStrings) => string;\n\n /**\n * Style elements used for adding CSS rules for editor\n */\n readonly styleElements: Record<string, HTMLStyleElement>;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { AnnounceData } from '../parameter/AnnounceData';
1
2
  import type { DOMHelper } from '../parameter/DOMHelper';
2
3
  import type { PluginEvent } from '../event/PluginEvent';
3
4
  import type { PluginState } from '../pluginState/PluginState';
@@ -121,6 +122,12 @@ export declare type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot)
121
122
  * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only
122
123
  */
123
124
  export declare type SetEditorStyle = (core: EditorCore, key: string, cssRule: string | null, subSelectors?: 'before' | 'after' | string[], maxRuleLength?: number) => void;
125
+ /**
126
+ * Announce the given data
127
+ * @param core The EditorCore object
128
+ * @param announceData Data to announce
129
+ */
130
+ export declare type Announce = (core: EditorCore, announceData: AnnounceData) => void;
124
131
  /**
125
132
  * The interface for the map of core API for Editor.
126
133
  * Editor can call call API from this map under EditorCore object
@@ -228,6 +235,12 @@ export interface CoreApiMap {
228
235
  * combined with root selector together to build a separate rule.
229
236
  */
230
237
  setEditorStyle: SetEditorStyle;
238
+ /**
239
+ * Announce the given data
240
+ * @param core The EditorCore object
241
+ * @param announceData Data to announce
242
+ */
243
+ announce: Announce;
231
244
  }
232
245
  /**
233
246
  * Represents the core data structure of an editor
@@ -1 +1 @@
1
- {"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import 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 '../group/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 * 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/**\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"]}
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 '../group/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"]}
@@ -1,3 +1,4 @@
1
+ import type { KnownAnnounceStrings } from '../parameter/AnnounceData';
1
2
  import type { PasteType } from '../enum/PasteType';
2
3
  import type { Colors, ColorTransformFunction } from '../context/DarkColorHandler';
3
4
  import type { EditorPlugin } from './EditorPlugin';
@@ -99,4 +100,10 @@ export interface EditorOptions {
99
100
  * Default paste type. By default will use the normal (as-is) paste type.
100
101
  */
101
102
  defaultPasteType?: PasteType;
103
+ /**
104
+ * A callback to help get string template to announce, used for accessibility
105
+ * @param key The key of known announce data
106
+ * @returns A template string to announce, use placeholder such as "{0}" for variables if necessary
107
+ */
108
+ announcerStringGetter?: (key: KnownAnnounceStrings) => string;
102
109
  }