roosterjs-content-model-types 9.24.0 → 9.25.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/README.md CHANGED
@@ -51,6 +51,9 @@ There are also some extension packages to provide additional functionalities.
51
51
  1. [roosterjs-color-utils](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_color_utils.html):
52
52
  Provide color transformation utility to make editor work under dark mode.
53
53
 
54
+ 2. [roosterjs-content-model-markdown](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_types.html):
55
+ Defines public APIs to enable conversions between Markdown and ContentModel
56
+
54
57
  To be compatible with old (8.\*) versions, you can use `EditorAdapter` class from the following package which can act as a 8.\* Editor:
55
58
 
56
59
  1. [roosterjs-editor-adapter](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_adapter.html):
@@ -56,4 +56,8 @@ export interface EditorContext {
56
56
  * A helper class that manages a mapping from paragraph marker to paragraph object.
57
57
  */
58
58
  paragraphMap?: ParagraphMap;
59
+ /**
60
+ * When set to true, size of table will be recalculated when converting from DOM to Content Model.
61
+ */
62
+ recalculateTableSize?: boolean;
59
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/EditorContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { DarkColorHandler } from './DarkColorHandler';\nimport type { DomIndexer } from './DomIndexer';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { PendingFormat } from '../pluginState/FormatPluginState';\nimport type { ParagraphMap } from '../parameter/ParagraphMap';\n\n/**\n * An editor context interface used by ContentModel PAI\n */\nexport interface EditorContext {\n /**\n * Whether current content is in dark mode\n */\n isDarkMode?: boolean;\n\n /**\n * Default format of editor\n */\n defaultFormat?: ContentModelSegmentFormat;\n\n /**\n * Pending format if any\n */\n pendingFormat?: PendingFormat;\n\n /**\n * Color manager, to help manager color in dark mode\n */\n darkColorHandler?: DarkColorHandler;\n\n /**\n * Whether to handle delimiters in Content Model\n */\n addDelimiterForEntity?: boolean;\n\n /**\n * Zoom scale number\n */\n zoomScale?: number;\n\n /**\n * Whether the content is in Right-to-left from root level\n */\n isRootRtl?: boolean;\n\n /**\n * Whether put the source element into Content Model when possible.\n * When pass true, this cached element will be used to create DOM tree back when convert Content Model to DOM\n */\n allowCacheElement?: boolean;\n\n /**\n * @optional Indexer for content model, to help build backward relationship from DOM node to Content Model\n */\n domIndexer?: DomIndexer;\n\n /**\n * Root Font size in Px.\n */\n rootFontSize?: number;\n\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: ReadonlyArray<string>;\n\n /**\n * A helper class that manages a mapping from paragraph marker to paragraph object.\n */\n paragraphMap?: ParagraphMap;\n}\n"]}
1
+ {"version":3,"file":"EditorContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/EditorContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { DarkColorHandler } from './DarkColorHandler';\nimport type { DomIndexer } from './DomIndexer';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { PendingFormat } from '../pluginState/FormatPluginState';\nimport type { ParagraphMap } from '../parameter/ParagraphMap';\n\n/**\n * An editor context interface used by ContentModel PAI\n */\nexport interface EditorContext {\n /**\n * Whether current content is in dark mode\n */\n isDarkMode?: boolean;\n\n /**\n * Default format of editor\n */\n defaultFormat?: ContentModelSegmentFormat;\n\n /**\n * Pending format if any\n */\n pendingFormat?: PendingFormat;\n\n /**\n * Color manager, to help manager color in dark mode\n */\n darkColorHandler?: DarkColorHandler;\n\n /**\n * Whether to handle delimiters in Content Model\n */\n addDelimiterForEntity?: boolean;\n\n /**\n * Zoom scale number\n */\n zoomScale?: number;\n\n /**\n * Whether the content is in Right-to-left from root level\n */\n isRootRtl?: boolean;\n\n /**\n * Whether put the source element into Content Model when possible.\n * When pass true, this cached element will be used to create DOM tree back when convert Content Model to DOM\n */\n allowCacheElement?: boolean;\n\n /**\n * @optional Indexer for content model, to help build backward relationship from DOM node to Content Model\n */\n domIndexer?: DomIndexer;\n\n /**\n * Root Font size in Px.\n */\n rootFontSize?: number;\n\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: ReadonlyArray<string>;\n\n /**\n * A helper class that manages a mapping from paragraph marker to paragraph object.\n */\n paragraphMap?: ParagraphMap;\n\n /**\n * When set to true, size of table will be recalculated when converting from DOM to Content Model.\n */\n recalculateTableSize?: boolean;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';
1
2
  /**
2
3
  * A helper class to provide DOM access APIs
3
4
  */
@@ -79,4 +80,8 @@ export interface DOMHelper {
79
80
  * Get a deep cloned root element
80
81
  */
81
82
  getClonedRoot(): HTMLElement;
83
+ /**
84
+ * Get format of the container element
85
+ */
86
+ getContainerFormat(): ContentModelSegmentFormat;
82
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n * @param excludeRoot When pass true, the function will return false if the passed in node is the root node itself\n */\n isNodeInEditor(node: Node, excludeRoot?: boolean): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Check if the root element is in RTL mode\n */\n isRightToLeft(): boolean;\n\n /**\n * Get the width of the editable area of the editor content div\n */\n getClientWidth(): number;\n\n /**\n * Get a deep cloned root element\n */\n getClonedRoot(): HTMLElement;\n}\n"]}
1
+ {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\n\n/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n * @param excludeRoot When pass true, the function will return false if the passed in node is the root node itself\n */\n isNodeInEditor(node: Node, excludeRoot?: boolean): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Check if the root element is in RTL mode\n */\n isRightToLeft(): boolean;\n\n /**\n * Get the width of the editable area of the editor content div\n */\n getClientWidth(): number;\n\n /**\n * Get a deep cloned root element\n */\n getClonedRoot(): HTMLElement;\n\n /**\n * Get format of the container element\n */\n getContainerFormat(): ContentModelSegmentFormat;\n}\n"]}
@@ -56,4 +56,8 @@ export interface EditorContext {
56
56
  * A helper class that manages a mapping from paragraph marker to paragraph object.
57
57
  */
58
58
  paragraphMap?: ParagraphMap;
59
+ /**
60
+ * When set to true, size of table will be recalculated when converting from DOM to Content Model.
61
+ */
62
+ recalculateTableSize?: boolean;
59
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/EditorContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { DarkColorHandler } from './DarkColorHandler';\nimport type { DomIndexer } from './DomIndexer';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { PendingFormat } from '../pluginState/FormatPluginState';\nimport type { ParagraphMap } from '../parameter/ParagraphMap';\n\n/**\n * An editor context interface used by ContentModel PAI\n */\nexport interface EditorContext {\n /**\n * Whether current content is in dark mode\n */\n isDarkMode?: boolean;\n\n /**\n * Default format of editor\n */\n defaultFormat?: ContentModelSegmentFormat;\n\n /**\n * Pending format if any\n */\n pendingFormat?: PendingFormat;\n\n /**\n * Color manager, to help manager color in dark mode\n */\n darkColorHandler?: DarkColorHandler;\n\n /**\n * Whether to handle delimiters in Content Model\n */\n addDelimiterForEntity?: boolean;\n\n /**\n * Zoom scale number\n */\n zoomScale?: number;\n\n /**\n * Whether the content is in Right-to-left from root level\n */\n isRootRtl?: boolean;\n\n /**\n * Whether put the source element into Content Model when possible.\n * When pass true, this cached element will be used to create DOM tree back when convert Content Model to DOM\n */\n allowCacheElement?: boolean;\n\n /**\n * @optional Indexer for content model, to help build backward relationship from DOM node to Content Model\n */\n domIndexer?: DomIndexer;\n\n /**\n * Root Font size in Px.\n */\n rootFontSize?: number;\n\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: ReadonlyArray<string>;\n\n /**\n * A helper class that manages a mapping from paragraph marker to paragraph object.\n */\n paragraphMap?: ParagraphMap;\n}\n"]}
1
+ {"version":3,"file":"EditorContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/EditorContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { DarkColorHandler } from './DarkColorHandler';\nimport type { DomIndexer } from './DomIndexer';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { PendingFormat } from '../pluginState/FormatPluginState';\nimport type { ParagraphMap } from '../parameter/ParagraphMap';\n\n/**\n * An editor context interface used by ContentModel PAI\n */\nexport interface EditorContext {\n /**\n * Whether current content is in dark mode\n */\n isDarkMode?: boolean;\n\n /**\n * Default format of editor\n */\n defaultFormat?: ContentModelSegmentFormat;\n\n /**\n * Pending format if any\n */\n pendingFormat?: PendingFormat;\n\n /**\n * Color manager, to help manager color in dark mode\n */\n darkColorHandler?: DarkColorHandler;\n\n /**\n * Whether to handle delimiters in Content Model\n */\n addDelimiterForEntity?: boolean;\n\n /**\n * Zoom scale number\n */\n zoomScale?: number;\n\n /**\n * Whether the content is in Right-to-left from root level\n */\n isRootRtl?: boolean;\n\n /**\n * Whether put the source element into Content Model when possible.\n * When pass true, this cached element will be used to create DOM tree back when convert Content Model to DOM\n */\n allowCacheElement?: boolean;\n\n /**\n * @optional Indexer for content model, to help build backward relationship from DOM node to Content Model\n */\n domIndexer?: DomIndexer;\n\n /**\n * Root Font size in Px.\n */\n rootFontSize?: number;\n\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: ReadonlyArray<string>;\n\n /**\n * A helper class that manages a mapping from paragraph marker to paragraph object.\n */\n paragraphMap?: ParagraphMap;\n\n /**\n * When set to true, size of table will be recalculated when converting from DOM to Content Model.\n */\n recalculateTableSize?: boolean;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';
1
2
  /**
2
3
  * A helper class to provide DOM access APIs
3
4
  */
@@ -79,4 +80,8 @@ export interface DOMHelper {
79
80
  * Get a deep cloned root element
80
81
  */
81
82
  getClonedRoot(): HTMLElement;
83
+ /**
84
+ * Get format of the container element
85
+ */
86
+ getContainerFormat(): ContentModelSegmentFormat;
82
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n * @param excludeRoot When pass true, the function will return false if the passed in node is the root node itself\n */\n isNodeInEditor(node: Node, excludeRoot?: boolean): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Check if the root element is in RTL mode\n */\n isRightToLeft(): boolean;\n\n /**\n * Get the width of the editable area of the editor content div\n */\n getClientWidth(): number;\n\n /**\n * Get a deep cloned root element\n */\n getClonedRoot(): HTMLElement;\n}\n"]}
1
+ {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\n\n/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n * @param excludeRoot When pass true, the function will return false if the passed in node is the root node itself\n */\n isNodeInEditor(node: Node, excludeRoot?: boolean): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Check if the root element is in RTL mode\n */\n isRightToLeft(): boolean;\n\n /**\n * Get the width of the editable area of the editor content div\n */\n getClientWidth(): number;\n\n /**\n * Get a deep cloned root element\n */\n getClonedRoot(): HTMLElement;\n\n /**\n * Get format of the container element\n */\n getContainerFormat(): ContentModelSegmentFormat;\n}\n"]}
@@ -56,4 +56,8 @@ export interface EditorContext {
56
56
  * A helper class that manages a mapping from paragraph marker to paragraph object.
57
57
  */
58
58
  paragraphMap?: ParagraphMap;
59
+ /**
60
+ * When set to true, size of table will be recalculated when converting from DOM to Content Model.
61
+ */
62
+ recalculateTableSize?: boolean;
59
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/EditorContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { DarkColorHandler } from './DarkColorHandler';\nimport type { DomIndexer } from './DomIndexer';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { PendingFormat } from '../pluginState/FormatPluginState';\nimport type { ParagraphMap } from '../parameter/ParagraphMap';\n\n/**\n * An editor context interface used by ContentModel PAI\n */\nexport interface EditorContext {\n /**\n * Whether current content is in dark mode\n */\n isDarkMode?: boolean;\n\n /**\n * Default format of editor\n */\n defaultFormat?: ContentModelSegmentFormat;\n\n /**\n * Pending format if any\n */\n pendingFormat?: PendingFormat;\n\n /**\n * Color manager, to help manager color in dark mode\n */\n darkColorHandler?: DarkColorHandler;\n\n /**\n * Whether to handle delimiters in Content Model\n */\n addDelimiterForEntity?: boolean;\n\n /**\n * Zoom scale number\n */\n zoomScale?: number;\n\n /**\n * Whether the content is in Right-to-left from root level\n */\n isRootRtl?: boolean;\n\n /**\n * Whether put the source element into Content Model when possible.\n * When pass true, this cached element will be used to create DOM tree back when convert Content Model to DOM\n */\n allowCacheElement?: boolean;\n\n /**\n * @optional Indexer for content model, to help build backward relationship from DOM node to Content Model\n */\n domIndexer?: DomIndexer;\n\n /**\n * Root Font size in Px.\n */\n rootFontSize?: number;\n\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: ReadonlyArray<string>;\n\n /**\n * A helper class that manages a mapping from paragraph marker to paragraph object.\n */\n paragraphMap?: ParagraphMap;\n}\n"]}
1
+ {"version":3,"file":"EditorContext.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/EditorContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { DarkColorHandler } from './DarkColorHandler';\nimport type { DomIndexer } from './DomIndexer';\nimport type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\nimport type { PendingFormat } from '../pluginState/FormatPluginState';\nimport type { ParagraphMap } from '../parameter/ParagraphMap';\n\n/**\n * An editor context interface used by ContentModel PAI\n */\nexport interface EditorContext {\n /**\n * Whether current content is in dark mode\n */\n isDarkMode?: boolean;\n\n /**\n * Default format of editor\n */\n defaultFormat?: ContentModelSegmentFormat;\n\n /**\n * Pending format if any\n */\n pendingFormat?: PendingFormat;\n\n /**\n * Color manager, to help manager color in dark mode\n */\n darkColorHandler?: DarkColorHandler;\n\n /**\n * Whether to handle delimiters in Content Model\n */\n addDelimiterForEntity?: boolean;\n\n /**\n * Zoom scale number\n */\n zoomScale?: number;\n\n /**\n * Whether the content is in Right-to-left from root level\n */\n isRootRtl?: boolean;\n\n /**\n * Whether put the source element into Content Model when possible.\n * When pass true, this cached element will be used to create DOM tree back when convert Content Model to DOM\n */\n allowCacheElement?: boolean;\n\n /**\n * @optional Indexer for content model, to help build backward relationship from DOM node to Content Model\n */\n domIndexer?: DomIndexer;\n\n /**\n * Root Font size in Px.\n */\n rootFontSize?: number;\n\n /**\n * Enabled experimental features\n */\n experimentalFeatures?: ReadonlyArray<string>;\n\n /**\n * A helper class that manages a mapping from paragraph marker to paragraph object.\n */\n paragraphMap?: ParagraphMap;\n\n /**\n * When set to true, size of table will be recalculated when converting from DOM to Content Model.\n */\n recalculateTableSize?: boolean;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';
1
2
  /**
2
3
  * A helper class to provide DOM access APIs
3
4
  */
@@ -79,4 +80,8 @@ export interface DOMHelper {
79
80
  * Get a deep cloned root element
80
81
  */
81
82
  getClonedRoot(): HTMLElement;
83
+ /**
84
+ * Get format of the container element
85
+ */
86
+ getContainerFormat(): ContentModelSegmentFormat;
82
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n * @param excludeRoot When pass true, the function will return false if the passed in node is the root node itself\n */\n isNodeInEditor(node: Node, excludeRoot?: boolean): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Check if the root element is in RTL mode\n */\n isRightToLeft(): boolean;\n\n /**\n * Get the width of the editable area of the editor content div\n */\n getClientWidth(): number;\n\n /**\n * Get a deep cloned root element\n */\n getClonedRoot(): HTMLElement;\n}\n"]}
1
+ {"version":3,"file":"DOMHelper.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/parameter/DOMHelper.ts"],"names":[],"mappings":"","sourcesContent":["import type { ContentModelSegmentFormat } from '../contentModel/format/ContentModelSegmentFormat';\n\n/**\n * A helper class to provide DOM access APIs\n */\nexport interface DOMHelper {\n /**\n * Check if the given DOM node is in editor\n * @param node The node to check\n * @param excludeRoot When pass true, the function will return false if the passed in node is the root node itself\n */\n isNodeInEditor(node: Node, excludeRoot?: boolean): boolean;\n\n /**\n * Query HTML elements in editor by tag name.\n * Be careful of this function since it will also return element under entity.\n * @param tag Tag name of the element to query\n * @returns HTML Element array of the query result\n */\n queryElements<TTag extends keyof HTMLElementTagNameMap>(\n tag: TTag\n ): HTMLElementTagNameMap[TTag][];\n\n /**\n * Query HTML elements in editor by a selector string\n * Be careful of this function since it will also return element under entity.\n * @param selector Selector string to query\n * @returns HTML Element array of the query result\n */\n queryElements(selector: string): HTMLElement[];\n\n /**\n * Get plain text content of editor using textContent property\n */\n getTextContent(): string;\n\n /**\n * Calculate current zoom scale of editor\n */\n calculateZoomScale(): number;\n\n /**\n * Set DOM attribute of editor content DIV\n * @param name Name of the attribute\n * @param value Value of the attribute\n */\n setDomAttribute(name: string, value: string | null): void;\n\n /**\n * Get DOM attribute of editor content DIV, null if there is no such attribute.\n * @param name Name of the attribute\n */\n getDomAttribute(name: string): string | null;\n\n /**\n * Get DOM style of editor content DIV\n * @param style Name of the style\n */\n getDomStyle<T extends keyof CSSStyleDeclaration>(style: T): CSSStyleDeclaration[T];\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor<T extends keyof HTMLElementTagNameMap>(\n node: Node,\n selector?: T\n ): HTMLElementTagNameMap[T] | null;\n\n /**\n * Find closest element ancestor start from the given node which matches the given selector\n * @param node Find ancestor start from this node\n * @param selector The expected selector. If null, return the first HTML Element found from start node\n * @returns An HTML element which matches the given selector. If the given start node matches the selector,\n * returns the given node\n */\n findClosestElementAncestor(node: Node, selector?: string): HTMLElement | null;\n\n /**\n * Check if the editor has focus now\n * @returns True if the editor has focus, otherwise false\n */\n hasFocus(): boolean;\n\n /**\n * Check if the root element is in RTL mode\n */\n isRightToLeft(): boolean;\n\n /**\n * Get the width of the editable area of the editor content div\n */\n getClientWidth(): number;\n\n /**\n * Get a deep cloned root element\n */\n getClonedRoot(): HTMLElement;\n\n /**\n * Get format of the container element\n */\n getContainerFormat(): ContentModelSegmentFormat;\n}\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "roosterjs-content-model-types",
3
3
  "description": "Types for roosterjs",
4
4
  "dependencies": {},
5
- "version": "9.24.0",
5
+ "version": "9.25.0",
6
6
  "main": "./lib/index.js",
7
7
  "typings": "./lib/index.d.ts",
8
8
  "module": "./lib-mjs/index.js",