roosterjs 9.55.0 → 9.57.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.55.0)
1
+ // Type definitions for roosterjs (Version 9.57.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -103,6 +103,11 @@ type ContentModelHyperLinkFormat = LinkFormat & TextColorFormat & BackgroundColo
103
103
  */
104
104
  type ContentModelCodeFormat = FontFamilyFormat & DisplayFormat;
105
105
 
106
+ /**
107
+ * The format object for a data element (<data>) in Content Model
108
+ */
109
+ type ContentModelDataFormat = DataValueFormat;
110
+
106
111
  /**
107
112
  * Type for FormatContainer
108
113
  */
@@ -217,6 +222,10 @@ interface ContentModelFormatMap {
217
222
  * Format type for code
218
223
  */
219
224
  code: FontFamilyFormat;
225
+ /**
226
+ * Format type for data, used by HTML <data> element
227
+ */
228
+ data: ContentModelDataFormat;
220
229
  /**
221
230
  * Format type for dataset
222
231
  */
@@ -285,6 +294,10 @@ interface FormatHandlerTypeMap {
285
294
  * Format for DatasetFormat
286
295
  */
287
296
  dataset: DatasetFormat;
297
+ /**
298
+ * Format for DataValueFormat, used by HTML <data> element
299
+ */
300
+ dataValue: DataValueFormat;
288
301
  /**
289
302
  * Format for DirectionFormat
290
303
  */
@@ -506,6 +519,16 @@ type LetterSpacingFormat = {
506
519
  letterSpacing?: string;
507
520
  };
508
521
 
522
+ /**
523
+ * Format of the value of a HTML "data" element
524
+ */
525
+ type DataValueFormat = {
526
+ /**
527
+ * The machine-readable value, represented by the "value" attribute of a HTML "data" element
528
+ */
529
+ dataValue?: string;
530
+ };
531
+
509
532
  /**
510
533
  * Format of line height
511
534
  */
@@ -2171,6 +2194,10 @@ interface ContentModelSegmentBase<T extends ContentModelSegmentType, TFormat ext
2171
2194
  * Code info
2172
2195
  */
2173
2196
  code?: ContentModelCode;
2197
+ /**
2198
+ * Data info, used by HTML &lt;data&gt; element
2199
+ */
2200
+ data?: ContentModelData;
2174
2201
  }
2175
2202
 
2176
2203
  /**
@@ -2195,6 +2222,10 @@ interface ReadonlyContentModelSegmentBase<T extends ContentModelSegmentType, TFo
2195
2222
  * Code info
2196
2223
  */
2197
2224
  readonly code?: ReadonlyContentModelCode;
2225
+ /**
2226
+ * Data info, used by HTML &lt;data&gt; element
2227
+ */
2228
+ readonly data?: ReadonlyContentModelData;
2198
2229
  }
2199
2230
 
2200
2231
  /**
@@ -2209,6 +2240,10 @@ interface ShallowMutableContentModelSegmentBase<T extends ContentModelSegmentTyp
2209
2240
  * Code info
2210
2241
  */
2211
2242
  code?: ContentModelCode;
2243
+ /**
2244
+ * Data info, used by HTML &lt;data&gt; element
2245
+ */
2246
+ data?: ContentModelData;
2212
2247
  }
2213
2248
 
2214
2249
  /**
@@ -2240,6 +2275,22 @@ interface ContentModelCode extends MutableMark, ContentModelWithFormat<ContentMo
2240
2275
  * since code is also a kind of segment, with some extra information
2241
2276
  */
