roosterjs 9.34.0 → 9.35.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/dist/rooster.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 9.34.0)
1
+ // Type definitions for roosterjs (Version 9.35.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -4284,13 +4284,13 @@ interface CachePluginState {
4284
4284
  */
4285
4285
  paragraphMap?: ParagraphMap & ParagraphIndexer;
4286
4286
  /**
4287
- * @optional Indexer for CachePlugin, to help build backward relationship from DOM node to Content Model
4287
+ * Indexer for CachePlugin, to help build backward relationship from DOM node to Content Model
4288
4288
  */
4289
- domIndexer?: DomIndexer;
4289
+ domIndexer: DomIndexer;
4290
4290
  /**
4291
- * @optional A wrapper of MutationObserver to help detect text changes in editor
4291
+ * A wrapper of MutationObserver to help detect text changes in editor
4292
4292
  */
4293
- textMutationObserver?: TextMutationObserver;
4293
+ textMutationObserver: TextMutationObserver;
4294
4294
  }
4295
4295
 
4296
4296
  /**
@@ -6093,7 +6093,11 @@ interface ContentChangedEvent extends BasePluginEvent<'contentChanged'> {
6093
6093
  */
6094
6094
  readonly formatApiName?: string;
6095
6095
  /**
6096
- * @deprecated Call editor.announce(announceData) directly insteaad
6096
+ * When set to true, the change will not be added to the undo stack
6097
+ */
6098
+ readonly skipUndo?: boolean;
6099
+ /**
6100
+ * @deprecated Call editor.announce(announceData) directly instead
6097
6101
  */
6098
6102
  readonly announceData?: AnnounceData;
6099
6103
  }
@@ -7490,8 +7494,9 @@ function getFirstSelectedTable(model: ReadonlyContentModelDocument): [ReadonlyCo
7490
7494
  * @param blockGroupTypes The expected block group types
7491
7495
  * @param stopTypes Block group types that will stop searching when hit
7492
7496
  * @param deepFirst True means search in deep first, otherwise wide first
7497
+ * @param isValidTarget @optional An additional callback to validate whether a matching block group is a valid target
7493
7498
  */
7494
- function getOperationalBlocks<T extends ContentModelBlockGroup>(group: ContentModelBlockGroup, blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes: ContentModelBlockGroupType[], deepFirst?: boolean): OperationalBlocks<T>[];
7499
+ function getOperationalBlocks<T extends ContentModelBlockGroup>(group: ContentModelBlockGroup, blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes: ContentModelBlockGroupType[], deepFirst?: boolean, isValidTarget?: (block: ReadonlyContentModelBlockGroup) => boolean): OperationalBlocks<T>[];
7495
7500
 
7496
7501
  /**
7497
7502
  * Get an array of block group - block pair that is of the expected block group type from selection (Readonly)
@@ -7499,8 +7504,9 @@ function getOperationalBlocks<T extends ContentModelBlockGroup>(group: ContentMo
7499
7504
  * @param blockGroupTypes The expected block group types
7500
7505
  * @param stopTypes Block group types that will stop searching when hit
7501
7506
  * @param deepFirst True means search in deep first, otherwise wide first
7507
+ * @param isValidTarget @optional An additional callback to validate whether a matching block group is a valid target
7502
7508
  */
7503
- function getOperationalBlocks<T extends ReadonlyContentModelBlockGroup>(group: ReadonlyContentModelBlockGroup, blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes: ContentModelBlockGroupType[], deepFirst?: boolean): ReadonlyOperationalBlocks<T>[];
7509
+ function getOperationalBlocks<T extends ReadonlyContentModelBlockGroup>(group: ReadonlyContentModelBlockGroup, blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes: ContentModelBlockGroupType[], deepFirst?: boolean, isValidTarget?: (block: ReadonlyContentModelBlockGroup) => boolean): ReadonlyOperationalBlocks<T>[];
7504
7510
 
7505
7511
  /**
7506
7512
  * Get any array of selected paragraphs from a content model
@@ -7737,8 +7743,9 @@ function getSegmentTextFormat(segment: ReadonlyContentModelSegment, includingBIU
7737
7743
  * @param path The block group path, from the closest one to root
7738
7744
  * @param blockGroupTypes The expected block group types
7739
7745
  * @param stopTypes @optional Block group types that will cause stop searching
7746
+ * @param isValidTarget @optional An additional callback to validate whether a matching block group is a valid target
7740
7747
  */
7741
- function getClosestAncestorBlockGroupIndex<T extends ContentModelBlockGroup>(path: ReadonlyContentModelBlockGroup[], blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes?: ContentModelBlockGroupType[]): number;
7748
+ function getClosestAncestorBlockGroupIndex<T extends ContentModelBlockGroup>(path: ReadonlyContentModelBlockGroup[], blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes?: ContentModelBlockGroupType[], isValidTarget?: (block: ReadonlyContentModelBlockGroup) => boolean): number;
7742
7749
 
7743
7750
  /**
7744
7751
  * Run editing steps on top of a given context object which includes current insert point and previous editing result
@@ -10058,13 +10065,20 @@ function getDarkColor(color: string, baseLValue?: number): string;
10058
10065
 
10059
10066
  /**
10060
10067
  * Convert the whole content to ContentModel with the given plain text
10061
- * @param editor The editor instance
10062
10068
  * @param text The markdown text
10063
10069
  * @param splitLinesPattern The pattern to split lines. Default is /\r\n|\r|\\n|\n/
10064
10070
  * @returns The ContentModelDocument
10065
10071
  */
10066
10072
  function convertMarkdownToContentModel(text: string, splitLinesPattern?: string): ContentModelDocument;
10067
10073
 
10074
+ /**
10075
+ * Convert the whole content to ContentModel with the given plain text
10076
+ * @param text The markdown text
10077
+ * @param options The markdown options
10078
+ * @returns The ContentModelDocument
10079
+ */
10080
+ function convertMarkdownToContentModel(text: string, options?: MarkdownToModelOptions): ContentModelDocument;
10081
+
10068
10082
  /**
10069
10083
  * Export content model document to markdown
10070
10084
  * @param selection The editor selection
@@ -10081,4 +10095,22 @@ interface MarkdownLineBreaks {
10081
10095
  lineBreak: string;
10082
10096
  }
10083
10097
 
10098
+ /**
10099
+ * Options for processing markdown text.
10100
+ */
10101
+ interface MarkdownToModelOptions {
10102
+ /**
10103
+ * The pattern to split lines in the markdown text.
10104
+ */
10105
+ splitLinesPattern?: string;
10106
+ /**
10107
+ * Specify how should we process empty lines in the markdown text.
10108
+ * - 'preserve': Keep empty lines as they are.
10109
+ * - 'remove': Remove empty lines.
10110
+ * - 'merge': Merge empty lines with adjacent paragraphs.
10111
+ * @default 'merge'
10112
+ */
10113
+ emptyLine?: 'preserve' | 'remove' | 'merge';
10114
+ }
10115
+
10084
10116
  }