roosterjs-content-model-types 9.5.1 → 9.7.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.
@@ -35,4 +35,14 @@ export interface DomIndexer {
35
35
  * @returns True if reconcile successfully, otherwise false
36
36
  */
37
37
  reconcileSelection: (model: ContentModelDocument, newSelection: DOMSelection, oldSelection?: CacheSelection) => boolean;
38
+ /**
39
+ * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.
40
+ * This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any,
41
+ * and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment
42
+ * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model
43
+ * @param addedNodes Nodes added by browser during mutation
44
+ * @param removedNodes Nodes removed by browser during mutation
45
+ * @returns True if the changed nodes are successfully reconciled, otherwise false
46
+ */
47
+ reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;
38
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DomIndexer.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/DomIndexer.ts"],"names":[],"mappings":"","sourcesContent":["import type { CacheSelection } from '../pluginState/CachePluginState';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelParagraph } from '../contentModel/block/ContentModelParagraph';\nimport type { ContentModelSegment } from '../contentModel/segment/ContentModelSegment';\nimport type { ContentModelTable } from '../contentModel/block/ContentModelTable';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an indexer object which provides methods to help build backward relationship\n * from DOM node to Content Model\n */\nexport interface DomIndexer {\n /**\n * Invoked when processing a segment\n * @param segmentNode The new DOM node for this segment\n * @param paragraph Parent paragraph of this segment\n * @param segments The source segments\n */\n onSegment: (\n segmentNode: Node,\n paragraph: ContentModelParagraph,\n segments: ContentModelSegment[]\n ) => void;\n\n /**\n * Invoked when new paragraph node is created in DOM tree\n * @param paragraphElement The new DOM node for this paragraph\n */\n onParagraph: (paragraphElement: HTMLElement) => void;\n\n /**\n * Invoked when new table node is created in DOM tree\n * @param tableElement The new DOM node for this table\n */\n onTable: (tableElement: HTMLTableElement, tableModel: ContentModelTable) => void;\n\n /**\n * When document content or selection is changed by user, we need to use this function to update the content model\n * to reflect the latest document. This process can fail since the selected node may not have a related model data structure.\n * @param model Current cached content model\n * @param newSelection Latest selection\n * @param oldSelection @optional Original selection before this change\n * @returns True if reconcile successfully, otherwise false\n */\n reconcileSelection: (\n model: ContentModelDocument,\n newSelection: DOMSelection,\n oldSelection?: CacheSelection\n ) => boolean;\n}\n"]}
1
+ {"version":3,"file":"DomIndexer.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/DomIndexer.ts"],"names":[],"mappings":"","sourcesContent":["import type { CacheSelection } from '../pluginState/CachePluginState';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelParagraph } from '../contentModel/block/ContentModelParagraph';\nimport type { ContentModelSegment } from '../contentModel/segment/ContentModelSegment';\nimport type { ContentModelTable } from '../contentModel/block/ContentModelTable';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an indexer object which provides methods to help build backward relationship\n * from DOM node to Content Model\n */\nexport interface DomIndexer {\n /**\n * Invoked when processing a segment\n * @param segmentNode The new DOM node for this segment\n * @param paragraph Parent paragraph of this segment\n * @param segments The source segments\n */\n onSegment: (\n segmentNode: Node,\n paragraph: ContentModelParagraph,\n segments: ContentModelSegment[]\n ) => void;\n\n /**\n * Invoked when new paragraph node is created in DOM tree\n * @param paragraphElement The new DOM node for this paragraph\n */\n onParagraph: (paragraphElement: HTMLElement) => void;\n\n /**\n * Invoked when new table node is created in DOM tree\n * @param tableElement The new DOM node for this table\n */\n onTable: (tableElement: HTMLTableElement, tableModel: ContentModelTable) => void;\n\n /**\n * When document content or selection is changed by user, we need to use this function to update the content model\n * to reflect the latest document. This process can fail since the selected node may not have a related model data structure.\n * @param model Current cached content model\n * @param newSelection Latest selection\n * @param oldSelection @optional Original selection before this change\n * @returns True if reconcile successfully, otherwise false\n */\n reconcileSelection: (\n model: ContentModelDocument,\n newSelection: DOMSelection,\n oldSelection?: CacheSelection\n ) => boolean;\n\n /**\n * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.\n * This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any,\n * and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment\n * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model\n * @param addedNodes Nodes added by browser during mutation\n * @param removedNodes Nodes removed by browser during mutation\n * @returns True if the changed nodes are successfully reconciled, otherwise false\n */\n reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;\n}\n"]}
@@ -11,7 +11,9 @@ export interface TextMutationObserver {
11
11
  */
12
12
  stopObserving(): void;
13
13
  /**
14
- * Flush all pending mutations that have not be handled in order to ignore them
14
+ * Flush all pending mutations and update cached model if need
15
+ * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.
16
+ * This should only be used when we already have a up-to-date content model and will set it as latest cache
15
17
  */
16
- flushMutations(): void;
18
+ flushMutations(ignoreMutations?: boolean): void;
17
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextMutationObserver.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/TextMutationObserver.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A wrapper of MutationObserver to observe text change from editor\n */\nexport interface TextMutationObserver {\n /**\n * Start observing mutations from editor\n */\n startObserving(): void;\n\n /**\n * Stop observing mutations from editor\n */\n stopObserving(): void;\n\n /**\n * Flush all pending mutations that have not be handled in order to ignore them\n */\n flushMutations(): void;\n}\n"]}
1
+ {"version":3,"file":"TextMutationObserver.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/TextMutationObserver.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A wrapper of MutationObserver to observe text change from editor\n */\nexport interface TextMutationObserver {\n /**\n * Start observing mutations from editor\n */\n startObserving(): void;\n\n /**\n * Stop observing mutations from editor\n */\n stopObserving(): void;\n\n /**\n * Flush all pending mutations and update cached model if need\n * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.\n * This should only be used when we already have a up-to-date content model and will set it as latest cache\n */\n flushMutations(ignoreMutations?: boolean): void;\n}\n"]}
@@ -35,4 +35,14 @@ export interface DomIndexer {
35
35
  * @returns True if reconcile successfully, otherwise false
36
36
  */
37
37
  reconcileSelection: (model: ContentModelDocument, newSelection: DOMSelection, oldSelection?: CacheSelection) => boolean;
38
+ /**
39
+ * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.
40
+ * This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any,
41
+ * and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment
42
+ * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model
43
+ * @param addedNodes Nodes added by browser during mutation
44
+ * @param removedNodes Nodes removed by browser during mutation
45
+ * @returns True if the changed nodes are successfully reconciled, otherwise false
46
+ */
47
+ reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;
38
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DomIndexer.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/DomIndexer.ts"],"names":[],"mappings":"","sourcesContent":["import type { CacheSelection } from '../pluginState/CachePluginState';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelParagraph } from '../contentModel/block/ContentModelParagraph';\nimport type { ContentModelSegment } from '../contentModel/segment/ContentModelSegment';\nimport type { ContentModelTable } from '../contentModel/block/ContentModelTable';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an indexer object which provides methods to help build backward relationship\n * from DOM node to Content Model\n */\nexport interface DomIndexer {\n /**\n * Invoked when processing a segment\n * @param segmentNode The new DOM node for this segment\n * @param paragraph Parent paragraph of this segment\n * @param segments The source segments\n */\n onSegment: (\n segmentNode: Node,\n paragraph: ContentModelParagraph,\n segments: ContentModelSegment[]\n ) => void;\n\n /**\n * Invoked when new paragraph node is created in DOM tree\n * @param paragraphElement The new DOM node for this paragraph\n */\n onParagraph: (paragraphElement: HTMLElement) => void;\n\n /**\n * Invoked when new table node is created in DOM tree\n * @param tableElement The new DOM node for this table\n */\n onTable: (tableElement: HTMLTableElement, tableModel: ContentModelTable) => void;\n\n /**\n * When document content or selection is changed by user, we need to use this function to update the content model\n * to reflect the latest document. This process can fail since the selected node may not have a related model data structure.\n * @param model Current cached content model\n * @param newSelection Latest selection\n * @param oldSelection @optional Original selection before this change\n * @returns True if reconcile successfully, otherwise false\n */\n reconcileSelection: (\n model: ContentModelDocument,\n newSelection: DOMSelection,\n oldSelection?: CacheSelection\n ) => boolean;\n}\n"]}
1
+ {"version":3,"file":"DomIndexer.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/DomIndexer.ts"],"names":[],"mappings":"","sourcesContent":["import type { CacheSelection } from '../pluginState/CachePluginState';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelParagraph } from '../contentModel/block/ContentModelParagraph';\nimport type { ContentModelSegment } from '../contentModel/segment/ContentModelSegment';\nimport type { ContentModelTable } from '../contentModel/block/ContentModelTable';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an indexer object which provides methods to help build backward relationship\n * from DOM node to Content Model\n */\nexport interface DomIndexer {\n /**\n * Invoked when processing a segment\n * @param segmentNode The new DOM node for this segment\n * @param paragraph Parent paragraph of this segment\n * @param segments The source segments\n */\n onSegment: (\n segmentNode: Node,\n paragraph: ContentModelParagraph,\n segments: ContentModelSegment[]\n ) => void;\n\n /**\n * Invoked when new paragraph node is created in DOM tree\n * @param paragraphElement The new DOM node for this paragraph\n */\n onParagraph: (paragraphElement: HTMLElement) => void;\n\n /**\n * Invoked when new table node is created in DOM tree\n * @param tableElement The new DOM node for this table\n */\n onTable: (tableElement: HTMLTableElement, tableModel: ContentModelTable) => void;\n\n /**\n * When document content or selection is changed by user, we need to use this function to update the content model\n * to reflect the latest document. This process can fail since the selected node may not have a related model data structure.\n * @param model Current cached content model\n * @param newSelection Latest selection\n * @param oldSelection @optional Original selection before this change\n * @returns True if reconcile successfully, otherwise false\n */\n reconcileSelection: (\n model: ContentModelDocument,\n newSelection: DOMSelection,\n oldSelection?: CacheSelection\n ) => boolean;\n\n /**\n * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.\n * This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any,\n * and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment\n * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model\n * @param addedNodes Nodes added by browser during mutation\n * @param removedNodes Nodes removed by browser during mutation\n * @returns True if the changed nodes are successfully reconciled, otherwise false\n */\n reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;\n}\n"]}
@@ -11,7 +11,9 @@ export interface TextMutationObserver {
11
11
  */
12
12
  stopObserving(): void;
13
13
  /**
14
- * Flush all pending mutations that have not be handled in order to ignore them
14
+ * Flush all pending mutations and update cached model if need
15
+ * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.
16
+ * This should only be used when we already have a up-to-date content model and will set it as latest cache
15
17
  */
16
- flushMutations(): void;
18
+ flushMutations(ignoreMutations?: boolean): void;
17
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextMutationObserver.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/TextMutationObserver.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A wrapper of MutationObserver to observe text change from editor\n */\nexport interface TextMutationObserver {\n /**\n * Start observing mutations from editor\n */\n startObserving(): void;\n\n /**\n * Stop observing mutations from editor\n */\n stopObserving(): void;\n\n /**\n * Flush all pending mutations that have not be handled in order to ignore them\n */\n flushMutations(): void;\n}\n"]}
1
+ {"version":3,"file":"TextMutationObserver.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/TextMutationObserver.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A wrapper of MutationObserver to observe text change from editor\n */\nexport interface TextMutationObserver {\n /**\n * Start observing mutations from editor\n */\n startObserving(): void;\n\n /**\n * Stop observing mutations from editor\n */\n stopObserving(): void;\n\n /**\n * Flush all pending mutations and update cached model if need\n * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.\n * This should only be used when we already have a up-to-date content model and will set it as latest cache\n */\n flushMutations(ignoreMutations?: boolean): void;\n}\n"]}
@@ -35,4 +35,14 @@ export interface DomIndexer {
35
35
  * @returns True if reconcile successfully, otherwise false
36
36
  */
37
37
  reconcileSelection: (model: ContentModelDocument, newSelection: DOMSelection, oldSelection?: CacheSelection) => boolean;
38
+ /**
39
+ * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.
40
+ * This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any,
41
+ * and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment
42
+ * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model
43
+ * @param addedNodes Nodes added by browser during mutation
44
+ * @param removedNodes Nodes removed by browser during mutation
45
+ * @returns True if the changed nodes are successfully reconciled, otherwise false
46
+ */
47
+ reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;
38
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DomIndexer.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/DomIndexer.ts"],"names":[],"mappings":"","sourcesContent":["import type { CacheSelection } from '../pluginState/CachePluginState';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelParagraph } from '../contentModel/block/ContentModelParagraph';\nimport type { ContentModelSegment } from '../contentModel/segment/ContentModelSegment';\nimport type { ContentModelTable } from '../contentModel/block/ContentModelTable';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an indexer object which provides methods to help build backward relationship\n * from DOM node to Content Model\n */\nexport interface DomIndexer {\n /**\n * Invoked when processing a segment\n * @param segmentNode The new DOM node for this segment\n * @param paragraph Parent paragraph of this segment\n * @param segments The source segments\n */\n onSegment: (\n segmentNode: Node,\n paragraph: ContentModelParagraph,\n segments: ContentModelSegment[]\n ) => void;\n\n /**\n * Invoked when new paragraph node is created in DOM tree\n * @param paragraphElement The new DOM node for this paragraph\n */\n onParagraph: (paragraphElement: HTMLElement) => void;\n\n /**\n * Invoked when new table node is created in DOM tree\n * @param tableElement The new DOM node for this table\n */\n onTable: (tableElement: HTMLTableElement, tableModel: ContentModelTable) => void;\n\n /**\n * When document content or selection is changed by user, we need to use this function to update the content model\n * to reflect the latest document. This process can fail since the selected node may not have a related model data structure.\n * @param model Current cached content model\n * @param newSelection Latest selection\n * @param oldSelection @optional Original selection before this change\n * @returns True if reconcile successfully, otherwise false\n */\n reconcileSelection: (\n model: ContentModelDocument,\n newSelection: DOMSelection,\n oldSelection?: CacheSelection\n ) => boolean;\n}\n"]}
1
+ {"version":3,"file":"DomIndexer.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/DomIndexer.ts"],"names":[],"mappings":"","sourcesContent":["import type { CacheSelection } from '../pluginState/CachePluginState';\nimport type { ContentModelDocument } from '../contentModel/blockGroup/ContentModelDocument';\nimport type { ContentModelParagraph } from '../contentModel/block/ContentModelParagraph';\nimport type { ContentModelSegment } from '../contentModel/segment/ContentModelSegment';\nimport type { ContentModelTable } from '../contentModel/block/ContentModelTable';\nimport type { DOMSelection } from '../selection/DOMSelection';\n\n/**\n * Represents an indexer object which provides methods to help build backward relationship\n * from DOM node to Content Model\n */\nexport interface DomIndexer {\n /**\n * Invoked when processing a segment\n * @param segmentNode The new DOM node for this segment\n * @param paragraph Parent paragraph of this segment\n * @param segments The source segments\n */\n onSegment: (\n segmentNode: Node,\n paragraph: ContentModelParagraph,\n segments: ContentModelSegment[]\n ) => void;\n\n /**\n * Invoked when new paragraph node is created in DOM tree\n * @param paragraphElement The new DOM node for this paragraph\n */\n onParagraph: (paragraphElement: HTMLElement) => void;\n\n /**\n * Invoked when new table node is created in DOM tree\n * @param tableElement The new DOM node for this table\n */\n onTable: (tableElement: HTMLTableElement, tableModel: ContentModelTable) => void;\n\n /**\n * When document content or selection is changed by user, we need to use this function to update the content model\n * to reflect the latest document. This process can fail since the selected node may not have a related model data structure.\n * @param model Current cached content model\n * @param newSelection Latest selection\n * @param oldSelection @optional Original selection before this change\n * @returns True if reconcile successfully, otherwise false\n */\n reconcileSelection: (\n model: ContentModelDocument,\n newSelection: DOMSelection,\n oldSelection?: CacheSelection\n ) => boolean;\n\n /**\n * When child list of editor content is changed, we can use this method to do sync the change from editor into content model.\n * This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any,\n * and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment\n * in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model\n * @param addedNodes Nodes added by browser during mutation\n * @param removedNodes Nodes removed by browser during mutation\n * @returns True if the changed nodes are successfully reconciled, otherwise false\n */\n reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean;\n}\n"]}
@@ -11,7 +11,9 @@ export interface TextMutationObserver {
11
11
  */
12
12
  stopObserving(): void;
13
13
  /**
14
- * Flush all pending mutations that have not be handled in order to ignore them
14
+ * Flush all pending mutations and update cached model if need
15
+ * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.
16
+ * This should only be used when we already have a up-to-date content model and will set it as latest cache
15
17
  */
16
- flushMutations(): void;
18
+ flushMutations(ignoreMutations?: boolean): void;
17
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextMutationObserver.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/TextMutationObserver.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A wrapper of MutationObserver to observe text change from editor\n */\nexport interface TextMutationObserver {\n /**\n * Start observing mutations from editor\n */\n startObserving(): void;\n\n /**\n * Stop observing mutations from editor\n */\n stopObserving(): void;\n\n /**\n * Flush all pending mutations that have not be handled in order to ignore them\n */\n flushMutations(): void;\n}\n"]}
1
+ {"version":3,"file":"TextMutationObserver.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-types/lib/context/TextMutationObserver.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A wrapper of MutationObserver to observe text change from editor\n */\nexport interface TextMutationObserver {\n /**\n * Start observing mutations from editor\n */\n startObserving(): void;\n\n /**\n * Stop observing mutations from editor\n */\n stopObserving(): void;\n\n /**\n * Flush all pending mutations and update cached model if need\n * @param ignoreMutations When pass true, all mutations will be ignored and do not update content model.\n * This should only be used when we already have a up-to-date content model and will set it as latest cache\n */\n flushMutations(ignoreMutations?: boolean): void;\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.5.1",
5
+ "version": "9.7.0",
6
6
  "main": "./lib/index.js",
7
7
  "typings": "./lib/index.d.ts",
8
8
  "module": "./lib-mjs/index.js",