2242
2277
  interface ReadonlyContentModelCode extends ReadonlyMark, ReadonlyContentModelWithFormat<ContentModelCodeFormat> {
2278
+ }
2279
+
2280
+ /**
2281
+ * Represent data info of Content Model, used by HTML &lt;data&gt; element.
2282
+ * ContentModelData is a decorator but not a standalone model type, instead it need to be put inside a ContentModelSegment
2283
+ * since the &lt;data&gt; element is also a kind of segment, with some extra information
2284
+ */
2285
+ interface ContentModelData extends MutableMark, ContentModelWithFormat<ContentModelDataFormat> {
2286
+ }
2287
+
2288
+ /**
2289
+ * Represent data info of Content Model, used by HTML &lt;data&gt; element. (Readonly)
2290
+ * ContentModelData is a decorator but not a standalone model type, instead it need to be put inside a ContentModelSegment
2291
+ * since the &lt;data&gt; element is also a kind of segment, with some extra information
2292
+ */
2293
+ interface ReadonlyContentModelData extends ReadonlyMark, ReadonlyContentModelWithFormat<ContentModelDataFormat> {
2243
2294
  }
2244
2295
 
2245
2296
  /**
@@ -2287,12 +2338,12 @@ interface ReadonlyContentModelParagraphDecorator extends ReadonlyMark, ReadonlyC
2287
2338
  /**
2288
2339
  * Union type for segment decorators
2289
2340
  */
2290
- type ContentModelDecorator = ContentModelLink | ContentModelCode | ContentModelListLevel;
2341
+ type ContentModelDecorator = ContentModelLink | ContentModelCode | ContentModelData | ContentModelListLevel;
2291
2342
 
2292
2343
  /**
2293
2344
  * Union type for segment decorators (Readonly)
2294
2345
  */
2295
- type ReadonlyContentModelDecorator = ReadonlyContentModelLink | ReadonlyContentModelCode | ReadonlyContentModelListLevel;
2346
+ type ReadonlyContentModelDecorator = ReadonlyContentModelLink | ReadonlyContentModelCode | ReadonlyContentModelData | ReadonlyContentModelListLevel;
2296
2347
 
2297
2348
  /**
2298
2349
  * Content Model of List Level
@@ -3048,6 +3099,10 @@ interface DomToModelDecoratorContext {
3048
3099
  * Context of code info
3049
3100
  */
3050
3101
  code: ContentModelCode;
3102
+ /**
3103
+ * Context of data info, used by HTML &lt;data&gt; element
3104
+ */
3105
+ data: ContentModelData;
3051
3106
  /**
3052
3107
  * Context for paragraph decorator
3053
3108
  */
@@ -3836,6 +3891,11 @@ interface IEditor {
3836
3891
  * @param featureName The name of feature to check
3837
3892
  */
3838
3893
  isExperimentalFeatureEnabled(featureName: ExperimentalFeature | string): boolean;
3894
+ /**
3895
+ * Get all experimental features enabled in this editor
3896
+ * @returns An array of experimental feature names
3897
+ */
3898
+ getExperimentalFeatures(): ExperimentalFeature[];
3839
3899
  }
3840
3900
 
3841
3901
  /**
@@ -3866,7 +3926,11 @@ type ExperimentalFeature = GraduatedExperimentalFeature
3866
3926
  * These characters can be used to hide text in HTML and may cause unexpected behavior.
3867
3927
  * @see https://embracethered.com/blog/posts/2024/hiding-and-finding-text-with-unicode-tags/
3868
3928
  */
3869
- | 'FilterInvisibleUnicode';
3929
+ | 'FilterInvisibleUnicode'
3930
+ /**
3931
+ * Handle the drop event for content that is dropped from the same editor instance.
3932
+ */
3933
+ | 'HandleDropInternalContent';
3870
3934
 
3871
3935
  /**
3872
3936
  * Predefined experiment features (Graduated, only keep them for backward compatibility)
@@ -5047,6 +5111,10 @@ interface FormatContentModelOptions {
5047
5111
  * When pass to true, scroll the editing caret into view after write DOM tree if need
5048
5112
  */
5049
5113
  scrollCaretIntoView?: boolean;
