roosterjs 8.55.0 → 8.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 8.55.0)
1
+ // Type definitions for roosterjs (Version 8.57.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
@@ -2956,6 +2972,10 @@ export interface DOMEventPluginState {
2956
2972
  * Image selection range
2957
2973
  */
2958
2974
  imageSelectionRange: ImageSelectionRange | null;
2975
+ /**
2976
+ * When set to true, onFocus event will not trigger reselect cached range
2977
+ */
2978
+ skipReselectOnFocus?: boolean;
2959
2979
  }
2960
2980
 
2961
2981
  /**
@@ -3101,6 +3121,29 @@ export interface CopyPastePluginState {
3101
3121
  allowedCustomPasteType: string[];
3102
3122
  }
3103
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
+
3104
3147
  /**
3105
3148
  * Command strings for Document.execCommand() API
3106
3149
  * https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand
@@ -3845,13 +3888,24 @@ export const enum ExperimentalFeatures {
3845
3888
  */
3846
3889
  EditWithContentModel = "EditWithContentModel",
3847
3890
  /**
3848
- * Provide additional Tab Key Features. Requires Text Features Content Editable Features
3849
- */
3850
- TabKeyTextFeatures = "TabKeyTextFeatures",
3851
- /**
3891
+ * @deprecated This feature is always enabled
3852
3892
  * Trigger formatting by a especial characters. Ex: (A), 1. i).
3853
3893
  */
3854
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",
3905
+ /**
3906
+ * Provide additional Tab Key Features. Requires Text Features Content Editable Features
3907
+ */
3908
+ TabKeyTextFeatures = "TabKeyTextFeatures",
3855
3909
  /**
3856
3910
  * With this feature enabled, when writing back a list item we will re-use all
3857
3911
  * ancestor list elements, even if they don't match the types currently in the
@@ -3863,14 +3917,6 @@ export const enum ExperimentalFeatures {
3863
3917
  * Delete table with Backspace key with the whole was selected with table selector
3864
3918
  */
3865
3919
  DeleteTableWithBackspace = "DeleteTableWithBackspace",
3866
- /**
3867
- * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
3868
- */
3869
- InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters",
3870
- /**
3871
- * Paste with Content model
3872
- */
3873
- ContentModelPaste = "ContentModelPaste",
3874
3920
  /**
3875
3921
  * Disable list chain functionality
3876
3922
  */
@@ -5300,6 +5346,25 @@ export interface BeforeKeyboardEditingData {
5300
5346
  export interface CompatibleBeforeKeyboardEditingEvent extends BeforeKeyboardEditingData, BasePluginEvent<CompatiblePluginEventType.BeforeKeyboardEditing> {
5301
5347
  }
5302
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
+
5303
5368
  /**
5304
5369
  * This refers to a "content block" in editor that serves as a content parsing boundary
5305
5370
  * It is most those html block like tags, i.e. &lt;p&gt;, &lt;div&gt;, &lt;li&gt;, &lt;td&gt; etc.
@@ -5430,6 +5495,12 @@ export interface ContentChangedData {
5430
5495
  * @returns Related entity state array
5431
5496
  */
5432
5497
  getEntityState?: () => EntityState[];
5498
+ /**
5499
+ * @optional
5500
+ * Get Announce data from this content changed event.
5501
+ * @returns
5502
+ */
5503
+ getAnnounceData?: () => AnnounceData | undefined;
5433
5504
  }
5434
5505
 
5435
5506
  /**
@@ -7235,6 +7306,12 @@ export interface EditorCore extends PluginState {
7235
7306
  * If keep it null, editor will still use original dataset-based dark mode solution.
7236
7307
  */
7237
7308
  darkColorHandler: DarkColorHandler;
7309
+ /**
7310
+ * A callback to be invoked when any exception is thrown during disposing editor
7311
+ * @param plugin The plugin that causes exception
7312
+ * @param error The error object we got
7313
+ */
7314
+ disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;
7238
7315
  }
7239
7316
 
7240
7317
  /**
@@ -7694,6 +7771,12 @@ export interface EditorOptions {
7694
7771
  * Color of the border of a selectedImage. Default color: '#DB626C'
7695
7772
  */
7696
7773
  imageSelectionBorderColor?: string;
7774
+ /**
7775
+ * A callback to be invoked when any exception is thrown during disposing editor
7776
+ * @param plugin The plugin that causes exception
7777
+ * @param error The error object we got
7778
+ */
7779
+ disposeErrorHandler?: (plugin: EditorPlugin, error: Error) => void;
7697
7780
  }
7698
7781
 
7699
7782
  /**
@@ -8660,13 +8743,24 @@ export enum CompatibleExperimentalFeatures {
8660
8743
  */
8661
8744
  EditWithContentModel = "EditWithContentModel",
8662
8745
  /**
8663
- * Provide additional Tab Key Features. Requires Text Features Content Editable Features
8664
- */
8665
- TabKeyTextFeatures = "TabKeyTextFeatures",
8666
- /**
8746
+ * @deprecated This feature is always enabled
8667
8747
  * Trigger formatting by a especial characters. Ex: (A), 1. i).
8668
8748
  */
8669
8749
  AutoFormatList = "AutoFormatList",
