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