@globalpayments/vega 2.37.0 → 2.37.1
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/cjs/{app-globals-7980768c.js → app-globals-e10d1859.js} +3 -3
- package/dist/cjs/{content-state-9a9a4bd8.js → content-state-f97d3278.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-0303f4a7.js → form-field-controller-slimmer-48c0ad0b.js} +1 -1
- package/dist/cjs/{image-annotation-action-8e622f61.js → image-annotation-action-7d82f7e1.js} +2 -2
- package/dist/cjs/{index-7c81de06.js → index-0546e2ea.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/loader.cjs.js +5 -5
- package/dist/cjs/{node-annotation.abstract-2c8373c1.js → node-annotation.abstract-4f6df9cf.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-396b1cee.js → string-input-formatter-slimmer-072b75a0.js} +2 -2
- package/dist/cjs/{sub-state-notify-slimmer-ae490543.js → sub-state-notify-slimmer-b1f1e61a.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-080731bc.js → sub-state-observer-slimmer-02634647.js} +1 -1
- package/dist/cjs/vega-app-footer.cjs.entry.js +3 -0
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-link.cjs.entry.js +1 -0
- package/dist/cjs/vega-calendar_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +11 -4
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +2 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +3 -3
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +2 -2
- package/dist/cjs/vega-form.cjs.entry.js +2 -2
- package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -2
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +5 -2
- package/dist/cjs/vega-input-range.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-select.cjs.entry.js +2 -2
- package/dist/cjs/vega-input.cjs.entry.js +5 -5
- package/dist/cjs/{vega-internal-event-id-b12071ea.js → vega-internal-event-id-bda63e14.js} +2 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +2 -0
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +6 -4
- package/dist/cjs/vega-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-radio_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +680 -412
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -2
- package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
- package/dist/cjs/vega-table_8.cjs.entry.js +10 -7
- package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega.cjs.js +5 -5
- package/dist/collection/components/vega-app-footer/vega-app-footer.js +12 -0
- package/dist/collection/components/vega-button-link/vega-button-link.js +4 -0
- package/dist/collection/components/vega-checkbox/vega-checkbox.js +9 -1
- package/dist/collection/components/vega-image-uploader/vega-image-uploader.js +4 -0
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +12 -0
- package/dist/collection/components/vega-input-select/vega-input-select.js +1 -1
- package/dist/collection/components/vega-item-toggle/vega-item-toggle.js +8 -0
- package/dist/collection/components/vega-nav/vega-left-nav-link/vega-left-nav-link.js +7 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +190 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +18 -123
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +9 -11
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +8 -18
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +5 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-composition-text-controller.js +244 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +16 -70
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +22 -14
- package/dist/collection/components/vega-signature-capture/vega-signature-capture.js +4 -0
- package/dist/collection/components/vega-table/slimmers/controllers/vega-table-editable-controller.js +2 -3
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-renderer.js +5 -1
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/esm/{app-globals-6912a75d.js → app-globals-c1f2bea9.js} +3 -3
- package/dist/esm/{content-state-c2d29b35.js → content-state-ccf5f960.js} +3 -3
- package/dist/esm/{form-field-controller-slimmer-7136b7fa.js → form-field-controller-slimmer-3535e76a.js} +1 -1
- package/dist/esm/{image-annotation-action-84422458.js → image-annotation-action-3da42221.js} +2 -2
- package/dist/esm/{index-b2045ad0.js → index-6e05b241.js} +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{node-annotation.abstract-a58b5a49.js → node-annotation.abstract-b2e36bc4.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-0ecbf367.js → string-input-formatter-slimmer-930f1125.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-4a201088.js → sub-state-notify-slimmer-51151fc3.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-0d6da563.js → sub-state-observer-slimmer-d77a1c46.js} +1 -1
- package/dist/esm/vega-app-footer.entry.js +3 -0
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button-link.entry.js +1 -0
- package/dist/esm/vega-calendar_3.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +11 -4
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +2 -2
- package/dist/esm/vega-date-picker_2.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +3 -3
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +2 -2
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-image-uploader.entry.js +3 -2
- package/dist/esm/vega-input-credit-card.entry.js +2 -2
- package/dist/esm/vega-input-numeric.entry.js +3 -3
- package/dist/esm/vega-input-phone-number.entry.js +5 -2
- package/dist/esm/vega-input-range.entry.js +2 -2
- package/dist/esm/vega-input-select.entry.js +2 -2
- package/dist/esm/vega-input.entry.js +5 -5
- package/dist/esm/{vega-internal-event-id-458939b6.js → vega-internal-event-id-d0690d0d.js} +2 -1
- package/dist/esm/vega-item-toggle.entry.js +2 -0
- package/dist/esm/vega-left-nav_5.entry.js +6 -4
- package/dist/esm/vega-popover_2.entry.js +1 -1
- package/dist/esm/vega-radio_2.entry.js +2 -2
- package/dist/esm/vega-rich-text-content.entry.js +6 -6
- package/dist/esm/vega-rich-text-editor_4.entry.js +680 -412
- package/dist/esm/vega-selection-chip_2.entry.js +4 -4
- package/dist/esm/vega-selection-tile_2.entry.js +4 -4
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +3 -2
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-table_8.entry.js +10 -7
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +2 -2
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega.js +5 -5
- package/dist/types/components/vega-app-footer/vega-app-footer.d.ts +3 -0
- package/dist/types/components/vega-button-link/vega-button-link.d.ts +1 -0
- package/dist/types/components/vega-checkbox/vega-checkbox.d.ts +2 -0
- package/dist/types/components/vega-image-uploader/vega-image-uploader.d.ts +1 -0
- package/dist/types/components/vega-input-phone-number/vega-input-phone-number.d.ts +3 -0
- package/dist/types/components/vega-input-select/types.d.ts +1 -0
- package/dist/types/components/vega-item-toggle/vega-item-toggle.d.ts +2 -0
- package/dist/types/components/vega-nav/vega-left-nav-link/vega-left-nav-link.d.ts +3 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.d.ts +57 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +11 -28
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +4 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.d.ts +1 -8
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/insert-composition-text-controller.d.ts +99 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +2 -21
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +7 -2
- package/dist/types/components/vega-signature-capture/vega-signature-capture.d.ts +1 -0
- package/dist/types/components/vega-table/slimmers/renderers/vega-table-renderer.d.ts +1 -0
- package/dist/types/components.d.ts +31 -5
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/types/components.type.d.ts +1 -5
- package/dist/types/types/public-api.d.ts +2 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-2d36dbfe.js → p-0461e318.js} +1 -1
- package/dist/vega/{p-1f67c930.entry.js → p-12fe63c1.entry.js} +1 -1
- package/dist/vega/{p-29dd376c.entry.js → p-1b67c443.entry.js} +1 -1
- package/dist/vega/{p-fbb91e25.entry.js → p-23fd9401.entry.js} +1 -1
- package/dist/vega/{p-5d7d0085.entry.js → p-267cde46.entry.js} +1 -1
- package/dist/vega/{p-ca239f51.js → p-29d6ec6c.js} +1 -1
- package/dist/vega/{p-d57920df.entry.js → p-2fecbcf9.entry.js} +1 -1
- package/dist/vega/{p-fe9644a0.js → p-348e95ba.js} +1 -1
- package/dist/vega/{p-00de36e4.js → p-34bd9204.js} +1 -1
- package/dist/vega/{p-3aec260c.entry.js → p-3cb90bdf.entry.js} +1 -1
- package/dist/vega/{p-fcab2244.entry.js → p-3e8f9fcf.entry.js} +1 -1
- package/dist/vega/{p-233e6715.entry.js → p-497f2f86.entry.js} +1 -1
- package/dist/vega/p-50eabdca.entry.js +1 -0
- package/dist/vega/{p-503ff1ef.js → p-52a8a4f8.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-5f82eb88.js → p-6100e1aa.js} +1 -1
- package/dist/vega/{p-766a0cdd.entry.js → p-6419e13e.entry.js} +1 -1
- package/dist/vega/{p-b2b41aa4.entry.js → p-7198d675.entry.js} +1 -1
- package/dist/vega/{p-00f4cf6a.entry.js → p-7baa4fae.entry.js} +1 -1
- package/dist/vega/p-7edcb8d0.entry.js +1 -0
- package/dist/vega/{p-34caa637.entry.js → p-84a7c18a.entry.js} +1 -1
- package/dist/vega/{p-bbea0599.entry.js → p-904b489a.entry.js} +1 -1
- package/dist/vega/{p-fea15767.entry.js → p-9689ad99.entry.js} +1 -1
- package/dist/vega/{p-95e50f3a.entry.js → p-9eb90ee8.entry.js} +1 -1
- package/dist/vega/{p-b1096431.entry.js → p-a7e078ac.entry.js} +1 -1
- package/dist/vega/{p-eb798062.entry.js → p-a7f40a65.entry.js} +1 -1
- package/dist/vega/{p-7fedfba5.js → p-a8b16ff2.js} +1 -1
- package/dist/vega/{p-9625162b.entry.js → p-aed80794.entry.js} +1 -1
- package/dist/vega/{p-c2ded423.js → p-b2d47bdd.js} +1 -1
- package/dist/vega/{p-7da8b05f.js → p-b517ed15.js} +1 -1
- package/dist/vega/{p-b6b4e40f.entry.js → p-b809f3d7.entry.js} +1 -1
- package/dist/vega/{p-0b9480a9.entry.js → p-b9a0f136.entry.js} +1 -1
- package/dist/vega/{p-5a19bcb5.entry.js → p-ba077ca8.entry.js} +1 -1
- package/dist/vega/{p-53360bc2.entry.js → p-ba2833c0.entry.js} +1 -1
- package/dist/vega/{p-13c22d72.entry.js → p-bf4996d5.entry.js} +1 -1
- package/dist/vega/{p-570bdeb5.entry.js → p-cb4fd6e1.entry.js} +1 -1
- package/dist/vega/p-da66dad5.entry.js +1 -0
- package/dist/vega/{p-cfd486ab.entry.js → p-e9785742.entry.js} +1 -1
- package/dist/vega/p-e9a5bd12.entry.js +1 -0
- package/dist/vega/{p-fb5c2cc6.entry.js → p-ee2e4bff.entry.js} +1 -1
- package/dist/vega/{p-8f8ab0d3.js → p-f86ec91b.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-497db801.entry.js +0 -1
- package/dist/vega/p-6705ce8f.entry.js +0 -1
- package/dist/vega/p-775fa5dd.entry.js +0 -1
- package/dist/vega/p-98043367.entry.js +0 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { VegaSlimmer, MapToComponentField, MapToComponentMethod } from 'vega-slimmer/core';
|
|
8
|
+
import { DomNodeSubjectObserverFactory } from '../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-observer-factory';
|
|
9
|
+
import { VegaInternalRichTextEditDeleteSelectedNodes } from '../../../../helpers/event-manager/event-id/vega-internal-event-id';
|
|
10
|
+
import { RTETextNode } from '../../dto/nodes/text-node';
|
|
11
|
+
import { RemoveChildAction } from '../../dto/actions/remove-child-action';
|
|
12
|
+
import { ReplaceSelectedTextAction } from '../../dto/actions/replace-selected-text-action';
|
|
13
|
+
import { RTEImageNode } from '../../dto/nodes/image-node';
|
|
14
|
+
import { RTETextBlock } from '../../dto/blocks/text-block';
|
|
15
|
+
import { InsertBlocksBeforeAction } from '../../dto/actions/insert-blocks-before-block';
|
|
16
|
+
import { generateUUID } from '../../../../utils/misc';
|
|
17
|
+
import { AppendChildNodesAction } from '../../dto/actions/append-child-nodes-action';
|
|
18
|
+
import { UpdateTextAction } from '../../dto/actions/update-text-action';
|
|
19
|
+
/**
|
|
20
|
+
* The `DeleteSelectedNodesController` class provides methods to delete selected nodes.
|
|
21
|
+
*/
|
|
22
|
+
export class DeleteSelectedNodesController extends VegaSlimmer {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
/**
|
|
26
|
+
* Deletes the selected nodes.
|
|
27
|
+
*
|
|
28
|
+
* @param {NotifyObserverPayload<boolean>} payload The notify payload
|
|
29
|
+
* @param {boolean} payload.detail The delete process need merge start node and end node or not, default value is true.
|
|
30
|
+
*/
|
|
31
|
+
this.deleteActionProcess = (payload) => {
|
|
32
|
+
const range = this.selectionController.getCurrentRange();
|
|
33
|
+
const { startContainer, endContainer, startOffset, endOffset } = range;
|
|
34
|
+
if (startContainer !== endContainer || startOffset !== endOffset) {
|
|
35
|
+
const cursorNode = this.removeSelectionRange();
|
|
36
|
+
const mergeStartAndEndFlag = payload && payload.detail ? payload.detail : false;
|
|
37
|
+
if (mergeStartAndEndFlag) {
|
|
38
|
+
this.mergeRangeStartAndEnd(startContainer, endContainer);
|
|
39
|
+
}
|
|
40
|
+
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, range.startOffset);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds the observer to the host element.
|
|
46
|
+
*/
|
|
47
|
+
addDeleteObserver() {
|
|
48
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(this.host, VegaInternalRichTextEditDeleteSelectedNodes, this.deleteActionProcess);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Removes the observer from the host element.
|
|
52
|
+
*/
|
|
53
|
+
removeDeleteObserver() {
|
|
54
|
+
DomNodeSubjectObserverFactory.removeUniqueObserverFromNode(this.host, VegaInternalRichTextEditDeleteSelectedNodes);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Removes selected nodes within a range in a rich text editor content.
|
|
58
|
+
* The method is only used for different nodes are selected
|
|
59
|
+
*
|
|
60
|
+
* @returns {RTENode} The range start node, usually the start node is the first item of selectedNodes, if the selectedNodes is all removed, the start node will be a new text node.
|
|
61
|
+
*/
|
|
62
|
+
removeSelectionRange() {
|
|
63
|
+
const range = this.selectionController.getCurrentRange();
|
|
64
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
65
|
+
const { endOffset, startOffset } = range;
|
|
66
|
+
const startNode = selectedNodes[0];
|
|
67
|
+
const endNode = selectedNodes[selectedNodes.length - 1];
|
|
68
|
+
if (selectedNodes.length > 1) {
|
|
69
|
+
// Remove all selected nodes except start node and end node(the end image node will be removed), the start node need to get the index of the block
|
|
70
|
+
const shouldRemovedItems = selectedNodes.filter((item) => {
|
|
71
|
+
if (item.type !== 'IMAGE') {
|
|
72
|
+
return item !== startNode && item !== endNode;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return item !== startNode && (item !== endNode || (item === endNode && endOffset !== 0));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
shouldRemovedItems.forEach((item) => {
|
|
79
|
+
item.parentBlock.apply(new RemoveChildAction(item));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
this.removeRangeStartAndEndSelectedText();
|
|
83
|
+
/**
|
|
84
|
+
* if the range start node is image and the item is selected, so we need remove the image item, the image block will be removed if the item is the only item.
|
|
85
|
+
* but before remove the image block, we need insert a paragraph to make sure the start block and start node could be get correct before insert text or break paragraph action
|
|
86
|
+
*/
|
|
87
|
+
if (startNode instanceof RTEImageNode &&
|
|
88
|
+
startOffset !== 1 &&
|
|
89
|
+
(endNode !== startNode || endOffset !== 0)) {
|
|
90
|
+
// the image block will be deleted when the image is the only item
|
|
91
|
+
if (startNode.parentBlock.nodes.length === 1) {
|
|
92
|
+
const paragraph = this.createEmptyParagraph();
|
|
93
|
+
startNode.parentBlock.parent.apply(new InsertBlocksBeforeAction(startNode.parentBlock, paragraph));
|
|
94
|
+
startNode.parentBlock.apply(new RemoveChildAction(startNode));
|
|
95
|
+
return paragraph.nodes[0];
|
|
96
|
+
}
|
|
97
|
+
else if (startNode === startNode.parentBlock.nodes[0]) {
|
|
98
|
+
// the start node should be the next image item if the image is first item
|
|
99
|
+
startNode.parentBlock.apply(new RemoveChildAction(startNode));
|
|
100
|
+
return startNode.parentBlock.nodes[0];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return startNode;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Removes the selected text at the start and end of a range in a Rich Text Editor.
|
|
107
|
+
*/
|
|
108
|
+
removeRangeStartAndEndSelectedText() {
|
|
109
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
110
|
+
const currentRange = this.selectionController.getCurrentRange();
|
|
111
|
+
if (selectedNodes[0] instanceof RTETextNode) {
|
|
112
|
+
selectedNodes[0].apply(new ReplaceSelectedTextAction('', currentRange));
|
|
113
|
+
}
|
|
114
|
+
if (selectedNodes.length > 1 && selectedNodes[selectedNodes.length - 1] instanceof RTETextNode) {
|
|
115
|
+
selectedNodes[selectedNodes.length - 1].apply(new ReplaceSelectedTextAction('', currentRange));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new paragraph with an empty text node and returns it.
|
|
120
|
+
*
|
|
121
|
+
* @returns {RTETextBlock} An empty paragraph with a unique identifier and a text node appended to it.
|
|
122
|
+
*/
|
|
123
|
+
createEmptyParagraph() {
|
|
124
|
+
const paragraph = new RTETextBlock(generateUUID(), 'paragraph');
|
|
125
|
+
const textNode = new RTETextNode(`${paragraph.id}1`, '', paragraph);
|
|
126
|
+
paragraph.apply(new AppendChildNodesAction([textNode]));
|
|
127
|
+
return paragraph;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Merges text nodes in a rich text editor.
|
|
131
|
+
*
|
|
132
|
+
* @param {Node} startContainer - Start text node element
|
|
133
|
+
* @param {Node} endContainer - End text node element
|
|
134
|
+
*/
|
|
135
|
+
mergeRangeStartAndEnd(startContainer, endContainer) {
|
|
136
|
+
if (startContainer !== endContainer) {
|
|
137
|
+
if (startContainer.nodeType === Node.TEXT_NODE && endContainer.nodeType === Node.TEXT_NODE) {
|
|
138
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
139
|
+
const startRTENode = selectedNodes[0];
|
|
140
|
+
const endRTENode = selectedNodes[selectedNodes.length - 1];
|
|
141
|
+
if (startRTENode && startRTENode.parentBlock && endRTENode && endRTENode.parentBlock) {
|
|
142
|
+
const endBlock = endRTENode.parentBlock;
|
|
143
|
+
if (this.shouldMergeTextNode(startRTENode, endRTENode)) {
|
|
144
|
+
startRTENode.apply(new UpdateTextAction(startRTENode.text + endRTENode.text));
|
|
145
|
+
if (startRTENode.parentBlock === endRTENode.parentBlock) {
|
|
146
|
+
startRTENode.parentBlock.apply(new RemoveChildAction(endRTENode));
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
endRTENode.parentBlock.apply(new RemoveChildAction(endRTENode.parentBlock.nodes[0]));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (startRTENode.parentBlock !== endRTENode.parentBlock) {
|
|
153
|
+
startRTENode.parentBlock.apply(new AppendChildNodesAction(endBlock.nodes));
|
|
154
|
+
endBlock.nodes = [];
|
|
155
|
+
}
|
|
156
|
+
if (endBlock.nodes.length < 1) {
|
|
157
|
+
endBlock.parent.apply(new RemoveChildAction(endBlock));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Compares the annotations of two RTETextNodes to determine if they can be merged.
|
|
165
|
+
*
|
|
166
|
+
* @param {RTETextNode} nodeA - node A
|
|
167
|
+
* @param {RTETextNode} nodeB - node B
|
|
168
|
+
* @returns {boolean} true or false
|
|
169
|
+
*/
|
|
170
|
+
shouldMergeTextNode(nodeA, nodeB) {
|
|
171
|
+
const { annotations: annotationsA } = nodeA.toJSON();
|
|
172
|
+
const { annotations: annotationsB } = nodeB.toJSON();
|
|
173
|
+
return JSON.stringify(annotationsA) === JSON.stringify(annotationsB);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
__decorate([
|
|
177
|
+
MapToComponentField()
|
|
178
|
+
], DeleteSelectedNodesController.prototype, "host", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
MapToComponentField()
|
|
181
|
+
], DeleteSelectedNodesController.prototype, "selectionController", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
MapToComponentField()
|
|
184
|
+
], DeleteSelectedNodesController.prototype, "value", void 0);
|
|
185
|
+
__decorate([
|
|
186
|
+
MapToComponentMethod('connectedCallback')
|
|
187
|
+
], DeleteSelectedNodesController.prototype, "addDeleteObserver", null);
|
|
188
|
+
__decorate([
|
|
189
|
+
MapToComponentMethod('disconnectedCallback')
|
|
190
|
+
], DeleteSelectedNodesController.prototype, "removeDeleteObserver", null);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import changeManager from '../../../../../../helpers/change-manager/change-manager';
|
|
2
|
+
import domNodeSubjectFactory from '../../../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-factory';
|
|
3
|
+
import { VegaInternalRichTextEditDeleteSelectedNodes } from '../../../../../../helpers/event-manager/event-id/vega-internal-event-id';
|
|
1
4
|
import { generateUUID } from '../../../../../../utils/misc';
|
|
2
5
|
import { AppendChildNodesAction } from '../../../../dto/actions/append-child-nodes-action';
|
|
3
|
-
import { InsertBlocksBeforeAction } from '../../../../dto/actions/insert-blocks-before-block';
|
|
4
|
-
import { RemoveChildAction } from '../../../../dto/actions/remove-child-action';
|
|
5
|
-
import { ReplaceSelectedTextAction } from '../../../../dto/actions/replace-selected-text-action';
|
|
6
|
-
import { UpdateTextAction } from '../../../../dto/actions/update-text-action';
|
|
7
6
|
import { RTETextBlock } from '../../../../dto/blocks/text-block';
|
|
8
|
-
import { RTEImageNode } from '../../../../dto/nodes/image-node';
|
|
9
7
|
import { RTETextNode } from '../../../../dto/nodes/text-node';
|
|
10
8
|
const ROOT_CONTAINER_CLASS_NAME = 'rich-text-content';
|
|
11
9
|
/** This code snippet is defining an abstract class named `BaseHandler` with an abstract method `execute`. */
|
|
@@ -15,30 +13,14 @@ export class BaseHandler {
|
|
|
15
13
|
*
|
|
16
14
|
* @param {VegaRTEContent} currentState - The current state of the VegaRTE content.
|
|
17
15
|
* @param {SelectionController} selectionController - Manages the selection of items in the user interface.
|
|
16
|
+
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
18
17
|
* @param {InputEvent} [event] - It is used to pass an input event to the method for handling.
|
|
19
18
|
*/
|
|
20
|
-
execute(currentState, selectionController, event) {
|
|
19
|
+
execute(currentState, selectionController, richTextEditor, event) {
|
|
21
20
|
this.initCurrentStateAndSelection(currentState, selectionController);
|
|
21
|
+
this.setCurrentRichTextEditor(richTextEditor);
|
|
22
22
|
this.handleEvent(event);
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Replaces the selected nodes with the provided text.
|
|
26
|
-
*
|
|
27
|
-
* @param {string} text - The insert text
|
|
28
|
-
* @returns {RTENode} - The selected start node
|
|
29
|
-
*/
|
|
30
|
-
replaceSelectedNodesWithText(text) {
|
|
31
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
32
|
-
const range = this.selectionController.getCurrentRange();
|
|
33
|
-
const { startContainer, endContainer } = range;
|
|
34
|
-
const result = this.removeSelectionRange();
|
|
35
|
-
const startNode = selectedNodes[0];
|
|
36
|
-
if (startNode instanceof RTETextNode && text) {
|
|
37
|
-
startNode.apply(new UpdateTextAction(startNode.text + text));
|
|
38
|
-
}
|
|
39
|
-
this.mergeRangeStartAndEnd(startContainer, endContainer);
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
24
|
/**
|
|
43
25
|
* The function `isRootContainer` checks if an HTML element is a root container with a class of 'rich-text-content'.
|
|
44
26
|
*
|
|
@@ -59,101 +41,18 @@ export class BaseHandler {
|
|
|
59
41
|
isEmptyParagraph(node) {
|
|
60
42
|
return node && node.childNodes && node.childNodes.length === 0;
|
|
61
43
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Removes the selected text at the start and end of a range in a Rich Text Editor.
|
|
64
|
-
*/
|
|
65
|
-
removeRangeStartAndEndSelectedText() {
|
|
66
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
67
|
-
const currentRange = this.selectionController.getCurrentRange();
|
|
68
|
-
if (selectedNodes[0] instanceof RTETextNode) {
|
|
69
|
-
selectedNodes[0].apply(new ReplaceSelectedTextAction('', currentRange));
|
|
70
|
-
}
|
|
71
|
-
if (selectedNodes.length > 1 && selectedNodes[selectedNodes.length - 1] instanceof RTETextNode) {
|
|
72
|
-
selectedNodes[selectedNodes.length - 1].apply(new ReplaceSelectedTextAction('', currentRange));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Merges text nodes in a rich text editor.
|
|
77
|
-
*
|
|
78
|
-
* @param {Node} startContainer - Start text node element
|
|
79
|
-
* @param {Node} endContainer - End text node element
|
|
80
|
-
*/
|
|
81
|
-
mergeRangeStartAndEnd(startContainer, endContainer) {
|
|
82
|
-
if (startContainer !== endContainer) {
|
|
83
|
-
if (startContainer.nodeType === Node.TEXT_NODE && endContainer.nodeType === Node.TEXT_NODE) {
|
|
84
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
85
|
-
const startRTENode = selectedNodes[0];
|
|
86
|
-
const endRTENode = selectedNodes[selectedNodes.length - 1];
|
|
87
|
-
if (startRTENode && startRTENode.parentBlock && endRTENode && endRTENode.parentBlock) {
|
|
88
|
-
const endBlock = endRTENode.parentBlock;
|
|
89
|
-
if (this.shouldMergeTextNode(startRTENode, endRTENode)) {
|
|
90
|
-
startRTENode.apply(new UpdateTextAction(startRTENode.text + endRTENode.text));
|
|
91
|
-
if (startRTENode.parentBlock === endRTENode.parentBlock) {
|
|
92
|
-
startRTENode.parentBlock.apply(new RemoveChildAction(endRTENode));
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
endRTENode.parentBlock.apply(new RemoveChildAction(endRTENode.parentBlock.nodes[0]));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (startRTENode.parentBlock !== endRTENode.parentBlock) {
|
|
99
|
-
startRTENode.parentBlock.apply(new AppendChildNodesAction(endBlock.nodes));
|
|
100
|
-
endBlock.nodes = [];
|
|
101
|
-
}
|
|
102
|
-
if (endBlock.nodes.length < 1) {
|
|
103
|
-
endBlock.parent.apply(new RemoveChildAction(endBlock));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
44
|
/**
|
|
110
45
|
* Removes selected nodes within a range in a rich text editor content.
|
|
111
46
|
* The method is only used for different nodes are selected
|
|
112
47
|
*
|
|
48
|
+
* @param {boolean} [mergeNode] Merge start node and end node or not, default value is false.
|
|
113
49
|
* @returns {RTENode} The range start node, usually the start node is the first item of selectedNodes, if the selectedNodes is all removed, the start node will be a new text node.
|
|
114
50
|
*/
|
|
115
|
-
removeSelectionRange() {
|
|
51
|
+
removeSelectionRange(mergeNode = false) {
|
|
52
|
+
changeManager.notify(domNodeSubjectFactory.getSubject(this.richTextEditorRef, VegaInternalRichTextEditDeleteSelectedNodes), { host: this.richTextEditorRef, detail: mergeNode });
|
|
116
53
|
const range = this.selectionController.getCurrentRange();
|
|
117
54
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
118
|
-
|
|
119
|
-
const startNode = selectedNodes[0];
|
|
120
|
-
const endNode = selectedNodes[selectedNodes.length - 1];
|
|
121
|
-
if (selectedNodes.length > 1) {
|
|
122
|
-
// Remove all selected nodes except start node and end node(the end image node will be removed), the start node need to get the index of the block
|
|
123
|
-
const shouldRemovedItems = selectedNodes.filter((item) => {
|
|
124
|
-
if (item.type !== 'IMAGE') {
|
|
125
|
-
return item !== startNode && item !== endNode;
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
return item !== startNode && (item !== endNode || (item === endNode && endOffset !== 0));
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
shouldRemovedItems.forEach((item) => {
|
|
132
|
-
item.parentBlock.apply(new RemoveChildAction(item));
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
this.removeRangeStartAndEndSelectedText();
|
|
136
|
-
/**
|
|
137
|
-
* if the range start node is image and the item is selected, so we need remove the image item, the image block will be removed if the item is the only item.
|
|
138
|
-
* but before remove the image block, we need insert a paragraph to make sure the start block and start node could be get correct before insert text or break paragraph action
|
|
139
|
-
*/
|
|
140
|
-
if (startNode instanceof RTEImageNode &&
|
|
141
|
-
startOffset !== 1 &&
|
|
142
|
-
(endNode !== startNode || endOffset !== 0)) {
|
|
143
|
-
// the image block will be deleted when the image is the only item
|
|
144
|
-
if (startNode.parentBlock.nodes.length === 1) {
|
|
145
|
-
const paragraph = this.createEmptyParagraph();
|
|
146
|
-
startNode.parentBlock.parent.apply(new InsertBlocksBeforeAction(startNode.parentBlock, paragraph));
|
|
147
|
-
startNode.parentBlock.apply(new RemoveChildAction(startNode));
|
|
148
|
-
return paragraph.nodes[0];
|
|
149
|
-
}
|
|
150
|
-
else if (startNode === startNode.parentBlock.nodes[0]) {
|
|
151
|
-
// the start node should be the next image item if the image is first item
|
|
152
|
-
startNode.parentBlock.apply(new RemoveChildAction(startNode));
|
|
153
|
-
return startNode.parentBlock.nodes[0];
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return startNode;
|
|
55
|
+
return range.startNode || selectedNodes[0];
|
|
157
56
|
}
|
|
158
57
|
/**
|
|
159
58
|
* Creates a new paragraph with an empty text node and returns it.
|
|
@@ -166,18 +65,6 @@ export class BaseHandler {
|
|
|
166
65
|
paragraph.apply(new AppendChildNodesAction([textNode]));
|
|
167
66
|
return paragraph;
|
|
168
67
|
}
|
|
169
|
-
/**
|
|
170
|
-
* Compares the annotations of two RTETextNodes to determine if they can be merged.
|
|
171
|
-
*
|
|
172
|
-
* @param {RTETextNode} nodeA - node A
|
|
173
|
-
* @param {RTETextNode} nodeB - node B
|
|
174
|
-
* @returns {boolean} true or false
|
|
175
|
-
*/
|
|
176
|
-
shouldMergeTextNode(nodeA, nodeB) {
|
|
177
|
-
const { annotations: annotationsA } = nodeA.toJSON();
|
|
178
|
-
const { annotations: annotationsB } = nodeB.toJSON();
|
|
179
|
-
return JSON.stringify(annotationsA) === JSON.stringify(annotationsB);
|
|
180
|
-
}
|
|
181
68
|
/**
|
|
182
69
|
* The function initializes the current state and selection controller in TypeScript.
|
|
183
70
|
*
|
|
@@ -188,4 +75,12 @@ export class BaseHandler {
|
|
|
188
75
|
this.currentState = currentState;
|
|
189
76
|
this.selectionController = selectionController;
|
|
190
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Queries the rich text editor element from the input event target.
|
|
80
|
+
*
|
|
81
|
+
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
82
|
+
*/
|
|
83
|
+
setCurrentRichTextEditor(richTextEditor) {
|
|
84
|
+
this.richTextEditorRef = richTextEditor;
|
|
85
|
+
}
|
|
191
86
|
}
|
|
@@ -49,21 +49,12 @@ export class DeleteContentHandler extends BaseHandler {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Creates a new paragraph element with a text node and appends it to the current state.
|
|
54
|
-
*/
|
|
55
|
-
insertDefaultParagraph() {
|
|
56
|
-
const paragraph = this.createEmptyParagraph();
|
|
57
|
-
this.currentState.apply(new AppendChildNodesAction([paragraph]));
|
|
58
|
-
this.selectionController.enqueueSelectionRangeFutureState(paragraph.nodes[0], 1);
|
|
59
|
-
}
|
|
60
52
|
/**
|
|
61
53
|
* Deletes the content within multiple nodes selected by the user.
|
|
62
54
|
*/
|
|
63
55
|
deleteContentWithMultipleNodes() {
|
|
64
|
-
const range = this.selectionController.getCurrentRange();
|
|
65
56
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
66
|
-
const cursorNode = this.
|
|
57
|
+
const cursorNode = this.removeSelectionRange(true);
|
|
67
58
|
const lastSelectedNode = selectedNodes[selectedNodes.length - 1];
|
|
68
59
|
if (selectedNodes.length > 1 &&
|
|
69
60
|
lastSelectedNode instanceof RTETextNode &&
|
|
@@ -71,7 +62,6 @@ export class DeleteContentHandler extends BaseHandler {
|
|
|
71
62
|
lastSelectedNode.parentBlock.apply(new RemoveChildAction(lastSelectedNode));
|
|
72
63
|
}
|
|
73
64
|
this.convertFirstBlockToParagraph(cursorNode.parentBlock);
|
|
74
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, range.startOffset);
|
|
75
65
|
}
|
|
76
66
|
/**
|
|
77
67
|
* If the first block is not paragraph, convert the block to paragraph after delete all text
|
|
@@ -91,6 +81,14 @@ export class DeleteContentHandler extends BaseHandler {
|
|
|
91
81
|
block.parent.apply(new RemoveChildAction(block));
|
|
92
82
|
}
|
|
93
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new paragraph element with a text node and appends it to the current state.
|
|
86
|
+
*/
|
|
87
|
+
insertDefaultParagraph() {
|
|
88
|
+
const paragraph = this.createEmptyParagraph();
|
|
89
|
+
this.currentState.apply(new AppendChildNodesAction([paragraph]));
|
|
90
|
+
this.selectionController.enqueueSelectionRangeFutureState(paragraph.nodes[0], 1);
|
|
91
|
+
}
|
|
94
92
|
/**
|
|
95
93
|
* Returns the end offset of a given node in a Rich Text Editor based on its type and text content.
|
|
96
94
|
*
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { BaseHandler } from './base-handler';
|
|
2
|
-
import { RTETextNode } from '../../../../dto/nodes/text-node';
|
|
3
|
-
import { generateUUID } from '../../../../../../utils/misc';
|
|
4
2
|
import { RTETextBlock } from '../../../../dto/blocks/text-block';
|
|
5
|
-
import { AppendChildNodesAction } from '../../../../dto/actions/append-child-nodes-action';
|
|
6
3
|
import { LineBreakSingleBlockAction } from '../../../../dto/actions/line-break-single-block-action';
|
|
7
4
|
import { lineBreakMultipleBlocksAction } from '../../../../dto/actions/line-break-multiple-block-action';
|
|
8
5
|
/** User press shift + enter will tigger this callback */
|
|
@@ -31,11 +28,13 @@ export class InsertLineBreakHandler extends BaseHandler {
|
|
|
31
28
|
* </p>
|
|
32
29
|
*/
|
|
33
30
|
breakNewBlock() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
if (this.currentState &&
|
|
32
|
+
this.currentState.blocks[0] &&
|
|
33
|
+
this.currentState.blocks[0] instanceof RTETextBlock) {
|
|
34
|
+
const lineBreakAction = new LineBreakSingleBlockAction(this.currentState.blocks[0].nodes[0], 0);
|
|
35
|
+
this.currentState.blocks[0].apply(lineBreakAction);
|
|
36
|
+
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
37
|
+
}
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
40
|
* If the selected node is a text node
|
|
@@ -72,7 +71,7 @@ export class InsertLineBreakHandler extends BaseHandler {
|
|
|
72
71
|
/**
|
|
73
72
|
* Moves the caret to the next node element in a rich text editor.
|
|
74
73
|
*
|
|
75
|
-
* @param {
|
|
74
|
+
* @param {RTENode} lineBreakNode - Represents a node element in a rich text editor.
|
|
76
75
|
*/
|
|
77
76
|
switchCaretPositionToSpecifiedNode(lineBreakNode) {
|
|
78
77
|
this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(lineBreakNode), 0);
|
|
@@ -88,13 +87,4 @@ export class InsertLineBreakHandler extends BaseHandler {
|
|
|
88
87
|
const nextNode = lineBreakNode.parentBlock['nodes'][index + 1];
|
|
89
88
|
return nextNode || lineBreakNode;
|
|
90
89
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Create a null text that will render a br element in a rich text editor.
|
|
93
|
-
*
|
|
94
|
-
* @param {RTEBlock} block - Represents a block element in a rich text editor.
|
|
95
|
-
* @returns {RTETextNode} the new line break node.
|
|
96
|
-
*/
|
|
97
|
-
createLineBreakNode(block) {
|
|
98
|
-
return new RTETextNode(generateUUID(), '\n', block);
|
|
99
|
-
}
|
|
100
90
|
}
|
|
@@ -45,8 +45,8 @@ export class InsertPasteHandler extends BaseHandler {
|
|
|
45
45
|
*/
|
|
46
46
|
insertBlocksToContent(blocks) {
|
|
47
47
|
const cursorNode = this.removeSelectionRange();
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (cursorNode && cursorNode.parentBlock) {
|
|
49
|
+
const currentBlock = cursorNode.parentBlock;
|
|
50
50
|
const { startOffset } = this.selectionController.getCurrentRange();
|
|
51
51
|
const breakAction = new SplitBlockWithNodeAction(cursorNode, startOffset);
|
|
52
52
|
currentBlock.apply(breakAction);
|
|
@@ -48,10 +48,11 @@ export class InsertTextHandler extends BaseHandler {
|
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
// The selected nodes is multiple nodes
|
|
51
|
-
const cursorNode = this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const cursorNode = this.removeSelectionRange(true);
|
|
52
|
+
if (cursorNode instanceof RTETextNode) {
|
|
53
|
+
cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
|
|
54
|
+
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(startOffset + text.length, cursorNode.text.length));
|
|
55
|
+
}
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
/**
|