roosterjs 9.26.0 → 9.29.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-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +154 -11
- package/dist/rooster-amd.js +1277 -408
- package/dist/rooster-amd.js.map +1 -1
- package/dist/rooster-min.js +1 -1
- package/dist/rooster-min.js.map +1 -1
- package/dist/rooster-react.js +53 -53
- package/dist/rooster-react.js.map +1 -1
- package/dist/rooster.d.ts +154 -11
- package/dist/rooster.js +1277 -408
- package/dist/rooster.js.map +1 -1
- package/package.json +7 -7
package/dist/rooster.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 9.
|
|
1
|
+
// Type definitions for roosterjs (Version 9.29.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -76,7 +76,7 @@ type ShallowMutableContentModelWithDataset<T> = ShallowMutableMark & {
|
|
|
76
76
|
/**
|
|
77
77
|
* The format object for a paragraph in Content Model
|
|
78
78
|
*/
|
|
79
|
-
type ContentModelBlockFormat = BackgroundColorFormat & DirectionFormat & TextAlignFormat & HtmlAlignFormat & MarginFormat & PaddingFormat & LineHeightFormat & WhiteSpaceFormat & BorderFormat & TextIndentFormat;
|
|
79
|
+
type ContentModelBlockFormat = BackgroundColorFormat & DirectionFormat & TextAlignFormat & HtmlAlignFormat & MarginFormat & PaddingFormat & LineHeightFormat & WhiteSpaceFormat & BorderFormat & TextIndentFormat & IdFormat;
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Format of table cell
|
|
@@ -236,7 +236,7 @@ interface ContentModelFormatMap {
|
|
|
236
236
|
/**
|
|
237
237
|
* The format object for an image in Content Model
|
|
238
238
|
*/
|
|
239
|
-
type ContentModelImageFormat = ContentModelSegmentFormat & IdFormat & SizeFormat & MarginFormat & PaddingFormat & BorderFormat & BoxShadowFormat & DisplayFormat & FloatFormat & VerticalAlignFormat;
|
|
239
|
+
type ContentModelImageFormat = ContentModelSegmentFormat & IdFormat & SizeFormat & MarginFormat & PaddingFormat & BorderFormat & BoxShadowFormat & DisplayFormat & FloatFormat & VerticalAlignFormat & ImageStateFormat;
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* The format object for an entity in Content Model
|
|
@@ -307,6 +307,10 @@ interface FormatHandlerTypeMap {
|
|
|
307
307
|
* Format for IdFormat
|
|
308
308
|
*/
|
|
309
309
|
id: IdFormat;
|
|
310
|
+
/**
|
|
311
|
+
* Format of ImageStateFormat
|
|
312
|
+
*/
|
|
313
|
+
imageState: ImageStateFormat;
|
|
310
314
|
/**
|
|
311
315
|
* Format for ItalicFormat
|
|
312
316
|
*/
|
|
@@ -891,6 +895,16 @@ type UndeletableFormat = {
|
|
|
891
895
|
undeletable?: boolean;
|
|
892
896
|
};
|
|
893
897
|
|
|
898
|
+
/**
|
|
899
|
+
* The hidden property of an image
|
|
900
|
+
*/
|
|
901
|
+
type ImageStateFormat = {
|
|
902
|
+
/**
|
|
903
|
+
* A hidden marker for the image state
|
|
904
|
+
*/
|
|
905
|
+
imageState?: string;
|
|
906
|
+
};
|
|
907
|
+
|
|
894
908
|
/**
|
|
895
909
|
* Represents dataset format of Content Model
|
|
896
910
|
*/
|
|
@@ -3161,6 +3175,11 @@ interface DomIndexer {
|
|
|
3161
3175
|
* Node1 will become "FooBar", Node2 will be removed from DOM tree
|
|
3162
3176
|
*/
|
|
3163
3177
|
onMergeText: (targetText: Text, sourceText: Text) => void;
|
|
3178
|
+
/**
|
|
3179
|
+
* Clear index from the given container and all its descendants
|
|
3180
|
+
* @param container The root container to clear index from
|
|
3181
|
+
*/
|
|
3182
|
+
clearIndex: (container: Node) => void;
|
|
3164
3183
|
/**
|
|
3165
3184
|
* When document content or selection is changed by user, we need to use this function to update the content model
|
|
3166
3185
|
* to reflect the latest document. This process can fail since the selected node may not have a related model data structure.
|
|
@@ -3590,9 +3609,15 @@ type ExperimentalFeature = /**
|
|
|
3590
3609
|
*/
|
|
3591
3610
|
| 'LegacyImageSelection'
|
|
3592
3611
|
/**
|
|
3612
|
+
* @deprecated Please use the shouldHandleEnterKey option of the EditPlugin Options
|
|
3593
3613
|
* Use Content Model handle ENTER key
|
|
3594
3614
|
*/
|
|
3595
|
-
| 'HandleEnterKey'
|
|
3615
|
+
| 'HandleEnterKey'
|
|
3616
|
+
/**
|
|
3617
|
+
* Prevent default browser behavior for copy/cut event,
|
|
3618
|
+
* and set the clipboard data with custom implementation.
|
|
3619
|
+
*/
|
|
3620
|
+
| 'CustomCopyCut';
|
|
3596
3621
|
|
|
3597
3622
|
/**
|
|
3598
3623
|
* Options for editor
|
|
@@ -4855,9 +4880,13 @@ interface ContentModelFormatState {
|
|
|
4855
4880
|
*/
|
|
4856
4881
|
fontWeight?: string;
|
|
4857
4882
|
/**
|
|
4858
|
-
* Format of image, if there is
|
|
4883
|
+
* Format of image, if there is image at cursor position
|
|
4859
4884
|
*/
|
|
4860
4885
|
imageFormat?: ImageFormatState;
|
|
4886
|
+
/**
|
|
4887
|
+
* Editing metadata of image, if there is image at cursor position
|
|
4888
|
+
*/
|
|
4889
|
+
imageEditingMetadata?: ImageMetadataFormat | null;
|
|
4861
4890
|
/**
|
|
4862
4891
|
* Letter spacing
|
|
4863
4892
|
*/
|
|
@@ -5306,7 +5335,15 @@ type TrustedHTMLHandler = DOMCreator | LegacyTrustedHTMLHandler;
|
|
|
5306
5335
|
* A handler type to convert HTML string to a DOM object
|
|
5307
5336
|
*/
|
|
5308
5337
|
interface DOMCreator {
|
|
5338
|
+
/**
|
|
5339
|
+
* Callback to convert HTML string to a DOM object
|
|
5340
|
+
*/
|
|
5309
5341
|
htmlToDOM: (html: string) => Document;
|
|
5342
|
+
/**
|
|
5343
|
+
* Flag to indicate if this handler is bypassed or not.
|
|
5344
|
+
* If this is true, it means that when converting HTML string to DOM object, we don't need to do any conversion.
|
|
5345
|
+
*/
|
|
5346
|
+
isBypassed?: boolean;
|
|
5310
5347
|
}
|
|
5311
5348
|
|
|
5312
5349
|
/**
|
|
@@ -6925,7 +6962,7 @@ function isGeneralSegment(group: ReadonlyContentModelBlockGroup | ReadonlyConten
|
|
|
6925
6962
|
* @param parent Parent block group of the unwrapping group
|
|
6926
6963
|
* @param groupToUnwrap The block group to unwrap
|
|
6927
6964
|
*/
|
|
6928
|
-
function unwrapBlock(parent: ReadonlyContentModelBlockGroup | null, groupToUnwrap: ReadonlyContentModelBlockGroup & ReadonlyContentModelBlock): void;
|
|
6965
|
+
function unwrapBlock(parent: ReadonlyContentModelBlockGroup | null, groupToUnwrap: ReadonlyContentModelBlockGroup & ReadonlyContentModelBlock, formatsToKeep?: (keyof ContentModelBlockFormat)[]): void;
|
|
6929
6966
|
|
|
6930
6967
|
/**
|
|
6931
6968
|
* Add a given segment into a paragraph from its parent group. If the last block of the given group is not paragraph, create a new paragraph.
|
|
@@ -6964,12 +7001,49 @@ function normalizeSingleSegment(paragraph: ReadonlyContentModelParagraph, segmen
|
|
|
6964
7001
|
*/
|
|
6965
7002
|
function mergeTextSegments(block: ShallowMutableContentModelParagraph): void;
|
|
6966
7003
|
|
|
7004
|
+
/**
|
|
7005
|
+
* Some format values can be changed when apply to DOM, such as font family.
|
|
7006
|
+
* This function will normalize the format and return the same string after DOM modification.
|
|
7007
|
+
* @param format The format to be normalized
|
|
7008
|
+
* @return Normalized format
|
|
7009
|
+
*/
|
|
7010
|
+
function normalizeSegmentFormat(format: ContentModelSegmentFormat, environment: EditorEnvironment): ContentModelSegmentFormat;
|
|
7011
|
+
|
|
6967
7012
|
/**
|
|
6968
7013
|
* For a given block, if it is a paragraph, set it to be not-implicit
|
|
6969
7014
|
* @param block The block to check
|
|
6970
7015
|
*/
|
|
6971
7016
|
function setParagraphNotImplicit(block: ReadonlyContentModelBlock): void;
|
|
6972
7017
|
|
|
7018
|
+
/**
|
|
7019
|
+
* Copy formats from source to target with only specified keys
|
|
7020
|
+
* @param targetFormat The format object to copy format to
|
|
7021
|
+
* @param sourceFormat The format object to copy format from
|
|
7022
|
+
* @param formatKeys The format keys to copy
|
|
7023
|
+
* @param deleteOriginalFormat True to delete the original format from sourceFormat, false to keep it. @default false
|
|
7024
|
+
*/
|
|
7025
|
+
function copyFormat<T extends ContentModelFormatBase>(targetFormat: T, sourceFormat: T, formatKeys: (keyof T)[], deleteOriginalFormat?: boolean): void;
|
|
7026
|
+
|
|
7027
|
+
/**
|
|
7028
|
+
* When copy format from one block to another, these are all the formats that we can copy
|
|
7029
|
+
*/
|
|
7030
|
+
const ListFormats: (keyof ContentModelBlockFormat)[];
|
|
7031
|
+
|
|
7032
|
+
/**
|
|
7033
|
+
* When copy format between list and paragraph, these are the formats that we can copy and keep in the source
|
|
7034
|
+
*/
|
|
7035
|
+
const ListFormatsToKeep: (keyof ContentModelBlockFormat)[];
|
|
7036
|
+
|
|
7037
|
+
/**
|
|
7038
|
+
* When copy format between list and paragraph, these are the formats that we can copy and remove from the source
|
|
7039
|
+
*/
|
|
7040
|
+
const ListFormatsToMove: (keyof ContentModelBlockFormat)[];
|
|
7041
|
+
|
|
7042
|
+
/**
|
|
7043
|
+
* When copy format between paragraphs, these are the formats that we can copy
|
|
7044
|
+
*/
|
|
7045
|
+
const ParagraphFormats: (keyof ContentModelBlockFormat)[];
|
|
7046
|
+
|
|
6973
7047
|
/**
|
|
6974
7048
|
* Get the list number for a list item according to list style type and its index number
|
|
6975
7049
|
* @param styleType The list style number, should be a value of NumberingListType type
|
|
@@ -7188,6 +7262,14 @@ function readFile(file: File, callback: (dataUrl: string | null) => void): void;
|
|
|
7188
7262
|
*/
|
|
7189
7263
|
function transformColor(rootNode: Node, includeSelf: boolean, direction: 'lightToDark' | 'darkToLight', darkColorHandler?: DarkColorHandler): void;
|
|
7190
7264
|
|
|
7265
|
+
/**
|
|
7266
|
+
* Normalize font family string to a standard format
|
|
7267
|
+
* Add quotes around font family names that contain non-alphanumeric/dash characters
|
|
7268
|
+
* @param fontFamily The font family string to normalize
|
|
7269
|
+
* @returns The normalized font family string
|
|
7270
|
+
*/
|
|
7271
|
+
function normalizeFontFamily(fontFamily: string): string;
|
|
7272
|
+
|
|
7191
7273
|
/**
|
|
7192
7274
|
* Extract clipboard items to be a ClipboardData object for IE
|
|
7193
7275
|
* @param items The clipboard items retrieve from a DataTransfer object
|
|
@@ -7215,6 +7297,16 @@ function setParagraphMarker(element: HTMLElement, marker: string): void;
|
|
|
7215
7297
|
*/
|
|
7216
7298
|
function getParagraphMarker(element: HTMLElement): string | undefined;
|
|
7217
7299
|
|
|
7300
|
+
/**
|
|
7301
|
+
* Set image state to element. This is used to store a image state.
|
|
7302
|
+
*/
|
|
7303
|
+
function setImageState(element: HTMLElement, marker: string): void;
|
|
7304
|
+
|
|
7305
|
+
/**
|
|
7306
|
+
* Get image state from element. This is used to store a image state.
|
|
7307
|
+
*/
|
|
7308
|
+
function getImageState(element: HTMLElement): string | undefined;
|
|
7309
|
+
|
|
7218
7310
|
/**
|
|
7219
7311
|
* Check if the given content model block or block group is of the expected block group type
|
|
7220
7312
|
* @param input The object to check
|
|
@@ -7693,6 +7785,18 @@ const BulletListType: {
|
|
|
7693
7785
|
* Bullet type circle
|
|
7694
7786
|
*/
|
|
7695
7787
|
Circle: number;
|
|
7788
|
+
/**
|
|
7789
|
+
* Box Shadow bullet type
|
|
7790
|
+
*/
|
|
7791
|
+
BoxShadow: number;
|
|
7792
|
+
/**
|
|
7793
|
+
* Rhombus with a cross inside
|
|
7794
|
+
*/
|
|
7795
|
+
Xrhombus: number;
|
|
7796
|
+
/**
|
|
7797
|
+
* Check mark bullet type
|
|
7798
|
+
*/
|
|
7799
|
+
CheckMark: number;
|
|
7696
7800
|
/**
|
|
7697
7801
|
* Maximum value of the enum
|
|
7698
7802
|
*/
|
|
@@ -8497,6 +8601,14 @@ function insertTableColumn(table: ShallowMutableContentModelTable, operation: Ta
|
|
|
8497
8601
|
*/
|
|
8498
8602
|
function clearSelectedCells(table: ReadonlyContentModelTable, sel: TableSelectionCoordinates): void;
|
|
8499
8603
|
|
|
8604
|
+
/**
|
|
8605
|
+
* Create an EditorContext for an entity
|
|
8606
|
+
* @param editor The editor object
|
|
8607
|
+
* @param entity The entity to create the context for
|
|
8608
|
+
* @returns The generated EditorContext for the entity
|
|
8609
|
+
*/
|
|
8610
|
+
function createEditorContextForEntity(editor: IEditor, entity: ContentModelEntity): EditorContext;
|
|
8611
|
+
|
|
8500
8612
|
/**
|
|
8501
8613
|
* Invoke a callback to format the selected table using Content Model
|
|
8502
8614
|
* @param editor The editor object
|
|
@@ -8632,8 +8744,9 @@ function getListAnnounceData(path: ReadonlyContentModelBlockGroup[]): AnnounceDa
|
|
|
8632
8744
|
* @param type The type of block to query
|
|
8633
8745
|
* @param filter Optional selector to filter the blocks
|
|
8634
8746
|
* @param findFirstOnly True to return the first block only, false to return all blocks
|
|
8747
|
+
* @param shouldExpandEntity Optional function to determine if an entity's children should be recursively queried, should return a EditorContext if the entity should be expanded, or null if not
|
|
8635
8748
|
*/
|
|
8636
|
-
function queryContentModelBlocks<T extends ReadonlyContentModelBlock>(group: ReadonlyContentModelBlockGroup, type: T extends ReadonlyContentModelBlockBase<infer U> ? U : never, filter?: (element: T) => element is T, findFirstOnly?: boolean): T[];
|
|
8749
|
+
function queryContentModelBlocks<T extends ReadonlyContentModelBlock>(group: ReadonlyContentModelBlockGroup, type: T extends ReadonlyContentModelBlockBase<infer U> ? U : never, filter?: (element: T) => element is T, findFirstOnly?: boolean, shouldExpandEntity?: (entity: ContentModelEntity) => EditorContext | null): T[];
|
|
8637
8750
|
|
|
8638
8751
|
/**
|
|
8639
8752
|
* TableEdit plugin, provides the ability to resize a table by drag-and-drop
|
|
@@ -8642,6 +8755,7 @@ class TableEditPlugin implements EditorPlugin {
|
|
|
8642
8755
|
private anchorContainerSelector?;
|
|
8643
8756
|
private onTableEditorCreated?;
|
|
8644
8757
|
private disableFeatures?;
|
|
8758
|
+
private tableSelector;
|
|
8645
8759
|
private editor;
|
|
8646
8760
|
private onMouseMoveDisposer;
|
|
8647
8761
|
private tableRectMap;
|
|
@@ -8653,8 +8767,9 @@ class TableEditPlugin implements EditorPlugin {
|
|
|
8653
8767
|
* If not specified, the plugin will be inserted in document.body
|
|
8654
8768
|
* @param onTableEditorCreated An optional callback to customize the Table Editors elements when created.
|
|
8655
8769
|
* @param disableFeatures An optional array of TableEditFeatures to disable
|
|
8770
|
+
* @param tableSelector A function to select the tables to be edited. By default, it selects all contentEditable tables.
|
|
8656
8771
|
*/
|
|
8657
|
-
constructor(anchorContainerSelector?: string | undefined, onTableEditorCreated?: OnTableEditorCreatedCallback | undefined, disableFeatures?: TableEditFeatureName[] | undefined);
|
|
8772
|
+
constructor(anchorContainerSelector?: string | undefined, onTableEditorCreated?: OnTableEditorCreatedCallback | undefined, disableFeatures?: TableEditFeatureName[] | undefined, tableSelector?: (domHelper: DOMHelper) => TableWithRoot[]);
|
|
8658
8773
|
/**
|
|
8659
8774
|
* Get a friendly name of this plugin
|
|
8660
8775
|
*/
|
|
@@ -8677,10 +8792,10 @@ class TableEditPlugin implements EditorPlugin {
|
|
|
8677
8792
|
private onMouseMove;
|
|
8678
8793
|
/**
|
|
8679
8794
|
* @internal Public only for unit test
|
|
8680
|
-
* @param
|
|
8795
|
+
* @param entry Table to use when setting the Editors
|
|
8681
8796
|
* @param event (Optional) Mouse event
|
|
8682
8797
|
*/
|
|
8683
|
-
setTableEditor(
|
|
8798
|
+
setTableEditor(entry: TableWithRoot | null, event?: MouseEvent): void;
|
|
8684
8799
|
private invalidateTableRects;
|
|
8685
8800
|
private disposeTableEditor;
|
|
8686
8801
|
private ensureTableRects;
|
|
@@ -8696,6 +8811,22 @@ type OnTableEditorCreatedCallback = (featureType: TableEditFeatureName, element:
|
|
|
8696
8811
|
*/
|
|
8697
8812
|
type TableEditFeatureName = 'HorizontalTableInserter' | 'VerticalTableInserter' | 'TableMover' | 'TableResizer' | 'TableSelector' | 'CellResizer';
|
|
8698
8813
|
|
|
8814
|
+
/**
|
|
8815
|
+
* Represents a table and its container (logical root)
|
|
8816
|
+
*/
|
|
8817
|
+
interface TableWithRoot {
|
|
8818
|
+
/**
|
|
8819
|
+
* The table element
|
|
8820
|
+
*/
|
|
8821
|
+
table: HTMLTableElement;
|
|
8822
|
+
/**
|
|
8823
|
+
* The logical root element of the table
|
|
8824
|
+
* This is the element that contains the table and all its ancestors
|
|
8825
|
+
* It is used to determine the logical root of the table
|
|
8826
|
+
*/
|
|
8827
|
+
logicalRoot: HTMLDivElement | null;
|
|
8828
|
+
}
|
|
8829
|
+
|
|
8699
8830
|
/**
|
|
8700
8831
|
* Paste plugin, handles BeforePaste event and reformat some special content, including:
|
|
8701
8832
|
* 1. Content copied from Word
|
|
@@ -8764,6 +8895,8 @@ class EditPlugin implements EditorPlugin {
|
|
|
8764
8895
|
* handleTabKey: A boolean that enables or disables Tab key handling. Defaults to true.
|
|
8765
8896
|
*/
|
|
8766
8897
|
constructor(options?: EditOptions);
|
|
8898
|
+
private createNormalEnterChecker;
|
|
8899
|
+
private getHandleNormalEnter;
|
|
8767
8900
|
/**
|
|
8768
8901
|
* Get name of this plugin
|
|
8769
8902
|
*/
|
|
@@ -8814,6 +8947,13 @@ type EditOptions = {
|
|
|
8814
8947
|
* @default true
|
|
8815
8948
|
*/
|
|
8816
8949
|
handleExpandedSelectionOnDelete?: boolean;
|
|
8950
|
+
/**
|
|
8951
|
+
* Callback function to determine whether the Rooster should handle the Enter key press.
|
|
8952
|
+
* If the function returns true, the Rooster will handle the Enter key press instead of the browser.
|
|
8953
|
+
* @param editor - The editor instance.
|
|
8954
|
+
* @returns A boolean
|
|
8955
|
+
*/
|
|
8956
|
+
shouldHandleEnterKey?: ((editor: IEditor) => boolean) | boolean;
|
|
8817
8957
|
};
|
|
8818
8958
|
|
|
8819
8959
|
/**
|
|
@@ -8862,10 +9002,13 @@ class AutoFormatPlugin implements EditorPlugin {
|
|
|
8862
9002
|
* @param event The event to handle:
|
|
8863
9003
|
*/
|
|
8864
9004
|
onPluginEvent(event: PluginEvent): void;
|
|
9005
|
+
private autoLink;
|
|
9006
|
+
private tabFeatures;
|
|
8865
9007
|
private features;
|
|
9008
|
+
private enterFeatures;
|
|
9009
|
+
private handleKeyboardEvents;
|
|
8866
9010
|
private handleEditorInputEvent;
|
|
8867
9011
|
private handleKeyDownEvent;
|
|
8868
|
-
private handleEnterKey;
|
|
8869
9012
|
private handleContentChangedEvent;
|
|
8870
9013
|
}
|
|
8871
9014
|
|