roosterjs 9.1.0 → 9.3.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-adapter-amd-min.js +1 -1
- package/dist/rooster-adapter-amd-min.js.map +1 -1
- package/dist/rooster-adapter-amd.js +10 -1
- package/dist/rooster-adapter-amd.js.map +1 -1
- package/dist/rooster-adapter-min.js +1 -1
- package/dist/rooster-adapter-min.js.map +1 -1
- package/dist/rooster-adapter.js +10 -1
- package/dist/rooster-adapter.js.map +1 -1
- package/dist/rooster-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +503 -31
- package/dist/rooster-amd.js +1888 -403
- 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.d.ts +503 -31
- package/dist/rooster.js +1888 -403
- package/dist/rooster.js.map +1 -1
- package/package.json +6 -6
package/dist/rooster.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 9.
|
|
1
|
+
// Type definitions for roosterjs (Version 9.3.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -1480,6 +1480,10 @@ interface ContentModelEntity extends ContentModelBlockBase<'Entity', ContentMode
|
|
|
1480
1480
|
* Content Model document entry point
|
|
1481
1481
|
*/
|
|
1482
1482
|
interface ContentModelDocument extends ContentModelBlockGroupBase<'Document'>, Partial<ContentModelWithFormat<ContentModelSegmentFormat>> {
|
|
1483
|
+
/**
|
|
1484
|
+
* Whether the selection in model (if any) is a revert selection (end is before start)
|
|
1485
|
+
*/
|
|
1486
|
+
hasRevertedRangeSelection?: boolean;
|
|
1483
1487
|
}
|
|
1484
1488
|
|
|
1485
1489
|
/**
|
|
@@ -2707,19 +2711,20 @@ type ColorTransformFunction = (lightColor: string, baseLValue?: number, colorTyp
|
|
|
2707
2711
|
* An interface of Editor, built on top of Content Model
|
|
2708
2712
|
*/
|
|
2709
2713
|
interface IEditor {
|
|
2714
|
+
/**
|
|
2715
|
+
* @deprecated Use formatContentModel() instead
|
|
2716
|
+
*/
|
|
2717
|
+
getContentModelCopy(mode: 'connected'): ContentModelDocument;
|
|
2710
2718
|
/**
|
|
2711
2719
|
* Create Content Model from DOM tree in this editor
|
|
2712
2720
|
* @param mode What kind of Content Model we want. Currently we support the following values:
|
|
2713
|
-
* - connected: Returns a connect Content Model object. "Connected" means if there is any entity inside editor, the returned Content Model will
|
|
2714
|
-
* contain the same wrapper element for entity. This option should only be used in some special cases. In most cases we should use "disconnected"
|
|
2715
|
-
* to get a fully disconnected Content Model so that any change to the model will not impact editor content.
|
|
2716
2721
|
* - disconnected: Returns a disconnected clone of Content Model from editor which you can do any change on it and it won't impact the editor content.
|
|
2717
2722
|
* If there is any entity in editor, the returned object will contain cloned copy of entity wrapper element.
|
|
2718
2723
|
* If editor is in dark mode, the cloned entity will be converted back to light mode.
|
|
2719
2724
|
* - clean: Similar with disconnected, this will return a disconnected model, the difference is "clean" mode will not include any selection info.
|
|
2720
2725
|
* This is usually used for exporting content
|
|
2721
2726
|
*/
|
|
2722
|
-
getContentModelCopy(mode: '
|
|
2727
|
+
getContentModelCopy(mode: 'disconnected' | 'clean'): ContentModelDocument;
|
|
2723
2728
|
/**
|
|
2724
2729
|
* Get current running environment, such as if editor is running on Mac
|
|
2725
2730
|
*/
|
|
@@ -2864,6 +2869,11 @@ interface IEditor {
|
|
|
2864
2869
|
* combined with root selector together to build a separate rule.
|
|
2865
2870
|
*/
|
|
2866
2871
|
setEditorStyle(key: string, cssRule: string | null, subSelectors?: 'before' | 'after' | string[]): void;
|
|
2872
|
+
/**
|
|
2873
|
+
* Announce the given data
|
|
2874
|
+
* @param announceData Data to announce
|
|
2875
|
+
*/
|
|
2876
|
+
announce(announceData: AnnounceData): void;
|
|
2867
2877
|
}
|
|
2868
2878
|
|
|
2869
2879
|
/**
|
|
@@ -2957,6 +2967,12 @@ interface EditorOptions {
|
|
|
2957
2967
|
* Default paste type. By default will use the normal (as-is) paste type.
|
|
2958
2968
|
*/
|
|
2959
2969
|
defaultPasteType?: PasteType;
|
|
2970
|
+
/**
|
|
2971
|
+
* A callback to help get string template to announce, used for accessibility
|
|
2972
|
+
* @param key The key of known announce data
|
|
2973
|
+
* @returns A template string to announce, use placeholder such as "{0}" for variables if necessary
|
|
2974
|
+
*/
|
|
2975
|
+
announcerStringGetter?: (key: KnownAnnounceStrings) => string;
|
|
2960
2976
|
}
|
|
2961
2977
|
|
|
2962
2978
|
/**
|
|
@@ -3123,6 +3139,12 @@ interface CoreApiMap {
|
|
|
3123
3139
|
* combined with root selector together to build a separate rule.
|
|
3124
3140
|
*/
|
|
3125
3141
|
setEditorStyle: SetEditorStyle;
|
|
3142
|
+
/**
|
|
3143
|
+
* Announce the given data
|
|
3144
|
+
* @param core The EditorCore object
|
|
3145
|
+
* @param announceData Data to announce
|
|
3146
|
+
*/
|
|
3147
|
+
announce: Announce;
|
|
3126
3148
|
}
|
|
3127
3149
|
|
|
3128
3150
|
/**
|
|
@@ -3241,6 +3263,13 @@ type GetVisibleViewport = (core: EditorCore) => Rect | null;
|
|
|
3241
3263
|
*/
|
|
3242
3264
|
type SetEditorStyle = (core: EditorCore, key: string, cssRule: string | null, subSelectors?: 'before' | 'after' | string[], maxRuleLength?: number) => void;
|
|
3243
3265
|
|
|
3266
|
+
/**
|
|
3267
|
+
* Announce the given data
|
|
3268
|
+
* @param core The EditorCore object
|
|
3269
|
+
* @param announceData Data to announce
|
|
3270
|
+
*/
|
|
3271
|
+
type Announce = (core: EditorCore, announceData: AnnounceData) => void;
|
|
3272
|
+
|
|
3244
3273
|
/**
|
|
3245
3274
|
* Core plugins for editor
|
|
3246
3275
|
*/
|
|
@@ -3477,6 +3506,16 @@ interface LifecyclePluginState {
|
|
|
3477
3506
|
* Cached document fragment for original content
|
|
3478
3507
|
*/
|
|
3479
3508
|
shadowEditFragment: DocumentFragment | null;
|
|
3509
|
+
/**
|
|
3510
|
+
* The HTML container for announced string
|
|
3511
|
+
*/
|
|
3512
|
+
announceContainer?: HTMLElement;
|
|
3513
|
+
/**
|
|
3514
|
+
* A callback to help get string template to announce, used for accessibility
|
|
3515
|
+
* @param key The key of known announce data
|
|
3516
|
+
* @returns A template string to announce, use placeholder such as "{0}" for variables if necessary
|
|
3517
|
+
*/
|
|
3518
|
+
readonly announcerStringGetter?: (key: KnownAnnounceStrings) => string;
|
|
3480
3519
|
/**
|
|
3481
3520
|
* Style elements used for adding CSS rules for editor
|
|
3482
3521
|
*/
|
|
@@ -3780,6 +3819,10 @@ interface FormatContentModelContext {
|
|
|
3780
3819
|
* @optional Set to true if this action can be undone when user press Backspace key (aka Auto Complete).
|
|
3781
3820
|
*/
|
|
3782
3821
|
canUndoByBackspace?: boolean;
|
|
3822
|
+
/**
|
|
3823
|
+
* @optional Set this value to tell AnnouncePlugin to announce the given information
|
|
3824
|
+
*/
|
|
3825
|
+
announceData?: AnnounceData | null;
|
|
3783
3826
|
}
|
|
3784
3827
|
|
|
3785
3828
|
/**
|
|
@@ -3812,6 +3855,10 @@ interface FormatContentModelOptions {
|
|
|
3812
3855
|
* When specified, use this selection range to override current selection inside editor
|
|
3813
3856
|
*/
|
|
3814
3857
|
selectionOverride?: DOMSelection;
|
|
3858
|
+
/**
|
|
3859
|
+
* When pass to true, scroll the editing caret into view after write DOM tree if need
|
|
3860
|
+
*/
|
|
3861
|
+
scrollCaretIntoView?: boolean;
|
|
3815
3862
|
}
|
|
3816
3863
|
|
|
3817
3864
|
/**
|
|
@@ -4475,6 +4522,14 @@ interface DOMHelper {
|
|
|
4475
4522
|
* @returns True if the editor has focus, otherwise false
|
|
4476
4523
|
*/
|
|
4477
4524
|
hasFocus(): boolean;
|
|
4525
|
+
/**
|
|
4526
|
+
* Check if the root element is in RTL mode
|
|
4527
|
+
*/
|
|
4528
|
+
isRightToLeft(): boolean;
|
|
4529
|
+
/**
|
|
4530
|
+
* Get the width of the editable area of the editor content div
|
|
4531
|
+
*/
|
|
4532
|
+
getClientWidth(): number;
|
|
4478
4533
|
}
|
|
4479
4534
|
|
|
4480
4535
|
/**
|
|
@@ -4708,6 +4763,60 @@ type ParsedTable = ParsedTableCell[][];
|
|
|
4708
4763
|
*/
|
|
4709
4764
|
type ParsedTableCell = HTMLTableCellElement | 'spanLeft' | 'spanTop' | 'spanBoth';
|
|
4710
4765
|
|
|
4766
|
+
/**
|
|
4767
|
+
* Callback function type for converting a given Content Model object to plain text
|
|
4768
|
+
* @param model The source model object to be converted to plain text
|
|
4769
|
+
*/
|
|
4770
|
+
type ModelToTextCallback<T> = (model: T) => string;
|
|
4771
|
+
|
|
4772
|
+
/**
|
|
4773
|
+
* Callbacks to customize the behavior of contentModelToText function
|
|
4774
|
+
*/
|
|
4775
|
+
interface ModelToTextCallbacks {
|
|
4776
|
+
/**
|
|
4777
|
+
* Customize the behavior of converting entity segment to plain text
|
|
4778
|
+
*/
|
|
4779
|
+
onEntitySegment?: ModelToTextCallback<ContentModelEntity>;
|
|
4780
|
+
/**
|
|
4781
|
+
* Customize the behavior of converting entity block to plain text
|
|
4782
|
+
*/
|
|
4783
|
+
onEntityBlock?: ModelToTextCallback<ContentModelEntity>;
|
|
4784
|
+
/**
|
|
4785
|
+
* Customize the behavior of converting general segment to plain text
|
|
4786
|
+
*/
|
|
4787
|
+
onGeneralSegment?: ModelToTextCallback<ContentModelGeneralSegment>;
|
|
4788
|
+
/**
|
|
4789
|
+
* Customize the behavior of converting text model to plain text
|
|
4790
|
+
*/
|
|
4791
|
+
onText?: ModelToTextCallback<ContentModelText>;
|
|
4792
|
+
/**
|
|
4793
|
+
* Customize the behavior of converting image model to plain text
|
|
4794
|
+
*/
|
|
4795
|
+
onImage?: ModelToTextCallback<ContentModelImage>;
|
|
4796
|
+
/**
|
|
4797
|
+
* Customize the behavior of converting divider model to plain text
|
|
4798
|
+
*/
|
|
4799
|
+
onDivider?: ModelToTextCallback<ContentModelDivider>;
|
|
4800
|
+
/**
|
|
4801
|
+
* Customize the check if we should convert a paragraph model to plain text
|
|
4802
|
+
*/
|
|
4803
|
+
onParagraph?: ModelToTextChecker<ContentModelParagraph>;
|
|
4804
|
+
/**
|
|
4805
|
+
* Customize the check if we should convert a table model to plain text
|
|
4806
|
+
*/
|
|
4807
|
+
onTable?: ModelToTextChecker<ContentModelTable>;
|
|
4808
|
+
/**
|
|
4809
|
+
* Customize the check if we should convert a block group model to plain text
|
|
4810
|
+
*/
|
|
4811
|
+
onBlockGroup?: ModelToTextChecker<ContentModelBlockGroup>;
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4814
|
+
/**
|
|
4815
|
+
* Callback function type for checking if we should convert to text for the given content model object
|
|
4816
|
+
* @param model The source model to check if we should convert it to plain text
|
|
4817
|
+
*/
|
|
4818
|
+
type ModelToTextChecker<T> = (model: T) => boolean;
|
|
4819
|
+
|
|
4711
4820
|
/**
|
|
4712
4821
|
* Editor plugin event interface
|
|
4713
4822
|
*/
|
|
@@ -4856,7 +4965,7 @@ interface ContentChangedEvent extends BasePluginEvent<'contentChanged'> {
|
|
|
4856
4965
|
*/
|
|
4857
4966
|
readonly formatApiName?: string;
|
|
4858
4967
|
/**
|
|
4859
|
-
* @
|
|
4968
|
+
* @deprecated Call editor.announce(announceData) directly insteaad
|
|
4860
4969
|
*/
|
|
4861
4970
|
readonly announceData?: AnnounceData;
|
|
4862
4971
|
}
|
|
@@ -5255,8 +5364,9 @@ function contentModelToDom(doc: Document, root: Node, model: ContentModelDocumen
|
|
|
5255
5364
|
* Convert Content Model to plain text
|
|
5256
5365
|
* @param model The source Content Model
|
|
5257
5366
|
* @param [separator='\r\n'] The separator string used for connect lines
|
|
5367
|
+
* @param callbacks Callbacks to customize the behavior of contentModelToText function
|
|
5258
5368
|
*/
|
|
5259
|
-
function contentModelToText(model: ContentModelDocument, separator?: string): string;
|
|
5369
|
+
function contentModelToText(model: ContentModelDocument, separator?: string, callbacks?: ModelToTextCallbacks): string;
|
|
5260
5370
|
|
|
5261
5371
|
/**
|
|
5262
5372
|
* Content Model Element Processor for child elements
|
|
@@ -5494,9 +5604,25 @@ function addDelimiters(doc: Document, element: HTMLElement, format?: ContentMode
|
|
|
5494
5604
|
/**
|
|
5495
5605
|
* Checks whether the node provided is a Entity delimiter
|
|
5496
5606
|
* @param node the node to check
|
|
5607
|
+
* @param isBefore True to match delimiter before entity only, false to match delimiter after entity, or undefined means match both
|
|
5497
5608
|
* @return true if it is a delimiter
|
|
5498
5609
|
*/
|
|
5499
|
-
function isEntityDelimiter(element: HTMLElement): boolean;
|
|
5610
|
+
function isEntityDelimiter(element: HTMLElement, isBefore?: boolean): boolean;
|
|
5611
|
+
|
|
5612
|
+
/**
|
|
5613
|
+
* Check if the given element is a container element of block entity
|
|
5614
|
+
* @param element The element to check
|
|
5615
|
+
* @returns True if the element is a block entity container, otherwise false
|
|
5616
|
+
*/
|
|
5617
|
+
function isBlockEntityContainer(element: HTMLElement): boolean;
|
|
5618
|
+
|
|
5619
|
+
/**
|
|
5620
|
+
* Find the closest block entity wrapper element from a given DOM node
|
|
5621
|
+
* @param node The node to start looking for entity container
|
|
5622
|
+
* @param domHelper The DOM helper
|
|
5623
|
+
* @returns
|
|
5624
|
+
*/
|
|
5625
|
+
function findClosestBlockEntityContainer(node: Node, domHelper: DOMHelper): HTMLElement | null;
|
|
5500
5626
|
|
|
5501
5627
|
/**
|
|
5502
5628
|
* When set a DOM tree into editor, reuse the existing element in editor and no need to change it
|
|
@@ -5727,6 +5853,29 @@ function normalizeSingleSegment(segment: ContentModelSegment, ignoreTrailingSpac
|
|
|
5727
5853
|
*/
|
|
5728
5854
|
function setParagraphNotImplicit(block: ContentModelBlock): void;
|
|
5729
5855
|
|
|
5856
|
+
/**
|
|
5857
|
+
* Get the list number for a list item according to list style type and its index number
|
|
5858
|
+
* @param styleType The list style number, should be a value of NumberingListType type
|
|
5859
|
+
* @param listNumber List number, start from 1
|
|
5860
|
+
* @returns A string for this list item. For example, when pass in NumberingListType.LowerAlpha and 2, it returns "b"
|
|
5861
|
+
*/
|
|
5862
|
+
function getOrderedListNumberStr(styleType: number, listNumber: number): string;
|
|
5863
|
+
|
|
5864
|
+
/**
|
|
5865
|
+
* Get automatic list style of a list item according to its lis type and metadata.
|
|
5866
|
+
* @param listType The list type, either OL or UL
|
|
5867
|
+
* @param metadata Metadata of this list item from list item model
|
|
5868
|
+
* @param depth Depth of list level, start from 0
|
|
5869
|
+
* @param existingStyleType Existing list style type in format, if any
|
|
5870
|
+
* @returns A number to represent list style type.
|
|
5871
|
+
* This will be the value of either NumberingListType (when listType is OL) or BulletListType (when listType is UL).
|
|
5872
|
+
* When there is a specified list style in its metadata, return this value, otherwise
|
|
5873
|
+
* When specified "applyListStyleFromLevel" in metadata, calculate auto list type from its depth, otherwise
|
|
5874
|
+
* When there is already listStyleType in list level format, find a related style type index, otherwise
|
|
5875
|
+
* return undefined
|
|
5876
|
+
*/
|
|
5877
|
+
function getAutoListStyleType(listType: 'OL' | 'UL', metadata: ListMetadataFormat, depth: number, existingStyleType?: string): number | undefined;
|
|
5878
|
+
|
|
5730
5879
|
/**
|
|
5731
5880
|
* Parse unit value with its unit
|
|
5732
5881
|
* @param value The source value to parse
|
|
@@ -5962,12 +6111,12 @@ function getFirstSelectedTable(model: ContentModelDocument): [ContentModelTable
|
|
|
5962
6111
|
|
|
5963
6112
|
/**
|
|
5964
6113
|
* Get an array of block group - block pair that is of the expected block group type from selection
|
|
5965
|
-
* @param
|
|
6114
|
+
* @param group The root block group to search
|
|
5966
6115
|
* @param blockGroupTypes The expected block group types
|
|
5967
6116
|
* @param stopTypes Block group types that will stop searching when hit
|
|
5968
6117
|
* @param deepFirst True means search in deep first, otherwise wide first
|
|
5969
6118
|
*/
|
|
5970
|
-
function getOperationalBlocks<T extends ContentModelBlockGroup>(
|
|
6119
|
+
function getOperationalBlocks<T extends ContentModelBlockGroup>(group: ContentModelBlockGroup, blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes: ContentModelBlockGroupType[], deepFirst?: boolean): OperationalBlocks<T>[];
|
|
5971
6120
|
|
|
5972
6121
|
/**
|
|
5973
6122
|
* Get any array of selected paragraphs from a content model
|
|
@@ -5987,7 +6136,7 @@ function getSelectedSegments(model: ContentModelDocument, includingFormatHolder:
|
|
|
5987
6136
|
* @param model The Content Model to get selection from
|
|
5988
6137
|
* @param includingFormatHolder True means also include format holder as segment from list item, in that case paragraph will be null
|
|
5989
6138
|
*/
|
|
5990
|
-
function getSelectedSegmentsAndParagraphs(model: ContentModelDocument, includingFormatHolder: boolean): [ContentModelSegment, ContentModelParagraph | null][];
|
|
6139
|
+
function getSelectedSegmentsAndParagraphs(model: ContentModelDocument, includingFormatHolder: boolean, includingEntity?: boolean): [ContentModelSegment, ContentModelParagraph | null, ContentModelBlockGroup[]][];
|
|
5991
6140
|
|
|
5992
6141
|
/**
|
|
5993
6142
|
* Get selection coordinates of a table. If there is no selection, return null
|
|
@@ -6157,7 +6306,7 @@ function updateListMetadata(list: ContentModelWithDataset<ListMetadataFormat>, c
|
|
|
6157
6306
|
/**
|
|
6158
6307
|
* Metadata definition for List
|
|
6159
6308
|
*/
|
|
6160
|
-
const ListMetadataDefinition:
|
|
6309
|
+
const ListMetadataDefinition: ObjectDefinition<ListMetadataFormat>;
|
|
6161
6310
|
|
|
6162
6311
|
/**
|
|
6163
6312
|
* Possible change sources. Here are the predefined sources.
|
|
@@ -6217,6 +6366,10 @@ const ChangeSource: {
|
|
|
6217
6366
|
* Data of this event will be the key code number
|
|
6218
6367
|
*/
|
|
6219
6368
|
Keyboard: string;
|
|
6369
|
+
/**
|
|
6370
|
+
* Content changed by auto format
|
|
6371
|
+
*/
|
|
6372
|
+
AutoFormat: string;
|
|
6220
6373
|
};
|
|
6221
6374
|
|
|
6222
6375
|
/**
|
|
@@ -6478,9 +6631,6 @@ class Editor implements IEditor {
|
|
|
6478
6631
|
/**
|
|
6479
6632
|
* Create Content Model from DOM tree in this editor
|
|
6480
6633
|
* @param mode What kind of Content Model we want. Currently we support the following values:
|
|
6481
|
-
* - connected: Returns a connect Content Model object. "Connected" means if there is any entity inside editor, the returned Content Model will
|
|
6482
|
-
* contain the same wrapper element for entity. This option should only be used in some special cases. In most cases we should use "disconnected"
|
|
6483
|
-
* to get a fully disconnected Content Model so that any change to the model will not impact editor content.
|
|
6484
6634
|
* - disconnected: Returns a disconnected clone of Content Model from editor which you can do any change on it and it won't impact the editor content.
|
|
6485
6635
|
* If there is any entity in editor, the returned object will contain cloned copy of entity wrapper element.
|
|
6486
6636
|
* If editor is in dark mode, the cloned entity will be converted back to light mode.
|
|
@@ -6620,6 +6770,11 @@ class Editor implements IEditor {
|
|
|
6620
6770
|
* combined with root selector together to build a separate rule.
|
|
6621
6771
|
*/
|
|
6622
6772
|
setEditorStyle(key: string, cssRule: string | null, subSelectors?: 'before' | 'after' | string[]): void;
|
|
6773
|
+
/**
|
|
6774
|
+
* Announce the given data
|
|
6775
|
+
* @param announceData Data to announce
|
|
6776
|
+
*/
|
|
6777
|
+
announce(announceData: AnnounceData): void;
|
|
6623
6778
|
/**
|
|
6624
6779
|
* @returns the current EditorCore object
|
|
6625
6780
|
* @throws a standard Error if there's no core object
|
|
@@ -6638,15 +6793,28 @@ class Editor implements IEditor {
|
|
|
6638
6793
|
function createModelFromHtml(html: string, options?: Partial<DomToModelOptionForSanitizing>, trustedHTMLHandler?: TrustedHTMLHandler, defaultSegmentFormat?: ContentModelSegmentFormat): ContentModelDocument;
|
|
6639
6794
|
|
|
6640
6795
|
/**
|
|
6641
|
-
* Export
|
|
6796
|
+
* Export HTML content. If there are entities, this will cause EntityOperation event with option = 'replaceTemporaryContent' to get a dehydrated entity
|
|
6797
|
+
* @param editor The editor to get content from
|
|
6798
|
+
* @param mode Specify HTML to get plain text result. This is the default option
|
|
6799
|
+
* @param options @optional Options for Model to DOM conversion
|
|
6800
|
+
*/
|
|
6801
|
+
function exportContent(editor: IEditor, mode?: 'HTML', options?: ModelToDomOption): string;
|
|
6802
|
+
|
|
6803
|
+
/**
|
|
6804
|
+
* Export plain text content
|
|
6805
|
+
* @param editor The editor to get content from
|
|
6806
|
+
* @param mode Specify PlainText to get plain text result
|
|
6807
|
+
* @param callbacks @optional Callbacks to customize conversion behavior
|
|
6808
|
+
*/
|
|
6809
|
+
function exportContent(editor: IEditor, mode: 'PlainText', callbacks?: ModelToTextCallbacks): string;
|
|
6810
|
+
|
|
6811
|
+
/**
|
|
6812
|
+
* Export plain text using editor's textContent property directly
|
|
6642
6813
|
* @param editor The editor to get content from
|
|
6643
|
-
* @param mode
|
|
6644
|
-
* - HTML: Export HTML content. If there are entities, this will cause EntityOperation event with option = 'replaceTemporaryContent' to get a dehydrated entity
|
|
6645
|
-
* - PlainText: Export plain text content
|
|
6646
|
-
* - PlainTextFast: Export plain text using editor's textContent property directly
|
|
6814
|
+
* @param mode Specify PlainTextFast to get plain text result using textContent property
|
|
6647
6815
|
* @param options @optional Options for Model to DOM conversion
|
|
6648
6816
|
*/
|
|
6649
|
-
function exportContent(editor: IEditor, mode
|
|
6817
|
+
function exportContent(editor: IEditor, mode: 'PlainTextFast'): string;
|
|
6650
6818
|
|
|
6651
6819
|
/**
|
|
6652
6820
|
* Undo to last undo snapshot
|
|
@@ -7063,8 +7231,18 @@ function formatSegmentWithContentModel(editor: IEditor, apiName: string, toggleS
|
|
|
7063
7231
|
* Invoke a callback to format the text segment before the selection marker using Content Model
|
|
7064
7232
|
* @param editor The editor object
|
|
7065
7233
|
* @param callback The callback to format the text segment.
|
|
7234
|
+
* @returns True if the segment before cursor is found and callback is called, otherwise false
|
|
7066
7235
|
*/
|
|
7067
|
-
function formatTextSegmentBeforeSelectionMarker(editor: IEditor, callback: (model: ContentModelDocument, previousSegment: ContentModelText, paragraph: ContentModelParagraph, markerFormat: ContentModelSegmentFormat, context: FormatContentModelContext) => boolean):
|
|
7236
|
+
function formatTextSegmentBeforeSelectionMarker(editor: IEditor, callback: (model: ContentModelDocument, previousSegment: ContentModelText, paragraph: ContentModelParagraph, markerFormat: ContentModelSegmentFormat, context: FormatContentModelContext) => boolean, options?: FormatContentModelOptions): boolean;
|
|
7237
|
+
|
|
7238
|
+
/**
|
|
7239
|
+
* Format content model at a given insert point with a callback function
|
|
7240
|
+
* @param editor The editor object
|
|
7241
|
+
* @param insertPoint The insert point to format
|
|
7242
|
+
* @param callback The callback function to format the content model
|
|
7243
|
+
* @param options Options to control the behavior of the formatting
|
|
7244
|
+
*/
|
|
7245
|
+
function formatInsertPointWithContentModel(editor: IEditor, insertPoint: DOMInsertPoint, callback: (model: ContentModelDocument, context: FormatContentModelContext, insertPoint?: InsertPoint) => void, options?: FormatContentModelOptions): void;
|
|
7068
7246
|
|
|
7069
7247
|
/**
|
|
7070
7248
|
* Set a list type to content model
|
|
@@ -7093,7 +7271,7 @@ function setModelListStartNumber(model: ContentModelDocument, value: number): bo
|
|
|
7093
7271
|
* @param currentItem The current list item
|
|
7094
7272
|
* Search for all list items in the same thread as the current list item
|
|
7095
7273
|
*/
|
|
7096
|
-
function findListItemsInSameThread(
|
|
7274
|
+
function findListItemsInSameThread(group: ContentModelBlockGroup, currentItem: ContentModelListItem): ContentModelListItem[];
|
|
7097
7275
|
|
|
7098
7276
|
/**
|
|
7099
7277
|
* @param model The content model to set indentation
|
|
@@ -7101,7 +7279,7 @@ function findListItemsInSameThread(model: ContentModelDocument, currentItem: Con
|
|
|
7101
7279
|
* @param length The length of indentation in pixel, default value is 40
|
|
7102
7280
|
* Set indentation for selected list items or paragraphs
|
|
7103
7281
|
*/
|
|
7104
|
-
function setModelIndentation(model: ContentModelDocument, indentation: 'indent' | 'outdent', length?: number): boolean;
|
|
7282
|
+
function setModelIndentation(model: ContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
|
|
7105
7283
|
|
|
7106
7284
|
/**
|
|
7107
7285
|
* Try to match a given string with link match rules, return matched link
|
|
@@ -7115,11 +7293,20 @@ function setModelIndentation(model: ContentModelDocument, indentation: 'indent'
|
|
|
7115
7293
|
*/
|
|
7116
7294
|
function matchLink(url: string): LinkData | null;
|
|
7117
7295
|
|
|
7296
|
+
/**
|
|
7297
|
+
* Get announce data for list item
|
|
7298
|
+
* @param path Content model path that include the list item
|
|
7299
|
+
* @returns Announce data of current list item if any, or null
|
|
7300
|
+
*/
|
|
7301
|
+
function getListAnnounceData(path: ContentModelBlockGroup[]): AnnounceData | null;
|
|
7302
|
+
|
|
7118
7303
|
/**
|
|
7119
7304
|
* TableEdit plugin, provides the ability to resize a table by drag-and-drop
|
|
7120
7305
|
*/
|
|
7121
7306
|
class TableEditPlugin implements EditorPlugin {
|
|
7122
7307
|
private anchorContainerSelector?;
|
|
7308
|
+
private onTableEditorCreated?;
|
|
7309
|
+
private disableFeatures?;
|
|
7123
7310
|
private editor;
|
|
7124
7311
|
private onMouseMoveDisposer;
|
|
7125
7312
|
private tableRectMap;
|
|
@@ -7129,8 +7316,10 @@ class TableEditPlugin implements EditorPlugin {
|
|
|
7129
7316
|
* @param anchorContainerSelector An optional selector string to specify the container to host the plugin.
|
|
7130
7317
|
* The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.
|
|
7131
7318
|
* If not specified, the plugin will be inserted in document.body
|
|
7319
|
+
* @param onTableEditorCreated An optional callback to customize the Table Editors elements when created.
|
|
7320
|
+
* @param disableFeatures An optional array of TableEditFeatures to disable
|
|
7132
7321
|
*/
|
|
7133
|
-
constructor(anchorContainerSelector?: string | undefined);
|
|
7322
|
+
constructor(anchorContainerSelector?: string | undefined, onTableEditorCreated?: OnTableEditorCreatedCallback | undefined, disableFeatures?: TableEditFeatureName[] | undefined);
|
|
7134
7323
|
/**
|
|
7135
7324
|
* Get a friendly name of this plugin
|
|
7136
7325
|
*/
|
|
@@ -7162,6 +7351,16 @@ class TableEditPlugin implements EditorPlugin {
|
|
|
7162
7351
|
private ensureTableRects;
|
|
7163
7352
|
}
|
|
7164
7353
|
|
|
7354
|
+
/**
|
|
7355
|
+
* Optional callback when creating a TableEditPlugin, allows to customize the Selectors element as required.
|
|
7356
|
+
*/
|
|
7357
|
+
type OnTableEditorCreatedCallback = (featureType: TableEditFeatureName, element: HTMLElement) => () => void;
|
|
7358
|
+
|
|
7359
|
+
/**
|
|
7360
|
+
* Names of table edit features
|
|
7361
|
+
*/
|
|
7362
|
+
type TableEditFeatureName = 'HorizontalTableInserter' | 'VerticalTableInserter' | 'TableMover' | 'TableResizer' | 'TableSelector' | 'CellResizer';
|
|
7363
|
+
|
|
7165
7364
|
/**
|
|
7166
7365
|
* Paste plugin, handles BeforePaste event and reformat some special content, including:
|
|
7167
7366
|
* 1. Content copied from Word
|
|
@@ -7257,6 +7456,8 @@ class AutoFormatPlugin implements EditorPlugin {
|
|
|
7257
7456
|
* - autoLink: A boolean that enables or disables automatic hyperlink creation when pasting or typing content. Defaults to false.
|
|
7258
7457
|
* - autoUnlink: A boolean that enables or disables automatic hyperlink removal when pressing backspace. Defaults to false.
|
|
7259
7458
|
* - autoHyphen: A boolean that enables or disables automatic hyphen transformation. Defaults to false.
|
|
7459
|
+
* - autoFraction: A boolean that enables or disables automatic fraction transformation. Defaults to false.
|
|
7460
|
+
* - autoOrdinals: A boolean that enables or disables automatic ordinal number transformation. Defaults to false.
|
|
7260
7461
|
*/
|
|
7261
7462
|
constructor(options?: AutoFormatOptions);
|
|
7262
7463
|
/**
|
|
@@ -7295,23 +7496,31 @@ type AutoFormatOptions = {
|
|
|
7295
7496
|
/**
|
|
7296
7497
|
* When true, after type *, ->, -, --, => , —, > and space key a type of bullet list will be triggered. @default true
|
|
7297
7498
|
*/
|
|
7298
|
-
autoBullet
|
|
7499
|
+
autoBullet?: boolean;
|
|
7299
7500
|
/**
|
|
7300
7501
|
* When true, after type 1, A, a, i, I followed by ., ), - or between () and space key a type of numbering list will be triggered. @default true
|
|
7301
7502
|
*/
|
|
7302
|
-
autoNumbering
|
|
7503
|
+
autoNumbering?: boolean;
|
|
7303
7504
|
/**
|
|
7304
7505
|
* When press backspace before a link, remove the hyperlink
|
|
7305
7506
|
*/
|
|
7306
|
-
autoUnlink
|
|
7507
|
+
autoUnlink?: boolean;
|
|
7307
7508
|
/**
|
|
7308
7509
|
* When paste content, create hyperlink for the pasted link
|
|
7309
7510
|
*/
|
|
7310
|
-
autoLink
|
|
7511
|
+
autoLink?: boolean;
|
|
7311
7512
|
/**
|
|
7312
7513
|
* Transform -- into hyphen, if typed between two words
|
|
7313
7514
|
*/
|
|
7314
|
-
autoHyphen
|
|
7515
|
+
autoHyphen?: boolean;
|
|
7516
|
+
/**
|
|
7517
|
+
* Transform 1/2, 1/4, 3/4 into fraction character
|
|
7518
|
+
*/
|
|
7519
|
+
autoFraction?: boolean;
|
|
7520
|
+
/**
|
|
7521
|
+
* Transform ordinal numbers into superscript
|
|
7522
|
+
*/
|
|
7523
|
+
autoOrdinals?: boolean;
|
|
7315
7524
|
};
|
|
7316
7525
|
|
|
7317
7526
|
/**
|
|
@@ -7364,6 +7573,14 @@ const ShortcutUndo2: ShortcutCommand;
|
|
|
7364
7573
|
const ShortcutRedo: ShortcutCommand;
|
|
7365
7574
|
|
|
7366
7575
|
/**
|
|
7576
|
+
* Shortcut command for Redo 3
|
|
7577
|
+
* Windows: Ctrl + Shift + Z
|
|
7578
|
+
* MacOS: Meta + Shift + Z
|
|
7579
|
+
*/
|
|
7580
|
+
const ShortcutRedoAlt: ShortcutCommand;
|
|
7581
|
+
|
|
7582
|
+
/**
|
|
7583
|
+
* @deprecated
|
|
7367
7584
|
* Shortcut command for Redo 2
|
|
7368
7585
|
* Windows: N/A
|
|
7369
7586
|
* MacOS: Meta + Shift + Z
|
|
@@ -7570,7 +7787,7 @@ interface ContextMenuOptions<T> {
|
|
|
7570
7787
|
* A watermark plugin to manage watermark string for roosterjs
|
|
7571
7788
|
*/
|
|
7572
7789
|
class WatermarkPlugin implements EditorPlugin {
|
|
7573
|
-
|
|
7790
|
+
protected watermark: string;
|
|
7574
7791
|
private editor;
|
|
7575
7792
|
private format;
|
|
7576
7793
|
private isShowing;
|
|
@@ -7727,6 +7944,261 @@ class HyperlinkPlugin implements EditorPlugin {
|
|
|
7727
7944
|
*/
|
|
7728
7945
|
type HyperlinkToolTip = string | null | ((url: string, anchor: HTMLAnchorElement) => string);
|
|
7729
7946
|
|
|
7947
|
+
/**
|
|
7948
|
+
* PickerPlugin represents a plugin of editor which can handle picker related behaviors, including
|
|
7949
|
+
* - Show picker when special trigger key is pressed
|
|
7950
|
+
* - Hide picker
|
|
7951
|
+
* - Change selection in picker by Up/Down/Left/Right
|
|
7952
|
+
* - Apply selected item in picker
|
|
7953
|
+
*
|
|
7954
|
+
* PickerPlugin doesn't provide any UI, it just wraps related DOM events and invoke callback functions.
|
|
7955
|
+
*/
|
|
7956
|
+
class PickerPlugin implements EditorPlugin {
|
|
7957
|
+
private triggerCharacter;
|
|
7958
|
+
private readonly handler;
|
|
7959
|
+
private isMac;
|
|
7960
|
+
private lastQueryString;
|
|
7961
|
+
private helper;
|
|
7962
|
+
/**
|
|
7963
|
+
* Construct a new instance of PickerPlugin class
|
|
7964
|
+
* @param triggerCharacter The character to trigger a picker to be shown
|
|
7965
|
+
* @param handler Picker handler for receiving picker state change events
|
|
7966
|
+
*/
|
|
7967
|
+
constructor(triggerCharacter: string, handler: PickerHandler);
|
|
7968
|
+
/**
|
|
7969
|
+
* Get a friendly name
|
|
7970
|
+
*/
|
|
7971
|
+
getName(): string;
|
|
7972
|
+
/**
|
|
7973
|
+
* Initialize this plugin. This should only be called from Editor
|
|
7974
|
+
* @param editor Editor instance
|
|
7975
|
+
*/
|
|
7976
|
+
initialize(editor: IEditor): void;
|
|
7977
|
+
/**
|
|
7978
|
+
* Dispose this plugin
|
|
7979
|
+
*/
|
|
7980
|
+
dispose(): void;
|
|
7981
|
+
/**
|
|
7982
|
+
* Check if the plugin should handle the given event exclusively.
|
|
7983
|
+
* Handle an event exclusively means other plugin will not receive this event in
|
|
7984
|
+
* onPluginEvent method.
|
|
7985
|
+
* If two plugins will return true in willHandleEventExclusively() for the same event,
|
|
7986
|
+
* the final result depends on the order of the plugins are added into editor
|
|
7987
|
+
* @param event The event to check
|
|
7988
|
+
*/
|
|
7989
|
+
willHandleEventExclusively(event: PluginEvent): boolean;
|
|
7990
|
+
/**
|
|
7991
|
+
* Handle events triggered from editor
|
|
7992
|
+
* @param event PluginEvent object
|
|
7993
|
+
*/
|
|
7994
|
+
onPluginEvent(event: PluginEvent): void;
|
|
7995
|
+
private onSuggestingKeyDown;
|
|
7996
|
+
private onSuggestingInput;
|
|
7997
|
+
private onInput;
|
|
7998
|
+
}
|
|
7999
|
+
|
|
8000
|
+
/**
|
|
8001
|
+
* Represents the interface of picker plugin, provides necessary utility functions for pickers
|
|
8002
|
+
*/
|
|
8003
|
+
interface PickerHelper {
|
|
8004
|
+
/**
|
|
8005
|
+
* The editor instance
|
|
8006
|
+
*/
|
|
8007
|
+
readonly editor: IEditor;
|
|
8008
|
+
/**
|
|
8009
|
+
* Replace the query string with a given Content Model.
|
|
8010
|
+
* This is used for commit a change from picker and insert the committed content into editor.
|
|
8011
|
+
* @param model The Content Model to insert
|
|
8012
|
+
* @param options Options for formatting content model
|
|
8013
|
+
* @param canUndoByBackspace Whether this change can be undone using Backspace key
|
|
8014
|
+
*/
|
|
8015
|
+
replaceQueryString: (model: ContentModelDocument, options?: FormatContentModelOptions, canUndoByBackspace?: boolean) => void;
|
|
8016
|
+
/**
|
|
8017
|
+
* Notify Picker Plugin that picker is closed from the handler code, so picker plugin can quit the suggesting state
|
|
8018
|
+
*/
|
|
8019
|
+
closePicker: () => void;
|
|
8020
|
+
}
|
|
8021
|
+
|
|
8022
|
+
/**
|
|
8023
|
+
* Change mode that PickerPlugin will pass to child class
|
|
8024
|
+
*/
|
|
8025
|
+
type PickerSelectionChangMode = /**
|
|
8026
|
+
* When user press Right ("horizontal" mode or "both" mode) (Left in RTL) or Down ("vertical" mode),
|
|
8027
|
+
* select the next option
|
|
8028
|
+
*/
|
|
8029
|
+
'next'
|
|
8030
|
+
/**
|
|
8031
|
+
* When user press Left ("horizontal" mode or "both" mode) (Right in RTL) or Up ("vertical" mode),
|
|
8032
|
+
* select the previous option
|
|
8033
|
+
*/
|
|
8034
|
+
| 'previous'
|
|
8035
|
+
/**
|
|
8036
|
+
* When user press Down ("both" mode),
|
|
8037
|
+
* select the next row
|
|
8038
|
+
*/
|
|
8039
|
+
| 'nextRow'
|
|
8040
|
+
/**
|
|
8041
|
+
* When user press Up ("both" mode),
|
|
8042
|
+
* select the previous row
|
|
8043
|
+
*/
|
|
8044
|
+
| 'previousRow'
|
|
8045
|
+
/**
|
|
8046
|
+
* When user press PageDown,
|
|
8047
|
+
* switch to next page
|
|
8048
|
+
*/
|
|
8049
|
+
| 'nextPage'
|
|
8050
|
+
/**
|
|
8051
|
+
* When user press PageUp,
|
|
8052
|
+
* switch to previous page
|
|
8053
|
+
*/
|
|
8054
|
+
| 'previousPage'
|
|
8055
|
+
/**
|
|
8056
|
+
* When user press Home,
|
|
8057
|
+
* Select the first item in current row
|
|
8058
|
+
*/
|
|
8059
|
+
| 'firstInRow'
|
|
8060
|
+
/**
|
|
8061
|
+
* When user press End,
|
|
8062
|
+
* Select the last item in current row
|
|
8063
|
+
*/
|
|
8064
|
+
| 'lastInRow'
|
|
8065
|
+
/**
|
|
8066
|
+
* When user press CTRL (or META on Mac) + Home,
|
|
8067
|
+
* Select the very first item
|
|
8068
|
+
*/
|
|
8069
|
+
| 'first'
|
|
8070
|
+
/**
|
|
8071
|
+
* When user press CTRL (or META on Mac) + End,
|
|
8072
|
+
* Select the very last item
|
|
8073
|
+
*/
|
|
8074
|
+
| 'last';
|
|
8075
|
+
|
|
8076
|
+
/**
|
|
8077
|
+
* Direction option for picker
|
|
8078
|
+
*/
|
|
8079
|
+
type PickerDirection = /**
|
|
8080
|
+
* Show options horizontally
|
|
8081
|
+
*/
|
|
8082
|
+
'horizontal'
|
|
8083
|
+
/**
|
|
8084
|
+
* Show options vertically
|
|
8085
|
+
*/
|
|
8086
|
+
| 'vertical'
|
|
8087
|
+
/**
|
|
8088
|
+
* Show options in both direction (2-D picker)
|
|
8089
|
+
*/
|
|
8090
|
+
| 'both';
|
|
8091
|
+
|
|
8092
|
+
/**
|
|
8093
|
+
* Represents the interface a handler for picker plugin. Developer need to implement this interface to create a new type of picker
|
|
8094
|
+
*/
|
|
8095
|
+
interface PickerHandler {
|
|
8096
|
+
/**
|
|
8097
|
+
* Initialize the picker handler, pass in editor and PickerPlugin instance so that the handler can save them
|
|
8098
|
+
* @param editor The editor instance
|
|
8099
|
+
* @param pickerPlugin The PickerPlugin instance
|
|
8100
|
+
*/
|
|
8101
|
+
onInitialize: (helper: PickerHelper) => void;
|
|
8102
|
+
/**
|
|
8103
|
+
* Dispose the picker handler
|
|
8104
|
+
*/
|
|
8105
|
+
onDispose: () => void;
|
|
8106
|
+
/**
|
|
8107
|
+
* Notify the picker handler that user has typed trigger character so handler should show picker now
|
|
8108
|
+
* @param queryString Current query string
|
|
8109
|
+
* @param insertPoint Insert point where user is typing, can be used for calculating picker position
|
|
8110
|
+
* @returns A picker direction to let picker plugin know what kind of picker is opened. Picker plugin will use this value
|
|
8111
|
+
* to decide how to handle keyboard event to change selection. Return null means picker is not actually opened
|
|
8112
|
+
*/
|
|
8113
|
+
onTrigger: (queryString: string, insertPoint: DOMInsertPoint) => PickerDirection | null;
|
|
8114
|
+
/**
|
|
8115
|
+
* Notify the picker handler that picker should be closed now
|
|
8116
|
+
*/
|
|
8117
|
+
onClosePicker?(): void;
|
|
8118
|
+
/**
|
|
8119
|
+
* Notify the picker handler that user has changed current typed query string
|
|
8120
|
+
*/
|
|
8121
|
+
onQueryStringChanged?(queryString: string): void;
|
|
8122
|
+
/**
|
|
8123
|
+
* Notify the picker handler that user has decide to select the current option in picker
|
|
8124
|
+
*/
|
|
8125
|
+
onSelect?(): void;
|
|
8126
|
+
/**
|
|
8127
|
+
* Notify the picker handler that user is using keyboard to change current selection
|
|
8128
|
+
* @param mode The moving mode. Handler code can use this value to decide which item need to be selected
|
|
8129
|
+
*/
|
|
8130
|
+
onSelectionChanged?(mode: PickerSelectionChangMode): void;
|
|
8131
|
+
}
|
|
8132
|
+
|
|
8133
|
+
/**
|
|
8134
|
+
* CustomReplacePlugin is a plugin that allows you to replace a string with another string in the editor.
|
|
8135
|
+
*/
|
|
8136
|
+
class CustomReplacePlugin implements EditorPlugin {
|
|
8137
|
+
private customReplacements;
|
|
8138
|
+
private editor;
|
|
8139
|
+
private triggerKeys;
|
|
8140
|
+
/**
|
|
8141
|
+
* @param customReplacements Custom replacement rules.
|
|
8142
|
+
* Ex: [{ stringToReplace: ':)', replacementString: '🙂', replacementHandler: replaceEmojis }]
|
|
8143
|
+
*/
|
|
8144
|
+
constructor(customReplacements: CustomReplace[]);
|
|
8145
|
+
/**
|
|
8146
|
+
* Get name of this plugin
|
|
8147
|
+
*/
|
|
8148
|
+
getName(): string;
|
|
8149
|
+
/**
|
|
8150
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
8151
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
8152
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
8153
|
+
* @param editor The editor object
|
|
8154
|
+
*/
|
|
8155
|
+
initialize(editor: IEditor): void;
|
|
8156
|
+
/**
|
|
8157
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
8158
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
8159
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
8160
|
+
*/
|
|
8161
|
+
dispose(): void;
|
|
8162
|
+
/**
|
|
8163
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
8164
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
8165
|
+
* exclusively by another plugin.
|
|
8166
|
+
* @param event The event to handle:
|
|
8167
|
+
*/
|
|
8168
|
+
onPluginEvent(event: PluginEvent): void;
|
|
8169
|
+
private handleEditorInputEvent;
|
|
8170
|
+
}
|
|
8171
|
+
|
|
8172
|
+
/**
|
|
8173
|
+
* The CustomReplace interface defines a custom replacement that can be used in CustomReplacePlugin.
|
|
8174
|
+
*/
|
|
8175
|
+
interface CustomReplace {
|
|
8176
|
+
/**
|
|
8177
|
+
* The string to replace in the editor.
|
|
8178
|
+
*/
|
|
8179
|
+
stringToReplace: string;
|
|
8180
|
+
/**
|
|
8181
|
+
* The string to replace with.
|
|
8182
|
+
*/
|
|
8183
|
+
replacementString: string;
|
|
8184
|
+
/**
|
|
8185
|
+
* The handler to replace the string.
|
|
8186
|
+
* @param previousSegment The text segment to replace.
|
|
8187
|
+
* @param stringToReplace The string to replace.
|
|
8188
|
+
* @param replacementString The string to replace with.
|
|
8189
|
+
* @param paragraph The paragraph that contains the text segment.
|
|
8190
|
+
* @returns True if the string is replaced successfully, otherwise false.
|
|
8191
|
+
*/
|
|
8192
|
+
replacementHandler: (previousSegment: ContentModelText, stringToReplace: string, replacementString: string, paragraph?: ContentModelParagraph) => boolean;
|
|
8193
|
+
}
|
|
8194
|
+
|
|
8195
|
+
/**
|
|
8196
|
+
* Get bounding rect of the given DOM insert point
|
|
8197
|
+
* @param doc The document object
|
|
8198
|
+
* @param pos The input DOM insert point
|
|
8199
|
+
*/
|
|
8200
|
+
function getDOMInsertPointRect(doc: Document, pos: DOMInsertPoint): Rect | null;
|
|
8201
|
+
|
|
7730
8202
|
/**
|
|
7731
8203
|
* Get dark mode color for a given color
|
|
7732
8204
|
* @param color The color to calculate from
|