roosterjs 9.2.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 +104 -18
- package/dist/rooster-amd.js +435 -149
- 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 +104 -18
- package/dist/rooster.js +435 -149
- 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
|
|
|
@@ -2711,19 +2711,20 @@ type ColorTransformFunction = (lightColor: string, baseLValue?: number, colorTyp
|
|
|
2711
2711
|
* An interface of Editor, built on top of Content Model
|
|
2712
2712
|
*/
|
|
2713
2713
|
interface IEditor {
|
|
2714
|
+
/**
|
|
2715
|
+
* @deprecated Use formatContentModel() instead
|
|
2716
|
+
*/
|
|
2717
|
+
getContentModelCopy(mode: 'connected'): ContentModelDocument;
|
|
2714
2718
|
/**
|
|
2715
2719
|
* Create Content Model from DOM tree in this editor
|
|
2716
2720
|
* @param mode What kind of Content Model we want. Currently we support the following values:
|
|
2717
|
-
* - connected: Returns a connect Content Model object. "Connected" means if there is any entity inside editor, the returned Content Model will
|
|
2718
|
-
* contain the same wrapper element for entity. This option should only be used in some special cases. In most cases we should use "disconnected"
|
|
2719
|
-
* to get a fully disconnected Content Model so that any change to the model will not impact editor content.
|
|
2720
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.
|
|
2721
2722
|
* If there is any entity in editor, the returned object will contain cloned copy of entity wrapper element.
|
|
2722
2723
|
* If editor is in dark mode, the cloned entity will be converted back to light mode.
|
|
2723
2724
|
* - clean: Similar with disconnected, this will return a disconnected model, the difference is "clean" mode will not include any selection info.
|
|
2724
2725
|
* This is usually used for exporting content
|
|
2725
2726
|
*/
|
|
2726
|
-
getContentModelCopy(mode: '
|
|
2727
|
+
getContentModelCopy(mode: 'disconnected' | 'clean'): ContentModelDocument;
|
|
2727
2728
|
/**
|
|
2728
2729
|
* Get current running environment, such as if editor is running on Mac
|
|
2729
2730
|
*/
|
|
@@ -3854,6 +3855,10 @@ interface FormatContentModelOptions {
|
|
|
3854
3855
|
* When specified, use this selection range to override current selection inside editor
|
|
3855
3856
|
*/
|
|
3856
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;
|
|
3857
3862
|
}
|
|
3858
3863
|
|
|
3859
3864
|
/**
|
|
@@ -4758,6 +4763,60 @@ type ParsedTable = ParsedTableCell[][];
|
|
|
4758
4763
|
*/
|
|
4759
4764
|
type ParsedTableCell = HTMLTableCellElement | 'spanLeft' | 'spanTop' | 'spanBoth';
|
|
4760
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
|
+
|
|
4761
4820
|
/**
|
|
4762
4821
|
* Editor plugin event interface
|
|
4763
4822
|
*/
|
|
@@ -5305,8 +5364,9 @@ function contentModelToDom(doc: Document, root: Node, model: ContentModelDocumen
|
|
|
5305
5364
|
* Convert Content Model to plain text
|
|
5306
5365
|
* @param model The source Content Model
|
|
5307
5366
|
* @param [separator='\r\n'] The separator string used for connect lines
|
|
5367
|
+
* @param callbacks Callbacks to customize the behavior of contentModelToText function
|
|
5308
5368
|
*/
|
|
5309
|
-
function contentModelToText(model: ContentModelDocument, separator?: string): string;
|
|
5369
|
+
function contentModelToText(model: ContentModelDocument, separator?: string, callbacks?: ModelToTextCallbacks): string;
|
|
5310
5370
|
|
|
5311
5371
|
/**
|
|
5312
5372
|
* Content Model Element Processor for child elements
|
|
@@ -6571,9 +6631,6 @@ class Editor implements IEditor {
|
|
|
6571
6631
|
/**
|
|
6572
6632
|
* Create Content Model from DOM tree in this editor
|
|
6573
6633
|
* @param mode What kind of Content Model we want. Currently we support the following values:
|
|
6574
|
-
* - connected: Returns a connect Content Model object. "Connected" means if there is any entity inside editor, the returned Content Model will
|
|
6575
|
-
* contain the same wrapper element for entity. This option should only be used in some special cases. In most cases we should use "disconnected"
|
|
6576
|
-
* to get a fully disconnected Content Model so that any change to the model will not impact editor content.
|
|
6577
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.
|
|
6578
6635
|
* If there is any entity in editor, the returned object will contain cloned copy of entity wrapper element.
|
|
6579
6636
|
* If editor is in dark mode, the cloned entity will be converted back to light mode.
|
|
@@ -6736,15 +6793,28 @@ class Editor implements IEditor {
|
|
|
6736
6793
|
function createModelFromHtml(html: string, options?: Partial<DomToModelOptionForSanitizing>, trustedHTMLHandler?: TrustedHTMLHandler, defaultSegmentFormat?: ContentModelSegmentFormat): ContentModelDocument;
|
|
6737
6794
|
|
|
6738
6795
|
/**
|
|
6739
|
-
* 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
|
|
6740
6813
|
* @param editor The editor to get content from
|
|
6741
|
-
* @param mode
|
|
6742
|
-
* - HTML: Export HTML content. If there are entities, this will cause EntityOperation event with option = 'replaceTemporaryContent' to get a dehydrated entity
|
|
6743
|
-
* - PlainText: Export plain text content
|
|
6744
|
-
* - PlainTextFast: Export plain text using editor's textContent property directly
|
|
6814
|
+
* @param mode Specify PlainTextFast to get plain text result using textContent property
|
|
6745
6815
|
* @param options @optional Options for Model to DOM conversion
|
|
6746
6816
|
*/
|
|
6747
|
-
function exportContent(editor: IEditor, mode
|
|
6817
|
+
function exportContent(editor: IEditor, mode: 'PlainTextFast'): string;
|
|
6748
6818
|
|
|
6749
6819
|
/**
|
|
6750
6820
|
* Undo to last undo snapshot
|
|
@@ -7165,6 +7235,15 @@ function formatSegmentWithContentModel(editor: IEditor, apiName: string, toggleS
|
|
|
7165
7235
|
*/
|
|
7166
7236
|
function formatTextSegmentBeforeSelectionMarker(editor: IEditor, callback: (model: ContentModelDocument, previousSegment: ContentModelText, paragraph: ContentModelParagraph, markerFormat: ContentModelSegmentFormat, context: FormatContentModelContext) => boolean, options?: FormatContentModelOptions): boolean;
|
|
7167
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;
|
|
7246
|
+
|
|
7168
7247
|
/**
|
|
7169
7248
|
* Set a list type to content model
|
|
7170
7249
|
* @param model the model document
|
|
@@ -7227,6 +7306,7 @@ function getListAnnounceData(path: ContentModelBlockGroup[]): AnnounceData | nul
|
|
|
7227
7306
|
class TableEditPlugin implements EditorPlugin {
|
|
7228
7307
|
private anchorContainerSelector?;
|
|
7229
7308
|
private onTableEditorCreated?;
|
|
7309
|
+
private disableFeatures?;
|
|
7230
7310
|
private editor;
|
|
7231
7311
|
private onMouseMoveDisposer;
|
|
7232
7312
|
private tableRectMap;
|
|
@@ -7237,8 +7317,9 @@ class TableEditPlugin implements EditorPlugin {
|
|
|
7237
7317
|
* The container must not be affected by transform: scale(), otherwise the position calculation will be wrong.
|
|
7238
7318
|
* If not specified, the plugin will be inserted in document.body
|
|
7239
7319
|
* @param onTableEditorCreated An optional callback to customize the Table Editors elements when created.
|
|
7320
|
+
* @param disableFeatures An optional array of TableEditFeatures to disable
|
|
7240
7321
|
*/
|
|
7241
|
-
constructor(anchorContainerSelector?: string | undefined, onTableEditorCreated?: OnTableEditorCreatedCallback | undefined);
|
|
7322
|
+
constructor(anchorContainerSelector?: string | undefined, onTableEditorCreated?: OnTableEditorCreatedCallback | undefined, disableFeatures?: TableEditFeatureName[] | undefined);
|
|
7242
7323
|
/**
|
|
7243
7324
|
* Get a friendly name of this plugin
|
|
7244
7325
|
*/
|
|
@@ -7273,7 +7354,12 @@ class TableEditPlugin implements EditorPlugin {
|
|
|
7273
7354
|
/**
|
|
7274
7355
|
* Optional callback when creating a TableEditPlugin, allows to customize the Selectors element as required.
|
|
7275
7356
|
*/
|
|
7276
|
-
type OnTableEditorCreatedCallback = (
|
|
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';
|
|
7277
7363
|
|
|
7278
7364
|
/**
|
|
7279
7365
|
* Paste plugin, handles BeforePaste event and reformat some special content, including:
|
|
@@ -7701,7 +7787,7 @@ interface ContextMenuOptions<T> {
|
|
|
7701
7787
|
* A watermark plugin to manage watermark string for roosterjs
|
|
7702
7788
|
*/
|
|
7703
7789
|
class WatermarkPlugin implements EditorPlugin {
|
|
7704
|
-
|
|
7790
|
+
protected watermark: string;
|
|
7705
7791
|
private editor;
|
|
7706
7792
|
private format;
|
|
7707
7793
|
private isShowing;
|