roosterjs-content-model-plugins 9.1.0 → 9.2.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/lib/autoFormat/AutoFormatPlugin.d.ts +15 -5
- package/lib/autoFormat/AutoFormatPlugin.js +41 -4
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib/autoFormat/link/createLink.js +2 -0
- package/lib/autoFormat/link/createLink.js.map +1 -1
- package/lib/autoFormat/list/keyboardListTrigger.js +7 -9
- package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib/autoFormat/numbers/transformFraction.d.ts +5 -0
- package/lib/autoFormat/numbers/transformFraction.js +27 -0
- package/lib/autoFormat/numbers/transformFraction.js.map +1 -0
- package/lib/autoFormat/numbers/transformOrdinals.d.ts +5 -0
- package/lib/autoFormat/numbers/transformOrdinals.js +32 -0
- package/lib/autoFormat/numbers/transformOrdinals.js.map +1 -0
- package/lib/customReplace/CustomReplacePlugin.d.ts +61 -0
- package/lib/customReplace/CustomReplacePlugin.js +87 -0
- package/lib/customReplace/CustomReplacePlugin.js.map +1 -0
- package/lib/edit/EditPlugin.js +19 -1
- package/lib/edit/EditPlugin.js.map +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.js +8 -1
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib/edit/keyboardTab.js +5 -5
- package/lib/edit/keyboardTab.js.map +1 -1
- package/lib/edit/tabUtils/handleTabOnList.d.ts +2 -2
- package/lib/edit/tabUtils/handleTabOnList.js +3 -3
- package/lib/edit/tabUtils/handleTabOnList.js.map +1 -1
- package/lib/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
- package/lib/edit/tabUtils/handleTabOnParagraph.js +2 -2
- package/lib/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.js +8 -1
- package/lib/index.js.map +1 -1
- package/lib/markdown/utils/setFormat.js +11 -9
- package/lib/markdown/utils/setFormat.js.map +1 -1
- package/lib/picker/PickerHandler.d.ts +112 -0
- package/lib/picker/PickerHandler.js +3 -0
- package/lib/picker/PickerHandler.js.map +1 -0
- package/lib/picker/PickerHelper.d.ts +22 -0
- package/lib/picker/PickerHelper.js +3 -0
- package/lib/picker/PickerHelper.js.map +1 -0
- package/lib/picker/PickerHelperImpl.d.ts +25 -0
- package/lib/picker/PickerHelperImpl.js +54 -0
- package/lib/picker/PickerHelperImpl.js.map +1 -0
- package/lib/picker/PickerPlugin.d.ts +54 -0
- package/lib/picker/PickerPlugin.js +217 -0
- package/lib/picker/PickerPlugin.js.map +1 -0
- package/lib/picker/getQueryString.d.ts +5 -0
- package/lib/picker/getQueryString.js +36 -0
- package/lib/picker/getQueryString.js.map +1 -0
- package/lib/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
- package/lib/pluginUtils/Rect/getDOMInsertPointRect.js +57 -0
- package/lib/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
- package/lib/shortcut/ShortcutPlugin.js +1 -0
- package/lib/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib/shortcut/shortcuts.d.ts +7 -0
- package/lib/shortcut/shortcuts.js +15 -1
- package/lib/shortcut/shortcuts.js.map +1 -1
- package/lib/shortcut/utils/setShortcutIndentationCommand.js +2 -2
- package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
- package/lib/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
- package/lib/tableEdit/OnTableEditorCreatedCallback.js +3 -0
- package/lib/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
- package/lib/tableEdit/TableEditPlugin.d.ts +4 -1
- package/lib/tableEdit/TableEditPlugin.js +5 -2
- package/lib/tableEdit/TableEditPlugin.js.map +1 -1
- package/lib/tableEdit/editors/TableEditor.d.ts +4 -1
- package/lib/tableEdit/editors/TableEditor.js +23 -7
- package/lib/tableEdit/editors/TableEditor.js.map +1 -1
- package/lib/tableEdit/editors/features/TableEditFeature.js +3 -3
- package/lib/tableEdit/editors/features/TableEditFeature.js.map +1 -1
- package/lib/tableEdit/editors/features/TableInserter.d.ts +2 -1
- package/lib/tableEdit/editors/features/TableInserter.js +7 -9
- package/lib/tableEdit/editors/features/TableInserter.js.map +1 -1
- package/lib/tableEdit/editors/features/TableMover.d.ts +2 -1
- package/lib/tableEdit/editors/features/TableMover.js +8 -11
- package/lib/tableEdit/editors/features/TableMover.js.map +1 -1
- package/lib/tableEdit/editors/features/TableResizer.d.ts +2 -1
- package/lib/tableEdit/editors/features/TableResizer.js +19 -3
- package/lib/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +15 -5
- package/lib-amd/autoFormat/AutoFormatPlugin.js +39 -5
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-amd/autoFormat/link/createLink.js +2 -0
- package/lib-amd/autoFormat/link/createLink.js.map +1 -1
- package/lib-amd/autoFormat/list/keyboardListTrigger.js +7 -9
- package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib-amd/autoFormat/numbers/transformFraction.d.ts +5 -0
- package/lib-amd/autoFormat/numbers/transformFraction.js +28 -0
- package/lib-amd/autoFormat/numbers/transformFraction.js.map +1 -0
- package/lib-amd/autoFormat/numbers/transformOrdinals.d.ts +5 -0
- package/lib-amd/autoFormat/numbers/transformOrdinals.js +33 -0
- package/lib-amd/autoFormat/numbers/transformOrdinals.js.map +1 -0
- package/lib-amd/customReplace/CustomReplacePlugin.d.ts +61 -0
- package/lib-amd/customReplace/CustomReplacePlugin.js +88 -0
- package/lib-amd/customReplace/CustomReplacePlugin.js.map +1 -0
- package/lib-amd/edit/EditPlugin.js +19 -1
- package/lib-amd/edit/EditPlugin.js.map +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +8 -2
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-amd/edit/keyboardTab.js +5 -5
- package/lib-amd/edit/keyboardTab.js.map +1 -1
- package/lib-amd/edit/tabUtils/handleTabOnList.d.ts +2 -2
- package/lib-amd/edit/tabUtils/handleTabOnList.js +3 -3
- package/lib-amd/edit/tabUtils/handleTabOnList.js.map +1 -1
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js +2 -2
- package/lib-amd/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
- package/lib-amd/index.d.ts +7 -1
- package/lib-amd/index.js +6 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/markdown/utils/setFormat.js +11 -9
- package/lib-amd/markdown/utils/setFormat.js.map +1 -1
- package/lib-amd/picker/PickerHandler.d.ts +112 -0
- package/lib-amd/picker/PickerHandler.js +5 -0
- package/lib-amd/picker/PickerHandler.js.map +1 -0
- package/lib-amd/picker/PickerHelper.d.ts +22 -0
- package/lib-amd/picker/PickerHelper.js +5 -0
- package/lib-amd/picker/PickerHelper.js.map +1 -0
- package/lib-amd/picker/PickerHelperImpl.d.ts +25 -0
- package/lib-amd/picker/PickerHelperImpl.js +53 -0
- package/lib-amd/picker/PickerHelperImpl.js.map +1 -0
- package/lib-amd/picker/PickerPlugin.d.ts +54 -0
- package/lib-amd/picker/PickerPlugin.js +215 -0
- package/lib-amd/picker/PickerPlugin.js.map +1 -0
- package/lib-amd/picker/getQueryString.d.ts +5 -0
- package/lib-amd/picker/getQueryString.js +37 -0
- package/lib-amd/picker/getQueryString.js.map +1 -0
- package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
- package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.js +58 -0
- package/lib-amd/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
- package/lib-amd/shortcut/ShortcutPlugin.js +1 -0
- package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib-amd/shortcut/shortcuts.d.ts +7 -0
- package/lib-amd/shortcut/shortcuts.js +15 -1
- package/lib-amd/shortcut/shortcuts.js.map +1 -1
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +2 -2
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
- package/lib-amd/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
- package/lib-amd/tableEdit/OnTableEditorCreatedCallback.js +5 -0
- package/lib-amd/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
- package/lib-amd/tableEdit/TableEditPlugin.d.ts +4 -1
- package/lib-amd/tableEdit/TableEditPlugin.js +5 -2
- package/lib-amd/tableEdit/TableEditPlugin.js.map +1 -1
- package/lib-amd/tableEdit/editors/TableEditor.d.ts +4 -1
- package/lib-amd/tableEdit/editors/TableEditor.js +23 -7
- package/lib-amd/tableEdit/editors/TableEditor.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/TableEditFeature.js +3 -3
- package/lib-amd/tableEdit/editors/features/TableEditFeature.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/TableInserter.d.ts +2 -1
- package/lib-amd/tableEdit/editors/features/TableInserter.js +7 -9
- package/lib-amd/tableEdit/editors/features/TableInserter.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/TableMover.d.ts +2 -1
- package/lib-amd/tableEdit/editors/features/TableMover.js +8 -11
- package/lib-amd/tableEdit/editors/features/TableMover.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/TableResizer.d.ts +2 -1
- package/lib-amd/tableEdit/editors/features/TableResizer.js +19 -4
- package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +15 -5
- package/lib-mjs/autoFormat/AutoFormatPlugin.js +41 -4
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-mjs/autoFormat/link/createLink.js +3 -1
- package/lib-mjs/autoFormat/link/createLink.js.map +1 -1
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js +7 -9
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib-mjs/autoFormat/numbers/transformFraction.d.ts +5 -0
- package/lib-mjs/autoFormat/numbers/transformFraction.js +23 -0
- package/lib-mjs/autoFormat/numbers/transformFraction.js.map +1 -0
- package/lib-mjs/autoFormat/numbers/transformOrdinals.d.ts +5 -0
- package/lib-mjs/autoFormat/numbers/transformOrdinals.js +28 -0
- package/lib-mjs/autoFormat/numbers/transformOrdinals.js.map +1 -0
- package/lib-mjs/customReplace/CustomReplacePlugin.d.ts +61 -0
- package/lib-mjs/customReplace/CustomReplacePlugin.js +84 -0
- package/lib-mjs/customReplace/CustomReplacePlugin.js.map +1 -0
- package/lib-mjs/edit/EditPlugin.js +19 -1
- package/lib-mjs/edit/EditPlugin.js.map +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +8 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-mjs/edit/keyboardTab.js +5 -5
- package/lib-mjs/edit/keyboardTab.js.map +1 -1
- package/lib-mjs/edit/tabUtils/handleTabOnList.d.ts +2 -2
- package/lib-mjs/edit/tabUtils/handleTabOnList.js +3 -3
- package/lib-mjs/edit/tabUtils/handleTabOnList.js.map +1 -1
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.d.ts +2 -2
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js +2 -2
- package/lib-mjs/edit/tabUtils/handleTabOnParagraph.js.map +1 -1
- package/lib-mjs/index.d.ts +7 -1
- package/lib-mjs/index.js +4 -1
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/markdown/utils/setFormat.js +11 -9
- package/lib-mjs/markdown/utils/setFormat.js.map +1 -1
- package/lib-mjs/picker/PickerHandler.d.ts +112 -0
- package/lib-mjs/picker/PickerHandler.js +2 -0
- package/lib-mjs/picker/PickerHandler.js.map +1 -0
- package/lib-mjs/picker/PickerHelper.d.ts +22 -0
- package/lib-mjs/picker/PickerHelper.js +2 -0
- package/lib-mjs/picker/PickerHelper.js.map +1 -0
- package/lib-mjs/picker/PickerHelperImpl.d.ts +25 -0
- package/lib-mjs/picker/PickerHelperImpl.js +51 -0
- package/lib-mjs/picker/PickerHelperImpl.js.map +1 -0
- package/lib-mjs/picker/PickerPlugin.d.ts +54 -0
- package/lib-mjs/picker/PickerPlugin.js +214 -0
- package/lib-mjs/picker/PickerPlugin.js.map +1 -0
- package/lib-mjs/picker/getQueryString.d.ts +5 -0
- package/lib-mjs/picker/getQueryString.js +32 -0
- package/lib-mjs/picker/getQueryString.js.map +1 -0
- package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.d.ts +7 -0
- package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.js +53 -0
- package/lib-mjs/pluginUtils/Rect/getDOMInsertPointRect.js.map +1 -0
- package/lib-mjs/shortcut/ShortcutPlugin.js +2 -1
- package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib-mjs/shortcut/shortcuts.d.ts +7 -0
- package/lib-mjs/shortcut/shortcuts.js +14 -0
- package/lib-mjs/shortcut/shortcuts.js.map +1 -1
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +2 -2
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
- package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.d.ts +4 -0
- package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.js +2 -0
- package/lib-mjs/tableEdit/OnTableEditorCreatedCallback.js.map +1 -0
- package/lib-mjs/tableEdit/TableEditPlugin.d.ts +4 -1
- package/lib-mjs/tableEdit/TableEditPlugin.js +5 -2
- package/lib-mjs/tableEdit/TableEditPlugin.js.map +1 -1
- package/lib-mjs/tableEdit/editors/TableEditor.d.ts +4 -1
- package/lib-mjs/tableEdit/editors/TableEditor.js +24 -8
- package/lib-mjs/tableEdit/editors/TableEditor.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.js +3 -3
- package/lib-mjs/tableEdit/editors/features/TableEditFeature.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/TableInserter.d.ts +2 -1
- package/lib-mjs/tableEdit/editors/features/TableInserter.js +7 -9
- package/lib-mjs/tableEdit/editors/features/TableInserter.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/TableMover.d.ts +2 -1
- package/lib-mjs/tableEdit/editors/features/TableMover.js +8 -11
- package/lib-mjs/tableEdit/editors/features/TableMover.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/TableResizer.d.ts +2 -1
- package/lib-mjs/tableEdit/editors/features/TableResizer.js +19 -3
- package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ContentModelParagraph, ContentModelText, EditorPlugin, IEditor, PluginEvent } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* The CustomReplace interface defines a custom replacement that can be used in CustomReplacePlugin.
|
|
4
|
+
*/
|
|
5
|
+
export interface CustomReplace {
|
|
6
|
+
/**
|
|
7
|
+
* The string to replace in the editor.
|
|
8
|
+
*/
|
|
9
|
+
stringToReplace: string;
|
|
10
|
+
/**
|
|
11
|
+
* The string to replace with.
|
|
12
|
+
*/
|
|
13
|
+
replacementString: string;
|
|
14
|
+
/**
|
|
15
|
+
* The handler to replace the string.
|
|
16
|
+
* @param previousSegment The text segment to replace.
|
|
17
|
+
* @param stringToReplace The string to replace.
|
|
18
|
+
* @param replacementString The string to replace with.
|
|
19
|
+
* @param paragraph The paragraph that contains the text segment.
|
|
20
|
+
* @returns True if the string is replaced successfully, otherwise false.
|
|
21
|
+
*/
|
|
22
|
+
replacementHandler: (previousSegment: ContentModelText, stringToReplace: string, replacementString: string, paragraph?: ContentModelParagraph) => boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* CustomReplacePlugin is a plugin that allows you to replace a string with another string in the editor.
|
|
26
|
+
*/
|
|
27
|
+
export declare class CustomReplacePlugin implements EditorPlugin {
|
|
28
|
+
private customReplacements;
|
|
29
|
+
private editor;
|
|
30
|
+
private triggerKeys;
|
|
31
|
+
/**
|
|
32
|
+
* @param customReplacements Custom replacement rules.
|
|
33
|
+
* Ex: [{ stringToReplace: ':)', replacementString: '🙂', replacementHandler: replaceEmojis }]
|
|
34
|
+
*/
|
|
35
|
+
constructor(customReplacements: CustomReplace[]);
|
|
36
|
+
/**
|
|
37
|
+
* Get name of this plugin
|
|
38
|
+
*/
|
|
39
|
+
getName(): string;
|
|
40
|
+
/**
|
|
41
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
42
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
43
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
44
|
+
* @param editor The editor object
|
|
45
|
+
*/
|
|
46
|
+
initialize(editor: IEditor): void;
|
|
47
|
+
/**
|
|
48
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
49
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
50
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
51
|
+
*/
|
|
52
|
+
dispose(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
55
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
56
|
+
* exclusively by another plugin.
|
|
57
|
+
* @param event The event to handle:
|
|
58
|
+
*/
|
|
59
|
+
onPluginEvent(event: PluginEvent): void;
|
|
60
|
+
private handleEditorInputEvent;
|
|
61
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
define(["require", "exports", "roosterjs-content-model-api"], function (require, exports, roosterjs_content_model_api_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CustomReplacePlugin = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* CustomReplacePlugin is a plugin that allows you to replace a string with another string in the editor.
|
|
7
|
+
*/
|
|
8
|
+
var CustomReplacePlugin = /** @class */ (function () {
|
|
9
|
+
/**
|
|
10
|
+
* @param customReplacements Custom replacement rules.
|
|
11
|
+
* Ex: [{ stringToReplace: ':)', replacementString: '🙂', replacementHandler: replaceEmojis }]
|
|
12
|
+
*/
|
|
13
|
+
function CustomReplacePlugin(customReplacements) {
|
|
14
|
+
this.customReplacements = customReplacements;
|
|
15
|
+
this.editor = null;
|
|
16
|
+
this.triggerKeys = [];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get name of this plugin
|
|
20
|
+
*/
|
|
21
|
+
CustomReplacePlugin.prototype.getName = function () {
|
|
22
|
+
return 'CustomReplace';
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The first method that editor will call to a plugin when editor is initializing.
|
|
26
|
+
* It will pass in the editor instance, plugin should take this chance to save the
|
|
27
|
+
* editor reference so that it can call to any editor method or format API later.
|
|
28
|
+
* @param editor The editor object
|
|
29
|
+
*/
|
|
30
|
+
CustomReplacePlugin.prototype.initialize = function (editor) {
|
|
31
|
+
this.editor = editor;
|
|
32
|
+
this.triggerKeys = this.customReplacements.map(function (replacement) {
|
|
33
|
+
return replacement.stringToReplace.slice(-1);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The last method that editor will call to a plugin before it is disposed.
|
|
38
|
+
* Plugin can take this chance to clear the reference to editor. After this method is
|
|
39
|
+
* called, plugin should not call to any editor method since it will result in error.
|
|
40
|
+
*/
|
|
41
|
+
CustomReplacePlugin.prototype.dispose = function () {
|
|
42
|
+
this.editor = null;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Core method for a plugin. Once an event happens in editor, editor will call this
|
|
46
|
+
* method of each plugin to handle the event as long as the event is not handled
|
|
47
|
+
* exclusively by another plugin.
|
|
48
|
+
* @param event The event to handle:
|
|
49
|
+
*/
|
|
50
|
+
CustomReplacePlugin.prototype.onPluginEvent = function (event) {
|
|
51
|
+
if (this.editor) {
|
|
52
|
+
switch (event.eventType) {
|
|
53
|
+
case 'input':
|
|
54
|
+
this.handleEditorInputEvent(this.editor, event);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
CustomReplacePlugin.prototype.handleEditorInputEvent = function (editor, event) {
|
|
60
|
+
var _this = this;
|
|
61
|
+
var rawEvent = event.rawEvent;
|
|
62
|
+
var selection = editor.getDOMSelection();
|
|
63
|
+
var key = rawEvent.data;
|
|
64
|
+
if (this.customReplacements.length > 0 &&
|
|
65
|
+
rawEvent.inputType === 'insertText' &&
|
|
66
|
+
selection &&
|
|
67
|
+
selection.type === 'range' &&
|
|
68
|
+
selection.range.collapsed &&
|
|
69
|
+
key &&
|
|
70
|
+
this.triggerKeys.indexOf(key) > -1) {
|
|
71
|
+
(0, roosterjs_content_model_api_1.formatTextSegmentBeforeSelectionMarker)(editor, function (_model, previousSegment, paragraph, _markerFormat, context) {
|
|
72
|
+
var replaced = _this.customReplacements.some(function (_a) {
|
|
73
|
+
var stringToReplace = _a.stringToReplace, replacementString = _a.replacementString, replacementHandler = _a.replacementHandler;
|
|
74
|
+
return replacementHandler(previousSegment, stringToReplace, replacementString, paragraph);
|
|
75
|
+
});
|
|
76
|
+
if (replaced) {
|
|
77
|
+
context.canUndoByBackspace = true;
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return CustomReplacePlugin;
|
|
85
|
+
}());
|
|
86
|
+
exports.CustomReplacePlugin = CustomReplacePlugin;
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=CustomReplacePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomReplacePlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/customReplace/CustomReplacePlugin.ts"],"names":[],"mappings":";;;;IAwCA;;OAEG;IACH;QAII;;;WAGG;QACH,6BAAoB,kBAA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WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EACpC;gBACE,IAAA,oEAAsC,EAClC,MAAM,EACN,UAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO;oBACvD,IAAM,QAAQ,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CACzC,UAAC,EAA0D;4BAAxD,eAAe,qBAAA,EAAE,iBAAiB,uBAAA,EAAE,kBAAkB,wBAAA;wBACrD,OAAO,kBAAkB,CACrB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,SAAS,CACZ,CAAC;oBACN,CAAC,CACJ,CAAC;oBACF,IAAI,QAAQ,EAAE;wBACV,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;wBAClC,OAAO,IAAI,CAAC;qBACf;oBACD,OAAO,KAAK,CAAC;gBACjB,CAAC,CACJ,CAAC;aACL;QACL,CAAC;QACL,0BAAC;IAAD,CAAC,AA1FD,IA0FC;IA1FY,kDAAmB","sourcesContent":["import { formatTextSegmentBeforeSelectionMarker } from 'roosterjs-content-model-api';\nimport type {\n ContentModelParagraph,\n ContentModelText,\n EditorInputEvent,\n EditorPlugin,\n IEditor,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\n/**\n * The CustomReplace interface defines a custom replacement that can be used in CustomReplacePlugin.\n */\nexport interface CustomReplace {\n /**\n * The string to replace in the editor.\n */\n stringToReplace: string;\n\n /**\n * The string to replace with.\n */\n replacementString: string;\n\n /**\n * The handler to replace the string.\n * @param previousSegment The text segment to replace.\n * @param stringToReplace The string to replace.\n * @param replacementString The string to replace with.\n * @param paragraph The paragraph that contains the text segment.\n * @returns True if the string is replaced successfully, otherwise false.\n */\n replacementHandler: (\n previousSegment: ContentModelText,\n stringToReplace: string,\n replacementString: string,\n paragraph?: ContentModelParagraph\n ) => boolean;\n}\n\n/**\n * CustomReplacePlugin is a plugin that allows you to replace a string with another string in the editor.\n */\nexport class CustomReplacePlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private triggerKeys: string[] = [];\n\n /**\n * @param customReplacements Custom replacement rules.\n * Ex: [{ stringToReplace: ':)', replacementString: '🙂', replacementHandler: replaceEmojis }]\n */\n constructor(private customReplacements: CustomReplace[]) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'CustomReplace';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n this.triggerKeys = this.customReplacements.map(replacement =>\n replacement.stringToReplace.slice(-1)\n );\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor) {\n switch (event.eventType) {\n case 'input':\n this.handleEditorInputEvent(this.editor, event);\n break;\n }\n }\n }\n\n private handleEditorInputEvent(editor: IEditor, event: EditorInputEvent) {\n const rawEvent = event.rawEvent;\n const selection = editor.getDOMSelection();\n const key = rawEvent.data;\n if (\n this.customReplacements.length > 0 &&\n rawEvent.inputType === 'insertText' &&\n selection &&\n selection.type === 'range' &&\n selection.range.collapsed &&\n key &&\n this.triggerKeys.indexOf(key) > -1\n ) {\n formatTextSegmentBeforeSelectionMarker(\n editor,\n (_model, previousSegment, paragraph, _markerFormat, context) => {\n const replaced = this.customReplacements.some(\n ({ stringToReplace, replacementString, replacementHandler }) => {\n return replacementHandler(\n previousSegment,\n stringToReplace,\n replacementString,\n paragraph\n );\n }\n );\n if (replaced) {\n context.canUndoByBackspace = true;\n return true;\n }\n return false;\n }\n );\n }\n }\n}\n"]}
|
|
@@ -71,11 +71,18 @@ define(["require", "exports", "./keyboardDelete", "./keyboardInput", "./keyboard
|
|
|
71
71
|
if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {
|
|
72
72
|
switch (rawEvent.key) {
|
|
73
73
|
case 'Backspace':
|
|
74
|
-
case 'Delete':
|
|
75
74
|
// Use our API to handle BACKSPACE/DELETE key.
|
|
76
75
|
// No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache
|
|
77
76
|
(0, keyboardDelete_1.keyboardDelete)(editor, rawEvent);
|
|
78
77
|
break;
|
|
78
|
+
case 'Delete':
|
|
79
|
+
// Use our API to handle BACKSPACE/DELETE key.
|
|
80
|
+
// No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache
|
|
81
|
+
// And leave it to browser when shift key is pressed so that browser will trigger cut event
|
|
82
|
+
if (!event.rawEvent.shiftKey) {
|
|
83
|
+
(0, keyboardDelete_1.keyboardDelete)(editor, rawEvent);
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
79
86
|
case 'Tab':
|
|
80
87
|
(0, keyboardTab_1.keyboardTab)(editor, rawEvent);
|
|
81
88
|
break;
|
|
@@ -92,6 +99,8 @@ define(["require", "exports", "./keyboardDelete", "./keyboardInput", "./keyboard
|
|
|
92
99
|
}
|
|
93
100
|
};
|
|
94
101
|
EditPlugin.prototype.handleBeforeInputEvent = function (editor, rawEvent) {
|
|
102
|
+
var _this = this;
|
|
103
|
+
var _a, _b;
|
|
95
104
|
// Some Android IMEs doesn't fire correct keydown event for BACKSPACE/DELETE key
|
|
96
105
|
// Here we translate input event to BACKSPACE/DELETE keydown event to be compatible with existing logic
|
|
97
106
|
if (!this.shouldHandleNextInputEvent ||
|
|
@@ -119,6 +128,15 @@ define(["require", "exports", "./keyboardDelete", "./keyboardInput", "./keyboard
|
|
|
119
128
|
}
|
|
120
129
|
if (handled) {
|
|
121
130
|
rawEvent.preventDefault();
|
|
131
|
+
// Restore the selection to avoid the cursor jump issue
|
|
132
|
+
// See: https://issues.chromium.org/issues/330596261
|
|
133
|
+
var selection_1 = editor.getDOMSelection();
|
|
134
|
+
var doc = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getDocument();
|
|
135
|
+
(_b = doc === null || doc === void 0 ? void 0 : doc.defaultView) === null || _b === void 0 ? void 0 : _b.requestAnimationFrame(function () {
|
|
136
|
+
if (_this.editor) {
|
|
137
|
+
_this.editor.setDOMSelection(selection_1);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
122
140
|
}
|
|
123
141
|
};
|
|
124
142
|
return EditPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/EditPlugin.ts"],"names":[],"mappings":";;;;IAUA,IAAM,aAAa,GAAG,CAAC,CAAC;IACxB,IAAM,UAAU,GAAG,EAAE,CAAC;IAEtB;;;;;;OAMG;IACH;QAAA;YACY,WAAM,GAAmB,IAAI,CAAC;YAC9B,aAAQ,GAAwB,IAAI,CAAC;YACrC,+BAA0B,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"EditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/EditPlugin.ts"],"names":[],"mappings":";;;;IAUA,IAAM,aAAa,GAAG,CAAC,CAAC;IACxB,IAAM,UAAU,GAAG,EAAE,CAAC;IAEtB;;;;;;OAMG;IACH;QAAA;YACY,WAAM,GAAmB,IAAI,CAAC;YAC9B,aAAQ,GAAwB,IAAI,CAAC;YACrC,+BAA0B,GAAG,KAAK,CAAC;QA4I/C,CAAC;QA1IG;;WAEG;QACH,4BAAO,GAAP;YACI,OAAO,MAAM,CAAC;QAClB,CAAC;QAED;;;;;WAKG;QACH,+BAAU,GAAV,UAAW,MAAe;YAA1B,iBASC;YARG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC,SAAS,EAAE;gBACnC,IAAI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,CAAC,eAAe,EAAE,CAAC;gBAC3C,IAAM,GAAG,GAAG,MAAA,IAAI,CAAC,MAAM,0CAAE,WAAW,EAAE,CAAC;gBACvC,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,0CAAE,qBAAqB,CAAC;oBACpC,IAAI,KAAI,CAAC,MAAM,EAAE;wBACb,KAAI,CAAC,MAAM,CAAC,eAAe,CAAC,WAAS,CAAC,CAAC;qBAC1C;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC;QACL,iBAAC;IAAD,CAAC,AA/ID,IA+IC;IA/IY,gCAAU","sourcesContent":["import { keyboardDelete } from './keyboardDelete';\nimport { keyboardInput } from './keyboardInput';\nimport { keyboardTab } from './keyboardTab';\nimport type {\n EditorPlugin,\n IEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst BACKSPACE_KEY = 8;\nconst DELETE_KEY = 46;\n\n/**\n * Edit plugins helps editor to do editing operation on top of content model.\n * This includes:\n * 1. Delete Key\n * 2. Backspace Key\n * 3. Tab Key\n */\nexport class EditPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n private disposer: (() => void) | null = null;\n private shouldHandleNextInputEvent = false;\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'Edit';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n if (editor.getEnvironment().isAndroid) {\n this.disposer = this.editor.attachDomEvent({\n beforeinput: {\n beforeDispatch: e => this.handleBeforeInputEvent(editor, e),\n },\n });\n }\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n this.disposer?.();\n this.disposer = null;\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor) {\n switch (event.eventType) {\n case 'keyDown':\n this.handleKeyDownEvent(this.editor, event);\n break;\n }\n }\n }\n\n private handleKeyDownEvent(editor: IEditor, event: KeyDownEvent) {\n const rawEvent = event.rawEvent;\n\n if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {\n switch (rawEvent.key) {\n case 'Backspace':\n // Use our API to handle BACKSPACE/DELETE key.\n // No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache\n keyboardDelete(editor, rawEvent);\n break;\n\n case 'Delete':\n // Use our API to handle BACKSPACE/DELETE key.\n // No need to clear cache here since if we rely on browser's behavior, there will be Input event and its handler will reconcile cache\n // And leave it to browser when shift key is pressed so that browser will trigger cut event\n if (!event.rawEvent.shiftKey) {\n keyboardDelete(editor, rawEvent);\n }\n break;\n\n case 'Tab':\n keyboardTab(editor, rawEvent);\n break;\n case 'Unidentified':\n if (editor.getEnvironment().isAndroid) {\n this.shouldHandleNextInputEvent = true;\n }\n break;\n\n case 'Enter':\n default:\n keyboardInput(editor, rawEvent);\n break;\n }\n }\n }\n\n private handleBeforeInputEvent(editor: IEditor, rawEvent: Event) {\n // Some Android IMEs doesn't fire correct keydown event for BACKSPACE/DELETE key\n // Here we translate input event to BACKSPACE/DELETE keydown event to be compatible with existing logic\n if (\n !this.shouldHandleNextInputEvent ||\n !(rawEvent instanceof InputEvent) ||\n rawEvent.defaultPrevented\n ) {\n return;\n }\n this.shouldHandleNextInputEvent = false;\n\n let handled = false;\n switch (rawEvent.inputType) {\n case 'deleteContentBackward':\n handled = keyboardDelete(\n editor,\n new KeyboardEvent('keydown', {\n key: 'Backspace',\n keyCode: BACKSPACE_KEY,\n which: BACKSPACE_KEY,\n })\n );\n break;\n case 'deleteContentForward':\n handled = keyboardDelete(\n editor,\n new KeyboardEvent('keydown', {\n key: 'Delete',\n keyCode: DELETE_KEY,\n which: DELETE_KEY,\n })\n );\n break;\n }\n\n if (handled) {\n rawEvent.preventDefault();\n\n // Restore the selection to avoid the cursor jump issue\n // See: https://issues.chromium.org/issues/330596261\n const selection = editor.getDOMSelection();\n const doc = this.editor?.getDocument();\n doc?.defaultView?.requestAnimationFrame(() => {\n if (this.editor) {\n this.editor.setDOMSelection(selection);\n }\n });\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_dom_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "roosterjs-content-model-api", "roosterjs-content-model-dom"], function (require, exports, tslib_1, roosterjs_content_model_api_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.handleEnterOnList = void 0;
|
|
@@ -47,7 +47,12 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function
|
|
|
47
47
|
listItem_1.levels.pop();
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
createNewListItem(context, listItem_1, listParent);
|
|
50
|
+
var newListItem = createNewListItem(context, listItem_1, listParent);
|
|
51
|
+
if (context.formatContext) {
|
|
52
|
+
context.formatContext.announceData = (0, roosterjs_content_model_api_1.getListAnnounceData)((0, tslib_1.__spreadArray)([
|
|
53
|
+
newListItem
|
|
54
|
+
], (0, tslib_1.__read)(path.slice(index + 1)), false));
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
58
|
rawEvent === null || rawEvent === void 0 ? void 0 : rawEvent.preventDefault();
|
|
@@ -73,6 +78,7 @@ define(["require", "exports", "tslib", "roosterjs-content-model-dom"], function
|
|
|
73
78
|
insertPoint.paragraph = newParagraph;
|
|
74
79
|
context.lastParagraph = newParagraph;
|
|
75
80
|
listParent.blocks.splice(listIndex + 1, 0, newListItem);
|
|
81
|
+
return newListItem;
|
|
76
82
|
};
|
|
77
83
|
var createNewListLevel = function (listItem) {
|
|
78
84
|
return listItem.levels.map(function (level) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleEnterOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/inputSteps/handleEnterOnList.ts"],"names":[],"mappings":";;;;IAoBA;;OAEG;IACI,IAAM,iBAAiB,GAAwB,UAAA,OAAO;QACjD,IAAA,YAAY,GAAK,OAAO,aAAZ,CAAa;QACjC,IACI,YAAY,IAAI,iBAAiB;YACjC,YAAY,IAAI,YAAY;YAC5B,YAAY,IAAI,OAAO,EACzB;YACU,IAAA,WAAW,GAAoB,OAAO,YAA3B,EAAE,aAAa,GAAK,OAAO,cAAZ,CAAa;YACvC,IAAA,IAAI,GAAK,WAAW,KAAhB,CAAiB;YAC7B,IAAM,QAAQ,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,CAAC;YACzC,IAAM,KAAK,GAAG,IAAA,+DAAiC,EAAC,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;YAEnF,IAAM,UAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAEnC,IAAI,UAAQ,IAAI,UAAQ,CAAC,cAAc,KAAK,UAAU,IAAI,UAAU,EAAE;gBAClE,IAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAQ,CAAC,CAAC;gBACtD,IAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBACnD,IAAI,YAAY,IAAI,OAAO,IAAI,SAAS,EAAE;oBACtC,IAAA,mDAAqB,EAAC,UAAU,CAAC,CAAC;oBAClC,IAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,S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SACpD;QAED,IAAA,gDAAkB,EAAC,YAAY,CAAC,CAAC;QAEjC,OAAO,YAAY,CAAC;IACxB,CAAC,CAAC","sourcesContent":["import {\n createBr,\n createListItem,\n createListLevel,\n createParagraph,\n createSelectionMarker,\n normalizeContentModel,\n normalizeParagraph,\n setParagraphNotImplicit,\n getClosestAncestorBlockGroupIndex,\n isBlockGroupOfType,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockGroup,\n ContentModelListItem,\n DeleteSelectionStep,\n InsertPoint,\n ValidDeleteSelectionContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const handleEnterOnList: DeleteSelectionStep = context => {\n const { deleteResult } = context;\n if (\n deleteResult == 'nothingToDelete' ||\n deleteResult == 'notDeleted' ||\n deleteResult == 'range'\n ) {\n const { insertPoint, formatContext } = context;\n const { path } = insertPoint;\n const rawEvent = formatContext?.rawEvent;\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n\n const listItem = path[index];\n const listParent = path[index + 1];\n\n if (listItem && listItem.blockGroupType === 'ListItem' && listParent) {\n const listIndex = listParent.blocks.indexOf(listItem);\n const nextBlock = listParent.blocks[listIndex + 1];\n if (deleteResult == 'range' && nextBlock) {\n normalizeContentModel(listParent);\n const nextListItem = listParent.blocks[listIndex + 1];\n if (\n isBlockGroupOfType<ContentModelListItem>(nextListItem, 'ListItem') &&\n nextListItem.levels[0]\n ) {\n nextListItem.levels.forEach((level, index) => {\n level.format.startNumberOverride = undefined;\n level.dataset = listItem.levels[index]\n ? listItem.levels[index].dataset\n : {};\n });\n const lastParagraph = listItem.blocks[listItem.blocks.length - 1];\n const nextParagraph = nextListItem.blocks[0];\n if (\n nextParagraph.blockType === 'Paragraph' &&\n lastParagraph.blockType === 'Paragraph' &&\n lastParagraph.segments[lastParagraph.segments.length - 1].segmentType ===\n 'SelectionMarker'\n ) {\n lastParagraph.segments.pop();\n\n nextParagraph.segments.unshift(\n createSelectionMarker(insertPoint.marker.format)\n );\n }\n context.lastParagraph = undefined;\n }\n } else if (deleteResult !== 'range') {\n if (isEmptyListItem(listItem)) {\n listItem.levels.pop();\n } else {\n createNewListItem(context, listItem, listParent);\n }\n }\n rawEvent?.preventDefault();\n context.deleteResult = 'range';\n }\n }\n};\n\nconst isEmptyListItem = (listItem: ContentModelListItem) => {\n return (\n listItem.blocks.length === 1 &&\n listItem.blocks[0].blockType === 'Paragraph' &&\n listItem.blocks[0].segments.length === 2 &&\n listItem.blocks[0].segments[0].segmentType === 'SelectionMarker' &&\n listItem.blocks[0].segments[1].segmentType === 'Br'\n );\n};\n\nconst createNewListItem = (\n context: ValidDeleteSelectionContext,\n listItem: ContentModelListItem,\n listParent: ContentModelBlockGroup\n) => {\n const { insertPoint } = context;\n const listIndex = listParent.blocks.indexOf(listItem);\n const newParagraph = createNewParagraph(insertPoint);\n\n const levels = createNewListLevel(listItem);\n const newListItem = createListItem(levels, insertPoint.marker.format);\n newListItem.blocks.push(newParagraph);\n insertPoint.paragraph = newParagraph;\n context.lastParagraph = newParagraph;\n listParent.blocks.splice(listIndex + 1, 0, newListItem);\n};\n\nconst createNewListLevel = (listItem: ContentModelListItem) => {\n return listItem.levels.map(level => {\n return createListLevel(\n level.listType,\n {\n ...level.format,\n startNumberOverride: undefined,\n displayForDummyItem: undefined, // When ENTER, we should create a new regular list item, so force its dummy item display to undefined\n },\n level.dataset\n );\n });\n};\n\nconst createNewParagraph = (insertPoint: InsertPoint) => {\n const { paragraph, marker } = insertPoint;\n const newParagraph = createParagraph(\n false /*isImplicit*/,\n paragraph.format,\n paragraph.segmentFormat\n );\n\n const markerIndex = paragraph.segments.indexOf(marker);\n const segments = paragraph.segments.splice(\n markerIndex,\n paragraph.segments.length - markerIndex\n );\n\n newParagraph.segments.push(...segments);\n\n setParagraphNotImplicit(paragraph);\n\n if (paragraph.segments.every(x => x.segmentType == 'SelectionMarker')) {\n paragraph.segments.push(createBr(marker.format));\n }\n\n normalizeParagraph(newParagraph);\n\n return newParagraph;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"handleEnterOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/inputSteps/handleEnterOnList.ts"],"names":[],"mappings":";;;;IAqBA;;OAEG;IACI,IAAM,iBAAiB,GAAwB,UAAA,OAAO;QACjD,IAAA,YAAY,GAAK,OAAO,aAAZ,CAAa;QACjC,IACI,YAAY,IAAI,iBAAiB;YACjC,YAAY,IAAI,YAAY;YAC5B,YAAY,IAAI,OAAO,EACzB;YACU,IAAA,WAAW,GAAoB,OAAO,YAA3B,EAAE,aAAa,GAAK,OAAO,cAAZ,CAAa;YACvC,IAAA,IAAI,GAAK,WAAW,KAAhB,CAAiB;YAC7B,IAAM,QAAQ,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,CAAC;YACzC,IAAM,KAAK,GAAG,IAAA,+DAAiC,EAAC,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;YAEnF,IAAM,UAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAEnC,IAAI,UAAQ,IAAI,UAAQ,CAAC,cAAc,KAAK,UAAU,IAAI,UAAU,EAAE;gBAClE,IAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAQ,CAAC,CAAC;gBACtD,IAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAEnD,IAAI,YAAY,IAAI,OAAO,IAAI,SAAS,EAAE;oBACtC,IAAA,mDAAqB,EAAC,UAAU,CAAC,CAAC;oBAElC,IAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;oBAEtD,IACI,IAAA,gDAAkB,EAAuB,YAAY,EAAE,UAAU,CAAC;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I,iBAAiB,EAAlC,CAAkC,CAAC,EAAE;YACnE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,sCAAQ,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;SACpD;QAED,IAAA,gDAAkB,EAAC,YAAY,CAAC,CAAC;QAEjC,OAAO,YAAY,CAAC;IACxB,CAAC,CAAC","sourcesContent":["import { getListAnnounceData } from 'roosterjs-content-model-api';\nimport {\n createBr,\n createListItem,\n createListLevel,\n createParagraph,\n createSelectionMarker,\n normalizeContentModel,\n normalizeParagraph,\n setParagraphNotImplicit,\n getClosestAncestorBlockGroupIndex,\n isBlockGroupOfType,\n} from 'roosterjs-content-model-dom';\nimport type {\n ContentModelBlockGroup,\n ContentModelListItem,\n DeleteSelectionStep,\n InsertPoint,\n ValidDeleteSelectionContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const handleEnterOnList: DeleteSelectionStep = context => {\n const { deleteResult } = context;\n if (\n deleteResult == 'nothingToDelete' ||\n deleteResult == 'notDeleted' ||\n deleteResult == 'range'\n ) {\n const { insertPoint, formatContext } = context;\n const { path } = insertPoint;\n const rawEvent = formatContext?.rawEvent;\n const index = getClosestAncestorBlockGroupIndex(path, ['ListItem'], ['TableCell']);\n\n const listItem = path[index];\n const listParent = path[index + 1];\n\n if (listItem && listItem.blockGroupType === 'ListItem' && listParent) {\n const listIndex = listParent.blocks.indexOf(listItem);\n const nextBlock = listParent.blocks[listIndex + 1];\n\n if (deleteResult == 'range' && nextBlock) {\n normalizeContentModel(listParent);\n\n const nextListItem = listParent.blocks[listIndex + 1];\n\n if (\n isBlockGroupOfType<ContentModelListItem>(nextListItem, 'ListItem') &&\n nextListItem.levels[0]\n ) {\n nextListItem.levels.forEach((level, index) => {\n level.format.startNumberOverride = undefined;\n level.dataset = listItem.levels[index]\n ? listItem.levels[index].dataset\n : {};\n });\n\n const lastParagraph = listItem.blocks[listItem.blocks.length - 1];\n const nextParagraph = nextListItem.blocks[0];\n\n if (\n nextParagraph.blockType === 'Paragraph' &&\n lastParagraph.blockType === 'Paragraph' &&\n lastParagraph.segments[lastParagraph.segments.length - 1].segmentType ===\n 'SelectionMarker'\n ) {\n lastParagraph.segments.pop();\n\n nextParagraph.segments.unshift(\n createSelectionMarker(insertPoint.marker.format)\n );\n }\n\n context.lastParagraph = undefined;\n }\n } else if (deleteResult !== 'range') {\n if (isEmptyListItem(listItem)) {\n listItem.levels.pop();\n } else {\n const newListItem = createNewListItem(context, listItem, listParent);\n\n if (context.formatContext) {\n context.formatContext.announceData = getListAnnounceData([\n newListItem,\n ...path.slice(index + 1),\n ]);\n }\n }\n }\n\n rawEvent?.preventDefault();\n context.deleteResult = 'range';\n }\n }\n};\n\nconst isEmptyListItem = (listItem: ContentModelListItem) => {\n return (\n listItem.blocks.length === 1 &&\n listItem.blocks[0].blockType === 'Paragraph' &&\n listItem.blocks[0].segments.length === 2 &&\n listItem.blocks[0].segments[0].segmentType === 'SelectionMarker' &&\n listItem.blocks[0].segments[1].segmentType === 'Br'\n );\n};\n\nconst createNewListItem = (\n context: ValidDeleteSelectionContext,\n listItem: ContentModelListItem,\n listParent: ContentModelBlockGroup\n) => {\n const { insertPoint } = context;\n const listIndex = listParent.blocks.indexOf(listItem);\n const newParagraph = createNewParagraph(insertPoint);\n\n const levels = createNewListLevel(listItem);\n const newListItem = createListItem(levels, insertPoint.marker.format);\n newListItem.blocks.push(newParagraph);\n insertPoint.paragraph = newParagraph;\n context.lastParagraph = newParagraph;\n listParent.blocks.splice(listIndex + 1, 0, newListItem);\n\n return newListItem;\n};\n\nconst createNewListLevel = (listItem: ContentModelListItem) => {\n return listItem.levels.map(level => {\n return createListLevel(\n level.listType,\n {\n ...level.format,\n startNumberOverride: undefined,\n displayForDummyItem: undefined, // When ENTER, we should create a new regular list item, so force its dummy item display to undefined\n },\n level.dataset\n );\n });\n};\n\nconst createNewParagraph = (insertPoint: InsertPoint) => {\n const { paragraph, marker } = insertPoint;\n const newParagraph = createParagraph(\n false /*isImplicit*/,\n paragraph.format,\n paragraph.segmentFormat\n );\n\n const markerIndex = paragraph.segments.indexOf(marker);\n const segments = paragraph.segments.splice(\n markerIndex,\n paragraph.segments.length - markerIndex\n );\n\n newParagraph.segments.push(...segments);\n\n setParagraphNotImplicit(paragraph);\n\n if (paragraph.segments.every(x => x.segmentType == 'SelectionMarker')) {\n paragraph.segments.push(createBr(marker.format));\n }\n\n normalizeParagraph(newParagraph);\n\n return newParagraph;\n};\n"]}
|
|
@@ -9,8 +9,8 @@ define(["require", "exports", "roosterjs-content-model-dom", "./tabUtils/handleT
|
|
|
9
9
|
var selection = editor.getDOMSelection();
|
|
10
10
|
switch (selection === null || selection === void 0 ? void 0 : selection.type) {
|
|
11
11
|
case 'range':
|
|
12
|
-
editor.formatContentModel(function (model) {
|
|
13
|
-
return handleTab(model, rawEvent);
|
|
12
|
+
editor.formatContentModel(function (model, context) {
|
|
13
|
+
return handleTab(model, rawEvent, context);
|
|
14
14
|
}, {
|
|
15
15
|
apiName: 'handleTabKey',
|
|
16
16
|
});
|
|
@@ -32,7 +32,7 @@ define(["require", "exports", "roosterjs-content-model-dom", "./tabUtils/handleT
|
|
|
32
32
|
* - If it is a paragraph, call handleTabOnParagraph to handle the tab key.
|
|
33
33
|
* - If it is a list item, call handleTabOnList to handle the tab key.
|
|
34
34
|
*/
|
|
35
|
-
function handleTab(model, rawEvent) {
|
|
35
|
+
function handleTab(model, rawEvent, context) {
|
|
36
36
|
var blocks = (0, roosterjs_content_model_dom_1.getOperationalBlocks)(model, ['ListItem', 'TableCell'], []);
|
|
37
37
|
var block = blocks.length > 0 ? blocks[0].block : undefined;
|
|
38
38
|
if (blocks.length > 1) {
|
|
@@ -44,10 +44,10 @@ define(["require", "exports", "roosterjs-content-model-dom", "./tabUtils/handleT
|
|
|
44
44
|
return (0, handleTabOnTableCell_1.handleTabOnTableCell)(model, block, rawEvent);
|
|
45
45
|
}
|
|
46
46
|
else if ((block === null || block === void 0 ? void 0 : block.blockType) === 'Paragraph') {
|
|
47
|
-
return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, block, rawEvent);
|
|
47
|
+
return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, block, rawEvent, context);
|
|
48
48
|
}
|
|
49
49
|
else if ((0, roosterjs_content_model_dom_1.isBlockGroupOfType)(block, 'ListItem')) {
|
|
50
|
-
return (0, handleTabOnList_1.handleTabOnList)(model, block, rawEvent);
|
|
50
|
+
return (0, handleTabOnList_1.handleTabOnList)(model, block, rawEvent, context);
|
|
51
51
|
}
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardTab.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardTab.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"keyboardTab.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/edit/keyboardTab.ts"],"names":[],"mappings":";;;;IAcA;;OAEG;IACH,SAAgB,WAAW,CAAC,MAAe,EAAE,QAAuB;QAChE,IAAM,SAAS,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;QAE3C,QAAQ,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,EAAE;YACrB,KAAK,OAAO;gBACR,MAAM,CAAC,kBAAkB,CACrB,UAAC,KAAK,EAAE,OAAO;oBACX,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAC/C,CAAC,EACD;oBACI,OAAO,EAAE,cAAc;iBAC1B,CACJ,CAAC;gBAEF,OAAO,IAAI,CAAC;YAChB,KAAK,OAAO;gBACR,MAAM,CAAC,kBAAkB,CACrB,UAAA,KAAK;oBACD,OAAO,IAAA,mCAAgB,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBAC7C,CAAC,EACD;oBACI,OAAO,EAAE,cAAc;iBAC1B,CACJ,CAAC;gBACF,OAAO,IAAI,CAAC;SACnB;IACL,CAAC;IA1BD,kCA0BC;IAED;;;;;;OAMG;IACH,SAAS,SAAS,CACd,KAA2B,EAC3B,QAAuB,EACvB,OAAkC;QAElC,IAAM,MAAM,GAAG,IAAA,kDAAoB,EAC/B,KAAK,EACL,CAAC,UAAU,EAAE,WAAW,CAAC,EACzB,EAAE,CACL,CAAC;QACF,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,IAAA,iDAAmB,EAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACrE,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;aAAM,IAAI,IAAA,gDAAkB,EAAwB,KAAK,EAAE,WAAW,CAAC,EAAE;YACtE,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;SACvD;aAAM,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,WAAW,EAAE;YACzC,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAChE;aAAM,IAAI,IAAA,gDAAkB,EAAuB,KAAK,EAAE,UAAU,CAAC,EAAE;YACpE,OAAO,IAAA,iCAAe,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC3D;QACD,OAAO,KAAK,CAAC;IACjB,CAAC","sourcesContent":["import { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-dom';\nimport { handleTabOnList } from './tabUtils/handleTabOnList';\nimport { handleTabOnParagraph } from './tabUtils/handleTabOnParagraph';\nimport { handleTabOnTable } from './tabUtils/handleTabOnTable';\nimport { handleTabOnTableCell } from './tabUtils/handleTabOnTableCell';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n ContentModelTableCell,\n FormatContentModelContext,\n IEditor,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardTab(editor: IEditor, rawEvent: KeyboardEvent) {\n const selection = editor.getDOMSelection();\n\n switch (selection?.type) {\n case 'range':\n editor.formatContentModel(\n (model, context) => {\n return handleTab(model, rawEvent, context);\n },\n {\n apiName: 'handleTabKey',\n }\n );\n\n return true;\n case 'table':\n editor.formatContentModel(\n model => {\n return handleTabOnTable(model, rawEvent);\n },\n {\n apiName: 'handleTabKey',\n }\n );\n return true;\n }\n}\n\n/**\n * If multiple blocks are selected, indent or outdent the selected blocks with setModelIndentation.\n * If only one block is selected:\n * - If it is a table cell, call handleTabOnTableCell to handle the tab key.\n * - If it is a paragraph, call handleTabOnParagraph to handle the tab key.\n * - If it is a list item, call handleTabOnList to handle the tab key.\n */\nfunction handleTab(\n model: ContentModelDocument,\n rawEvent: KeyboardEvent,\n context: FormatContentModelContext\n) {\n const blocks = getOperationalBlocks<ContentModelListItem | ContentModelTableCell>(\n model,\n ['ListItem', 'TableCell'],\n []\n );\n const block = blocks.length > 0 ? blocks[0].block : undefined;\n\n if (blocks.length > 1) {\n setModelIndentation(model, rawEvent.shiftKey ? 'outdent' : 'indent');\n rawEvent.preventDefault();\n return true;\n } else if (isBlockGroupOfType<ContentModelTableCell>(block, 'TableCell')) {\n return handleTabOnTableCell(model, block, rawEvent);\n } else if (block?.blockType === 'Paragraph') {\n return handleTabOnParagraph(model, block, rawEvent, context);\n } else if (isBlockGroupOfType<ContentModelListItem>(block, 'ListItem')) {\n return handleTabOnList(model, block, rawEvent, context);\n }\n return false;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ContentModelDocument, ContentModelListItem } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { ContentModelDocument, ContentModelListItem, FormatContentModelContext } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.
|
|
4
4
|
* 2. Otherwise call handleTabOnParagraph.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare function handleTabOnList(model: ContentModelDocument, listItem: ContentModelListItem, rawEvent: KeyboardEvent): boolean;
|
|
7
|
+
export declare function handleTabOnList(model: ContentModelDocument, listItem: ContentModelListItem, rawEvent: KeyboardEvent, context?: FormatContentModelContext): boolean;
|
|
@@ -7,15 +7,15 @@ define(["require", "exports", "./handleTabOnParagraph", "roosterjs-content-model
|
|
|
7
7
|
* 2. Otherwise call handleTabOnParagraph.
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
function handleTabOnList(model, listItem, rawEvent) {
|
|
10
|
+
function handleTabOnList(model, listItem, rawEvent, context) {
|
|
11
11
|
var selectedParagraph = findSelectedParagraph(listItem);
|
|
12
12
|
if (!isMarkerAtStartOfBlock(listItem) &&
|
|
13
13
|
selectedParagraph.length == 1 &&
|
|
14
14
|
selectedParagraph[0].blockType === 'Paragraph') {
|
|
15
|
-
return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, selectedParagraph[0], rawEvent);
|
|
15
|
+
return (0, handleTabOnParagraph_1.handleTabOnParagraph)(model, selectedParagraph[0], rawEvent, context);
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
(0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent');
|
|
18
|
+
(0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent', undefined /*length*/, context);
|
|
19
19
|
rawEvent.preventDefault();
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleTabOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnList.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"handleTabOnList.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnList.ts"],"names":[],"mappings":";;;;IAQA;;;;OAIG;IACH,SAAgB,eAAe,CAC3B,KAA2B,EAC3B,QAA8B,EAC9B,QAAuB,EACvB,OAAmC;QAEnC,IAAM,iBAAiB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAC1D,IACI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;YACjC,iBAAiB,CAAC,MAAM,IAAI,CAAC;YAC7B,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,WAAW,EAChD;YACE,OAAO,IAAA,2CAAoB,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC/E;aAAM;YACH,IAAA,iDAAmB,EACf,KAAK,EACL,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EACxC,SAAS,CAAC,UAAU,EACpB,OAAO,CACV,CAAC;YACF,QAAQ,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAvBD,0CAuBC;IAED,SAAS,sBAAsB,CAAC,QAA8B;QAC1D,OAAO,CACH,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,WAAW;YAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAClE,CAAC;IACN,CAAC;IAED,SAAS,qBAAqB,CAAC,QAA8B;QACzD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CACzB,UAAA,KAAK;YACD,OAAA,KAAK,CAAC,SAAS,IAAI,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC;QAApF,CAAoF,CAC3F,CAAC;IACN,CAAC","sourcesContent":["import { handleTabOnParagraph } from './handleTabOnParagraph';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n FormatContentModelContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * 1. When the selection is collapsed and the cursor is at start of a list item, call setModelIndentation.\n * 2. Otherwise call handleTabOnParagraph.\n * @internal\n */\nexport function handleTabOnList(\n model: ContentModelDocument,\n listItem: ContentModelListItem,\n rawEvent: KeyboardEvent,\n context?: FormatContentModelContext\n) {\n const selectedParagraph = findSelectedParagraph(listItem);\n if (\n !isMarkerAtStartOfBlock(listItem) &&\n selectedParagraph.length == 1 &&\n selectedParagraph[0].blockType === 'Paragraph'\n ) {\n return handleTabOnParagraph(model, selectedParagraph[0], rawEvent, context);\n } else {\n setModelIndentation(\n model,\n rawEvent.shiftKey ? 'outdent' : 'indent',\n undefined /*length*/,\n context\n );\n rawEvent.preventDefault();\n return true;\n }\n}\n\nfunction isMarkerAtStartOfBlock(listItem: ContentModelListItem) {\n return (\n listItem.blocks[0].blockType == 'Paragraph' &&\n listItem.blocks[0].segments[0].segmentType == 'SelectionMarker'\n );\n}\n\nfunction findSelectedParagraph(listItem: ContentModelListItem) {\n return listItem.blocks.filter(\n block =>\n block.blockType == 'Paragraph' && block.segments.some(segment => segment.isSelected)\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContentModelDocument, ContentModelParagraph } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { ContentModelDocument, ContentModelParagraph, FormatContentModelContext } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
The handleTabOnParagraph function will handle the tab key in following scenarios:
|
|
@@ -14,4 +14,4 @@ import type { ContentModelDocument, ContentModelParagraph } from 'roosterjs-cont
|
|
|
14
14
|
* 4. When the selection is not collapsed, replace the selected range with a 4 space.
|
|
15
15
|
* 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph
|
|
16
16
|
*/
|
|
17
|
-
export declare function handleTabOnParagraph(model: ContentModelDocument, paragraph: ContentModelParagraph, rawEvent: KeyboardEvent): boolean;
|
|
17
|
+
export declare function handleTabOnParagraph(model: ContentModelDocument, paragraph: ContentModelParagraph, rawEvent: KeyboardEvent, context?: FormatContentModelContext): boolean;
|
|
@@ -19,7 +19,7 @@ define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-
|
|
|
19
19
|
* 4. When the selection is not collapsed, replace the selected range with a 4 space.
|
|
20
20
|
* 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph
|
|
21
21
|
*/
|
|
22
|
-
function handleTabOnParagraph(model, paragraph, rawEvent) {
|
|
22
|
+
function handleTabOnParagraph(model, paragraph, rawEvent, context) {
|
|
23
23
|
var selectedSegments = paragraph.segments.filter(function (segment) { return segment.isSelected; });
|
|
24
24
|
var isCollapsed = selectedSegments.length === 1 && selectedSegments[0].segmentType === 'SelectionMarker';
|
|
25
25
|
var isAllSelected = paragraph.segments.every(function (segment) { return segment.isSelected; });
|
|
@@ -31,7 +31,7 @@ define(["require", "exports", "roosterjs-content-model-dom", "roosterjs-content-
|
|
|
31
31
|
(isRtl && (!marginRight || marginRight == '0px')))) {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
|
-
(0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent');
|
|
34
|
+
(0, roosterjs_content_model_api_1.setModelIndentation)(model, rawEvent.shiftKey ? 'outdent' : 'indent', undefined /*length*/, context);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
if (!isCollapsed) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleTabOnParagraph.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnParagraph.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"handleTabOnParagraph.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/edit/tabUtils/handleTabOnParagraph.ts"],"names":[],"mappings":";;;;IAQA,IAAM,SAAS,GAAG,MAAM,CAAC;IACzB,IAAM,KAAK,GAAG,GAAG,CAAC;IAElB;;;;;;;;;;;;;;OAcG;IACH,SAAgB,oBAAoB,CAChC,KAA2B,EAC3B,SAAgC,EAChC,QAAuB,EACvB,OAAmC;QAEnC,IAAM,gBAAgB,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC,CAAC;QAClF,IAAM,WAAW,GACb,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,iBAAiB,CAAC;QAC3F,IAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC,CAAC;QAC9E,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,iBAAiB,IAAI,WAAW,CAAC,IAAI,aAAa,EAAE;YACrF,IAAA,KAAyC,SAAS,CAAC,MAAM,EAAvD,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,SAAS,eAAqB,CAAC;YAChE,IAAM,KAAK,GAAG,SAAS,KAAK,KAAK,CAAC;YAClC,IACI,QAAQ,CAAC,QAAQ;gBACjB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,IAAI,UAAU,IAAI,KAAK,CAAC,CAAC;oBAC7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AA,OAAO,IAAI,OAAA,OAAO,CAAC,WAAW,KAAK,iBAAiB,EAAzC,CAAyC,CACvD,CAAC;gBACF,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;oBACpB,IAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;oBAC5D,IAAM,OAAO,GAAG,IAAA,wCAAU,EAAC,SAAS,EAAE,YAAY,CAAC,CAAC;oBACpD,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;iBACtD;qBAAM;oBACH,IAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;oBACpD,IAAM,eAAe,GAAG,SAAS,CAAC,MAAM,CAAC;oBACzC,IAAI,OAAO,CAAC,WAAW,IAAI,MAAM,EAAE;wBAC/B,IAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;wBACjE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;4BAC5B,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;yBACjD;6BAAM,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE;4BACjE,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;yBAChE;6BAAM;4BACH,OAAO,KAAK,CAAC;yBAChB;qBACJ;iBACJ;aACJ;SACJ;QACD,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAjFD,oDAiFC","sourcesContent":["import { createSelectionMarker, createText } from 'roosterjs-content-model-dom';\nimport { setModelIndentation } from 'roosterjs-content-model-api';\nimport type {\n ContentModelDocument,\n ContentModelParagraph,\n FormatContentModelContext,\n} from 'roosterjs-content-model-types';\n\nconst tabSpaces = ' ';\nconst space = ' ';\n\n/**\n * @internal\n The handleTabOnParagraph function will handle the tab key in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, add 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to indent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, add 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a single space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to indent the whole paragraph\n The handleTabOnParagraph function will handle the shift + tab key in a indented paragraph in following scenarios:\n * 1. When the selection is collapsed and the cursor is at the end of a paragraph, remove 4 spaces.\n * 2. When the selection is collapsed and the cursor is at the start of a paragraph, call setModelIndention function to outdent the whole paragraph\n * 3. When the selection is collapsed and the cursor is at the middle of a paragraph, remove 4 spaces.\n * 4. When the selection is not collapsed, replace the selected range with a 4 space.\n * 5. When the selection is not collapsed, but all segments are selected, call setModelIndention function to outdent the whole paragraph\n */\nexport function handleTabOnParagraph(\n model: ContentModelDocument,\n paragraph: ContentModelParagraph,\n rawEvent: KeyboardEvent,\n context?: FormatContentModelContext\n) {\n const selectedSegments = paragraph.segments.filter(segment => segment.isSelected);\n const isCollapsed =\n selectedSegments.length === 1 && selectedSegments[0].segmentType === 'SelectionMarker';\n const isAllSelected = paragraph.segments.every(segment => segment.isSelected);\n if ((paragraph.segments[0].segmentType === 'SelectionMarker' && isCollapsed) || isAllSelected) {\n const { marginLeft, marginRight, direction } = paragraph.format;\n const isRtl = direction === 'rtl';\n if (\n rawEvent.shiftKey &&\n ((!isRtl && (!marginLeft || marginLeft == '0px')) ||\n (isRtl && (!marginRight || marginRight == '0px')))\n ) {\n return false;\n }\n setModelIndentation(\n model,\n rawEvent.shiftKey ? 'outdent' : 'indent',\n undefined /*length*/,\n context\n );\n } else {\n if (!isCollapsed) {\n let firstSelectedSegmentIndex: number | undefined = undefined;\n let lastSelectedSegmentIndex: number | undefined = undefined;\n\n paragraph.segments.forEach((segment, index) => {\n if (segment.isSelected) {\n if (!firstSelectedSegmentIndex) {\n firstSelectedSegmentIndex = index;\n }\n lastSelectedSegmentIndex = index;\n }\n });\n if (firstSelectedSegmentIndex && lastSelectedSegmentIndex) {\n const firstSelectedSegment = paragraph.segments[firstSelectedSegmentIndex];\n const spaceText = createText(\n rawEvent.shiftKey ? tabSpaces : space,\n firstSelectedSegment.format\n );\n const marker = createSelectionMarker(firstSelectedSegment.format);\n paragraph.segments.splice(\n firstSelectedSegmentIndex,\n lastSelectedSegmentIndex - firstSelectedSegmentIndex + 1,\n spaceText,\n marker\n );\n } else {\n return false;\n }\n } else {\n const markerIndex = paragraph.segments.findIndex(\n segment => segment.segmentType === 'SelectionMarker'\n );\n if (!rawEvent.shiftKey) {\n const markerFormat = paragraph.segments[markerIndex].format;\n const tabText = createText(tabSpaces, markerFormat);\n paragraph.segments.splice(markerIndex, 0, tabText);\n } else {\n const tabText = paragraph.segments[markerIndex - 1];\n const tabSpacesLength = tabSpaces.length;\n if (tabText.segmentType == 'Text') {\n const tabSpaceTextLength = tabText.text.length - tabSpacesLength;\n if (tabText.text === tabSpaces) {\n paragraph.segments.splice(markerIndex - 1, 1);\n } else if (tabText.text.substring(tabSpaceTextLength) === tabSpaces) {\n tabText.text = tabText.text.substring(0, tabSpaceTextLength);\n } else {\n return false;\n }\n }\n }\n }\n }\n rawEvent.preventDefault();\n return true;\n}\n"]}
|
package/lib-amd/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { TableEditPlugin } from './tableEdit/TableEditPlugin';
|
|
2
|
+
export { OnTableEditorCreatedCallback } from './tableEdit/OnTableEditorCreatedCallback';
|
|
2
3
|
export { PastePlugin } from './paste/PastePlugin';
|
|
3
4
|
export { EditPlugin } from './edit/EditPlugin';
|
|
4
5
|
export { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';
|
|
5
|
-
export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
|
|
6
|
+
export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoAlt, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
|
|
6
7
|
export { ShortcutPlugin } from './shortcut/ShortcutPlugin';
|
|
7
8
|
export { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';
|
|
8
9
|
export { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';
|
|
@@ -11,3 +12,8 @@ export { WatermarkFormat } from './watermark/WatermarkFormat';
|
|
|
11
12
|
export { MarkdownPlugin, MarkdownOptions } from './markdown/MarkdownPlugin';
|
|
12
13
|
export { HyperlinkPlugin } from './hyperlink/HyperlinkPlugin';
|
|
13
14
|
export { HyperlinkToolTip } from './hyperlink/HyperlinkToolTip';
|
|
15
|
+
export { PickerPlugin } from './picker/PickerPlugin';
|
|
16
|
+
export { PickerHelper } from './picker/PickerHelper';
|
|
17
|
+
export { PickerSelectionChangMode, PickerDirection, PickerHandler } from './picker/PickerHandler';
|
|
18
|
+
export { CustomReplacePlugin, CustomReplace } from './customReplace/CustomReplacePlugin';
|
|
19
|
+
export { getDOMInsertPointRect } from './pluginUtils/Rect/getDOMInsertPointRect';
|
package/lib-amd/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugin", "./edit/EditPlugin", "./autoFormat/AutoFormatPlugin", "./shortcut/shortcuts", "./shortcut/ShortcutPlugin", "./contextMenuBase/ContextMenuPluginBase", "./watermark/WatermarkPlugin", "./markdown/MarkdownPlugin", "./hyperlink/HyperlinkPlugin"], function (require, exports, TableEditPlugin_1, PastePlugin_1, EditPlugin_1, AutoFormatPlugin_1, shortcuts_1, ShortcutPlugin_1, ContextMenuPluginBase_1, WatermarkPlugin_1, MarkdownPlugin_1, HyperlinkPlugin_1) {
|
|
1
|
+
define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugin", "./edit/EditPlugin", "./autoFormat/AutoFormatPlugin", "./shortcut/shortcuts", "./shortcut/ShortcutPlugin", "./contextMenuBase/ContextMenuPluginBase", "./watermark/WatermarkPlugin", "./markdown/MarkdownPlugin", "./hyperlink/HyperlinkPlugin", "./picker/PickerPlugin", "./customReplace/CustomReplacePlugin", "./pluginUtils/Rect/getDOMInsertPointRect"], function (require, exports, TableEditPlugin_1, PastePlugin_1, EditPlugin_1, AutoFormatPlugin_1, shortcuts_1, ShortcutPlugin_1, ContextMenuPluginBase_1, WatermarkPlugin_1, MarkdownPlugin_1, HyperlinkPlugin_1, PickerPlugin_1, CustomReplacePlugin_1, getDOMInsertPointRect_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.HyperlinkPlugin = exports.MarkdownPlugin = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.PastePlugin = exports.TableEditPlugin = void 0;
|
|
4
|
+
exports.getDOMInsertPointRect = exports.CustomReplacePlugin = exports.PickerPlugin = exports.HyperlinkPlugin = exports.MarkdownPlugin = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedoAlt = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.PastePlugin = exports.TableEditPlugin = void 0;
|
|
5
5
|
Object.defineProperty(exports, "TableEditPlugin", { enumerable: true, get: function () { return TableEditPlugin_1.TableEditPlugin; } });
|
|
6
6
|
Object.defineProperty(exports, "PastePlugin", { enumerable: true, get: function () { return PastePlugin_1.PastePlugin; } });
|
|
7
7
|
Object.defineProperty(exports, "EditPlugin", { enumerable: true, get: function () { return EditPlugin_1.EditPlugin; } });
|
|
@@ -13,6 +13,7 @@ define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugi
|
|
|
13
13
|
Object.defineProperty(exports, "ShortcutUndo", { enumerable: true, get: function () { return shortcuts_1.ShortcutUndo; } });
|
|
14
14
|
Object.defineProperty(exports, "ShortcutUndo2", { enumerable: true, get: function () { return shortcuts_1.ShortcutUndo2; } });
|
|
15
15
|
Object.defineProperty(exports, "ShortcutRedo", { enumerable: true, get: function () { return shortcuts_1.ShortcutRedo; } });
|
|
16
|
+
Object.defineProperty(exports, "ShortcutRedoAlt", { enumerable: true, get: function () { return shortcuts_1.ShortcutRedoAlt; } });
|
|
16
17
|
Object.defineProperty(exports, "ShortcutRedoMacOS", { enumerable: true, get: function () { return shortcuts_1.ShortcutRedoMacOS; } });
|
|
17
18
|
Object.defineProperty(exports, "ShortcutBullet", { enumerable: true, get: function () { return shortcuts_1.ShortcutBullet; } });
|
|
18
19
|
Object.defineProperty(exports, "ShortcutNumbering", { enumerable: true, get: function () { return shortcuts_1.ShortcutNumbering; } });
|
|
@@ -25,5 +26,8 @@ define(["require", "exports", "./tableEdit/TableEditPlugin", "./paste/PastePlugi
|
|
|
25
26
|
Object.defineProperty(exports, "WatermarkPlugin", { enumerable: true, get: function () { return WatermarkPlugin_1.WatermarkPlugin; } });
|
|
26
27
|
Object.defineProperty(exports, "MarkdownPlugin", { enumerable: true, get: function () { return MarkdownPlugin_1.MarkdownPlugin; } });
|
|
27
28
|
Object.defineProperty(exports, "HyperlinkPlugin", { enumerable: true, get: function () { return HyperlinkPlugin_1.HyperlinkPlugin; } });
|
|
29
|
+
Object.defineProperty(exports, "PickerPlugin", { enumerable: true, get: function () { return PickerPlugin_1.PickerPlugin; } });
|
|
30
|
+
Object.defineProperty(exports, "CustomReplacePlugin", { enumerable: true, get: function () { return CustomReplacePlugin_1.CustomReplacePlugin; } });
|
|
31
|
+
Object.defineProperty(exports, "getDOMInsertPointRect", { enumerable: true, get: function () { return getDOMInsertPointRect_1.getDOMInsertPointRect; } });
|
|
28
32
|
});
|
|
29
33
|
//# sourceMappingURL=index.js.map
|
package/lib-amd/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":";;;;IAAS,kHAAA,eAAe,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":";;;;IAAS,kHAAA,eAAe,OAAA;IAEf,0GAAA,WAAW,OAAA;IACX,wGAAA,UAAU,OAAA;IACV,oHAAA,gBAAgB,OAAA;IAGrB,yGAAA,YAAY,OAAA;IACZ,2GAAA,cAAc,OAAA;IACd,8GAAA,iBAAiB,OAAA;IACjB,gHAAA,mBAAmB,OAAA;IACnB,yGAAA,YAAY,OAAA;IACZ,0GAAA,aAAa,OAAA;IACb,yGAAA,YAAY,OAAA;IACZ,4GAAA,eAAe,OAAA;IACf,8GAAA,iBAAiB,OAAA;IACjB,2GAAA,cAAc,OAAA;IACd,8GAAA,iBAAiB,OAAA;IACjB,iHAAA,oBAAoB,OAAA;IACpB,iHAAA,oBAAoB,OAAA;IACpB,+GAAA,kBAAkB,OAAA;IAClB,gHAAA,mBAAmB,OAAA;IAEd,gHAAA,cAAc,OAAA;IAEd,8HAAA,qBAAqB,OAAA;IACrB,kHAAA,eAAe,OAAA;IAEf,gHAAA,cAAc,OAAA;IACd,kHAAA,eAAe,OAAA;IAEf,4GAAA,YAAY,OAAA;IAGZ,0HAAA,mBAAmB,OAAA;IAEnB,8HAAA,qBAAqB,OAAA","sourcesContent":["export { TableEditPlugin } from './tableEdit/TableEditPlugin';\nexport { OnTableEditorCreatedCallback } from './tableEdit/OnTableEditorCreatedCallback';\nexport { PastePlugin } from './paste/PastePlugin';\nexport { EditPlugin } from './edit/EditPlugin';\nexport { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';\n\nexport {\n ShortcutBold,\n ShortcutItalic,\n ShortcutUnderline,\n ShortcutClearFormat,\n ShortcutUndo,\n ShortcutUndo2,\n ShortcutRedo,\n ShortcutRedoAlt,\n ShortcutRedoMacOS,\n ShortcutBullet,\n ShortcutNumbering,\n ShortcutIncreaseFont,\n ShortcutDecreaseFont,\n ShortcutIndentList,\n ShortcutOutdentList,\n} from './shortcut/shortcuts';\nexport { ShortcutPlugin } from './shortcut/ShortcutPlugin';\nexport { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';\nexport { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';\nexport { WatermarkPlugin } from './watermark/WatermarkPlugin';\nexport { WatermarkFormat } from './watermark/WatermarkFormat';\nexport { MarkdownPlugin, MarkdownOptions } from './markdown/MarkdownPlugin';\nexport { HyperlinkPlugin } from './hyperlink/HyperlinkPlugin';\nexport { HyperlinkToolTip } from './hyperlink/HyperlinkToolTip';\nexport { PickerPlugin } from './picker/PickerPlugin';\nexport { PickerHelper } from './picker/PickerHelper';\nexport { PickerSelectionChangMode, PickerDirection, PickerHandler } from './picker/PickerHandler';\nexport { CustomReplacePlugin, CustomReplace } from './customReplace/CustomReplacePlugin';\n\nexport { getDOMInsertPointRect } from './pluginUtils/Rect/getDOMInsertPointRect';\n"]}
|