5114
+ /**
5115
+ * When pass to true, skip setting DOM selection after write DOM tree. @default false
5116
+ */
5117
+ skipDOMSelection?: boolean;
5050
5118
  }
5051
5119
 
5052
5120
  /**
@@ -5205,9 +5273,19 @@ interface ContentModelFormatState {
5205
5273
 
5206
5274
  /**
5207
5275
  * Represents the PasteType parameter used to set the paste type to use.
5208
- * It can be either the Paste Type value or a callback that retuns the Paste Type to use.
5276
+ * It can be either the Paste Type value or a callback that returns the Paste Type to use.
5277
+ */
5278
+ type PasteTypeOrGetter = PasteType | PasteTypeGetter;
5279
+
5280
+ /**
5281
+ * A function that returns the Paste Type to use based on the pasted content and clipboard data.
5282
+ * @param document The document parsed from the clipboard raw HTML, or null when there is no HTML
5283
+ * @param clipboardData Clipboard data retrieved from clipboard
5284
+ * @param environment The editor environment information
5285
+ * @param htmlAttributes The metadata (HTML attributes) retrieved from the pasted content
5286
+ * @returns The Paste Type to use
5209
5287
  */
5210
- type PasteTypeOrGetter = PasteType | ((document: Document | null, clipboardData: ClipboardData) => PasteType);
5288
+ type PasteTypeGetter = (document: Document | null, clipboardData: ClipboardData, environment: EditorEnvironment, htmlAttributes: Record<string, string>) => PasteType;
5211
5289
 
5212
5290
  /**
5213
5291
  * Image Format
@@ -7363,9 +7441,10 @@ function createTableCell(spanLeftOrColSpan?: boolean | number, spanAboveOrRowSpa
7363
7441
  * @param text Text of this model
7364
7442
  * @param format @optional The format of this model
7365
7443
  * @param link @optional The link decorator
7366
- * @param code @option The code decorator
7444
+ * @param code @optional The code decorator
7445
+ * @param data @optional The data decorator
7367
7446
  */
7368
- function createText(text: string, format?: Readonly<ContentModelSegmentFormat>, link?: ReadonlyContentModelLink, code?: ReadonlyContentModelCode): ContentModelText;
7447
+ function createText(text: string, format?: Readonly<ContentModelSegmentFormat>, link?: ReadonlyContentModelLink, code?: ReadonlyContentModelCode, data?: ReadonlyContentModelData): ContentModelText;
7369
7448
 
7370
7449
  /**
7371
7450
  * Create a ContentModelImage model
@@ -8331,6 +8410,10 @@ const ChangeSource: {
8331
8410
  * Content changed by paste
8332
8411
  */
8333
8412
  Paste: string;
8413
+ /**
8414
+ * Content changed by auto markdown conversion
8415
+ */
8416
+ AutoMarkdownConversion: string;
8334
8417
  /**
8335
8418
  * Content changed by setContent API
8336
8419
  */
@@ -8807,6 +8890,11 @@ class Editor implements IEditor {
8807
8890
  * @param featureName The name of feature to check
8808
8891
  */
8809
8892
  isExperimentalFeatureEnabled(featureName: ExperimentalFeature | string): boolean;
8893
+ /**
8894
+ * Get all experimental features enabled in this editor
8895
+ * @returns An array of experimental feature names
8896
+ * */
8897
+ getExperimentalFeatures(): ExperimentalFeature[];
8810
8898
  /**
8811
8899
  * @returns the current EditorCore object
8812
8900
  * @throws a standard Error if there's no core object
@@ -10878,7 +10966,7 @@ class AnnouncePlugin implements EditorPlugin {
10878
10966
  class DragAndDropPlugin implements EditorPlugin {
10879
10967
  private editor;
10880
10968
  private forbiddenElements;
10881
- private isInternalDragging;
10969
+ private internalDrag;
10882
10970
  private disposer;
10883
10971
  /**
10884
10972
  * Construct a new instance of DragAndDropPlugin