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