roosterjs 9.11.2 → 9.13.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.11.2)
1
+ // Type definitions for roosterjs (Version 9.13.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -2853,6 +2853,10 @@ interface ModelToDomBlockAndSegmentNode {
2853
2853
  * Segment node of this position. When provided, it represents the position right after this node
2854
2854
  */
2855
2855
  segment: Node | null;
2856
+ /**
2857
+ * Offset number of this position. It is only used for Text node, default value is 0
2858
+ */
2859
+ offset?: number;
2856
2860
  }
2857
2861
 
2858
2862
  /**
@@ -3065,6 +3069,14 @@ interface DomIndexer {
3065
3069
  * @param parent Parent of entity. For block element, this should be the parent block group. For inline entity, this should be the parent paragraph
3066
3070
  */
3067
3071
  onBlockEntity: (entity: ContentModelEntity, group: ContentModelBlockGroup) => void;
3072
+ /**
3073
+ * Invoke when merge two continuous text nodes, we need to merge their indexes as well
3074
+ * @param targetText Target text node to merge into
3075
+ * @param sourceText Source text node to merge from
3076
+ * @example Assume we have two text nodes: Node1="Foo", Node2="Bar", after merge,
3077
+ * Node1 will become "FooBar", Node2 will be removed from DOM tree
3078
+ */
3079
+ onMergeText: (targetText: Text, sourceText: Text) => void;
3068
3080
  /**
3069
3081
  * When document content or selection is changed by user, we need to use this function to update the content model
3070
3082
  * to reflect the latest document. This process can fail since the selected node may not have a related model data structure.
@@ -4360,6 +4372,28 @@ interface ContextMenuPluginState {
4360
4372
  contextMenuProviders: ContextMenuProvider<any>[];
4361
4373
  }
4362
4374
 
4375
+ /**
4376
+ * Options to customize the Auto link options in Auto Format Plugin
4377
+ */
4378
+ interface AutoLinkOptions {
4379
+ /**
4380
+ * When press backspace before a link, remove the hyperlink
4381
+ */
4382
+ autoUnlink?: boolean;
4383
+ /**
4384
+ * When paste or type content with a link, create hyperlink for the link
4385
+ */
4386
+ autoLink?: boolean;
4387
+ /**
4388
+ * When paste content or type content with telephone, create hyperlink for the telephone number
4389
+ */
4390
+ autoTel?: boolean;
4391
+ /**
4392
+ * When paste or type a content with mailto, create hyperlink for the content
4393
+ */
4394
+ autoMailto?: boolean;
4395
+ }
4396
+
4363
4397
  /**
4364
4398
  * Current running environment
4365
4399
  */
@@ -5334,14 +5368,16 @@ interface MergeModelOption {
5334
5368
  insertPosition?: InsertPoint;
5335
5369
  /**
5336
5370
  * Use this to decide whether to change the source model format when doing the merge.
5337
- * 'mergeAll': segment format of the insert position will be merged into the content that is merged into current model.
5371
+ * 'mergeAll': (deprecated) Use PreferSource Instead, segment format of the insert position will be merged into the content that is merged into current model.
5338
5372
  * If the source model already has some format, it will not be overwritten.
5339
5373
  * 'keepSourceEmphasisFormat': format of the insert position will be set into the content that is merged into current model.
5340
5374
  * If the source model already has emphasis format, such as, fontWeight, Italic or underline different than the default style, it will not be overwritten.
5341
5375
  * 'none' the source segment format will not be modified.
5376
+ * 'preferSource' Will merge both formatting, but source will overwrite target
5377
+ * 'preferTarget' Will merge both formatting, but target will overwrite source
5342
5378
  * @default undefined
5343
5379
  */
5344
- mergeFormat?: 'mergeAll' | 'keepSourceEmphasisFormat' | 'none';
5380
+ mergeFormat?: 'mergeAll' | 'keepSourceEmphasisFormat' | 'none' | 'preferSource' | 'preferTarget';
5345
5381
  /**
5346
5382
  * Whether to add a paragraph after the merged content.
5347
5383
  */
@@ -7182,9 +7218,10 @@ function getListStyleTypeFromString(listType: 'OL' | 'UL', bullet: string): numb
7182
7218
  /**
7183
7219
  * Get the text format of a segment, this function will return only format that is applicable to text
7184
7220
  * @param segment The segment to get format from
7221
+ * @param includingBIU When pass true, also get Bold/Italic/Underline format
7185
7222
  * @returns
7186
7223
  */
7187
- function getSegmentTextFormat(segment: ReadonlyContentModelSegment): ContentModelSegmentFormat;
7224
+ function getSegmentTextFormat(segment: ReadonlyContentModelSegment, includingBIU?: boolean): ContentModelSegmentFormat;
7188
7225
 
7189
7226
  /**
7190
7227
  * Get index of closest ancestor block group of the expected block group type. If not found, return -1
@@ -8270,6 +8307,19 @@ function setModelIndentation(model: ReadonlyContentModelDocument, indentation: '
8270
8307
  */
8271
8308
  function matchLink(url: string): LinkData | null;
8272
8309
 
8310
+ /**
8311
+ * Promote the given text segment to a hyper link when the segment text is ending with a valid link format.
8312
+ * When the whole text segment if of a link, promote the whole segment.
8313
+ * When the text segment ends with a link format, split the segment and promote the second part
8314
+ * When link is in middle of the text segment, no action.
8315
+ * This is mainly used for doing auto link when there is a link before cursor
8316
+ * @param segment The text segment to search link text from
8317
+ * @param paragraph Parent paragraph of the segment
8318
+ * @param options Options of auto link
8319
+ * @returns If a link is promoted, return this segment. Otherwise return null
8320
+ */
8321
+ function promoteLink(segment: ContentModelText, paragraph: ShallowMutableContentModelParagraph, autoLinkOptions: AutoLinkOptions): ContentModelText | null;
8322
+
8273
8323
  /**
8274
8324
  * Get announce data for list item
8275
8325
  * @param path Content model path that include the list item
@@ -8528,28 +8578,6 @@ interface AutoFormatOptions extends AutoLinkOptions {
8528
8578
  autoOrdinals?: boolean;
8529
8579
  }
8530
8580
 
8531
- /**
8532
- * Options to customize the Auto link options in Auto Format Plugin
8533
- */
8534
- interface AutoLinkOptions {
8535
- /**
8536
- * When press backspace before a link, remove the hyperlink
8537
- */
8538
- autoUnlink?: boolean;
8539
- /**
8540
- * When paste or type content with a link, create hyperlink for the link
8541
- */
8542
- autoLink?: boolean;
8543
- /**
8544
- * When paste content or type content with telephone, create hyperlink for the telephone number
8545
- */
8546
- autoTel?: boolean;
8547
- /**
8548
- * When paste or type a content with mailto, create hyperlink for the content
8549
- */
8550
- autoMailto?: boolean;
8551
- }
8552
-
8553
8581
  /**
8554
8582
  * Shortcut command for Bold
8555
8583
  * Windows: Ctrl + B