-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85eebb6
commit 0bc2578
Showing
4 changed files
with
164 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/roosterjs-editor-adapter/lib/publicTypes/MixedPlugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { PluginEvent, IEditor } from 'roosterjs-content-model-types'; | ||
import type { EditorPlugin } from 'roosterjs-editor-types'; | ||
|
||
/** | ||
* Represents a mixed version plugin that can handle both v8 and v9 events. | ||
* This is not commonly used, but just for transitioning from v8 to v9 plugins | ||
*/ | ||
export interface MixedPlugin extends EditorPlugin { | ||
/** | ||
* The first method that editor will call to a plugin when editor is initializing. | ||
* It will pass in the editor instance, plugin should take this chance to save the | ||
* editor reference so that it can call to any editor method or format API later. | ||
* @param editor The editor object | ||
*/ | ||
|
||
initializeV9: (editor: IEditor) => void; | ||
|
||
/** | ||
* Check if the plugin should handle the given event exclusively. | ||
* Handle an event exclusively means other plugin will not receive this event in | ||
* onPluginEvent method. | ||
* If two plugins will return true in willHandleEventExclusively() for the same event, | ||
* the final result depends on the order of the plugins are added into editor | ||
* @param event The event to check: | ||
*/ | ||
willHandleEventExclusivelyV9?: (event: PluginEvent) => boolean; | ||
|
||
/** | ||
* Core method for a plugin. Once an event happens in editor, editor will call this | ||
* method of each plugin to handle the event as long as the event is not handled | ||
* exclusively by another plugin. | ||
* @param event The event to handle: | ||
*/ | ||
onPluginEventV9?: (event: PluginEvent) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters