roosterjs-content-model-types 9.15.0 → 9.16.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.
- package/lib/editor/EditorCore.d.ts +12 -4
- package/lib/editor/EditorCore.js.map +1 -1
- package/lib/editor/IEditor.d.ts +10 -2
- package/lib/editor/IEditor.js.map +1 -1
- package/lib/enum/EntityOperation.d.ts +11 -1
- package/lib/enum/EntityOperation.js.map +1 -1
- package/lib/event/EntityOperationEvent.d.ts +27 -3
- package/lib/event/EntityOperationEvent.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js.map +1 -1
- package/lib/parameter/TrustedHTMLHandler.d.ts +12 -1
- package/lib/parameter/TrustedHTMLHandler.js.map +1 -1
- package/lib-amd/editor/EditorCore.d.ts +12 -4
- package/lib-amd/editor/EditorCore.js.map +1 -1
- package/lib-amd/editor/IEditor.d.ts +10 -2
- package/lib-amd/editor/IEditor.js.map +1 -1
- package/lib-amd/enum/EntityOperation.d.ts +11 -1
- package/lib-amd/enum/EntityOperation.js.map +1 -1
- package/lib-amd/event/EntityOperationEvent.d.ts +27 -3
- package/lib-amd/event/EntityOperationEvent.js.map +1 -1
- package/lib-amd/index.d.ts +3 -3
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/parameter/TrustedHTMLHandler.d.ts +12 -1
- package/lib-amd/parameter/TrustedHTMLHandler.js.map +1 -1
- package/lib-mjs/editor/EditorCore.d.ts +12 -4
- package/lib-mjs/editor/EditorCore.js.map +1 -1
- package/lib-mjs/editor/IEditor.d.ts +10 -2
- package/lib-mjs/editor/IEditor.js.map +1 -1
- package/lib-mjs/enum/EntityOperation.d.ts +11 -1
- package/lib-mjs/enum/EntityOperation.js.map +1 -1
- package/lib-mjs/event/EntityOperationEvent.d.ts +27 -3
- package/lib-mjs/event/EntityOperationEvent.js.map +1 -1
- package/lib-mjs/index.d.ts +3 -3
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/parameter/TrustedHTMLHandler.d.ts +12 -1
- package/lib-mjs/parameter/TrustedHTMLHandler.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ import type { EditorContext } from '../context/EditorContext';
|
|
|
14
14
|
import type { EditorEnvironment } from '../parameter/EditorEnvironment';
|
|
15
15
|
import type { ModelToDomOption } from '../context/ModelToDomOption';
|
|
16
16
|
import type { OnNodeCreated } from '../context/ModelToDomSettings';
|
|
17
|
-
import type {
|
|
17
|
+
import type { DOMCreator, LegacyTrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';
|
|
18
18
|
import type { Rect } from '../parameter/Rect';
|
|
19
19
|
import type { ContentModelFormatter, FormatContentModelOptions } from '../parameter/FormatContentModelOptions';
|
|
20
20
|
/**
|
|
@@ -283,11 +283,19 @@ export interface EditorCore extends PluginState {
|
|
|
283
283
|
*/
|
|
284
284
|
readonly darkColorHandler: DarkColorHandler;
|
|
285
285
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
286
|
+
* @deprecated
|
|
287
|
+
* @see DOMCreator
|
|
288
|
+
* A handler to convert HTML string to a trust string.
|
|
289
|
+
* By default it will just convert the original HTML string into a string directly.
|
|
288
290
|
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
|
|
289
291
|
*/
|
|
290
|
-
readonly trustedHTMLHandler:
|
|
292
|
+
readonly trustedHTMLHandler: LegacyTrustedHTMLHandler;
|
|
293
|
+
/**
|
|
294
|
+
* A handler to convert HTML string to a trust Document.
|
|
295
|
+
* By default it will just convert the original HTML string into a Document object directly.
|
|
296
|
+
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
|
|
297
|
+
*/
|
|
298
|
+
readonly domCreator: DOMCreator;
|
|
291
299
|
/**
|
|
292
300
|
* A helper class to provide DOM access APIs
|
|
293
301
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEvent } from '../event/PluginEvent';\nimport type { PluginState } from '../pluginState/PluginState';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type {\n ContentModelDocument,\n ReadonlyContentModelDocument,\n} from '../contentModel/blockGroup/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The EditorCore object\n * @param saveIndex True to allow saving index info into node using domIndexer, otherwise false\n */\nexport type CreateEditorContext = (core: EditorCore, saveIndex: boolean) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\nexport type CreateContentModel = (\n core: EditorCore,\n option?: DomToModelOptionForCreateModel,\n selectionOverride?: DOMSelection | 'none'\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\nexport type GetDOMSelection = (core: EditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\nexport type SetContentModel = (\n core: EditorCore,\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated,\n isInitializing?: boolean\n) => DOMSelection | null;\n\n/**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\nexport type SetDOMSelection = (\n core: EditorCore,\n selection: DOMSelection | null,\n skipSelectionChangedEvent?: boolean\n) => void;\n\n/**\n * Set a new logical root (most likely due to focus change)\n * @param core The EditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot or null to use physicalRoot as logical root)\n */\nexport type SetLogicalRoot = (core: EditorCore, logicalRoot: HTMLDivElement | null) => void;\n\n/**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\nexport type FormatContentModel = (\n core: EditorCore,\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOptions?: DomToModelOptionForCreateModel\n) => void;\n\n/**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\nexport type SwitchShadowEdit = (core: EditorCore, isOn: boolean) => void;\n\n/**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\nexport type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;\n\n/**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\nexport type AddUndoSnapshot = (\n core: EditorCore,\n canUndoByBackspace: boolean,\n entityStates?: EntityState[]\n) => Snapshot | null;\n\n/**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\nexport type GetVisibleViewport = (core: EditorCore) => Rect | null;\n\n/**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\nexport type Focus = (core: EditorCore) => void;\n\n/**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\nexport type AttachDomEvent = (\n core: EditorCore,\n eventMap: Record<string, DOMEventRecord>\n) => () => void;\n\n/**\n * Restore an undo snapshot into editor\n * @param core The EditorCore object\n * @param step Steps to move, can be 0, positive or negative\n */\nexport type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot) => void;\n\n/**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to remove existing rules\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule. It also accepts pseudo classes \"before\" and \"after\" to create pseudo class rule \"::before\"\n * and \"::after\" to the editor root element itself\n * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only\n */\nexport type SetEditorStyle = (\n core: EditorCore,\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[],\n maxRuleLength?: number\n) => void;\n\n/**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\nexport type Announce = (core: EditorCore, announceData: AnnounceData) => void;\n\n/**\n * The interface for the map of core API for Editor.\n * Editor can call call API from this map under EditorCore object\n */\nexport interface CoreApiMap {\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n */\n createContentModel: CreateContentModel;\n\n /**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\n setContentModel: SetContentModel;\n\n /**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\n setDOMSelection: SetDOMSelection;\n\n /**\n * Set a new logical root (most likely due to focus change)\n * @param core The StandaloneEditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot)\n */\n setLogicalRoot: SetLogicalRoot;\n\n /**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel: FormatContentModel;\n\n /**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\n switchShadowEdit: SwitchShadowEdit;\n\n /**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\n getVisibleViewport: GetVisibleViewport;\n\n /**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\n focus: Focus;\n\n /**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n addUndoSnapshot: AddUndoSnapshot;\n\n /**\n * Restore an undo snapshot into editor\n * @param core The editor core object\n * @param step Steps to move, can be 0, positive or negative\n */\n restoreUndoSnapshot: RestoreUndoSnapshot;\n\n /**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent: AttachDomEvent;\n\n /**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\n triggerEvent: TriggerEvent;\n\n /**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule.\n */\n setEditorStyle: SetEditorStyle;\n\n /**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\n announce: Announce;\n}\n\n/**\n * Represents the core data structure of an editor\n */\nexport interface EditorCore extends PluginState {\n /**\n * The root DIV element of this editor (formerly contentDiv)\n */\n readonly physicalRoot: HTMLDivElement;\n\n /**\n * The content DIV element that operations should be applied to\n * By default, the logical root is the same as the physical root,\n * but if nested editors are used, the logical root changes to that of the inner editor\n */\n logicalRoot: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: CoreApiMap;\n\n /**\n * Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.\n */\n readonly originalApi: CoreApiMap;\n\n /**\n * An array of editor plugins.\n */\n readonly plugins: EditorPlugin[];\n\n /**\n * Editor running environment\n */\n readonly environment: EditorEnvironment;\n\n /**\n * Dark model handler for the editor, used for variable-based solution.\n * If keep it null, editor will still use original dataset-based dark mode solution.\n */\n readonly darkColorHandler: DarkColorHandler;\n\n /**\n * A handler to convert HTML string to a trust HTML string.\n * By default it will just return the original HTML string directly.\n * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n */\n readonly trustedHTMLHandler: TrustedHTMLHandler;\n\n /**\n * A helper class to provide DOM access APIs\n */\n readonly domHelper: DOMHelper;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n readonly disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * An optional callback function that will be invoked before write content model back to editor.\n * This is used for make sure model can satisfy some customized requirement\n * @param model The model to fix up\n */\n readonly onFixUpModel?: (model: ReadonlyContentModelDocument) => void;\n\n /**\n * Enabled experimental features\n */\n readonly experimentalFeatures: ReadonlyArray<string>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEvent } from '../event/PluginEvent';\nimport type { PluginState } from '../pluginState/PluginState';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type {\n ContentModelDocument,\n ReadonlyContentModelDocument,\n} from '../contentModel/blockGroup/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type { DOMCreator, LegacyTrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The EditorCore object\n * @param saveIndex True to allow saving index info into node using domIndexer, otherwise false\n */\nexport type CreateEditorContext = (core: EditorCore, saveIndex: boolean) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\nexport type CreateContentModel = (\n core: EditorCore,\n option?: DomToModelOptionForCreateModel,\n selectionOverride?: DOMSelection | 'none'\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\nexport type GetDOMSelection = (core: EditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\nexport type SetContentModel = (\n core: EditorCore,\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated,\n isInitializing?: boolean\n) => DOMSelection | null;\n\n/**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\nexport type SetDOMSelection = (\n core: EditorCore,\n selection: DOMSelection | null,\n skipSelectionChangedEvent?: boolean\n) => void;\n\n/**\n * Set a new logical root (most likely due to focus change)\n * @param core The EditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot or null to use physicalRoot as logical root)\n */\nexport type SetLogicalRoot = (core: EditorCore, logicalRoot: HTMLDivElement | null) => void;\n\n/**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\nexport type FormatContentModel = (\n core: EditorCore,\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOptions?: DomToModelOptionForCreateModel\n) => void;\n\n/**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\nexport type SwitchShadowEdit = (core: EditorCore, isOn: boolean) => void;\n\n/**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\nexport type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;\n\n/**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\nexport type AddUndoSnapshot = (\n core: EditorCore,\n canUndoByBackspace: boolean,\n entityStates?: EntityState[]\n) => Snapshot | null;\n\n/**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\nexport type GetVisibleViewport = (core: EditorCore) => Rect | null;\n\n/**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\nexport type Focus = (core: EditorCore) => void;\n\n/**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\nexport type AttachDomEvent = (\n core: EditorCore,\n eventMap: Record<string, DOMEventRecord>\n) => () => void;\n\n/**\n * Restore an undo snapshot into editor\n * @param core The EditorCore object\n * @param step Steps to move, can be 0, positive or negative\n */\nexport type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot) => void;\n\n/**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to remove existing rules\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule. It also accepts pseudo classes \"before\" and \"after\" to create pseudo class rule \"::before\"\n * and \"::after\" to the editor root element itself\n * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only\n */\nexport type SetEditorStyle = (\n core: EditorCore,\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[],\n maxRuleLength?: number\n) => void;\n\n/**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\nexport type Announce = (core: EditorCore, announceData: AnnounceData) => void;\n\n/**\n * The interface for the map of core API for Editor.\n * Editor can call call API from this map under EditorCore object\n */\nexport interface CoreApiMap {\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n */\n createContentModel: CreateContentModel;\n\n /**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\n setContentModel: SetContentModel;\n\n /**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\n setDOMSelection: SetDOMSelection;\n\n /**\n * Set a new logical root (most likely due to focus change)\n * @param core The StandaloneEditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot)\n */\n setLogicalRoot: SetLogicalRoot;\n\n /**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel: FormatContentModel;\n\n /**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\n switchShadowEdit: SwitchShadowEdit;\n\n /**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\n getVisibleViewport: GetVisibleViewport;\n\n /**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\n focus: Focus;\n\n /**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n addUndoSnapshot: AddUndoSnapshot;\n\n /**\n * Restore an undo snapshot into editor\n * @param core The editor core object\n * @param step Steps to move, can be 0, positive or negative\n */\n restoreUndoSnapshot: RestoreUndoSnapshot;\n\n /**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent: AttachDomEvent;\n\n /**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\n triggerEvent: TriggerEvent;\n\n /**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule.\n */\n setEditorStyle: SetEditorStyle;\n\n /**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\n announce: Announce;\n}\n\n/**\n * Represents the core data structure of an editor\n */\nexport interface EditorCore extends PluginState {\n /**\n * The root DIV element of this editor (formerly contentDiv)\n */\n readonly physicalRoot: HTMLDivElement;\n\n /**\n * The content DIV element that operations should be applied to\n * By default, the logical root is the same as the physical root,\n * but if nested editors are used, the logical root changes to that of the inner editor\n */\n logicalRoot: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: CoreApiMap;\n\n /**\n * Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.\n */\n readonly originalApi: CoreApiMap;\n\n /**\n * An array of editor plugins.\n */\n readonly plugins: EditorPlugin[];\n\n /**\n * Editor running environment\n */\n readonly environment: EditorEnvironment;\n\n /**\n * Dark model handler for the editor, used for variable-based solution.\n * If keep it null, editor will still use original dataset-based dark mode solution.\n */\n readonly darkColorHandler: DarkColorHandler;\n\n /**\n * @deprecated\n * @see DOMCreator\n * A handler to convert HTML string to a trust string.\n * By default it will just convert the original HTML string into a string directly.\n * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n */\n readonly trustedHTMLHandler: LegacyTrustedHTMLHandler;\n\n /**\n * A handler to convert HTML string to a trust Document.\n * By default it will just convert the original HTML string into a Document object directly.\n * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n */\n readonly domCreator: DOMCreator;\n\n /**\n * A helper class to provide DOM access APIs\n */\n readonly domHelper: DOMHelper;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n readonly disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * An optional callback function that will be invoked before write content model back to editor.\n * This is used for make sure model can satisfy some customized requirement\n * @param model The model to fix up\n */\n readonly onFixUpModel?: (model: ReadonlyContentModelDocument) => void;\n\n /**\n * Enabled experimental features\n */\n readonly experimentalFeatures: ReadonlyArray<string>;\n}\n"]}
|
package/lib/editor/IEditor.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { DOMSelection } from '../selection/DOMSelection';
|
|
|
12
12
|
import type { EditorEnvironment } from '../parameter/EditorEnvironment';
|
|
13
13
|
import type { ContentModelFormatter, FormatContentModelOptions } from '../parameter/FormatContentModelOptions';
|
|
14
14
|
import type { DarkColorHandler } from '../context/DarkColorHandler';
|
|
15
|
-
import type {
|
|
15
|
+
import type { DOMCreator, LegacyTrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';
|
|
16
16
|
import type { Rect } from '../parameter/Rect';
|
|
17
17
|
import type { EntityState } from '../parameter/FormatContentModelContext';
|
|
18
18
|
import type { ExperimentalFeature } from './ExperimentalFeature';
|
|
@@ -156,12 +156,20 @@ export interface IEditor {
|
|
|
156
156
|
*/
|
|
157
157
|
hasFocus(): boolean;
|
|
158
158
|
/**
|
|
159
|
+
* @deprecated use getDOMCreator instead
|
|
159
160
|
* Get a function to convert HTML string to trusted HTML string.
|
|
160
161
|
* By default it will just return the input HTML directly. To override this behavior,
|
|
161
162
|
* pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
|
|
162
163
|
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
|
|
163
164
|
*/
|
|
164
|
-
getTrustedHTMLHandler():
|
|
165
|
+
getTrustedHTMLHandler(): LegacyTrustedHTMLHandler;
|
|
166
|
+
/**
|
|
167
|
+
* Get a function to convert HTML string to a trust Document.
|
|
168
|
+
* By default it will just convert the original HTML string into a Document object directly.
|
|
169
|
+
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
|
|
170
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
|
|
171
|
+
*/
|
|
172
|
+
getDOMCreator(): DOMCreator;
|
|
165
173
|
/**
|
|
166
174
|
* Get the scroll container of the editor
|
|
167
175
|
*/
|
|
@@ -1 +1 @@
|
|
|
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 '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelSegmentFormat } from '../contentModel/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';\nimport type { ExperimentalFeature } from './ExperimentalFeature';\n\n/**\n * An interface of Editor, built on top of Content Model\n */\nexport interface IEditor {\n /**\n * @deprecated Use formatContentModel() instead\n */\n getContentModelCopy(mode: 'connected'): ContentModelDocument;\n\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 * - 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: '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 /**\n * Check if a given feature is enabled\n * @param featureName The name of feature to check\n */\n isExperimentalFeatureEnabled(featureName: ExperimentalFeature | string): boolean;\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 '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelSegmentFormat } from '../contentModel/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 { DOMCreator, LegacyTrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { ExperimentalFeature } from './ExperimentalFeature';\n\n/**\n * An interface of Editor, built on top of Content Model\n */\nexport interface IEditor {\n /**\n * @deprecated Use formatContentModel() instead\n */\n getContentModelCopy(mode: 'connected'): ContentModelDocument;\n\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 * - 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: '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 * @deprecated use getDOMCreator instead\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(): LegacyTrustedHTMLHandler;\n\n /**\n * Get a function to convert HTML string to a trust Document.\n * By default it will just convert the original HTML string into a Document object directly.\n * To override, 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 getDOMCreator(): DOMCreator;\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 /**\n * Check if a given feature is enabled\n * @param featureName The name of feature to check\n */\n isExperimentalFeatureEnabled(featureName: ExperimentalFeature | string): boolean;\n}\n"]}
|
|
@@ -50,7 +50,17 @@ export declare type EntityRemovalOperation =
|
|
|
50
50
|
* which contains some entities.
|
|
51
51
|
*/
|
|
52
52
|
| 'overwrite';
|
|
53
|
+
/**
|
|
54
|
+
* DEfine entity format related operations
|
|
55
|
+
*/
|
|
56
|
+
export declare type EntityFormatOperation =
|
|
57
|
+
/**
|
|
58
|
+
* Tell plugins we are doing format change and an entity is inside the selection.
|
|
59
|
+
* Plugin can handle this event and put root level node (must be under the entity wrapper) into
|
|
60
|
+
* event.formattableRoots so editor will create content models for each root and do format to their contents
|
|
61
|
+
*/
|
|
62
|
+
'beforeFormat';
|
|
53
63
|
/**
|
|
54
64
|
* Define possible operations to an entity
|
|
55
65
|
*/
|
|
56
|
-
export declare type EntityOperation = EntityLifecycleOperation | EntityRemovalOperation;
|
|
66
|
+
export declare type EntityOperation = EntityLifecycleOperation | EntityRemovalOperation | EntityFormatOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityOperation.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/enum/EntityOperation.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Define entity lifecycle related operations\n */\nexport type EntityLifecycleOperation =\n /**\n * Notify plugins that there is a new plugin was added into editor.\n * Plugin can handle this event to entity hydration.\n * This event will be only fired once for each entity DOM node.\n * After undo, or copy/paste, since new DOM nodes were added, this event will be fired\n * for those entities represented by newly added nodes.\n */\n | 'newEntity'\n\n /**\n * Notify plugins that editor is generating HTML content for save.\n * Plugin should use this event to remove any temporary content, and only leave DOM nodes that\n * should be saved as HTML string.\n * This event will provide a cloned DOM tree for each entity, do NOT compare the DOM nodes with cached nodes\n * because it will always return false.\n */\n | 'replaceTemporaryContent'\n\n /**\n * This event is triggered when an undo snapshot is taken while a custom logical root is used\n * Plugins can handle this event to include entity state to include in the snapshot\n */\n | 'snapshotEntityState'\n\n /**\n * Notify plugins that a new entity state need to be updated to an entity.\n * This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity\n */\n | 'updateEntityState'\n\n /**\n * Notify plugins that user is clicking target to an entity\n */\n | 'click';\n\n/**\n * Define entity removal related operations\n */\nexport type EntityRemovalOperation =\n /**\n * Notify plugins that user is removing an entity from its start position using DELETE key\n */\n | 'removeFromStart'\n\n /**\n * Notify plugins that user is remove an entity from its end position using BACKSPACE key\n */\n | 'removeFromEnd'\n\n /**\n * Notify plugins that an entity is being overwritten.\n * This can be caused by key in, cut, paste, delete, backspace ... on a selection\n * which contains some entities.\n */\n | 'overwrite';\n\n/**\n * Define possible operations to an entity\n */\nexport type EntityOperation
|
|
1
|
+
{"version":3,"file":"EntityOperation.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/enum/EntityOperation.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Define entity lifecycle related operations\n */\nexport type EntityLifecycleOperation =\n /**\n * Notify plugins that there is a new plugin was added into editor.\n * Plugin can handle this event to entity hydration.\n * This event will be only fired once for each entity DOM node.\n * After undo, or copy/paste, since new DOM nodes were added, this event will be fired\n * for those entities represented by newly added nodes.\n */\n | 'newEntity'\n\n /**\n * Notify plugins that editor is generating HTML content for save.\n * Plugin should use this event to remove any temporary content, and only leave DOM nodes that\n * should be saved as HTML string.\n * This event will provide a cloned DOM tree for each entity, do NOT compare the DOM nodes with cached nodes\n * because it will always return false.\n */\n | 'replaceTemporaryContent'\n\n /**\n * This event is triggered when an undo snapshot is taken while a custom logical root is used\n * Plugins can handle this event to include entity state to include in the snapshot\n */\n | 'snapshotEntityState'\n\n /**\n * Notify plugins that a new entity state need to be updated to an entity.\n * This is normally happened when user undo/redo the content with an entity snapshot added by a plugin that handles entity\n */\n | 'updateEntityState'\n\n /**\n * Notify plugins that user is clicking target to an entity\n */\n | 'click';\n\n/**\n * Define entity removal related operations\n */\nexport type EntityRemovalOperation =\n /**\n * Notify plugins that user is removing an entity from its start position using DELETE key\n */\n | 'removeFromStart'\n\n /**\n * Notify plugins that user is remove an entity from its end position using BACKSPACE key\n */\n | 'removeFromEnd'\n\n /**\n * Notify plugins that an entity is being overwritten.\n * This can be caused by key in, cut, paste, delete, backspace ... on a selection\n * which contains some entities.\n */\n | 'overwrite';\n\n/**\n * DEfine entity format related operations\n */\nexport type EntityFormatOperation =\n /**\n * Tell plugins we are doing format change and an entity is inside the selection.\n * Plugin can handle this event and put root level node (must be under the entity wrapper) into\n * event.formattableRoots so editor will create content models for each root and do format to their contents\n */\n 'beforeFormat';\n\n/**\n * Define possible operations to an entity\n */\nexport type EntityOperation =\n | EntityLifecycleOperation\n | EntityRemovalOperation\n | EntityFormatOperation;\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { BasePluginEvent } from './BasePluginEvent';
|
|
2
2
|
import type { EntityOperation } from '../enum/EntityOperation';
|
|
3
|
+
import type { DomToModelOption } from '../context/DomToModelOption';
|
|
4
|
+
import type { ModelToDomOption } from '../context/ModelToDomOption';
|
|
3
5
|
/**
|
|
4
6
|
* Represents an entity in editor.
|
|
5
7
|
*/
|
|
@@ -21,9 +23,26 @@ export interface Entity {
|
|
|
21
23
|
*/
|
|
22
24
|
isReadonly: boolean;
|
|
23
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Represent a combination of a root element under an entity and options to do DOM and content model conversion
|
|
28
|
+
*/
|
|
29
|
+
export interface FormattableRoot {
|
|
30
|
+
/**
|
|
31
|
+
* The root element to apply format under an entity
|
|
32
|
+
*/
|
|
33
|
+
element: HTMLElement;
|
|
34
|
+
/**
|
|
35
|
+
* @optional DOM to Content Model option
|
|
36
|
+
*/
|
|
37
|
+
domToModelOptions?: DomToModelOption;
|
|
38
|
+
/**
|
|
39
|
+
* @optional Content Model to DOM option
|
|
40
|
+
*/
|
|
41
|
+
modelToDomOptions?: ModelToDomOption;
|
|
42
|
+
}
|
|
24
43
|
/**
|
|
25
44
|
* Provide a chance for plugins to handle entity related events.
|
|
26
|
-
* See
|
|
45
|
+
* See type EntityOperation for more details about each operation
|
|
27
46
|
*/
|
|
28
47
|
export interface EntityOperationEvent extends BasePluginEvent<'entityOperation'> {
|
|
29
48
|
/**
|
|
@@ -39,14 +58,19 @@ export interface EntityOperationEvent extends BasePluginEvent<'entityOperation'>
|
|
|
39
58
|
*/
|
|
40
59
|
rawEvent?: Event;
|
|
41
60
|
/**
|
|
42
|
-
* For
|
|
61
|
+
* For entity operation "updateEntityState", we use this object to pass the new entity state to plugin.
|
|
43
62
|
* For other operation types, it is not used.
|
|
44
63
|
*/
|
|
45
64
|
state?: string;
|
|
46
65
|
/**
|
|
47
|
-
* For
|
|
66
|
+
* For entity operation "newEntity", plugin can set this property to true then the entity will be persisted.
|
|
48
67
|
* A persisted entity won't be touched during undo/redo, unless it does not exist after undo/redo.
|
|
49
68
|
* For other operation types, this value will be ignored.
|
|
50
69
|
*/
|
|
51
70
|
shouldPersist?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* For entity operation "beforeFormat" (happens when user wants to do format change), we will set this array
|
|
73
|
+
* in event and plugins can check if there is any elements inside the entity that should also apply the format
|
|
74
|
+
*/
|
|
75
|
+
formattableRoots?: FormattableRoot[];
|
|
52
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityOperationEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/EntityOperationEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { BasePluginEvent } from './BasePluginEvent';\nimport type { EntityOperation } from '../enum/EntityOperation';\n\n/**\n * Represents an entity in editor.\n */\nexport interface Entity {\n /**\n * Type of this entity. Specified when insert an entity, can be an valid CSS class-like string.\n */\n type: string;\n /**\n * Id of this entity, generated by editor code and will be unique within an editor\n */\n id: string;\n /**\n * The wrapper DOM node of this entity which holds the info CSS classes of this entity\n */\n wrapper: HTMLElement;\n /**\n * Whether this is a readonly entity\n */\n isReadonly: boolean;\n}\n\n/**\n * Provide a chance for plugins to handle entity related events.\n * See
|
|
1
|
+
{"version":3,"file":"EntityOperationEvent.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/event/EntityOperationEvent.ts"],"names":[],"mappings":"","sourcesContent":["import type { BasePluginEvent } from './BasePluginEvent';\nimport type { EntityOperation } from '../enum/EntityOperation';\nimport type { DomToModelOption } from '../context/DomToModelOption';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\n\n/**\n * Represents an entity in editor.\n */\nexport interface Entity {\n /**\n * Type of this entity. Specified when insert an entity, can be an valid CSS class-like string.\n */\n type: string;\n /**\n * Id of this entity, generated by editor code and will be unique within an editor\n */\n id: string;\n /**\n * The wrapper DOM node of this entity which holds the info CSS classes of this entity\n */\n wrapper: HTMLElement;\n /**\n * Whether this is a readonly entity\n */\n isReadonly: boolean;\n}\n\n/**\n * Represent a combination of a root element under an entity and options to do DOM and content model conversion\n */\nexport interface FormattableRoot {\n /**\n * The root element to apply format under an entity\n */\n element: HTMLElement;\n\n /**\n * @optional DOM to Content Model option\n */\n domToModelOptions?: DomToModelOption;\n\n /**\n * @optional Content Model to DOM option\n */\n modelToDomOptions?: ModelToDomOption;\n}\n\n/**\n * Provide a chance for plugins to handle entity related events.\n * See type EntityOperation for more details about each operation\n */\nexport interface EntityOperationEvent extends BasePluginEvent<'entityOperation'> {\n /**\n * Operation to this entity\n */\n operation: EntityOperation;\n\n /**\n * The entity that editor is operating on\n */\n entity: Entity;\n\n /**\n * Optional raw event. Need to do null check before use its value\n */\n rawEvent?: Event;\n\n /**\n * For entity operation \"updateEntityState\", we use this object to pass the new entity state to plugin.\n * For other operation types, it is not used.\n */\n state?: string;\n\n /**\n * For entity operation \"newEntity\", plugin can set this property to true then the entity will be persisted.\n * A persisted entity won't be touched during undo/redo, unless it does not exist after undo/redo.\n * For other operation types, this value will be ignored.\n */\n shouldPersist?: boolean;\n\n /**\n * For entity operation \"beforeFormat\" (happens when user wants to do format change), we will set this array\n * in event and plugins can check if there is any elements inside the entity that should also apply the format\n */\n formattableRoots?: FormattableRoot[];\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export { TableCellMetadataFormat } from './contentModel/format/metadata/TableCel
|
|
|
56
56
|
export { ContentModelBlockGroupType } from './contentModel/blockGroup/BlockGroupType';
|
|
57
57
|
export { ContentModelBlockType } from './contentModel/block/BlockType';
|
|
58
58
|
export { ContentModelSegmentType } from './contentModel/segment/SegmentType';
|
|
59
|
-
export { EntityLifecycleOperation, EntityOperation, EntityRemovalOperation, } from './enum/EntityOperation';
|
|
59
|
+
export { EntityLifecycleOperation, EntityOperation, EntityRemovalOperation, EntityFormatOperation, } from './enum/EntityOperation';
|
|
60
60
|
export { TableOperation, TableVerticalInsertOperation, TableHorizontalInsertOperation, TableDeleteOperation, TableVerticalMergeOperation, TableHorizontalMergeOperation, TableCellMergeOperation, TableSplitOperation, TableAlignOperation, TableCellHorizontalAlignOperation, TableCellVerticalAlignOperation, } from './enum/TableOperation';
|
|
61
61
|
export { PasteType } from './enum/PasteType';
|
|
62
62
|
export { BorderOperations } from './enum/BorderOperations';
|
|
@@ -150,7 +150,7 @@ export { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRec
|
|
|
150
150
|
export { EdgeLinkPreview } from './parameter/EdgeLinkPreview';
|
|
151
151
|
export { ClipboardData } from './parameter/ClipboardData';
|
|
152
152
|
export { AnnounceData, KnownAnnounceStrings } from './parameter/AnnounceData';
|
|
153
|
-
export { TrustedHTMLHandler } from './parameter/TrustedHTMLHandler';
|
|
153
|
+
export { TrustedHTMLHandler, DOMCreator, LegacyTrustedHTMLHandler, } from './parameter/TrustedHTMLHandler';
|
|
154
154
|
export { Rect } from './parameter/Rect';
|
|
155
155
|
export { ValueSanitizer } from './parameter/ValueSanitizer';
|
|
156
156
|
export { DOMHelper } from './parameter/DOMHelper';
|
|
@@ -176,7 +176,7 @@ export { ContextMenuEvent } from './event/ContextMenuEvent';
|
|
|
176
176
|
export { RewriteFromModelEvent } from './event/RewriteFromModelEvent';
|
|
177
177
|
export { EditImageEvent } from './event/EditImageEvent';
|
|
178
178
|
export { EditorReadyEvent } from './event/EditorReadyEvent';
|
|
179
|
-
export { EntityOperationEvent, Entity } from './event/EntityOperationEvent';
|
|
179
|
+
export { EntityOperationEvent, FormattableRoot, Entity } from './event/EntityOperationEvent';
|
|
180
180
|
export { ExtractContentWithDomEvent } from './event/ExtractContentWithDomEvent';
|
|
181
181
|
export { EditorInputEvent } from './event/EditorInputEvent';
|
|
182
182
|
export { KeyDownEvent, KeyPressEvent, KeyUpEvent, CompositionEndEvent, } from './event/KeyboardEvent';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-types/lib/index.ts"],"names":[],"mappings":"","sourcesContent":["export { ContentModelSegmentFormat } from './contentModel/format/ContentModelSegmentFormat';\nexport {\n ContentModelWithFormat,\n ReadonlyContentModelWithFormat,\n} from './contentModel/format/ContentModelWithFormat';\nexport { ContentModelTableFormat } from './contentModel/format/ContentModelTableFormat';\nexport {\n ContentModelWithDataset,\n ReadonlyContentModelWithDataset,\n ShallowMutableContentModelWithDataset,\n} from './contentModel/format/ContentModelWithDataset';\nexport { ContentModelBlockFormat } from './contentModel/format/ContentModelBlockFormat';\nexport { ContentModelTableCellFormat } from './contentModel/format/ContentModelTableCellFormat';\nexport { ContentModelListItemFormat } from './contentModel/format/ContentModelListItemFormat';\nexport { ContentModelListItemLevelFormat } from './contentModel/format/ContentModelListItemLevelFormat';\nexport { ContentModelHyperLinkFormat } from './contentModel/format/ContentModelHyperLinkFormat';\nexport { ContentModelCodeFormat } from './contentModel/format/ContentModelCodeFormat';\nexport { ContentModelFormatContainerFormat } from './contentModel/format/ContentModelFormatContainerFormat';\nexport { ContentModelDividerFormat } from './contentModel/format/ContentModelDividerFormat';\nexport { ContentModelFormatBase } from './contentModel/format/ContentModelFormatBase';\nexport { ContentModelFormatMap } from './contentModel/format/ContentModelFormatMap';\nexport { ContentModelImageFormat } from './contentModel/format/ContentModelImageFormat';\nexport { ContentModelEntityFormat } from './contentModel/format/ContentModelEntityFormat';\nexport { FormatHandlerTypeMap, FormatKey } from './contentModel/format/FormatHandlerTypeMap';\n\nexport { BackgroundColorFormat } from './contentModel/format/formatParts/BackgroundColorFormat';\nexport { BoldFormat } from './contentModel/format/formatParts/BoldFormat';\nexport { FontFamilyFormat } from './contentModel/format/formatParts/FontFamilyFormat';\nexport { FontSizeFormat } from './contentModel/format/formatParts/FontSizeFormat';\nexport { ItalicFormat } from './contentModel/format/formatParts/ItalicFormat';\nexport { LetterSpacingFormat } from './contentModel/format/formatParts/LetterSpacingFormat';\nexport { LineHeightFormat } from './contentModel/format/formatParts/LineHeightFormat';\nexport { StrikeFormat } from './contentModel/format/formatParts/StrikeFormat';\nexport { SuperOrSubScriptFormat } from './contentModel/format/formatParts/SuperOrSubScriptFormat';\nexport { TextColorFormat } from './contentModel/format/formatParts/TextColorFormat';\nexport { UnderlineFormat } from './contentModel/format/formatParts/UnderlineFormat';\nexport { BorderBoxFormat } from './contentModel/format/formatParts/BorderBoxFormat';\nexport { VerticalAlignFormat } from './contentModel/format/formatParts/VerticalAlignFormat';\nexport { WordBreakFormat } from './contentModel/format/formatParts/WordBreakFormat';\nexport { BorderFormat } from './contentModel/format/formatParts/BorderFormat';\nexport { DirectionFormat } from './contentModel/format/formatParts/DirectionFormat';\nexport { HtmlAlignFormat } from './contentModel/format/formatParts/HtmlAlignFormat';\nexport { MarginFormat } from './contentModel/format/formatParts/MarginFormat';\nexport { PaddingFormat } from './contentModel/format/formatParts/PaddingFormat';\nexport { TextAlignFormat } from './contentModel/format/formatParts/TextAlignFormat';\nexport { TextIndentFormat } from './contentModel/format/formatParts/TextIndentFormat';\nexport { WhiteSpaceFormat } from './contentModel/format/formatParts/WhiteSpaceFormat';\nexport { DisplayFormat } from './contentModel/format/formatParts/DisplayFormat';\nexport { IdFormat } from './contentModel/format/formatParts/IdFormat';\nexport { SpacingFormat } from './contentModel/format/formatParts/SpacingFormat';\nexport { TableLayoutFormat } from './contentModel/format/formatParts/TableLayoutFormat';\nexport { LinkFormat } from './contentModel/format/formatParts/LinkFormat';\nexport { SizeFormat } from './contentModel/format/formatParts/SizeFormat';\nexport { BoxShadowFormat } from './contentModel/format/formatParts/BoxShadowFormat';\nexport { ListThreadFormat } from './contentModel/format/formatParts/ListThreadFormat';\nexport { ListStyleFormat } from './contentModel/format/formatParts/ListStyleFormat';\nexport { FloatFormat } from './contentModel/format/formatParts/FloatFormat';\nexport { EntityInfoFormat } from './contentModel/format/formatParts/EntityInfoFormat';\n\nexport { DatasetFormat, ReadonlyDatasetFormat } from './contentModel/format/metadata/DatasetFormat';\nexport { TableMetadataFormat } from './contentModel/format/metadata/TableMetadataFormat';\nexport { ListMetadataFormat } from './contentModel/format/metadata/ListMetadataFormat';\nexport {\n ImageResizeMetadataFormat,\n ImageCropMetadataFormat,\n ImageMetadataFormat,\n ImageRotateMetadataFormat,\n ImageFlipMetadataFormat,\n} from './contentModel/format/metadata/ImageMetadataFormat';\nexport { TableCellMetadataFormat } from './contentModel/format/metadata/TableCellMetadataFormat';\n\nexport { ContentModelBlockGroupType } from './contentModel/blockGroup/BlockGroupType';\nexport { ContentModelBlockType } from './contentModel/block/BlockType';\nexport { ContentModelSegmentType } from './contentModel/segment/SegmentType';\n\nexport {\n EntityLifecycleOperation,\n EntityOperation,\n EntityRemovalOperation,\n} from './enum/EntityOperation';\nexport {\n TableOperation,\n TableVerticalInsertOperation,\n TableHorizontalInsertOperation,\n TableDeleteOperation,\n TableVerticalMergeOperation,\n TableHorizontalMergeOperation,\n TableCellMergeOperation,\n TableSplitOperation,\n TableAlignOperation,\n TableCellHorizontalAlignOperation,\n TableCellVerticalAlignOperation,\n} from './enum/TableOperation';\nexport { PasteType } from './enum/PasteType';\nexport { BorderOperations } from './enum/BorderOperations';\nexport { DeleteResult } from './enum/DeleteResult';\nexport { InsertEntityPosition } from './enum/InsertEntityPosition';\nexport { ExportContentMode } from './enum/ExportContentMode';\n\nexport {\n ContentModelBlock,\n ReadonlyContentModelBlock,\n ShallowMutableContentModelBlock,\n} from './contentModel/block/ContentModelBlock';\nexport {\n ContentModelParagraph,\n ContentModelParagraphCommon,\n ReadonlyContentModelParagraph,\n ShallowMutableContentModelParagraph,\n} from './contentModel/block/ContentModelParagraph';\nexport {\n ContentModelTable,\n ReadonlyContentModelTable,\n ShallowMutableContentModelTable,\n} from './contentModel/block/ContentModelTable';\nexport {\n ContentModelDivider,\n ContentModelDividerCommon,\n ReadonlyContentModelDivider,\n} from './contentModel/block/ContentModelDivider';\nexport {\n ContentModelBlockBase,\n ContentModelBlockBaseCommon,\n ReadonlyContentModelBlockBase,\n ShallowMutableContentModelBlockBase,\n} from './contentModel/block/ContentModelBlockBase';\nexport { ContentModelBlockWithCache } from './contentModel/common/ContentModelBlockWithCache';\nexport {\n ContentModelTableRow,\n ContentModelTableRowCommon,\n ReadonlyContentModelTableRow,\n ShallowMutableContentModelTableRow,\n} from './contentModel/block/ContentModelTableRow';\n\nexport { ContentModelEntity } from './contentModel/entity/ContentModelEntity';\n\nexport {\n ContentModelDocument,\n ContentModelDocumentCommon,\n ReadonlyContentModelDocument,\n ShallowMutableContentModelDocument,\n} from './contentModel/blockGroup/ContentModelDocument';\nexport {\n ContentModelBlockGroupBase,\n ContentModelBlockGroupBaseCommon,\n ReadonlyContentModelBlockGroupBase,\n ShallowMutableContentModelBlockGroupBase,\n} from './contentModel/blockGroup/ContentModelBlockGroupBase';\nexport {\n ContentModelFormatContainer,\n ContentModelFormatContainerCommon,\n ReadonlyContentModelFormatContainer,\n ShallowMutableContentModelFormatContainer,\n} from './contentModel/blockGroup/ContentModelFormatContainer';\nexport {\n ContentModelGeneralBlock,\n ContentModelGeneralBlockCommon,\n ReadonlyContentModelGeneralBlock,\n ShallowMutableContentModelGeneralBlock,\n} from './contentModel/blockGroup/ContentModelGeneralBlock';\nexport {\n ContentModelListItem,\n ReadonlyContentModelListItem,\n ShallowMutableContentModelListItem,\n} from './contentModel/blockGroup/ContentModelListItem';\nexport {\n ContentModelTableCell,\n ContentModelTableCellCommon,\n ReadonlyContentModelTableCell,\n ShallowMutableContentModelTableCell,\n} from './contentModel/blockGroup/ContentModelTableCell';\nexport {\n ContentModelBlockGroup,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelBlockGroup,\n} from './contentModel/blockGroup/ContentModelBlockGroup';\n\nexport { ContentModelBr, ReadonlyContentModelBr } from './contentModel/segment/ContentModelBr';\nexport {\n ContentModelGeneralSegment,\n ReadonlyContentModelGeneralSegment,\n ShallowMutableContentModelGeneralSegment,\n} from './contentModel/segment/ContentModelGeneralSegment';\nexport {\n ContentModelImage,\n ContentModelImageCommon,\n ReadonlyContentModelImage,\n} from './contentModel/segment/ContentModelImage';\nexport {\n ContentModelText,\n ContentModelTextCommon,\n ReadonlyContentModelText,\n} from './contentModel/segment/ContentModelText';\nexport {\n ContentModelSelectionMarker,\n ReadonlyContentModelSelectionMarker,\n} from './contentModel/segment/ContentModelSelectionMarker';\nexport {\n ContentModelSegmentBase,\n ContentModelSegmentBaseCommon,\n ReadonlyContentModelSegmentBase,\n ShallowMutableContentModelSegmentBase,\n} from './contentModel/segment/ContentModelSegmentBase';\nexport {\n ContentModelSegment,\n ReadonlyContentModelSegment,\n ShallowMutableContentModelSegment,\n} from './contentModel/segment/ContentModelSegment';\n\nexport {\n ContentModelCode,\n ReadonlyContentModelCode,\n} from './contentModel/decorator/ContentModelCode';\nexport {\n ContentModelLink,\n ReadonlyContentModelLink,\n} from './contentModel/decorator/ContentModelLink';\nexport {\n ContentModelParagraphDecorator,\n ContentModelParagraphDecoratorCommon,\n ReadonlyContentModelParagraphDecorator,\n} from './contentModel/decorator/ContentModelParagraphDecorator';\nexport {\n ContentModelDecorator,\n ReadonlyContentModelDecorator,\n} from './contentModel/decorator/ContentModelDecorator';\nexport {\n ContentModelListLevel,\n ContentModelListLevelCommon,\n ReadonlyContentModelListLevel,\n} from './contentModel/decorator/ContentModelListLevel';\n\nexport {\n Selectable,\n ReadonlySelectable,\n ShallowMutableSelectable,\n} from './contentModel/common/Selectable';\nexport { MutableMark, ShallowMutableMark, ReadonlyMark } from './contentModel/common/MutableMark';\nexport { MutableType } from './contentModel/common/MutableType';\n\nexport {\n DOMSelection,\n SelectionType,\n SelectionBase,\n ImageSelection,\n RangeSelection,\n TableSelection,\n DOMInsertPoint,\n} from './selection/DOMSelection';\nexport { InsertPoint } from './selection/InsertPoint';\nexport {\n TableSelectionContext,\n ReadonlyTableSelectionContext,\n} from './selection/TableSelectionContext';\nexport { TableSelectionCoordinates } from './selection/TableSelectionCoordinates';\n\nexport {\n ContentModelHandlerMap,\n DefaultImplicitFormatMap,\n FormatAppliers,\n FormatAppliersPerCategory,\n OnNodeCreated,\n ModelToDomSettings,\n FormatApplier,\n ApplyMetadata,\n MetadataApplier,\n MetadataAppliers,\n TextFormatApplier,\n ElementFormatAppliersPerCategory,\n} from './context/ModelToDomSettings';\nexport {\n DefaultStyleMap,\n ElementProcessorMap,\n FormatParsers,\n FormatParsersPerCategory,\n DomToModelSettings,\n FormatParser,\n TextFormatParser,\n ElementFormatParserPerCategory,\n} from './context/DomToModelSettings';\nexport { DomToModelContext } from './context/DomToModelContext';\nexport { ElementProcessor } from './context/ElementProcessor';\nexport { DomToModelSelectionContext } from './context/DomToModelSelectionContext';\nexport { EditorContext } from './context/EditorContext';\nexport {\n DomToModelFormatContext,\n DomToModelDecoratorContext,\n DomToModelListFormat,\n} from './context/DomToModelFormatContext';\nexport { ModelToDomContext } from './context/ModelToDomContext';\nexport {\n ModelToDomBlockAndSegmentNode,\n ModelToDomRegularSelection,\n ModelToDomSelectionContext,\n} from './context/ModelToDomSelectionContext';\nexport {\n ModelToDomListStackItem,\n ModelToDomListContext,\n ModelToDomFormatContext,\n} from './context/ModelToDomFormatContext';\nexport { RewriteFromModel, RewriteFromModelContext } from './context/RewriteFromModel';\nexport {\n ContentModelHandler,\n ContentModelSegmentHandler,\n ContentModelBlockHandler,\n} from './context/ContentModelHandler';\nexport {\n DomToModelOption,\n DomToModelOptionForSanitizing,\n DomToModelOptionForCreateModel,\n} from './context/DomToModelOption';\nexport { ModelToDomOption } from './context/ModelToDomOption';\nexport { DomIndexer } from './context/DomIndexer';\nexport { TextMutationObserver } from './context/TextMutationObserver';\n\nexport { DefinitionType } from './metadata/DefinitionType';\nexport {\n ArrayItemType,\n DefinitionBase,\n StringDefinition,\n NumberDefinition,\n BooleanDefinition,\n ArrayDefinition,\n ObjectPropertyDefinition,\n ObjectDefinition,\n Definition,\n} from './metadata/Definition';\nexport { DarkColorHandler, Colors, ColorTransformFunction } from './context/DarkColorHandler';\n\nexport { IEditor } from './editor/IEditor';\nexport { ExperimentalFeature } from './editor/ExperimentalFeature';\nexport {\n EditorOptions,\n ColorOptions,\n ContentModelOptions,\n SelectionOptions,\n PasteOptions,\n EditorBaseOptions,\n} from './editor/EditorOptions';\nexport {\n CreateContentModel,\n CreateEditorContext,\n GetDOMSelection,\n SetContentModel,\n SetDOMSelection,\n SetLogicalRoot,\n FormatContentModel,\n CoreApiMap,\n EditorCore,\n SwitchShadowEdit,\n TriggerEvent,\n AddUndoSnapshot,\n Focus,\n AttachDomEvent,\n RestoreUndoSnapshot,\n GetVisibleViewport,\n SetEditorStyle,\n Announce,\n} from './editor/EditorCore';\nexport { EditorCorePlugins } from './editor/EditorCorePlugins';\nexport { EditorPlugin } from './editor/EditorPlugin';\nexport { PluginWithState } from './editor/PluginWithState';\nexport { ContextMenuProvider } from './editor/ContextMenuProvider';\n\nexport {\n CachePluginState,\n RangeSelectionForCache,\n CacheSelection,\n} from './pluginState/CachePluginState';\nexport { FormatPluginState, PendingFormat } from './pluginState/FormatPluginState';\nexport { CopyPastePluginState } from './pluginState/CopyPastePluginState';\nexport { DOMEventPluginState } from './pluginState/DOMEventPluginState';\nexport { LifecyclePluginState } from './pluginState/LifecyclePluginState';\nexport { EntityPluginState, KnownEntityItem } from './pluginState/EntityPluginState';\nexport {\n SelectionPluginState,\n TableSelectionInfo,\n TableCellCoordinate,\n} from './pluginState/SelectionPluginState';\nexport { UndoPluginState } from './pluginState/UndoPluginState';\nexport {\n PluginKey,\n KeyOfStatePlugin,\n TypeOfStatePlugin,\n StatePluginKeys,\n GenericPluginState,\n PluginState,\n} from './pluginState/PluginState';\nexport { ContextMenuPluginState } from './pluginState/ContextMenuPluginState';\n\nexport { AutoLinkOptions } from './parameter/AutoLinkOptions';\nexport { EditorEnvironment, ContentModelSettings } from './parameter/EditorEnvironment';\nexport {\n EntityState,\n DeletedEntity,\n FormatContentModelContext,\n} from './parameter/FormatContentModelContext';\nexport {\n FormatContentModelOptions,\n ContentModelFormatter,\n} from './parameter/FormatContentModelOptions';\nexport { ContentModelFormatState } from './parameter/ContentModelFormatState';\nexport { PasteTypeOrGetter } from './parameter/PasteTypeOrGetter';\nexport { ImageFormatState } from './parameter/ImageFormatState';\nexport { Border } from './parameter/Border';\nexport { InsertEntityOptions } from './parameter/InsertEntityOptions';\nexport {\n DeleteSelectionContext,\n DeleteSelectionResult,\n DeleteSelectionStep,\n ValidDeleteSelectionContext,\n} from './parameter/DeleteSelectionStep';\nexport {\n SnapshotSelectionBase,\n RangeSnapshotSelection,\n ImageSnapshotSelection,\n TableSnapshotSelection,\n SnapshotSelection,\n Snapshot,\n Snapshots,\n} from './parameter/Snapshot';\nexport { SnapshotsManager } from './parameter/SnapshotsManager';\nexport { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRecord';\nexport { EdgeLinkPreview } from './parameter/EdgeLinkPreview';\nexport { ClipboardData } from './parameter/ClipboardData';\nexport { AnnounceData, KnownAnnounceStrings } from './parameter/AnnounceData';\nexport { TrustedHTMLHandler } from './parameter/TrustedHTMLHandler';\nexport { Rect } from './parameter/Rect';\nexport { ValueSanitizer } from './parameter/ValueSanitizer';\nexport { DOMHelper } from './parameter/DOMHelper';\nexport { ImageEditOperation, ImageEditor } from './parameter/ImageEditor';\nexport { CachedElementHandler, CloneModelOptions } from './parameter/CloneModelOptions';\nexport { LinkData } from './parameter/LinkData';\nexport { MergeModelOption } from './parameter/MergeModelOption';\nexport {\n IterateSelectionsCallback,\n IterateSelectionsOption,\n ReadonlyIterateSelectionsCallback,\n} from './parameter/IterateSelectionsOption';\nexport { NodeTypeMap } from './parameter/NodeTypeMap';\nexport { TypeOfBlockGroup } from './parameter/TypeOfBlockGroup';\nexport { OperationalBlocks, ReadonlyOperationalBlocks } from './parameter/OperationalBlocks';\nexport { ParsedTable, ParsedTableCell } from './parameter/ParsedTable';\nexport {\n ModelToTextCallback,\n ModelToTextCallbacks,\n ModelToTextChecker,\n} from './parameter/ModelToTextCallbacks';\nexport { ConflictFormatSolution } from './parameter/ConflictFormatSolution';\n\nexport { BasePluginEvent, BasePluginDomEvent } from './event/BasePluginEvent';\nexport { BeforeCutCopyEvent } from './event/BeforeCutCopyEvent';\nexport { BeforeDisposeEvent } from './event/BeforeDisposeEvent';\nexport { BeforeKeyboardEditingEvent } from './event/BeforeKeyboardEditingEvent';\nexport { BeforePasteEvent, MergePastedContentFunc } from './event/BeforePasteEvent';\nexport { BeforeSetContentEvent } from './event/BeforeSetContentEvent';\nexport { ContentChangedEvent, ChangedEntity } from './event/ContentChangedEvent';\nexport { ContextMenuEvent } from './event/ContextMenuEvent';\nexport { RewriteFromModelEvent } from './event/RewriteFromModelEvent';\nexport { EditImageEvent } from './event/EditImageEvent';\nexport { EditorReadyEvent } from './event/EditorReadyEvent';\nexport { EntityOperationEvent, Entity } from './event/EntityOperationEvent';\nexport { ExtractContentWithDomEvent } from './event/ExtractContentWithDomEvent';\nexport { EditorInputEvent } from './event/EditorInputEvent';\nexport {\n KeyDownEvent,\n KeyPressEvent,\n KeyUpEvent,\n CompositionEndEvent,\n} from './event/KeyboardEvent';\nexport { LogicalRootChangedEvent } from './event/LogicalRootChangedEvent';\nexport { MouseDownEvent, MouseUpEvent } from './event/MouseEvent';\nexport { PluginEvent } from './event/PluginEvent';\nexport {\n PluginEventData,\n PluginEventFromTypeGeneric,\n PluginEventFromType,\n PluginEventDataGeneric,\n} from './event/PluginEventData';\nexport { PluginEventType } from './event/PluginEventType';\nexport { ScrollEvent } from './event/ScrollEvent';\nexport { SelectionChangedEvent } from './event/SelectionChangedEvent';\nexport { EnterShadowEditEvent, LeaveShadowEditEvent } from './event/ShadowEditEvent';\nexport { ZoomChangedEvent } from './event/ZoomChangedEvent';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-types/lib/index.ts"],"names":[],"mappings":"","sourcesContent":["export { ContentModelSegmentFormat } from './contentModel/format/ContentModelSegmentFormat';\nexport {\n ContentModelWithFormat,\n ReadonlyContentModelWithFormat,\n} from './contentModel/format/ContentModelWithFormat';\nexport { ContentModelTableFormat } from './contentModel/format/ContentModelTableFormat';\nexport {\n ContentModelWithDataset,\n ReadonlyContentModelWithDataset,\n ShallowMutableContentModelWithDataset,\n} from './contentModel/format/ContentModelWithDataset';\nexport { ContentModelBlockFormat } from './contentModel/format/ContentModelBlockFormat';\nexport { ContentModelTableCellFormat } from './contentModel/format/ContentModelTableCellFormat';\nexport { ContentModelListItemFormat } from './contentModel/format/ContentModelListItemFormat';\nexport { ContentModelListItemLevelFormat } from './contentModel/format/ContentModelListItemLevelFormat';\nexport { ContentModelHyperLinkFormat } from './contentModel/format/ContentModelHyperLinkFormat';\nexport { ContentModelCodeFormat } from './contentModel/format/ContentModelCodeFormat';\nexport { ContentModelFormatContainerFormat } from './contentModel/format/ContentModelFormatContainerFormat';\nexport { ContentModelDividerFormat } from './contentModel/format/ContentModelDividerFormat';\nexport { ContentModelFormatBase } from './contentModel/format/ContentModelFormatBase';\nexport { ContentModelFormatMap } from './contentModel/format/ContentModelFormatMap';\nexport { ContentModelImageFormat } from './contentModel/format/ContentModelImageFormat';\nexport { ContentModelEntityFormat } from './contentModel/format/ContentModelEntityFormat';\nexport { FormatHandlerTypeMap, FormatKey } from './contentModel/format/FormatHandlerTypeMap';\n\nexport { BackgroundColorFormat } from './contentModel/format/formatParts/BackgroundColorFormat';\nexport { BoldFormat } from './contentModel/format/formatParts/BoldFormat';\nexport { FontFamilyFormat } from './contentModel/format/formatParts/FontFamilyFormat';\nexport { FontSizeFormat } from './contentModel/format/formatParts/FontSizeFormat';\nexport { ItalicFormat } from './contentModel/format/formatParts/ItalicFormat';\nexport { LetterSpacingFormat } from './contentModel/format/formatParts/LetterSpacingFormat';\nexport { LineHeightFormat } from './contentModel/format/formatParts/LineHeightFormat';\nexport { StrikeFormat } from './contentModel/format/formatParts/StrikeFormat';\nexport { SuperOrSubScriptFormat } from './contentModel/format/formatParts/SuperOrSubScriptFormat';\nexport { TextColorFormat } from './contentModel/format/formatParts/TextColorFormat';\nexport { UnderlineFormat } from './contentModel/format/formatParts/UnderlineFormat';\nexport { BorderBoxFormat } from './contentModel/format/formatParts/BorderBoxFormat';\nexport { VerticalAlignFormat } from './contentModel/format/formatParts/VerticalAlignFormat';\nexport { WordBreakFormat } from './contentModel/format/formatParts/WordBreakFormat';\nexport { BorderFormat } from './contentModel/format/formatParts/BorderFormat';\nexport { DirectionFormat } from './contentModel/format/formatParts/DirectionFormat';\nexport { HtmlAlignFormat } from './contentModel/format/formatParts/HtmlAlignFormat';\nexport { MarginFormat } from './contentModel/format/formatParts/MarginFormat';\nexport { PaddingFormat } from './contentModel/format/formatParts/PaddingFormat';\nexport { TextAlignFormat } from './contentModel/format/formatParts/TextAlignFormat';\nexport { TextIndentFormat } from './contentModel/format/formatParts/TextIndentFormat';\nexport { WhiteSpaceFormat } from './contentModel/format/formatParts/WhiteSpaceFormat';\nexport { DisplayFormat } from './contentModel/format/formatParts/DisplayFormat';\nexport { IdFormat } from './contentModel/format/formatParts/IdFormat';\nexport { SpacingFormat } from './contentModel/format/formatParts/SpacingFormat';\nexport { TableLayoutFormat } from './contentModel/format/formatParts/TableLayoutFormat';\nexport { LinkFormat } from './contentModel/format/formatParts/LinkFormat';\nexport { SizeFormat } from './contentModel/format/formatParts/SizeFormat';\nexport { BoxShadowFormat } from './contentModel/format/formatParts/BoxShadowFormat';\nexport { ListThreadFormat } from './contentModel/format/formatParts/ListThreadFormat';\nexport { ListStyleFormat } from './contentModel/format/formatParts/ListStyleFormat';\nexport { FloatFormat } from './contentModel/format/formatParts/FloatFormat';\nexport { EntityInfoFormat } from './contentModel/format/formatParts/EntityInfoFormat';\n\nexport { DatasetFormat, ReadonlyDatasetFormat } from './contentModel/format/metadata/DatasetFormat';\nexport { TableMetadataFormat } from './contentModel/format/metadata/TableMetadataFormat';\nexport { ListMetadataFormat } from './contentModel/format/metadata/ListMetadataFormat';\nexport {\n ImageResizeMetadataFormat,\n ImageCropMetadataFormat,\n ImageMetadataFormat,\n ImageRotateMetadataFormat,\n ImageFlipMetadataFormat,\n} from './contentModel/format/metadata/ImageMetadataFormat';\nexport { TableCellMetadataFormat } from './contentModel/format/metadata/TableCellMetadataFormat';\n\nexport { ContentModelBlockGroupType } from './contentModel/blockGroup/BlockGroupType';\nexport { ContentModelBlockType } from './contentModel/block/BlockType';\nexport { ContentModelSegmentType } from './contentModel/segment/SegmentType';\n\nexport {\n EntityLifecycleOperation,\n EntityOperation,\n EntityRemovalOperation,\n EntityFormatOperation,\n} from './enum/EntityOperation';\nexport {\n TableOperation,\n TableVerticalInsertOperation,\n TableHorizontalInsertOperation,\n TableDeleteOperation,\n TableVerticalMergeOperation,\n TableHorizontalMergeOperation,\n TableCellMergeOperation,\n TableSplitOperation,\n TableAlignOperation,\n TableCellHorizontalAlignOperation,\n TableCellVerticalAlignOperation,\n} from './enum/TableOperation';\nexport { PasteType } from './enum/PasteType';\nexport { BorderOperations } from './enum/BorderOperations';\nexport { DeleteResult } from './enum/DeleteResult';\nexport { InsertEntityPosition } from './enum/InsertEntityPosition';\nexport { ExportContentMode } from './enum/ExportContentMode';\n\nexport {\n ContentModelBlock,\n ReadonlyContentModelBlock,\n ShallowMutableContentModelBlock,\n} from './contentModel/block/ContentModelBlock';\nexport {\n ContentModelParagraph,\n ContentModelParagraphCommon,\n ReadonlyContentModelParagraph,\n ShallowMutableContentModelParagraph,\n} from './contentModel/block/ContentModelParagraph';\nexport {\n ContentModelTable,\n ReadonlyContentModelTable,\n ShallowMutableContentModelTable,\n} from './contentModel/block/ContentModelTable';\nexport {\n ContentModelDivider,\n ContentModelDividerCommon,\n ReadonlyContentModelDivider,\n} from './contentModel/block/ContentModelDivider';\nexport {\n ContentModelBlockBase,\n ContentModelBlockBaseCommon,\n ReadonlyContentModelBlockBase,\n ShallowMutableContentModelBlockBase,\n} from './contentModel/block/ContentModelBlockBase';\nexport { ContentModelBlockWithCache } from './contentModel/common/ContentModelBlockWithCache';\nexport {\n ContentModelTableRow,\n ContentModelTableRowCommon,\n ReadonlyContentModelTableRow,\n ShallowMutableContentModelTableRow,\n} from './contentModel/block/ContentModelTableRow';\n\nexport { ContentModelEntity } from './contentModel/entity/ContentModelEntity';\n\nexport {\n ContentModelDocument,\n ContentModelDocumentCommon,\n ReadonlyContentModelDocument,\n ShallowMutableContentModelDocument,\n} from './contentModel/blockGroup/ContentModelDocument';\nexport {\n ContentModelBlockGroupBase,\n ContentModelBlockGroupBaseCommon,\n ReadonlyContentModelBlockGroupBase,\n ShallowMutableContentModelBlockGroupBase,\n} from './contentModel/blockGroup/ContentModelBlockGroupBase';\nexport {\n ContentModelFormatContainer,\n ContentModelFormatContainerCommon,\n ReadonlyContentModelFormatContainer,\n ShallowMutableContentModelFormatContainer,\n} from './contentModel/blockGroup/ContentModelFormatContainer';\nexport {\n ContentModelGeneralBlock,\n ContentModelGeneralBlockCommon,\n ReadonlyContentModelGeneralBlock,\n ShallowMutableContentModelGeneralBlock,\n} from './contentModel/blockGroup/ContentModelGeneralBlock';\nexport {\n ContentModelListItem,\n ReadonlyContentModelListItem,\n ShallowMutableContentModelListItem,\n} from './contentModel/blockGroup/ContentModelListItem';\nexport {\n ContentModelTableCell,\n ContentModelTableCellCommon,\n ReadonlyContentModelTableCell,\n ShallowMutableContentModelTableCell,\n} from './contentModel/blockGroup/ContentModelTableCell';\nexport {\n ContentModelBlockGroup,\n ReadonlyContentModelBlockGroup,\n ShallowMutableContentModelBlockGroup,\n} from './contentModel/blockGroup/ContentModelBlockGroup';\n\nexport { ContentModelBr, ReadonlyContentModelBr } from './contentModel/segment/ContentModelBr';\nexport {\n ContentModelGeneralSegment,\n ReadonlyContentModelGeneralSegment,\n ShallowMutableContentModelGeneralSegment,\n} from './contentModel/segment/ContentModelGeneralSegment';\nexport {\n ContentModelImage,\n ContentModelImageCommon,\n ReadonlyContentModelImage,\n} from './contentModel/segment/ContentModelImage';\nexport {\n ContentModelText,\n ContentModelTextCommon,\n ReadonlyContentModelText,\n} from './contentModel/segment/ContentModelText';\nexport {\n ContentModelSelectionMarker,\n ReadonlyContentModelSelectionMarker,\n} from './contentModel/segment/ContentModelSelectionMarker';\nexport {\n ContentModelSegmentBase,\n ContentModelSegmentBaseCommon,\n ReadonlyContentModelSegmentBase,\n ShallowMutableContentModelSegmentBase,\n} from './contentModel/segment/ContentModelSegmentBase';\nexport {\n ContentModelSegment,\n ReadonlyContentModelSegment,\n ShallowMutableContentModelSegment,\n} from './contentModel/segment/ContentModelSegment';\n\nexport {\n ContentModelCode,\n ReadonlyContentModelCode,\n} from './contentModel/decorator/ContentModelCode';\nexport {\n ContentModelLink,\n ReadonlyContentModelLink,\n} from './contentModel/decorator/ContentModelLink';\nexport {\n ContentModelParagraphDecorator,\n ContentModelParagraphDecoratorCommon,\n ReadonlyContentModelParagraphDecorator,\n} from './contentModel/decorator/ContentModelParagraphDecorator';\nexport {\n ContentModelDecorator,\n ReadonlyContentModelDecorator,\n} from './contentModel/decorator/ContentModelDecorator';\nexport {\n ContentModelListLevel,\n ContentModelListLevelCommon,\n ReadonlyContentModelListLevel,\n} from './contentModel/decorator/ContentModelListLevel';\n\nexport {\n Selectable,\n ReadonlySelectable,\n ShallowMutableSelectable,\n} from './contentModel/common/Selectable';\nexport { MutableMark, ShallowMutableMark, ReadonlyMark } from './contentModel/common/MutableMark';\nexport { MutableType } from './contentModel/common/MutableType';\n\nexport {\n DOMSelection,\n SelectionType,\n SelectionBase,\n ImageSelection,\n RangeSelection,\n TableSelection,\n DOMInsertPoint,\n} from './selection/DOMSelection';\nexport { InsertPoint } from './selection/InsertPoint';\nexport {\n TableSelectionContext,\n ReadonlyTableSelectionContext,\n} from './selection/TableSelectionContext';\nexport { TableSelectionCoordinates } from './selection/TableSelectionCoordinates';\n\nexport {\n ContentModelHandlerMap,\n DefaultImplicitFormatMap,\n FormatAppliers,\n FormatAppliersPerCategory,\n OnNodeCreated,\n ModelToDomSettings,\n FormatApplier,\n ApplyMetadata,\n MetadataApplier,\n MetadataAppliers,\n TextFormatApplier,\n ElementFormatAppliersPerCategory,\n} from './context/ModelToDomSettings';\nexport {\n DefaultStyleMap,\n ElementProcessorMap,\n FormatParsers,\n FormatParsersPerCategory,\n DomToModelSettings,\n FormatParser,\n TextFormatParser,\n ElementFormatParserPerCategory,\n} from './context/DomToModelSettings';\nexport { DomToModelContext } from './context/DomToModelContext';\nexport { ElementProcessor } from './context/ElementProcessor';\nexport { DomToModelSelectionContext } from './context/DomToModelSelectionContext';\nexport { EditorContext } from './context/EditorContext';\nexport {\n DomToModelFormatContext,\n DomToModelDecoratorContext,\n DomToModelListFormat,\n} from './context/DomToModelFormatContext';\nexport { ModelToDomContext } from './context/ModelToDomContext';\nexport {\n ModelToDomBlockAndSegmentNode,\n ModelToDomRegularSelection,\n ModelToDomSelectionContext,\n} from './context/ModelToDomSelectionContext';\nexport {\n ModelToDomListStackItem,\n ModelToDomListContext,\n ModelToDomFormatContext,\n} from './context/ModelToDomFormatContext';\nexport { RewriteFromModel, RewriteFromModelContext } from './context/RewriteFromModel';\nexport {\n ContentModelHandler,\n ContentModelSegmentHandler,\n ContentModelBlockHandler,\n} from './context/ContentModelHandler';\nexport {\n DomToModelOption,\n DomToModelOptionForSanitizing,\n DomToModelOptionForCreateModel,\n} from './context/DomToModelOption';\nexport { ModelToDomOption } from './context/ModelToDomOption';\nexport { DomIndexer } from './context/DomIndexer';\nexport { TextMutationObserver } from './context/TextMutationObserver';\n\nexport { DefinitionType } from './metadata/DefinitionType';\nexport {\n ArrayItemType,\n DefinitionBase,\n StringDefinition,\n NumberDefinition,\n BooleanDefinition,\n ArrayDefinition,\n ObjectPropertyDefinition,\n ObjectDefinition,\n Definition,\n} from './metadata/Definition';\nexport { DarkColorHandler, Colors, ColorTransformFunction } from './context/DarkColorHandler';\n\nexport { IEditor } from './editor/IEditor';\nexport { ExperimentalFeature } from './editor/ExperimentalFeature';\nexport {\n EditorOptions,\n ColorOptions,\n ContentModelOptions,\n SelectionOptions,\n PasteOptions,\n EditorBaseOptions,\n} from './editor/EditorOptions';\nexport {\n CreateContentModel,\n CreateEditorContext,\n GetDOMSelection,\n SetContentModel,\n SetDOMSelection,\n SetLogicalRoot,\n FormatContentModel,\n CoreApiMap,\n EditorCore,\n SwitchShadowEdit,\n TriggerEvent,\n AddUndoSnapshot,\n Focus,\n AttachDomEvent,\n RestoreUndoSnapshot,\n GetVisibleViewport,\n SetEditorStyle,\n Announce,\n} from './editor/EditorCore';\nexport { EditorCorePlugins } from './editor/EditorCorePlugins';\nexport { EditorPlugin } from './editor/EditorPlugin';\nexport { PluginWithState } from './editor/PluginWithState';\nexport { ContextMenuProvider } from './editor/ContextMenuProvider';\n\nexport {\n CachePluginState,\n RangeSelectionForCache,\n CacheSelection,\n} from './pluginState/CachePluginState';\nexport { FormatPluginState, PendingFormat } from './pluginState/FormatPluginState';\nexport { CopyPastePluginState } from './pluginState/CopyPastePluginState';\nexport { DOMEventPluginState } from './pluginState/DOMEventPluginState';\nexport { LifecyclePluginState } from './pluginState/LifecyclePluginState';\nexport { EntityPluginState, KnownEntityItem } from './pluginState/EntityPluginState';\nexport {\n SelectionPluginState,\n TableSelectionInfo,\n TableCellCoordinate,\n} from './pluginState/SelectionPluginState';\nexport { UndoPluginState } from './pluginState/UndoPluginState';\nexport {\n PluginKey,\n KeyOfStatePlugin,\n TypeOfStatePlugin,\n StatePluginKeys,\n GenericPluginState,\n PluginState,\n} from './pluginState/PluginState';\nexport { ContextMenuPluginState } from './pluginState/ContextMenuPluginState';\n\nexport { AutoLinkOptions } from './parameter/AutoLinkOptions';\nexport { EditorEnvironment, ContentModelSettings } from './parameter/EditorEnvironment';\nexport {\n EntityState,\n DeletedEntity,\n FormatContentModelContext,\n} from './parameter/FormatContentModelContext';\nexport {\n FormatContentModelOptions,\n ContentModelFormatter,\n} from './parameter/FormatContentModelOptions';\nexport { ContentModelFormatState } from './parameter/ContentModelFormatState';\nexport { PasteTypeOrGetter } from './parameter/PasteTypeOrGetter';\nexport { ImageFormatState } from './parameter/ImageFormatState';\nexport { Border } from './parameter/Border';\nexport { InsertEntityOptions } from './parameter/InsertEntityOptions';\nexport {\n DeleteSelectionContext,\n DeleteSelectionResult,\n DeleteSelectionStep,\n ValidDeleteSelectionContext,\n} from './parameter/DeleteSelectionStep';\nexport {\n SnapshotSelectionBase,\n RangeSnapshotSelection,\n ImageSnapshotSelection,\n TableSnapshotSelection,\n SnapshotSelection,\n Snapshot,\n Snapshots,\n} from './parameter/Snapshot';\nexport { SnapshotsManager } from './parameter/SnapshotsManager';\nexport { DOMEventHandlerFunction, DOMEventRecord } from './parameter/DOMEventRecord';\nexport { EdgeLinkPreview } from './parameter/EdgeLinkPreview';\nexport { ClipboardData } from './parameter/ClipboardData';\nexport { AnnounceData, KnownAnnounceStrings } from './parameter/AnnounceData';\nexport {\n TrustedHTMLHandler,\n DOMCreator,\n LegacyTrustedHTMLHandler,\n} from './parameter/TrustedHTMLHandler';\nexport { Rect } from './parameter/Rect';\nexport { ValueSanitizer } from './parameter/ValueSanitizer';\nexport { DOMHelper } from './parameter/DOMHelper';\nexport { ImageEditOperation, ImageEditor } from './parameter/ImageEditor';\nexport { CachedElementHandler, CloneModelOptions } from './parameter/CloneModelOptions';\nexport { LinkData } from './parameter/LinkData';\nexport { MergeModelOption } from './parameter/MergeModelOption';\nexport {\n IterateSelectionsCallback,\n IterateSelectionsOption,\n ReadonlyIterateSelectionsCallback,\n} from './parameter/IterateSelectionsOption';\nexport { NodeTypeMap } from './parameter/NodeTypeMap';\nexport { TypeOfBlockGroup } from './parameter/TypeOfBlockGroup';\nexport { OperationalBlocks, ReadonlyOperationalBlocks } from './parameter/OperationalBlocks';\nexport { ParsedTable, ParsedTableCell } from './parameter/ParsedTable';\nexport {\n ModelToTextCallback,\n ModelToTextCallbacks,\n ModelToTextChecker,\n} from './parameter/ModelToTextCallbacks';\nexport { ConflictFormatSolution } from './parameter/ConflictFormatSolution';\n\nexport { BasePluginEvent, BasePluginDomEvent } from './event/BasePluginEvent';\nexport { BeforeCutCopyEvent } from './event/BeforeCutCopyEvent';\nexport { BeforeDisposeEvent } from './event/BeforeDisposeEvent';\nexport { BeforeKeyboardEditingEvent } from './event/BeforeKeyboardEditingEvent';\nexport { BeforePasteEvent, MergePastedContentFunc } from './event/BeforePasteEvent';\nexport { BeforeSetContentEvent } from './event/BeforeSetContentEvent';\nexport { ContentChangedEvent, ChangedEntity } from './event/ContentChangedEvent';\nexport { ContextMenuEvent } from './event/ContextMenuEvent';\nexport { RewriteFromModelEvent } from './event/RewriteFromModelEvent';\nexport { EditImageEvent } from './event/EditImageEvent';\nexport { EditorReadyEvent } from './event/EditorReadyEvent';\nexport { EntityOperationEvent, FormattableRoot, 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,4 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @deprecated Use DOMCreator instead
|
|
2
3
|
* A handler type to convert HTML string to a trust HTML string
|
|
3
4
|
*/
|
|
4
|
-
export declare type
|
|
5
|
+
export declare type LegacyTrustedHTMLHandler = (html: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* A handler type to convert HTML string to a DOM object
|
|
8
|
+
*/
|
|
9
|
+
export interface DOMCreator {
|
|
10
|
+
htmlToDOM: (html: string) => Document;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A handler type to convert HTML string to a trust HTML string or a DOM object
|
|
14
|
+
*/
|
|
15
|
+
export declare type TrustedHTMLHandler = DOMCreator | LegacyTrustedHTMLHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrustedHTMLHandler.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/TrustedHTMLHandler.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A handler type to convert HTML string to a trust HTML string\n */\nexport type
|
|
1
|
+
{"version":3,"file":"TrustedHTMLHandler.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/TrustedHTMLHandler.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @deprecated Use DOMCreator instead\n * A handler type to convert HTML string to a trust HTML string\n */\nexport type LegacyTrustedHTMLHandler = (html: string) => string;\n\n/**\n * A handler type to convert HTML string to a DOM object\n */\nexport interface DOMCreator {\n htmlToDOM: (html: string) => Document;\n}\n\n/**\n * A handler type to convert HTML string to a trust HTML string or a DOM object\n */\nexport type TrustedHTMLHandler = DOMCreator | LegacyTrustedHTMLHandler;\n"]}
|
|
@@ -14,7 +14,7 @@ import type { EditorContext } from '../context/EditorContext';
|
|
|
14
14
|
import type { EditorEnvironment } from '../parameter/EditorEnvironment';
|
|
15
15
|
import type { ModelToDomOption } from '../context/ModelToDomOption';
|
|
16
16
|
import type { OnNodeCreated } from '../context/ModelToDomSettings';
|
|
17
|
-
import type {
|
|
17
|
+
import type { DOMCreator, LegacyTrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';
|
|
18
18
|
import type { Rect } from '../parameter/Rect';
|
|
19
19
|
import type { ContentModelFormatter, FormatContentModelOptions } from '../parameter/FormatContentModelOptions';
|
|
20
20
|
/**
|
|
@@ -283,11 +283,19 @@ export interface EditorCore extends PluginState {
|
|
|
283
283
|
*/
|
|
284
284
|
readonly darkColorHandler: DarkColorHandler;
|
|
285
285
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
286
|
+
* @deprecated
|
|
287
|
+
* @see DOMCreator
|
|
288
|
+
* A handler to convert HTML string to a trust string.
|
|
289
|
+
* By default it will just convert the original HTML string into a string directly.
|
|
288
290
|
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
|
|
289
291
|
*/
|
|
290
|
-
readonly trustedHTMLHandler:
|
|
292
|
+
readonly trustedHTMLHandler: LegacyTrustedHTMLHandler;
|
|
293
|
+
/**
|
|
294
|
+
* A handler to convert HTML string to a trust Document.
|
|
295
|
+
* By default it will just convert the original HTML string into a Document object directly.
|
|
296
|
+
* To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler
|
|
297
|
+
*/
|
|
298
|
+
readonly domCreator: DOMCreator;
|
|
291
299
|
/**
|
|
292
300
|
* A helper class to provide DOM access APIs
|
|
293
301
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEvent } from '../event/PluginEvent';\nimport type { PluginState } from '../pluginState/PluginState';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type {\n ContentModelDocument,\n ReadonlyContentModelDocument,\n} from '../contentModel/blockGroup/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type { TrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The EditorCore object\n * @param saveIndex True to allow saving index info into node using domIndexer, otherwise false\n */\nexport type CreateEditorContext = (core: EditorCore, saveIndex: boolean) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\nexport type CreateContentModel = (\n core: EditorCore,\n option?: DomToModelOptionForCreateModel,\n selectionOverride?: DOMSelection | 'none'\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\nexport type GetDOMSelection = (core: EditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\nexport type SetContentModel = (\n core: EditorCore,\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated,\n isInitializing?: boolean\n) => DOMSelection | null;\n\n/**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\nexport type SetDOMSelection = (\n core: EditorCore,\n selection: DOMSelection | null,\n skipSelectionChangedEvent?: boolean\n) => void;\n\n/**\n * Set a new logical root (most likely due to focus change)\n * @param core The EditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot or null to use physicalRoot as logical root)\n */\nexport type SetLogicalRoot = (core: EditorCore, logicalRoot: HTMLDivElement | null) => void;\n\n/**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\nexport type FormatContentModel = (\n core: EditorCore,\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOptions?: DomToModelOptionForCreateModel\n) => void;\n\n/**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\nexport type SwitchShadowEdit = (core: EditorCore, isOn: boolean) => void;\n\n/**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\nexport type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;\n\n/**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\nexport type AddUndoSnapshot = (\n core: EditorCore,\n canUndoByBackspace: boolean,\n entityStates?: EntityState[]\n) => Snapshot | null;\n\n/**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\nexport type GetVisibleViewport = (core: EditorCore) => Rect | null;\n\n/**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\nexport type Focus = (core: EditorCore) => void;\n\n/**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\nexport type AttachDomEvent = (\n core: EditorCore,\n eventMap: Record<string, DOMEventRecord>\n) => () => void;\n\n/**\n * Restore an undo snapshot into editor\n * @param core The EditorCore object\n * @param step Steps to move, can be 0, positive or negative\n */\nexport type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot) => void;\n\n/**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to remove existing rules\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule. It also accepts pseudo classes \"before\" and \"after\" to create pseudo class rule \"::before\"\n * and \"::after\" to the editor root element itself\n * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only\n */\nexport type SetEditorStyle = (\n core: EditorCore,\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[],\n maxRuleLength?: number\n) => void;\n\n/**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\nexport type Announce = (core: EditorCore, announceData: AnnounceData) => void;\n\n/**\n * The interface for the map of core API for Editor.\n * Editor can call call API from this map under EditorCore object\n */\nexport interface CoreApiMap {\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n */\n createContentModel: CreateContentModel;\n\n /**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\n setContentModel: SetContentModel;\n\n /**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\n setDOMSelection: SetDOMSelection;\n\n /**\n * Set a new logical root (most likely due to focus change)\n * @param core The StandaloneEditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot)\n */\n setLogicalRoot: SetLogicalRoot;\n\n /**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel: FormatContentModel;\n\n /**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\n switchShadowEdit: SwitchShadowEdit;\n\n /**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\n getVisibleViewport: GetVisibleViewport;\n\n /**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\n focus: Focus;\n\n /**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n addUndoSnapshot: AddUndoSnapshot;\n\n /**\n * Restore an undo snapshot into editor\n * @param core The editor core object\n * @param step Steps to move, can be 0, positive or negative\n */\n restoreUndoSnapshot: RestoreUndoSnapshot;\n\n /**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent: AttachDomEvent;\n\n /**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\n triggerEvent: TriggerEvent;\n\n /**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule.\n */\n setEditorStyle: SetEditorStyle;\n\n /**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\n announce: Announce;\n}\n\n/**\n * Represents the core data structure of an editor\n */\nexport interface EditorCore extends PluginState {\n /**\n * The root DIV element of this editor (formerly contentDiv)\n */\n readonly physicalRoot: HTMLDivElement;\n\n /**\n * The content DIV element that operations should be applied to\n * By default, the logical root is the same as the physical root,\n * but if nested editors are used, the logical root changes to that of the inner editor\n */\n logicalRoot: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: CoreApiMap;\n\n /**\n * Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.\n */\n readonly originalApi: CoreApiMap;\n\n /**\n * An array of editor plugins.\n */\n readonly plugins: EditorPlugin[];\n\n /**\n * Editor running environment\n */\n readonly environment: EditorEnvironment;\n\n /**\n * Dark model handler for the editor, used for variable-based solution.\n * If keep it null, editor will still use original dataset-based dark mode solution.\n */\n readonly darkColorHandler: DarkColorHandler;\n\n /**\n * A handler to convert HTML string to a trust HTML string.\n * By default it will just return the original HTML string directly.\n * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n */\n readonly trustedHTMLHandler: TrustedHTMLHandler;\n\n /**\n * A helper class to provide DOM access APIs\n */\n readonly domHelper: DOMHelper;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n readonly disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * An optional callback function that will be invoked before write content model back to editor.\n * This is used for make sure model can satisfy some customized requirement\n * @param model The model to fix up\n */\n readonly onFixUpModel?: (model: ReadonlyContentModelDocument) => void;\n\n /**\n * Enabled experimental features\n */\n readonly experimentalFeatures: ReadonlyArray<string>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EditorCore.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/editor/EditorCore.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnnounceData } from '../parameter/AnnounceData';\nimport type { DOMHelper } from '../parameter/DOMHelper';\nimport type { PluginEvent } from '../event/PluginEvent';\nimport type { PluginState } from '../pluginState/PluginState';\nimport type { EditorPlugin } from './EditorPlugin';\nimport type { DOMEventRecord } from '../parameter/DOMEventRecord';\nimport type { Snapshot } from '../parameter/Snapshot';\nimport type { EntityState } from '../parameter/FormatContentModelContext';\nimport type { DarkColorHandler } from '../context/DarkColorHandler';\nimport type {\n ContentModelDocument,\n ReadonlyContentModelDocument,\n} from '../contentModel/blockGroup/ContentModelDocument';\nimport type { DOMSelection } from '../selection/DOMSelection';\nimport type { DomToModelOptionForCreateModel } from '../context/DomToModelOption';\nimport type { EditorContext } from '../context/EditorContext';\nimport type { EditorEnvironment } from '../parameter/EditorEnvironment';\nimport type { ModelToDomOption } from '../context/ModelToDomOption';\nimport type { OnNodeCreated } from '../context/ModelToDomSettings';\nimport type { DOMCreator, LegacyTrustedHTMLHandler } from '../parameter/TrustedHTMLHandler';\nimport type { Rect } from '../parameter/Rect';\nimport type {\n ContentModelFormatter,\n FormatContentModelOptions,\n} from '../parameter/FormatContentModelOptions';\n\n/**\n * Create a EditorContext object used by ContentModel API\n * @param core The EditorCore object\n * @param saveIndex True to allow saving index info into node using domIndexer, otherwise false\n */\nexport type CreateEditorContext = (core: EditorCore, saveIndex: boolean) => EditorContext;\n\n/**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\nexport type CreateContentModel = (\n core: EditorCore,\n option?: DomToModelOptionForCreateModel,\n selectionOverride?: DOMSelection | 'none'\n) => ContentModelDocument;\n\n/**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\nexport type GetDOMSelection = (core: EditorCore) => DOMSelection | null;\n\n/**\n * Set content with content model. This is the replacement of core API getSelectionRangeEx\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\nexport type SetContentModel = (\n core: EditorCore,\n model: ContentModelDocument,\n option?: ModelToDomOption,\n onNodeCreated?: OnNodeCreated,\n isInitializing?: boolean\n) => DOMSelection | null;\n\n/**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\nexport type SetDOMSelection = (\n core: EditorCore,\n selection: DOMSelection | null,\n skipSelectionChangedEvent?: boolean\n) => void;\n\n/**\n * Set a new logical root (most likely due to focus change)\n * @param core The EditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot or null to use physicalRoot as logical root)\n */\nexport type SetLogicalRoot = (core: EditorCore, logicalRoot: HTMLDivElement | null) => void;\n\n/**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\nexport type FormatContentModel = (\n core: EditorCore,\n formatter: ContentModelFormatter,\n options?: FormatContentModelOptions,\n domToModelOptions?: DomToModelOptionForCreateModel\n) => void;\n\n/**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\nexport type SwitchShadowEdit = (core: EditorCore, isOn: boolean) => void;\n\n/**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\nexport type TriggerEvent = (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void;\n\n/**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\nexport type AddUndoSnapshot = (\n core: EditorCore,\n canUndoByBackspace: boolean,\n entityStates?: EntityState[]\n) => Snapshot | null;\n\n/**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\nexport type GetVisibleViewport = (core: EditorCore) => Rect | null;\n\n/**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\nexport type Focus = (core: EditorCore) => void;\n\n/**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\nexport type AttachDomEvent = (\n core: EditorCore,\n eventMap: Record<string, DOMEventRecord>\n) => () => void;\n\n/**\n * Restore an undo snapshot into editor\n * @param core The EditorCore object\n * @param step Steps to move, can be 0, positive or negative\n */\nexport type RestoreUndoSnapshot = (core: EditorCore, snapshot: Snapshot) => void;\n\n/**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to remove existing rules\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule. It also accepts pseudo classes \"before\" and \"after\" to create pseudo class rule \"::before\"\n * and \"::after\" to the editor root element itself\n * @param maxRuleLength @optional Set maximum length for a single rule. This is used by test code only\n */\nexport type SetEditorStyle = (\n core: EditorCore,\n key: string,\n cssRule: string | null,\n subSelectors?: 'before' | 'after' | string[],\n maxRuleLength?: number\n) => void;\n\n/**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\nexport type Announce = (core: EditorCore, announceData: AnnounceData) => void;\n\n/**\n * The interface for the map of core API for Editor.\n * Editor can call call API from this map under EditorCore object\n */\nexport interface CoreApiMap {\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n * @param selectionOverride When passed a valid selection, use this selection range instead of current selection in editor.\n * When pass \"none\", it means we don't need a selection in content model\n */\n createEditorContext: CreateEditorContext;\n\n /**\n * Create Content Model from DOM tree in this editor\n * @param core The EditorCore object\n * @param option The option to customize the behavior of DOM to Content Model conversion\n */\n createContentModel: CreateContentModel;\n\n /**\n * Get current DOM selection from editor\n * @param core The EditorCore object\n */\n getDOMSelection: GetDOMSelection;\n\n /**\n * Set content with content model\n * @param core The EditorCore object\n * @param model The content model to set\n * @param option Additional options to customize the behavior of Content Model to DOM conversion\n * @param onNodeCreated An optional callback that will be called when a DOM node is created\n * @param isInitializing True means editor is being initialized then it will save modification nodes onto\n * lifecycleState instead of triggering events, false means other cases\n */\n setContentModel: SetContentModel;\n\n /**\n * Set current DOM selection from editor. This is the replacement of core API select\n * @param core The EditorCore object\n * @param selection The selection to set\n * @param skipSelectionChangedEvent @param Pass true to skip triggering a SelectionChangedEvent\n */\n setDOMSelection: SetDOMSelection;\n\n /**\n * Set a new logical root (most likely due to focus change)\n * @param core The StandaloneEditorCore object\n * @param logicalRoot The new logical root (has to be child of physicalRoot)\n */\n setLogicalRoot: SetLogicalRoot;\n\n /**\n * The general API to do format change with Content Model\n * It will grab a Content Model for current editor content, and invoke a callback function\n * to do format change. Then according to the return value, write back the modified content model into editor.\n * If there is cached model, it will be used and updated.\n * @param core The EditorCore object\n * @param formatter Formatter function, see ContentModelFormatter\n * @param options More options, see FormatContentModelOptions\n */\n formatContentModel: FormatContentModel;\n\n /**\n * Switch the Shadow Edit mode of editor On/Off\n * @param core The EditorCore object\n * @param isOn True to switch On, False to switch Off\n */\n switchShadowEdit: SwitchShadowEdit;\n\n /**\n * Retrieves the rect of the visible viewport of the editor.\n * @param core The EditorCore object\n */\n getVisibleViewport: GetVisibleViewport;\n\n /**\n * Focus to editor. If there is a cached selection range, use it as current selection\n * @param core The EditorCore object\n */\n focus: Focus;\n\n /**\n * Add an undo snapshot to current undo snapshot stack\n * @param core The EditorCore object\n * @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).\n * @param entityStates @optional Entity states related to this snapshot.\n * Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState\n * when undo/redo to this snapshot\n */\n addUndoSnapshot: AddUndoSnapshot;\n\n /**\n * Restore an undo snapshot into editor\n * @param core The editor core object\n * @param step Steps to move, can be 0, positive or negative\n */\n restoreUndoSnapshot: RestoreUndoSnapshot;\n\n /**\n * Attach a DOM event to the editor content DIV\n * @param core The EditorCore object\n * @param eventMap A map from event name to its handler\n */\n attachDomEvent: AttachDomEvent;\n\n /**\n * Trigger a plugin event\n * @param core The EditorCore object\n * @param pluginEvent The event object to trigger\n * @param broadcast Set to true to skip the shouldHandleEventExclusively check\n */\n triggerEvent: TriggerEvent;\n\n /**\n * Add CSS rules for editor\n * @param core The EditorCore object\n * @param key A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.\n * @param cssRule The CSS rule string, must be a valid CSS rule string, or browser may throw exception\n * @param subSelectors @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be\n * combined with root selector together to build a separate rule.\n */\n setEditorStyle: SetEditorStyle;\n\n /**\n * Announce the given data\n * @param core The EditorCore object\n * @param announceData Data to announce\n */\n announce: Announce;\n}\n\n/**\n * Represents the core data structure of an editor\n */\nexport interface EditorCore extends PluginState {\n /**\n * The root DIV element of this editor (formerly contentDiv)\n */\n readonly physicalRoot: HTMLDivElement;\n\n /**\n * The content DIV element that operations should be applied to\n * By default, the logical root is the same as the physical root,\n * but if nested editors are used, the logical root changes to that of the inner editor\n */\n logicalRoot: HTMLDivElement;\n\n /**\n * Core API map of this editor\n */\n readonly api: CoreApiMap;\n\n /**\n * Original API map of this editor. Overridden core API can use API from this map to call the original version of core API.\n */\n readonly originalApi: CoreApiMap;\n\n /**\n * An array of editor plugins.\n */\n readonly plugins: EditorPlugin[];\n\n /**\n * Editor running environment\n */\n readonly environment: EditorEnvironment;\n\n /**\n * Dark model handler for the editor, used for variable-based solution.\n * If keep it null, editor will still use original dataset-based dark mode solution.\n */\n readonly darkColorHandler: DarkColorHandler;\n\n /**\n * @deprecated\n * @see DOMCreator\n * A handler to convert HTML string to a trust string.\n * By default it will just convert the original HTML string into a string directly.\n * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n */\n readonly trustedHTMLHandler: LegacyTrustedHTMLHandler;\n\n /**\n * A handler to convert HTML string to a trust Document.\n * By default it will just convert the original HTML string into a Document object directly.\n * To override, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler\n */\n readonly domCreator: DOMCreator;\n\n /**\n * A helper class to provide DOM access APIs\n */\n readonly domHelper: DOMHelper;\n\n /**\n * A callback to be invoked when any exception is thrown during disposing editor\n * @param plugin The plugin that causes exception\n * @param error The error object we got\n */\n readonly disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;\n\n /**\n * An optional callback function that will be invoked before write content model back to editor.\n * This is used for make sure model can satisfy some customized requirement\n * @param model The model to fix up\n */\n readonly onFixUpModel?: (model: ReadonlyContentModelDocument) => void;\n\n /**\n * Enabled experimental features\n */\n readonly experimentalFeatures: ReadonlyArray<string>;\n}\n"]}
|