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