roosterjs 8.56.0 → 8.58.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 8.56.0)
1
+ // Type definitions for roosterjs (Version 8.58.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -1307,6 +1307,22 @@ export class VListChain {
1307
1307
  private getLists;
1308
1308
  }
1309
1309
 
1310
+ /**
1311
+ * Convert decimal numbers into english alphabet letters
1312
+ * @param decimal The decimal number that needs to be converted
1313
+ * @param isLowerCase if true the roman value will appear in lower case
1314
+ * @returns
1315
+ */
1316
+ export function convertDecimalsToAlpha(decimal: number, isLowerCase?: boolean): string;
1317
+
1318
+ /**
1319
+ * Convert decimal numbers into roman numbers
1320
+ * @param decimal The decimal number that needs to be converted
1321
+ * @param isLowerCase if true the roman value will appear in lower case
1322
+ * @returns
1323
+ */
1324
+ export function convertDecimalsToRoman(decimal: number, isLowerCase?: boolean): string;
1325
+
1310
1326
  /**
1311
1327
  * Set the Style of a List Item provided, with the styles that the inline child elements have
1312
1328
  * If the child inline elements have different styles, it will not modify the styles of the list item
@@ -3105,6 +3121,29 @@ export interface CopyPastePluginState {
3105
3121
  allowedCustomPasteType: string[];
3106
3122
  }
3107
3123
 
3124
+ /**
3125
+ * Known announce strings
3126
+ */
3127
+ export const enum KnownAnnounceStrings {
3128
+ /**
3129
+ * String announced for a list item in a OL List
3130
+ * @example
3131
+ * Auto corrected, {0}
3132
+ * Where &lcub0&rcub is the new list item bullet
3133
+ */
3134
+ AnnounceListItemNumbering = 1,
3135
+ /**
3136
+ * String announced for a list item in a UL List
3137
+ * @example
3138
+ * Auto corrected bullet
3139
+ */
3140
+ AnnounceListItemBullet = 2,
3141
+ /**
3142
+ * String announced when cursor is moved to the last cell in a table
3143
+ */
3144
+ AnnounceOnFocusLastCell = 3
3145
+ }
3146
+
3108
3147
  /**
3109
3148
  * Command strings for Document.execCommand() API
3110
3149
  * https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand
@@ -3853,6 +3892,16 @@ export const enum ExperimentalFeatures {
3853
3892
  * Trigger formatting by a especial characters. Ex: (A), 1. i).
3854
3893
  */
3855
3894
  AutoFormatList = "AutoFormatList",
3895
+ /**
3896
+ * @deprecated This feature is always enabled
3897
+ * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
3898
+ */
3899
+ InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters",
3900
+ /**
3901
+ * @deprecated This feature is always enabled
3902
+ * Paste with Content model
3903
+ */
3904
+ ContentModelPaste = "ContentModelPaste",
3856
3905
  /**
3857
3906
  * Provide additional Tab Key Features. Requires Text Features Content Editable Features
3858
3907
  */
@@ -3868,14 +3917,6 @@ export const enum ExperimentalFeatures {
3868
3917
  * Delete table with Backspace key with the whole was selected with table selector
3869
3918
  */
3870
3919
  DeleteTableWithBackspace = "DeleteTableWithBackspace",
3871
- /**
3872
- * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
3873
- */
3874
- InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters",
3875
- /**
3876
- * Paste with Content model
3877
- */
3878
- ContentModelPaste = "ContentModelPaste",
3879
3920
  /**
3880
3921
  * Disable list chain functionality
3881
3922
  */
@@ -5305,6 +5346,25 @@ export interface BeforeKeyboardEditingData {
5305
5346
  export interface CompatibleBeforeKeyboardEditingEvent extends BeforeKeyboardEditingData, BasePluginEvent<CompatiblePluginEventType.BeforeKeyboardEditing> {
5306
5347
  }
5307
5348
 
5349
+ /**
5350
+ * Represents data, that can be used to announce text to screen reader.
5351
+ */
5352
+ export interface AnnounceData {
5353
+ /**
5354
+ * @optional Default announce strings built in Rooster
5355
+ */
5356
+ defaultStrings?: KnownAnnounceStrings | CompatibleKnownAnnounceStrings;
5357
+ /**
5358
+ * @optional string to announce from this Content Changed event, will be the fallback value if default string
5359
+ * is not provided or if it is not found in the strings map.
5360
+ */
5361
+ text?: string;
5362
+ /**
5363
+ * @optional if provided, will attempt to replace {n} with each of the values inside of the array.
5364
+ */
5365
+ formatStrings?: string[];
5366
+ }
5367
+
5308
5368
  /**
5309
5369
  * This refers to a "content block" in editor that serves as a content parsing boundary
5310
5370
  * It is most those html block like tags, i.e. &lt;p&gt;, &lt;div&gt;, &lt;li&gt;, &lt;td&gt; etc.
@@ -5435,6 +5495,12 @@ export interface ContentChangedData {
5435
5495
  * @returns Related entity state array
5436
5496
  */
5437
5497
  getEntityState?: () => EntityState[];
5498
+ /**
5499
+ * @optional
5500
+ * Get Announce data from this content changed event.
5501
+ * @returns
5502
+ */
5503
+ getAnnounceData?: () => AnnounceData | undefined;
5438
5504
  }
5439
5505
 
5440
5506
  /**
@@ -5665,6 +5731,10 @@ export interface StyleBasedFormatState {
5665
5731
  * Direction of the element ('ltr' or 'rtl')
5666
5732
  */
5667
5733
  direction?: string;
5734
+ /**
5735
+ * Font weight
5736
+ */
5737
+ fontWeight?: string;
5668
5738
  }
5669
5739
 
5670
5740
  /**
@@ -6246,6 +6316,10 @@ export type TableCellMetadataFormat = {
6246
6316
  * Override default vertical align value
6247
6317
  */
6248
6318
  vAlignOverride?: boolean;
6319
+ /**
6320
+ * Override default border value
6321
+ */
6322
+ borderOverride?: boolean;
6249
6323
  };
6250
6324
 
6251
6325
  /**
@@ -7240,6 +7314,12 @@ export interface EditorCore extends PluginState {
7240
7314
  * If keep it null, editor will still use original dataset-based dark mode solution.
7241
7315
  */
7242
7316
  darkColorHandler: DarkColorHandler;
7317
+ /**
7318
+ * A callback to be invoked when any exception is thrown during disposing editor
7319
+ * @param plugin The plugin that causes exception
7320
+ * @param error The error object we got
7321
+ */
7322
+ disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;
7243
7323
  }
7244
7324
 
7245
7325
  /**
@@ -7699,6 +7779,12 @@ export interface EditorOptions {
7699
7779
  * Color of the border of a selectedImage. Default color: '#DB626C'
7700
7780
  */
7701
7781
  imageSelectionBorderColor?: string;
7782
+ /**
7783
+ * A callback to be invoked when any exception is thrown during disposing editor
7784
+ * @param plugin The plugin that causes exception
7785
+ * @param error The error object we got
7786
+ */
7787
+ disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;
7702
7788
  }
7703
7789
 
7704
7790
  /**
@@ -8227,6 +8313,10 @@ export interface ImageEditOptions {
8227
8313
  * @default ImageEditOperation.ResizeAndRotate
8228
8314
  */
8229
8315
  onSelectState?: ImageEditOperation | CompatibleImageEditOperation;
8316
+ /**
8317
+ * Apply changes when mouse upp
8318
+ */
8319
+ applyChangesOnMouseUp?: boolean;
8230
8320
  }
8231
8321
 
8232
8322
  /**
@@ -8669,6 +8759,16 @@ export enum CompatibleExperimentalFeatures {
8669
8759
  * Trigger formatting by a especial characters. Ex: (A), 1. i).
8670
8760
  */
8671
8761
  AutoFormatList = "AutoFormatList",
8762
+ /**
8763
+ * @deprecated This feature is always enabled
8764
+ * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
8765
+ */
8766
+ InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters",
8767
+ /**
8768
+ * @deprecated This feature is always enabled
8769
+ * Paste with Content model
8770
+ */
8771
+ ContentModelPaste = "ContentModelPaste",
8672
8772
  /**
8673
8773
  * Provide additional Tab Key Features. Requires Text Features Content Editable Features
8674
8774
  */
@@ -8684,14 +8784,6 @@ export enum CompatibleExperimentalFeatures {
8684
8784
  * Delete table with Backspace key with the whole was selected with table selector
8685
8785
  */
8686
8786
  DeleteTableWithBackspace = "DeleteTableWithBackspace",
8687
- /**
8688
- * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
8689
- */
8690
- InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters",
8691
- /**
8692
- * Paste with Content model
8693
- */
8694
- ContentModelPaste = "ContentModelPaste",
8695
8787
  /**
8696
8788
  * Disable list chain functionality
8697
8789
  */
@@ -8955,6 +9047,29 @@ export enum CompatibleEntityOperation {
8955
9047
  UpdateEntityState = 11
8956
9048
  }
8957
9049
 
9050
+ /**
9051
+ * Known announce strings
9052
+ */
9053
+ export enum CompatibleKnownAnnounceStrings {
9054
+ /**
9055
+ * String announced for a list item in a OL List
9056
+ * @example
9057
+ * Auto corrected, &lcub;0&rcub;
9058
+ * Where &lcub0&rcub is the new list item bullet
9059
+ */
9060
+ AnnounceListItemNumbering = 1,
9061
+ /**
9062
+ * String announced for a list item in a UL List
9063
+ * @example
9064
+ * Auto corrected bullet
9065
+ */
9066
+ AnnounceListItemBullet = 2,
9067
+ /**
9068
+ * String announced when cursor is moved to the last cell in a table
9069
+ */
9070
+ AnnounceOnFocusLastCell = 3
9071
+ }
9072
+
8958
9073
  /**
8959
9074
  * The position. Mostly used for content insertion and traversing
8960
9075
  * On insertion, we will need to specify where we want the content to be placed (begin, end, selection or outside)
@@ -10447,11 +10562,16 @@ export class ImageEdit implements EditorPlugin {
10447
10562
  * Create editing wrapper for the image
10448
10563
  */
10449
10564
  private createWrapper;
10450
- private insertImageWrapper;
10565
+ /**
10566
+ * EXPORTED FOR TESTING PURPOSES ONLY
10567
+ * @param wrapper
10568
+ */
10569
+ insertImageWrapper(wrapper: HTMLSpanElement): void;
10451
10570
  /**
10452
10571
  * Remove the temp wrapper of the image
10453
10572
  */
10454
10573
  private removeWrapper;
10574
+ private changesWhenMouseUp;
10455
10575
  /**
10456
10576
  * Update image edit elements to reflect current editing result
10457
10577
  * @param context
@@ -10641,6 +10761,7 @@ export class PickerPlugin<T extends PickerDataProvider = PickerDataProvider> imp
10641
10761
  private shouldHandleKeyUpEvent;
10642
10762
  private onKeyUpDomEvent;
10643
10763
  private onKeyDownEvent;
10764
+ private getParentNodeIfTextNode;
10644
10765
  private onAndroidInputEvent;
10645
10766
  private calcInputLength;
10646
10767
  private tryRemoveNode;
@@ -10790,3 +10911,63 @@ export class AutoFormat implements EditorPlugin {
10790
10911
  onPluginEvent(event: PluginEvent): void;
10791
10912
  }
10792
10913
 
10914
+ /**
10915
+ * Announce feature keys
10916
+ */
10917
+ export type AnnounceFeatureKey = 'announceNewListItem' | 'announceWarningOnLastTableCell';
10918
+
10919
+ /**
10920
+ * Represents a Announce feature used in Announce Plugin.
10921
+ * If the Should Handle Callback returns announce data, it will be announced by using a aria-live region.
10922
+ */
10923
+ export interface AnnounceFeature {
10924
+ /**
10925
+ * Whether to handle this feature, if returns Announce Data, will be announced, otherwise will do nothing.
10926
+ * @returns
10927
+ */
10928
+ shouldHandle: (editor: IEditor, lastFocusedElement: HTMLElement | null) => AnnounceData | false;
10929
+ /**
10930
+ * Keys handled in the current event
10931
+ */
10932
+ keys: number[];
10933
+ }
10934
+
10935
+ /**
10936
+ * Announce messages to screen reader by using aria live element.
10937
+ */
10938
+ export class Announce implements EditorPlugin {
10939
+ private stringsMapOrGetter?;
10940
+ private ariaLiveElement;
10941
+ private editor;
10942
+ private features;
10943
+ private lastFocusedElement;
10944
+ constructor(stringsMapOrGetter?: Map<KnownAnnounceStrings | CompatibleKnownAnnounceStrings, string> | ((key: KnownAnnounceStrings | CompatibleKnownAnnounceStrings) => string) | undefined, skipAnnounceFeatures?: AnnounceFeatureKey[], additionalFeatures?: AnnounceFeature[]);
10945
+ /**
10946
+ * Get a friendly name of this plugin
10947
+ */
10948
+ getName(): string;
10949
+ /**
10950
+ * Initialize this plugin
10951
+ * @param editor The editor instance
10952
+ */
10953
+ initialize(editor: IEditor): void;
10954
+ /**
10955
+ * Dispose this plugin
10956
+ */
10957
+ dispose(): void;
10958
+ /**
10959
+ * Handle events triggered from editor
10960
+ * @param event PluginEvent object
10961
+ */
10962
+ onPluginEvent(ev: PluginEvent): void;
10963
+ private handleFeatures;
10964
+ protected announce(announceData: AnnounceData, editor: IEditor): void;
10965
+ private getString;
10966
+ /**
10967
+ * @internal
10968
+ * Public only for unit testing.
10969
+ * @returns
10970
+ */
10971
+ getAriaLiveElement(): HTMLDivElement | undefined;
10972
+ }
10973
+