roosterjs 8.25.0 → 8.26.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 +274 -31
- package/dist/rooster-amd.js +216 -111
- 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 +274 -31
- package/dist/rooster.js +216 -111
- package/dist/rooster.js.map +1 -1
- package/package.json +7 -7
- package/tsconfig.child.tsbuildinfo +1 -1
package/dist/rooster-amd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 8.
|
|
1
|
+
// Type definitions for roosterjs (Version 8.26.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -337,6 +337,7 @@ export function applyTextStyle(container: Node, styler: (node: HTMLElement, isIn
|
|
|
337
337
|
* @param event The paste event
|
|
338
338
|
* @param callback Callback function when data is ready
|
|
339
339
|
* @param options Options to retrieve more items from the event, including HTML string and other customized items
|
|
340
|
+
* @param rangeBeforePaste Optional range to be removed when pasting in Android
|
|
340
341
|
* @returns An object with the following properties:
|
|
341
342
|
* types: Available types from the clipboard event
|
|
342
343
|
* text: Plain text from the clipboard event
|
|
@@ -345,7 +346,7 @@ export function applyTextStyle(container: Node, styler: (node: HTMLElement, isIn
|
|
|
345
346
|
* When set to undefined, it means can't retrieve HTML string, there may be HTML string but direct retrieving is
|
|
346
347
|
* not supported by browser.
|
|
347
348
|
*/
|
|
348
|
-
export function extractClipboardEvent(event: ClipboardEvent, callback: (clipboardData: ClipboardData) => void, options?: ExtractClipboardEventOption): void;
|
|
349
|
+
export function extractClipboardEvent(event: ClipboardEvent, callback: (clipboardData: ClipboardData) => void, options?: ExtractClipboardEventOption, rangeBeforePaste?: Range): void;
|
|
349
350
|
|
|
350
351
|
/**
|
|
351
352
|
* Extract clipboard items to be a ClipboardData object for IE
|
|
@@ -2560,7 +2561,7 @@ export function toggleListType(editor: IEditor, listType: ListType | CompatibleL
|
|
|
2560
2561
|
/**
|
|
2561
2562
|
* Split selection into regions, and perform a block-wise formatting action for each region.
|
|
2562
2563
|
*/
|
|
2563
|
-
export function blockFormat(editor: IEditor, callback: (region: Region, start: NodePosition, end: NodePosition, chains: VListChain[]) => void, beforeRunCallback?: () => boolean): void;
|
|
2564
|
+
export function blockFormat(editor: IEditor, callback: (region: Region, start: NodePosition, end: NodePosition, chains: VListChain[]) => void, beforeRunCallback?: () => boolean, apiName?: string): void;
|
|
2564
2565
|
|
|
2565
2566
|
/**
|
|
2566
2567
|
* Commit changes of all list changes when experiment features are allowed
|
|
@@ -4207,7 +4208,13 @@ export const enum DefinitionType {
|
|
|
4207
4208
|
/**
|
|
4208
4209
|
* Provides a chance for plugin to change the content before it is copied from editor.
|
|
4209
4210
|
*/
|
|
4210
|
-
export interface BeforeCutCopyEvent extends BasePluginEvent<PluginEventType.BeforeCutCopy> {
|
|
4211
|
+
export interface BeforeCutCopyEvent extends BeforeCutCopyEventData, BasePluginEvent<PluginEventType.BeforeCutCopy> {
|
|
4212
|
+
}
|
|
4213
|
+
|
|
4214
|
+
/**
|
|
4215
|
+
* Data of BeforeCutCopyEvent
|
|
4216
|
+
*/
|
|
4217
|
+
export interface BeforeCutCopyEventData {
|
|
4211
4218
|
/**
|
|
4212
4219
|
* Raw DOM event
|
|
4213
4220
|
*/
|
|
@@ -4226,6 +4233,12 @@ export interface BeforeCutCopyEvent extends BasePluginEvent<PluginEventType.Befo
|
|
|
4226
4233
|
isCut: boolean;
|
|
4227
4234
|
}
|
|
4228
4235
|
|
|
4236
|
+
/**
|
|
4237
|
+
* Provides a chance for plugin to change the content before it is copied from editor.
|
|
4238
|
+
*/
|
|
4239
|
+
export interface CompatibleBeforeCutCopyEvent extends BeforeCutCopyEventData, BasePluginEvent<CompatiblePluginEventType.BeforeCutCopy> {
|
|
4240
|
+
}
|
|
4241
|
+
|
|
4229
4242
|
/**
|
|
4230
4243
|
* Editor plugin event interface
|
|
4231
4244
|
*/
|
|
@@ -4253,7 +4266,19 @@ export interface BeforeDisposeEvent extends BasePluginEvent<PluginEventType.Befo
|
|
|
4253
4266
|
/**
|
|
4254
4267
|
* Provides a chance for plugin to change the content before it is pasted into editor.
|
|
4255
4268
|
*/
|
|
4256
|
-
export interface
|
|
4269
|
+
export interface CompatibleBeforeDisposeEvent extends BasePluginEvent<CompatiblePluginEventType.BeforeDispose> {
|
|
4270
|
+
}
|
|
4271
|
+
|
|
4272
|
+
/**
|
|
4273
|
+
* Provides a chance for plugin to change the content before it is pasted into editor.
|
|
4274
|
+
*/
|
|
4275
|
+
export interface BeforePasteEvent extends BeforePasteEventData, BasePluginEvent<PluginEventType.BeforePaste> {
|
|
4276
|
+
}
|
|
4277
|
+
|
|
4278
|
+
/**
|
|
4279
|
+
* Data of BeforePasteEvent
|
|
4280
|
+
*/
|
|
4281
|
+
export interface BeforePasteEventData {
|
|
4257
4282
|
/**
|
|
4258
4283
|
* An object contains all related data for pasting
|
|
4259
4284
|
*/
|
|
@@ -4280,21 +4305,46 @@ export interface BeforePasteEvent extends BasePluginEvent<PluginEventType.Before
|
|
|
4280
4305
|
htmlAttributes: Record<string, string>;
|
|
4281
4306
|
}
|
|
4282
4307
|
|
|
4308
|
+
/**
|
|
4309
|
+
* Provides a chance for plugin to change the content before it is pasted into editor.
|
|
4310
|
+
*/
|
|
4311
|
+
export interface CompatibleBeforePasteEvent extends BeforePasteEventData, BasePluginEvent<CompatiblePluginEventType.BeforePaste> {
|
|
4312
|
+
}
|
|
4313
|
+
|
|
4283
4314
|
/**
|
|
4284
4315
|
* The event to be triggered before SetContent API is called.
|
|
4285
4316
|
* Handle this event to cache anything you need from editor before it is gone.
|
|
4286
4317
|
*/
|
|
4287
|
-
export interface BeforeSetContentEvent extends BasePluginEvent<PluginEventType.BeforeSetContent> {
|
|
4318
|
+
export interface BeforeSetContentEvent extends BeforeSetContentEventData, BasePluginEvent<PluginEventType.BeforeSetContent> {
|
|
4319
|
+
}
|
|
4320
|
+
|
|
4321
|
+
/**
|
|
4322
|
+
* Data of BeforeSetContentEvent
|
|
4323
|
+
*/
|
|
4324
|
+
export interface BeforeSetContentEventData {
|
|
4288
4325
|
/**
|
|
4289
4326
|
* New content HTML that is about to set to editor
|
|
4290
4327
|
*/
|
|
4291
4328
|
newContent: string;
|
|
4292
4329
|
}
|
|
4293
4330
|
|
|
4331
|
+
/**
|
|
4332
|
+
* The event to be triggered before SetContent API is called.
|
|
4333
|
+
* Handle this event to cache anything you need from editor before it is gone.
|
|
4334
|
+
*/
|
|
4335
|
+
export interface CompatibleBeforeSetContentEvent extends BeforeSetContentEventData, BasePluginEvent<CompatiblePluginEventType.BeforeSetContent> {
|
|
4336
|
+
}
|
|
4337
|
+
|
|
4294
4338
|
/**
|
|
4295
4339
|
* Represents a change to the editor made by another plugin
|
|
4296
4340
|
*/
|
|
4297
|
-
export interface ContentChangedEvent extends BasePluginEvent<PluginEventType.ContentChanged> {
|
|
4341
|
+
export interface ContentChangedEvent extends ContentChangedEventData, BasePluginEvent<PluginEventType.ContentChanged> {
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
/**
|
|
4345
|
+
* Data of ContentChangedEvent
|
|
4346
|
+
*/
|
|
4347
|
+
export interface ContentChangedEventData {
|
|
4298
4348
|
/**
|
|
4299
4349
|
* Source of the change
|
|
4300
4350
|
*/
|
|
@@ -4303,13 +4353,26 @@ export interface ContentChangedEvent extends BasePluginEvent<PluginEventType.Con
|
|
|
4303
4353
|
* Optional related data
|
|
4304
4354
|
*/
|
|
4305
4355
|
data?: any;
|
|
4356
|
+
additionalData?: ContentChangedData;
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
/**
|
|
4360
|
+
* Represents a change to the editor made by another plugin
|
|
4361
|
+
*/
|
|
4362
|
+
export interface CompatibleContentChangedEvent extends ContentChangedEventData, BasePluginEvent<CompatiblePluginEventType.ContentChanged> {
|
|
4306
4363
|
}
|
|
4307
4364
|
|
|
4308
4365
|
/**
|
|
4309
4366
|
* Represents an event that will be fired when an inline image is edited by user, and the src
|
|
4310
4367
|
* attribute of the image is about to be changed
|
|
4311
4368
|
*/
|
|
4312
|
-
export interface EditImageEvent extends BasePluginEvent<PluginEventType.EditImage> {
|
|
4369
|
+
export interface EditImageEvent extends EditImageEventData, BasePluginEvent<PluginEventType.EditImage> {
|
|
4370
|
+
}
|
|
4371
|
+
|
|
4372
|
+
/**
|
|
4373
|
+
* Data of EditImageEvent
|
|
4374
|
+
*/
|
|
4375
|
+
export interface EditImageEventData {
|
|
4313
4376
|
/**
|
|
4314
4377
|
* The image element that is being changed
|
|
4315
4378
|
*/
|
|
@@ -4330,17 +4393,36 @@ export interface EditImageEvent extends BasePluginEvent<PluginEventType.EditImag
|
|
|
4330
4393
|
newSrc: string;
|
|
4331
4394
|
}
|
|
4332
4395
|
|
|
4396
|
+
/**
|
|
4397
|
+
* Represents an event that will be fired when an inline image is edited by user, and the src
|
|
4398
|
+
* attribute of the image is about to be changed
|
|
4399
|
+
*/
|
|
4400
|
+
export interface CompatibleEditImageEvent extends EditImageEventData, BasePluginEvent<CompatiblePluginEventType.EditImage> {
|
|
4401
|
+
}
|
|
4402
|
+
|
|
4333
4403
|
/**
|
|
4334
4404
|
* Provides a chance for plugin to change the content before it is pasted into editor.
|
|
4335
4405
|
*/
|
|
4336
4406
|
export interface EditorReadyEvent extends BasePluginEvent<PluginEventType.EditorReady> {
|
|
4337
4407
|
}
|
|
4338
4408
|
|
|
4409
|
+
/**
|
|
4410
|
+
* Provides a chance for plugin to change the content before it is pasted into editor.
|
|
4411
|
+
*/
|
|
4412
|
+
export interface CompatibleEditorReadyEvent extends BasePluginEvent<CompatiblePluginEventType.EditorReady> {
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4339
4415
|
/**
|
|
4340
4416
|
* Provide a chance for plugins to handle entity related events.
|
|
4341
4417
|
* See enum EntityOperation for more details about each operation
|
|
4342
4418
|
*/
|
|
4343
|
-
export interface EntityOperationEvent extends BasePluginEvent<PluginEventType.EntityOperation> {
|
|
4419
|
+
export interface EntityOperationEvent extends EntityOperationEventData, BasePluginEvent<PluginEventType.EntityOperation> {
|
|
4420
|
+
}
|
|
4421
|
+
|
|
4422
|
+
/**
|
|
4423
|
+
* Data of EntityOperationEvent
|
|
4424
|
+
*/
|
|
4425
|
+
export interface EntityOperationEventData {
|
|
4344
4426
|
/**
|
|
4345
4427
|
* Operation to this entity
|
|
4346
4428
|
*/
|
|
@@ -4367,13 +4449,26 @@ export interface EntityOperationEvent extends BasePluginEvent<PluginEventType.En
|
|
|
4367
4449
|
contentForShadowEntity?: DocumentFragment;
|
|
4368
4450
|
}
|
|
4369
4451
|
|
|
4452
|
+
/**
|
|
4453
|
+
* Provide a chance for plugins to handle entity related events.
|
|
4454
|
+
* See enum EntityOperation for more details about each operation
|
|
4455
|
+
*/
|
|
4456
|
+
export interface CompatibleEntityOperationEvent extends EntityOperationEventData, BasePluginEvent<CompatiblePluginEventType.EntityOperation> {
|
|
4457
|
+
}
|
|
4458
|
+
|
|
4370
4459
|
/**
|
|
4371
4460
|
* Extract Content with a DOM tree event
|
|
4372
4461
|
* This event is triggered when getContent() is called with triggerExtractContentEvent = true
|
|
4373
4462
|
* Plugin can handle this event to remove the UI only markups to return clean HTML
|
|
4374
4463
|
* by operating on a cloned DOM tree
|
|
4375
4464
|
*/
|
|
4376
|
-
export interface ExtractContentWithDomEvent extends BasePluginEvent<PluginEventType.ExtractContentWithDom> {
|
|
4465
|
+
export interface ExtractContentWithDomEvent extends ExtractContentWithDomEventData, BasePluginEvent<PluginEventType.ExtractContentWithDom> {
|
|
4466
|
+
}
|
|
4467
|
+
|
|
4468
|
+
/**
|
|
4469
|
+
* Data of ExtractContentWithDomEvent
|
|
4470
|
+
*/
|
|
4471
|
+
export interface ExtractContentWithDomEventData {
|
|
4377
4472
|
/**
|
|
4378
4473
|
* Cloned root element of editor
|
|
4379
4474
|
* Plugin can change this DOM tree to clean up the markups it added before
|
|
@@ -4381,6 +4476,15 @@ export interface ExtractContentWithDomEvent extends BasePluginEvent<PluginEventT
|
|
|
4381
4476
|
clonedRoot: HTMLElement;
|
|
4382
4477
|
}
|
|
4383
4478
|
|
|
4479
|
+
/**
|
|
4480
|
+
* Extract Content with a DOM tree event
|
|
4481
|
+
* This event is triggered when getContent() is called with triggerExtractContentEvent = true
|
|
4482
|
+
* Plugin can handle this event to remove the UI only markups to return clean HTML
|
|
4483
|
+
* by operating on a cloned DOM tree
|
|
4484
|
+
*/
|
|
4485
|
+
export interface CompatibleExtractContentWithDomEvent extends ExtractContentWithDomEventData, BasePluginEvent<CompatiblePluginEventType.ExtractContentWithDom> {
|
|
4486
|
+
}
|
|
4487
|
+
|
|
4384
4488
|
/**
|
|
4385
4489
|
* An event fired when pending format state (bold, italic, underline, ... with collapsed selection) is changed
|
|
4386
4490
|
*/
|
|
@@ -4388,6 +4492,13 @@ export interface PendingFormatStateChangedEvent extends BasePluginEvent<PluginEv
|
|
|
4388
4492
|
formatState: PendableFormatState;
|
|
4389
4493
|
}
|
|
4390
4494
|
|
|
4495
|
+
/**
|
|
4496
|
+
* An event fired when pending format state (bold, italic, underline, ... with collapsed selection) is changed
|
|
4497
|
+
*/
|
|
4498
|
+
export interface CompatiblePendingFormatStateChangedEvent extends BasePluginEvent<CompatiblePluginEventType.PendingFormatStateChanged> {
|
|
4499
|
+
formatState: PendableFormatState;
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4391
4502
|
/**
|
|
4392
4503
|
* This represents a PluginEvent wrapping native browser event
|
|
4393
4504
|
*/
|
|
@@ -4409,13 +4520,7 @@ export interface PluginCompositionEvent extends PluginDomEventBase<PluginEventTy
|
|
|
4409
4520
|
/**
|
|
4410
4521
|
* This interface represents a PluginEvent wrapping native ContextMenu event
|
|
4411
4522
|
*/
|
|
4412
|
-
export interface PluginContextMenuEvent extends PluginDomEventBase<PluginEventType.ContextMenu, MouseEvent> {
|
|
4413
|
-
/**
|
|
4414
|
-
* A callback array to let editor retrieve context menu item related to this event.
|
|
4415
|
-
* Plugins can add their own getter callback to this array,
|
|
4416
|
-
* items from each getter will be separated by a splitter item represented by null
|
|
4417
|
-
*/
|
|
4418
|
-
items: any[];
|
|
4523
|
+
export interface PluginContextMenuEvent extends PluginContextMenuEventData, PluginDomEventBase<PluginEventType.ContextMenu, MouseEvent> {
|
|
4419
4524
|
}
|
|
4420
4525
|
|
|
4421
4526
|
/**
|
|
@@ -4455,11 +4560,7 @@ export interface PluginMouseDownEvent extends PluginDomEventBase<PluginEventType
|
|
|
4455
4560
|
/**
|
|
4456
4561
|
* This interface represents a PluginEvent wrapping native MouseUp event
|
|
4457
4562
|
*/
|
|
4458
|
-
export interface PluginMouseUpEvent extends PluginDomEventBase<PluginEventType.MouseUp, MouseEvent> {
|
|
4459
|
-
/**
|
|
4460
|
-
* Whether this is a mouse click event (mouse up and down on the same position)
|
|
4461
|
-
*/
|
|
4462
|
-
isClicking?: boolean;
|
|
4563
|
+
export interface PluginMouseUpEvent extends PluginMouseUpEventData, PluginDomEventBase<PluginEventType.MouseUp, MouseEvent> {
|
|
4463
4564
|
}
|
|
4464
4565
|
|
|
4465
4566
|
/**
|
|
@@ -4471,14 +4572,114 @@ export interface PluginInputEvent extends PluginDomEventBase<PluginEventType.Inp
|
|
|
4471
4572
|
/**
|
|
4472
4573
|
* This interface represents a PluginEvent wrapping native scroll event
|
|
4473
4574
|
*/
|
|
4474
|
-
export interface PluginScrollEvent extends PluginDomEventBase<PluginEventType.Scroll, UIEvent> {
|
|
4575
|
+
export interface PluginScrollEvent extends PluginScrollEventData, PluginDomEventBase<PluginEventType.Scroll, UIEvent> {
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
/**
|
|
4579
|
+
* This represents a PluginEvent wrapping native browser event
|
|
4580
|
+
*/
|
|
4581
|
+
export type CompatiblePluginDomEvent = CompatiblePluginCompositionEvent | CompatiblePluginMouseEvent | CompatiblePluginKeyboardEvent | CompatiblePluginInputEvent | CompatiblePluginScrollEvent;
|
|
4582
|
+
|
|
4583
|
+
/**
|
|
4584
|
+
* This interface represents a PluginEvent wrapping native CompositionEnd event
|
|
4585
|
+
*/
|
|
4586
|
+
export interface CompatiblePluginCompositionEvent extends PluginDomEventBase<CompatiblePluginEventType.CompositionEnd, CompositionEvent> {
|
|
4587
|
+
}
|
|
4588
|
+
|
|
4589
|
+
/**
|
|
4590
|
+
* This interface represents a PluginEvent wrapping native ContextMenu event
|
|
4591
|
+
*/
|
|
4592
|
+
export interface CompatiblePluginContextMenuEvent extends PluginContextMenuEventData, PluginDomEventBase<CompatiblePluginEventType.ContextMenu, MouseEvent> {
|
|
4593
|
+
}
|
|
4594
|
+
|
|
4595
|
+
/**
|
|
4596
|
+
* The interface represents a PluginEvent wrapping native Keyboard event
|
|
4597
|
+
*/
|
|
4598
|
+
export type CompatiblePluginKeyboardEvent = CompatiblePluginKeyDownEvent | CompatiblePluginKeyPressEvent | CompatiblePluginKeyUpEvent;
|
|
4599
|
+
|
|
4600
|
+
/**
|
|
4601
|
+
* This interface represents a PluginEvent wrapping native KeyDown event
|
|
4602
|
+
*/
|
|
4603
|
+
export interface CompatiblePluginKeyDownEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyDown, KeyboardEvent> {
|
|
4604
|
+
}
|
|
4605
|
+
|
|
4606
|
+
/**
|
|
4607
|
+
* This interface represents a PluginEvent wrapping native KeyPress event
|
|
4608
|
+
*/
|
|
4609
|
+
export interface CompatiblePluginKeyPressEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyPress, KeyboardEvent> {
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
/**
|
|
4613
|
+
* This interface represents a PluginEvent wrapping native KeyUp event
|
|
4614
|
+
*/
|
|
4615
|
+
export interface CompatiblePluginKeyUpEvent extends PluginDomEventBase<CompatiblePluginEventType.KeyUp, KeyboardEvent> {
|
|
4616
|
+
}
|
|
4617
|
+
|
|
4618
|
+
/**
|
|
4619
|
+
* This interface represents a PluginEvent wrapping native Mouse event
|
|
4620
|
+
*/
|
|
4621
|
+
export type CompatiblePluginMouseEvent = CompatiblePluginMouseDownEvent | CompatiblePluginMouseUpEvent | CompatiblePluginContextMenuEvent;
|
|
4622
|
+
|
|
4623
|
+
/**
|
|
4624
|
+
* This interface represents a PluginEvent wrapping native MouseDown event
|
|
4625
|
+
*/
|
|
4626
|
+
export interface CompatiblePluginMouseDownEvent extends PluginDomEventBase<CompatiblePluginEventType.MouseDown, MouseEvent> {
|
|
4627
|
+
}
|
|
4628
|
+
|
|
4629
|
+
/**
|
|
4630
|
+
* This interface represents a PluginEvent wrapping native MouseUp event
|
|
4631
|
+
*/
|
|
4632
|
+
export interface CompatiblePluginMouseUpEvent extends PluginMouseUpEventData, PluginDomEventBase<CompatiblePluginEventType.MouseUp, MouseEvent> {
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
/**
|
|
4636
|
+
* This interface represents a PluginEvent wrapping native input / textinput event
|
|
4637
|
+
*/
|
|
4638
|
+
export interface CompatiblePluginInputEvent extends PluginDomEventBase<CompatiblePluginEventType.Input, InputEvent> {
|
|
4639
|
+
}
|
|
4640
|
+
|
|
4641
|
+
/**
|
|
4642
|
+
* This interface represents a PluginEvent wrapping native scroll event
|
|
4643
|
+
*/
|
|
4644
|
+
export interface CompatiblePluginScrollEvent extends PluginScrollEventData, PluginDomEventBase<CompatiblePluginEventType.Scroll, UIEvent> {
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
/**
|
|
4648
|
+
* Data of PluginScrollEvent
|
|
4649
|
+
*/
|
|
4650
|
+
export interface PluginScrollEventData {
|
|
4651
|
+
/**
|
|
4652
|
+
* Current scroll container that triggers this scroll event
|
|
4653
|
+
*/
|
|
4475
4654
|
scrollContainer: HTMLElement;
|
|
4476
4655
|
}
|
|
4477
4656
|
|
|
4657
|
+
/**
|
|
4658
|
+
* Data of PluginMouseUpEvent
|
|
4659
|
+
*/
|
|
4660
|
+
export interface PluginMouseUpEventData {
|
|
4661
|
+
/**
|
|
4662
|
+
* Whether this is a mouse click event (mouse up and down on the same position)
|
|
4663
|
+
*/
|
|
4664
|
+
isClicking?: boolean;
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
/**
|
|
4668
|
+
* Data of PluginContextMenuEvent
|
|
4669
|
+
*/
|
|
4670
|
+
export interface PluginContextMenuEventData {
|
|
4671
|
+
/**
|
|
4672
|
+
* A callback array to let editor retrieve context menu item related to this event.
|
|
4673
|
+
* Plugins can add their own getter callback to this array,
|
|
4674
|
+
* items from each getter will be separated by a splitter item represented by null
|
|
4675
|
+
*/
|
|
4676
|
+
items: any[];
|
|
4677
|
+
}
|
|
4678
|
+
|
|
4478
4679
|
/**
|
|
4479
4680
|
* Editor plugin event interface
|
|
4480
4681
|
*/
|
|
4481
|
-
export type PluginEvent = BeforeCutCopyEvent | BeforePasteEvent | ContentChangedEvent | EntityOperationEvent | ExtractContentWithDomEvent | PluginDomEvent | EditorReadyEvent | BeforeDisposeEvent | PendingFormatStateChangedEvent | EnterShadowEditEvent | LeaveShadowEditEvent | EditImageEvent | BeforeSetContentEvent | ZoomChangedEvent;
|
|
4682
|
+
export type PluginEvent = BeforeCutCopyEvent | BeforePasteEvent | ContentChangedEvent | EntityOperationEvent | ExtractContentWithDomEvent | PluginDomEvent | EditorReadyEvent | BeforeDisposeEvent | PendingFormatStateChangedEvent | EnterShadowEditEvent | LeaveShadowEditEvent | EditImageEvent | BeforeSetContentEvent | ZoomChangedEvent | CompatibleBeforeCutCopyEvent | CompatibleBeforeDisposeEvent | CompatibleBeforePasteEvent | CompatibleBeforeSetContentEvent | CompatibleContentChangedEvent | CompatibleEditImageEvent | CompatibleEditorReadyEvent | CompatibleEntityOperationEvent | CompatibleExtractContentWithDomEvent | CompatiblePendingFormatStateChangedEvent | CompatiblePluginDomEvent | CompatibleEnterShadowEditEvent | CompatibleLeaveShadowEditEvent | CompatibleZoomChangedEvent;
|
|
4482
4683
|
|
|
4483
4684
|
/**
|
|
4484
4685
|
* A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.
|
|
@@ -4505,7 +4706,19 @@ export type PluginEventFromTypeGeneric<E extends PluginEvent, T extends PluginEv
|
|
|
4505
4706
|
/**
|
|
4506
4707
|
* A plugin triggered right after editor has entered Shadow Edit mode
|
|
4507
4708
|
*/
|
|
4508
|
-
export interface EnterShadowEditEvent extends BasePluginEvent<PluginEventType.EnteredShadowEdit> {
|
|
4709
|
+
export interface EnterShadowEditEvent extends EnterShadowEditEventData, BasePluginEvent<PluginEventType.EnteredShadowEdit> {
|
|
4710
|
+
}
|
|
4711
|
+
|
|
4712
|
+
/**
|
|
4713
|
+
* A plugin triggered right before editor leave Shadow Edit mode
|
|
4714
|
+
*/
|
|
4715
|
+
export interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.LeavingShadowEdit> {
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
/**
|
|
4719
|
+
* Data of EnterShadowEditEvent
|
|
4720
|
+
*/
|
|
4721
|
+
export interface EnterShadowEditEventData {
|
|
4509
4722
|
/**
|
|
4510
4723
|
* The document fragment of original editor content
|
|
4511
4724
|
*/
|
|
@@ -4516,10 +4729,16 @@ export interface EnterShadowEditEvent extends BasePluginEvent<PluginEventType.En
|
|
|
4516
4729
|
selectionPath: SelectionPath;
|
|
4517
4730
|
}
|
|
4518
4731
|
|
|
4732
|
+
/**
|
|
4733
|
+
* A plugin triggered right after editor has entered Shadow Edit mode
|
|
4734
|
+
*/
|
|
4735
|
+
export interface CompatibleEnterShadowEditEvent extends EnterShadowEditEventData, BasePluginEvent<CompatiblePluginEventType.EnteredShadowEdit> {
|
|
4736
|
+
}
|
|
4737
|
+
|
|
4519
4738
|
/**
|
|
4520
4739
|
* A plugin triggered right before editor leave Shadow Edit mode
|
|
4521
4740
|
*/
|
|
4522
|
-
export interface
|
|
4741
|
+
export interface CompatibleLeaveShadowEditEvent extends BasePluginEvent<CompatiblePluginEventType.LeavingShadowEdit> {
|
|
4523
4742
|
}
|
|
4524
4743
|
|
|
4525
4744
|
/**
|
|
@@ -4527,7 +4746,13 @@ export interface LeaveShadowEditEvent extends BasePluginEvent<PluginEventType.Le
|
|
|
4527
4746
|
* Plugins can handle this event when they need to do something for zoom changing.
|
|
4528
4747
|
*
|
|
4529
4748
|
*/
|
|
4530
|
-
export interface ZoomChangedEvent extends BasePluginEvent<PluginEventType.ZoomChanged> {
|
|
4749
|
+
export interface ZoomChangedEvent extends ZoomChangedEventData, BasePluginEvent<PluginEventType.ZoomChanged> {
|
|
4750
|
+
}
|
|
4751
|
+
|
|
4752
|
+
/**
|
|
4753
|
+
* Data of ZoomChangedEvent
|
|
4754
|
+
*/
|
|
4755
|
+
export interface ZoomChangedEventData {
|
|
4531
4756
|
/**
|
|
4532
4757
|
* Zoom scale value before this change
|
|
4533
4758
|
*/
|
|
@@ -4538,6 +4763,14 @@ export interface ZoomChangedEvent extends BasePluginEvent<PluginEventType.ZoomCh
|
|
|
4538
4763
|
newZoomScale: number;
|
|
4539
4764
|
}
|
|
4540
4765
|
|
|
4766
|
+
/**
|
|
4767
|
+
* Represents an event object triggered from Editor.setZoomScale() API.
|
|
4768
|
+
* Plugins can handle this event when they need to do something for zoom changing.
|
|
4769
|
+
*
|
|
4770
|
+
*/
|
|
4771
|
+
export interface CompatibleZoomChangedEvent extends ZoomChangedEventData, BasePluginEvent<CompatiblePluginEventType.ZoomChanged> {
|
|
4772
|
+
}
|
|
4773
|
+
|
|
4541
4774
|
/**
|
|
4542
4775
|
* This refers to a "content block" in editor that serves as a content parsing boundary
|
|
4543
4776
|
* It is most those html block like tags, i.e. <p>, <div>, <li>, <td> etc.
|
|
@@ -4650,6 +4883,16 @@ export interface CustomData {
|
|
|
4650
4883
|
disposer?: (value: any) => void;
|
|
4651
4884
|
}
|
|
4652
4885
|
|
|
4886
|
+
/**
|
|
4887
|
+
* Property that is going to store additional data related to the Content Changed Event
|
|
4888
|
+
*/
|
|
4889
|
+
export interface ContentChangedData {
|
|
4890
|
+
/**
|
|
4891
|
+
* Optional property to store the format api name when using ChangeSource.Format
|
|
4892
|
+
*/
|
|
4893
|
+
formatApiName?: string;
|
|
4894
|
+
}
|
|
4895
|
+
|
|
4653
4896
|
/**
|
|
4654
4897
|
* Default format settings
|
|
4655
4898
|
*/
|
|
@@ -5861,8 +6104,9 @@ export interface IEditor {
|
|
|
5861
6104
|
* @param changeSource The change source to use when fire ContentChangedEvent. When the value is not null,
|
|
5862
6105
|
* a ContentChangedEvent will be fired with change source equal to this value
|
|
5863
6106
|
* @param canUndoByBackspace True if this action can be undone when user presses Backspace key (aka Auto Complete).
|
|
6107
|
+
* @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
|
|
5864
6108
|
*/
|
|
5865
|
-
addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean): void;
|
|
6109
|
+
addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean, additionalData?: ContentChangedData): void;
|
|
5866
6110
|
/**
|
|
5867
6111
|
* Whether there is an available undo/redo snapshot
|
|
5868
6112
|
*/
|
|
@@ -6244,8 +6488,9 @@ export interface EditorCore extends PluginState {
|
|
|
6244
6488
|
* @param callback The editing callback, accepting current selection start and end position, returns an optional object used as the data field of ContentChangedEvent.
|
|
6245
6489
|
* @param changeSource The ChangeSource string of ContentChangedEvent. @default ChangeSource.Format. Set to null to avoid triggering ContentChangedEvent
|
|
6246
6490
|
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
|
|
6491
|
+
* @param additionalData Optional parameter to provide additional data related to the ContentChanged Event.
|
|
6247
6492
|
*/
|
|
6248
|
-
export type AddUndoSnapshot = (core: EditorCore, callback: (start: NodePosition, end: NodePosition) => any, changeSource: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace: boolean) => void;
|
|
6493
|
+
export type AddUndoSnapshot = (core: EditorCore, callback: (start: NodePosition, end: NodePosition) => any, changeSource: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace: boolean, additionalData?: ContentChangedData) => void;
|
|
6249
6494
|
|
|
6250
6495
|
/**
|
|
6251
6496
|
* Attach a DOM event to the editor content DIV
|
|
@@ -9235,8 +9480,6 @@ export class Paste implements EditorPlugin {
|
|
|
9235
9480
|
* - Apply selected item in picker
|
|
9236
9481
|
*
|
|
9237
9482
|
* PickerPlugin doesn't provide any UI, it just wraps related DOM events and invoke callback functions.
|
|
9238
|
-
* To show a picker UI, you need to build your own UI component. Please reference to
|
|
9239
|
-
* https://github.com/microsoft/roosterjs/tree/master/demo/scripts/controls/samplepicker
|
|
9240
9483
|
*/
|
|
9241
9484
|
export class PickerPlugin<T extends PickerDataProvider = PickerDataProvider> implements EditorPlugin {
|
|
9242
9485
|
readonly dataProvider: T;
|