roosterjs 8.44.2 → 8.45.1

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 8.44.2)
1
+ // Type definitions for roosterjs (Version 8.45.1)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -1949,14 +1949,26 @@ function toArray<T>(array: readonly T[]): T[];
1949
1949
  /**
1950
1950
  * RoosterJs core editor class
1951
1951
  */
1952
- class Editor implements IEditor {
1953
- private core;
1952
+ class Editor extends EditorBase<EditorCore, EditorOptions> {
1954
1953
  /**
1955
- * Creates an instance of Editor
1954
+ * Creates an instance of EditorBase
1956
1955
  * @param contentDiv The DIV HTML element which will be the container element of editor
1957
1956
  * @param options An optional options object to customize the editor
1958
1957
  */
1959
1958
  constructor(contentDiv: HTMLDivElement, options?: EditorOptions);
1959
+ }
1960
+
1961
+ /**
1962
+ * Base class of editor
1963
+ */
1964
+ class EditorBase<TEditorCore extends EditorCore, TEditorOptions extends EditorOptions> implements IEditor {
1965
+ private core;
1966
+ /**
1967
+ * Creates an instance of EditorBase
1968
+ * @param contentDiv The DIV HTML element which will be the container element of editor
1969
+ * @param options An optional options object to customize the editor
1970
+ */
1971
+ constructor(contentDiv: HTMLDivElement, options: TEditorOptions, coreCreator: CoreCreator<TEditorCore, TEditorOptions>);
1960
1972
  /**
1961
1973
  * Dispose this editor, dispose all plugins and custom data
1962
1974
  */
@@ -2050,7 +2062,7 @@ class Editor implements IEditor {
2050
2062
  * @param applyCurrentStyle True if apply format of current selection to the pasted content,
2051
2063
  * false to keep original format. Default value is false. When pasteAsText is true, this parameter is ignored
2052
2064
  */
2053
- paste(clipboardData: ClipboardData, pasteAsText?: boolean, applyCurrentFormat?: boolean): void;
2065
+ paste(clipboardData: ClipboardData, pasteAsText?: boolean, applyCurrentFormat?: boolean, pasteAsImage?: boolean): void;
2054
2066
  /**
2055
2067
  * Get current selection range from Editor.
2056
2068
  * It does a live pull on the selection, if nothing retrieved, return whatever we have in cache.
@@ -2329,9 +2341,24 @@ class Editor implements IEditor {
2329
2341
  * @returns the current EditorCore object
2330
2342
  * @throws a standard Error if there's no core object
2331
2343
  */
2332
- protected getCore(): EditorCore;
2344
+ protected getCore(): TEditorCore;
2333
2345
  }
2334
2346
 
2347
+ /**
2348
+ * Check if the given experimental feature is enabled
2349
+ * @param featureSet All enabled features
2350
+ * @param feature The feature to check
2351
+ * @returns True if the given feature is enabled, otherwise false
2352
+ */
2353
+ function isFeatureEnabled(featureSet: (ExperimentalFeatures | CompatibleExperimentalFeatures)[] | undefined, feature: ExperimentalFeatures | CompatibleExperimentalFeatures): boolean;
2354
+
2355
+ /**
2356
+ * Create a new instance of Editor Core
2357
+ * @param contentDiv The DIV HTML element which will be the container element of editor
2358
+ * @param options An optional options object to customize the editor
2359
+ */
2360
+ const createEditorCore: CoreCreator<EditorCore, EditorOptions>;
2361
+
2335
2362
  /**
2336
2363
  * Increase or decrease font size in selection
2337
2364
  * @param editor The editor instance
@@ -3438,7 +3465,12 @@ const enum ChangeSource {
3438
3465
  /**
3439
3466
  * List chain reorganized numbers of lists
3440
3467
  */
3441
- ListChain = "ListChain"
3468
+ ListChain = "ListChain",
3469
+ /**
3470
+ * Keyboard event, used by Content Model.
3471
+ * Data of this event will be the key code number
3472
+ */
3473
+ Keyboard = "Keyboard"
3442
3474
  }
3443
3475
 
3444
3476
  /**
@@ -6342,7 +6374,7 @@ interface IEditor {
6342
6374
  * @param applyCurrentStyle True if apply format of current selection to the pasted content,
6343
6375
  * false to keep original format. Default value is false. When pasteAsText is true, this parameter is ignored
6344
6376
  */
6345
- paste(clipboardData: ClipboardData, pasteAsText?: boolean, applyCurrentFormat?: boolean): void;
6377
+ paste(clipboardData: ClipboardData, pasteAsText?: boolean, applyCurrentFormat?: boolean, pasteAsImage?: boolean): void;
6346
6378
  /**
6347
6379
  * Get current selection range from Editor.
6348
6380
  * It does a live pull on the selection, if nothing retrieved, return whatever we have in cache.
@@ -7087,6 +7119,16 @@ interface CoreApiMap {
7087
7119
  * @param step Steps to move, can be 0, positive or negative
7088
7120
  */
7089
7121
  restoreUndoSnapshot: RestoreUndoSnapshot;
7122
+ /**
7123
+ * Select content according to the given information.
7124
+ * There are a bunch of allowed combination of parameters. See IEditor.select for more details
7125
+ * @param core The editor core object
7126
+ * @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
7127
+ * @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection
7128
+ * @param arg3 (optional) A Node
7129
+ * @param arg4 (optional) An offset number, or a PositionType
7130
+ */
7131
+ select: Select;
7090
7132
  /**
7091
7133
  * Change the editor selection to the given range
7092
7134
  * @param core The EditorCore object
@@ -7158,7 +7200,7 @@ interface CoreApiMap {
7158
7200
  * @param applyCurrentStyle True if apply format of current selection to the pasted content,
7159
7201
  * false to keep original format
7160
7202
  */
7161
- type CreatePasteFragment = (core: EditorCore, clipboardData: ClipboardData, position: NodePosition | null, pasteAsText: boolean, applyCurrentStyle: boolean) => DocumentFragment | null;
7203
+ type CreatePasteFragment = (core: EditorCore, clipboardData: ClipboardData, position: NodePosition | null, pasteAsText: boolean, applyCurrentStyle: boolean, pasteAsImage: boolean) => DocumentFragment | null;
7162
7204
 
7163
7205
  /**
7164
7206
  * Ensure user will type into a container element rather than into the editor content DIV directly
@@ -7235,6 +7277,17 @@ type InsertNode = (core: EditorCore, node: Node, option: InsertOption | null) =>
7235
7277
  */
7236
7278
  type RestoreUndoSnapshot = (core: EditorCore, step: number) => void;
7237
7279
 
7280
+ /**
7281
+ * Select content according to the given information.
7282
+ * There are a bunch of allowed combination of parameters. See IEditor.select for more details
7283
+ * @param core The editor core object
7284
+ * @param arg1 A DOM Range, or SelectionRangeEx, or NodePosition, or Node, or Selection Path
7285
+ * @param arg2 (optional) A NodePosition, or an offset number, or a PositionType, or a TableSelection
7286
+ * @param arg3 (optional) A Node
7287
+ * @param arg4 (optional) An offset number, or a PositionType
7288
+ */
7289
+ type Select = (core: EditorCore, arg1: Range | SelectionRangeEx | NodePosition | Node | SelectionPath | null, arg2?: NodePosition | number | PositionType | TableSelection, arg3?: Node, arg4?: number | PositionType) => boolean;
7290
+
7238
7291
  /**
7239
7292
  * Change the editor selection to the given range
7240
7293
  * @param core The EditorCore object
@@ -7414,7 +7467,7 @@ interface EditorOptions {
7414
7467
  /**
7415
7468
  * A list to specify whether each of the listed content edit features is enabled
7416
7469
  */
7417
- interface ContentEditFeatureSettings extends ListFeatureSettings, QuoteFeatureSettings, TableFeatureSettings, StructuredNodeFeatureSettings, AutoLinkFeatureSettings, ShortcutFeatureSettings, CursorFeatureSettings, MarkdownFeatureSettings, EntityFeatureSettings, TextFeatureSettings {
7470
+ interface ContentEditFeatureSettings extends ListFeatureSettings, QuoteFeatureSettings, TableFeatureSettings, StructuredNodeFeatureSettings, AutoLinkFeatureSettings, ShortcutFeatureSettings, CursorFeatureSettings, MarkdownFeatureSettings, EntityFeatureSettings, TextFeatureSettings, CodeFeatureSettings {
7418
7471
  }
7419
7472
 
7420
7473
  /**
@@ -7543,6 +7596,16 @@ interface ListFeatureSettings {
7543
7596
  * @default true
7544
7597
  */
7545
7598
  mergeListOnBackspaceAfterList: boolean;
7599
+ /**
7600
+ * indentWhenAltShiftRight edit feature, provides the ability to indent or outdent current list when user press Alt+shift+Right
7601
+ * @default when browser is in Mac it is default disabled, else it is enabled
7602
+ */
7603
+ indentWhenAltShiftRight: boolean;
7604
+ /**
7605
+ * outdentWhenAltShiftLeft edit feature, provides the ability to indent or outdent current list when user press Alt+shift+Left
7606
+ * @default when browser is in Mac it is default disabled, else it is enabled
7607
+ */
7608
+ outdentWhenAltShiftLeft: boolean;
7546
7609
  }
7547
7610
 
7548
7611
  /**
@@ -7662,6 +7725,22 @@ interface TextFeatureSettings {
7662
7725
  autoHyphen: boolean;
7663
7726
  }
7664
7727
 
7728
+ /**
7729
+ * Settings for code features
7730
+ */
7731
+ interface CodeFeatureSettings {
7732
+ /**
7733
+ * When inside a code block, exit the code block by pressing Enter twice, or once on an empty line
7734
+ * @default true
7735
+ */
7736
+ removeCodeWhenEnterOnEmptyLine: boolean;
7737
+ /**
7738
+ * When inside an empty code block (or an empty first line), exit the code block by pressing Backspace
7739
+ * @default true
7740
+ */
7741
+ removeCodeWhenBackspaceOnEmptyFirstLine: boolean;
7742
+ }
7743
+
7665
7744
  /**
7666
7745
  * An interface to define a replacement rule for CustomReplace plugin
7667
7746
  */
@@ -8206,6 +8285,13 @@ interface CustomizeDefinition extends DefinitionBase<DefinitionType.Customize |
8206
8285
  */
8207
8286
  type Definition<T> = CustomizeDefinition | (T extends any[] ? ArrayDefinition<T> : T extends Record<string, any> ? ObjectDefinition<T> : T extends String ? StringDefinition : T extends Number ? NumberDefinition : T extends Boolean ? BooleanDefinition : never);
8208
8287
 
8288
+ /**
8289
+ * Type of Editor Core Creator
8290
+ * @param contentDiv The DIV HTML element which will be the container element of editor
8291
+ * @param options An optional options object to customize the editor
8292
+ */
8293
+ type CoreCreator<TEditorCore extends EditorCore, TEditorOptions extends EditorOptions> = (contentDiv: HTMLDivElement, options: TEditorOptions) => TEditorCore;
8294
+
8209
8295
  /**
8210
8296
  * Experimental feature flags
8211
8297
  */
@@ -8488,7 +8574,12 @@ enum CompatibleChangeSource {
8488
8574
  /**
8489
8575
  * List chain reorganized numbers of lists
8490
8576
  */
8491
- ListChain = "ListChain"
8577
+ ListChain = "ListChain",
8578
+ /**
8579
+ * Keyboard event, used by Content Model.
8580
+ * Data of this event will be the key code number
8581
+ */
8582
+ Keyboard = "Keyboard"
8492
8583
  }
8493
8584
 
8494
8585
  /**
@@ -9716,7 +9807,7 @@ class ContentEdit implements EditorPlugin {
9716
9807
  * @param settingsOverride An optional feature set to override default feature settings
9717
9808
  * @param additionalFeatures Optional. More features to add
9718
9809
  */
9719
- constructor(settingsOverride?: Partial<ContentEditFeatureSettings>, additionalFeatures?: GenericContentEditFeature<PluginEvent>[]);
9810
+ constructor(settingsOverride?: Partial<ContentEditFeatureSettings> | undefined, additionalFeatures?: GenericContentEditFeature<PluginEvent>[] | undefined);
9720
9811
  /**
9721
9812
  * Get a friendly name of this plugin
9722
9813
  */