8750
+ /**
8751
+ * @deprecated This feature is always enabled
8752
+ * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
8753
+ */
8754
+ InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters",
8755
+ /**
8756
+ * @deprecated This feature is always enabled
8757
+ * Paste with Content model
8758
+ */
8759
+ ContentModelPaste = "ContentModelPaste",
8760
+ /**
8761
+ * Provide additional Tab Key Features. Requires Text Features Content Editable Features
8762
+ */
8763
+ TabKeyTextFeatures = "TabKeyTextFeatures",
8670
8764
  /**
8671
8765
  * With this feature enabled, when writing back a list item we will re-use all
8672
8766
  * ancestor list elements, even if they don't match the types currently in the
@@ -8678,14 +8772,6 @@ export enum CompatibleExperimentalFeatures {
8678
8772
  * Delete table with Backspace key with the whole was selected with table selector
8679
8773
  */
8680
8774
  DeleteTableWithBackspace = "DeleteTableWithBackspace",
8681
- /**
8682
- * Add entities around a Read Only Inline entity to prevent cursor to be hidden when cursor is next of it.
8683
- */
8684
- InlineEntityReadOnlyDelimiters = "InlineEntityReadOnlyDelimiters",
8685
- /**
8686
- * Paste with Content model
8687
- */
8688
- ContentModelPaste = "ContentModelPaste",
8689
8775
  /**
8690
8776
  * Disable list chain functionality
8691
8777
  */
@@ -8949,6 +9035,29 @@ export enum CompatibleEntityOperation {
8949
9035
  UpdateEntityState = 11
8950
9036
  }
8951
9037
 
9038
+ /**
9039
+ * Known announce strings
9040
+ */
9041
+ export enum CompatibleKnownAnnounceStrings {
9042
+ /**
9043
+ * String announced for a list item in a OL List
9044
+ * @example
9045
+ * Auto corrected, &lcub;0&rcub;
9046
+ * Where &lcub0&rcub is the new list item bullet
9047
+ */
9048
+ AnnounceListItemNumbering = 1,
9049
+ /**
9050
+ * String announced for a list item in a UL List
9051
+ * @example
9052
+ * Auto corrected bullet
9053
+ */
9054
+ AnnounceListItemBullet = 2,
9055
+ /**
9056
+ * String announced when cursor is moved to the last cell in a table
9057
+ */
9058
+ AnnounceOnFocusLastCell = 3
9059
+ }
9060
+
8952
9061
  /**
8953
9062
  * The position. Mostly used for content insertion and traversing
8954
9063
  * On insertion, we will need to specify where we want the content to be placed (begin, end, selection or outside)
@@ -10635,6 +10744,7 @@ export class PickerPlugin<T extends PickerDataProvider = PickerDataProvider> imp
10635
10744
  private shouldHandleKeyUpEvent;
10636
10745
  private onKeyUpDomEvent;
10637
10746
  private onKeyDownEvent;
10747
+ private getParentNodeIfTextNode;
10638
10748
  private onAndroidInputEvent;
10639
10749
  private calcInputLength;
10640
10750
  private tryRemoveNode;
@@ -10784,3 +10894,63 @@ export class AutoFormat implements EditorPlugin {
10784
10894
  onPluginEvent(event: PluginEvent): void;
10785
10895
  }
10786
10896
 
10897
+ /**
10898
+ * Announce feature keys
10899
+ */
10900
+ export type AnnounceFeatureKey = 'announceNewListItem' | 'announceWarningOnLastTableCell';
10901
+
10902
+ /**
10903
+ * Represents a Announce feature used in Announce Plugin.
10904
+ * If the Should Handle Callback returns announce data, it will be announced by using a aria-live region.
10905
+ */
10906
+ export interface AnnounceFeature {
10907
+ /**
10908
+ * Whether to handle this feature, if returns Announce Data, will be announced, otherwise will do nothing.
10909
+ * @returns
10910
+ */
10911
+ shouldHandle: (editor: IEditor, lastFocusedElement: HTMLElement | null) => AnnounceData | false;
10912
+ /**
10913
+ * Keys handled in the current event
10914
+ */
10915
+ keys: number[];
10916
+ }
10917
+
10918
+ /**
10919
+ * Announce messages to screen reader by using aria live element.
10920
+ */
10921
+ export class Announce implements EditorPlugin {
10922
+ private stringsMapOrGetter?;
10923
+ private ariaLiveElement;
10924
+ private editor;
10925
+ private features;
10926
+ private lastFocusedElement;
10927
+ constructor(stringsMapOrGetter?: Map<KnownAnnounceStrings | CompatibleKnownAnnounceStrings, string> | ((key: KnownAnnounceStrings | CompatibleKnownAnnounceStrings) => string) | undefined, skipAnnounceFeatures?: AnnounceFeatureKey[], additionalFeatures?: AnnounceFeature[]);
10928
+ /**
10929
+ * Get a friendly name of this plugin
10930
+ */
10931
+ getName(): string;
10932
+ /**
10933
+ * Initialize this plugin
10934
+ * @param editor The editor instance
10935
+ */
10936
+ initialize(editor: IEditor): void;
10937
+ /**
10938
+ * Dispose this plugin
10939
+ */
10940
+ dispose(): void;
10941
+ /**
10942
+ * Handle events triggered from editor
10943
+ * @param event PluginEvent object
10944
+ */
10945
+ onPluginEvent(ev: PluginEvent): void;
10946
+ private handleFeatures;
10947
+ protected announce(announceData: AnnounceData, editor: IEditor): void;
10948
+ private getString;
10949
+ /**
10950
+ * @internal
10951
+ * Public only for unit testing.
10952
+ * @returns
10953
+ */
10954
+ getAriaLiveElement(): HTMLDivElement | undefined;
10955
+ }
10956
+