@heartlandone/vega 2.95.0 → 2.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-76815382.js → app-globals-38afea36.js} +7 -7
- package/dist/cjs/{code-block-493c7ce7.js → code-block-4126dc3b.js} +1501 -55
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-ab21fcbf.js → component-value-history-controller-slimmer.abstract-38ba956e.js} +2 -2
- package/dist/cjs/{content-state-fc34a814.js → content-state-50e8a03c.js} +142 -580
- package/dist/cjs/{element-appender-slimmer-1d6323c2.js → element-appender-slimmer-7773fdab.js} +115 -0
- package/dist/cjs/{image-annotation-action-7c4cd316.js → image-annotation-action-89363de8.js} +2 -2
- package/dist/cjs/{image-extension-30a7c10f.js → image-extension-c881c454.js} +2 -2
- package/dist/cjs/index.cjs.js +10 -10
- package/dist/cjs/{link-extension-92a63cb7.js → link-extension-b7f99a52.js} +2 -2
- package/dist/cjs/loader.cjs.js +7 -7
- package/dist/cjs/{public-rules-9e1ea1d9.js → public-rules-72894208.js} +3 -3
- package/dist/cjs/{range-30219330.js → range-95d41dea.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-23bf7485.js → rich-text-editor-required-rule-4d6d2493.js} +1 -1
- package/dist/cjs/{split-cell-operation-43752212.js → split-cell-operation-70be116d.js} +2 -2
- package/dist/cjs/{token-extension-d123d9d0.js → token-extension-eb828948.js} +35 -11
- package/dist/cjs/vega-code-block.cjs.entry.js +3 -3
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +27 -4
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +58 -9
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +608 -90
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-section-title.cjs.entry.js +896 -14
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +1 -1
- package/dist/cjs/vega.cjs.js +7 -7
- package/dist/collection/components/vega-combo-box/vega-combo-box.js +2 -2
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +30 -7
- package/dist/collection/components/vega-input-select/vega-input-select.js +2 -2
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +4 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.js +10 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +8 -3
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-annotation-strategy.abstract.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.js +36 -4
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-items-strategy.abstract.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-nest-items-strategy.js +74 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +81 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-selection.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +160 -9
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +376 -10
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-unnest-items-strategy.js +104 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/nest-list-items-action.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/unnest-list-items-action.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +10 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +11 -3
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +7 -1
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-block-filter-styles-strategy.js +8 -4
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +34 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +20 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.js +25 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +30 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/abstract-list-keyboard-handler.js +204 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-shift-tab-outdent-handler.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-tab-indent-handler.js +34 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/list-keyboard-slimmer.js +180 -0
- package/dist/collection/components/vega-section-title/slimmers/a11y-tree/build-section-title-a11y-tree.js +54 -0
- package/dist/collection/components/vega-section-title/slimmers/renderers/vega-section-title-renderer.js +4 -4
- package/dist/collection/components/vega-section-title/vega-section-title.js +18 -2
- package/dist/collection/helpers/a11y-tree/a11y-node-dto.js +210 -0
- package/dist/collection/helpers/a11y-tree/a11y-tree-applier.js +189 -0
- package/dist/collection/helpers/a11y-tree/a11y-tree.types.js +48 -0
- package/dist/collection/helpers/a11y-tree/strategies/baseline-strategy.js +78 -0
- package/dist/collection/helpers/a11y-tree/strategies/firefox-nvda-strategy.js +56 -0
- package/dist/collection/helpers/a11y-tree/strategies/webkit-voiceover-strategy.js +140 -0
- package/dist/collection/helpers/a11y-tree/strategy-resolver.js +172 -0
- package/dist/collection/helpers/slimmers/a11y-tree-slimmer.js +54 -0
- package/dist/collection/helpers/slimmers/element-appender/element-appender-slimmer.js +29 -0
- package/dist/collection/helpers/slimmers/element-appender/visibility-modifiers/clip-on-scroll-modifier.js +70 -0
- package/dist/collection/helpers/slimmers/element-appender/visibility-modifiers/visibility-modifier.interface.js +1 -0
- package/dist/collection/helpers/ui/element-appender.js +16 -0
- package/dist/esm/{app-globals-eafcc7a1.js → app-globals-d7b651c1.js} +7 -7
- package/dist/esm/{code-block-e12588fe.js → code-block-0a88b481.js} +1495 -51
- package/dist/esm/{component-value-history-controller-slimmer.abstract-4e8eb313.js → component-value-history-controller-slimmer.abstract-6846edfa.js} +2 -2
- package/dist/esm/{content-state-8032467a.js → content-state-79ca99e5.js} +105 -541
- package/dist/esm/{element-appender-slimmer-7fcb944b.js → element-appender-slimmer-73ad10ae.js} +115 -0
- package/dist/esm/{image-annotation-action-08a20d5e.js → image-annotation-action-bb299ef1.js} +2 -2
- package/dist/esm/{image-extension-b6c7e4a7.js → image-extension-48a96f98.js} +2 -2
- package/dist/esm/index.js +8 -8
- package/dist/esm/{link-extension-97fcb8fb.js → link-extension-09534514.js} +2 -2
- package/dist/esm/loader.js +7 -7
- package/dist/esm/{public-rules-c06f0d2a.js → public-rules-5eb03ef0.js} +3 -3
- package/dist/esm/{range-e999837f.js → range-d4deb7df.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-71f8ee98.js → rich-text-editor-required-rule-5bbbce23.js} +1 -1
- package/dist/esm/{split-cell-operation-359f8082.js → split-cell-operation-7f3058ad.js} +2 -2
- package/dist/esm/{token-extension-f5bf9c21.js → token-extension-40c32bcc.js} +30 -6
- package/dist/esm/vega-code-block.entry.js +3 -3
- package/dist/esm/vega-date-picker_2.entry.js +1 -1
- package/dist/esm/vega-dropdown_5.entry.js +27 -4
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-popover_2.entry.js +1 -1
- package/dist/esm/vega-rich-text-content.entry.js +58 -9
- package/dist/esm/vega-rich-text-editor_4.entry.js +604 -86
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +3 -3
- package/dist/esm/vega-section-title.entry.js +897 -15
- package/dist/esm/vega-time-picker_2.entry.js +1 -1
- package/dist/esm/vega-tooltip_2.entry.js +1 -1
- package/dist/esm/vega.js +7 -7
- package/dist/sri/vega-sri-manifest.json +94 -94
- package/dist/types/components/vega-combo-box/vega-combo-box.d.ts +6 -6
- package/dist/types/components/vega-dropdown/types.d.ts +2 -2
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +32 -9
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +6 -6
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-annotation-strategy.abstract.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.d.ts +14 -2
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-items-strategy.abstract.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-nest-items-strategy.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-selection.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.d.ts +30 -3
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.d.ts +99 -3
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-unnest-items-strategy.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/nest-list-items-action.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/unnest-list-items-action.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +6 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/abstract-list-keyboard-handler.d.ts +99 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-shift-tab-outdent-handler.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-tab-indent-handler.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/list-keyboard-slimmer.d.ts +73 -0
- package/dist/types/components/vega-section-title/slimmers/a11y-tree/build-section-title-a11y-tree.d.ts +41 -0
- package/dist/types/components/vega-section-title/vega-section-title.d.ts +9 -0
- package/dist/types/components.d.ts +10 -10
- package/dist/types/helpers/a11y-tree/a11y-node-dto.d.ts +173 -0
- package/dist/types/helpers/a11y-tree/a11y-tree-applier.d.ts +28 -0
- package/dist/types/helpers/a11y-tree/a11y-tree.types.d.ts +137 -0
- package/dist/types/helpers/a11y-tree/strategies/baseline-strategy.d.ts +18 -0
- package/dist/types/helpers/a11y-tree/strategies/firefox-nvda-strategy.d.ts +16 -0
- package/dist/types/helpers/a11y-tree/strategies/webkit-voiceover-strategy.d.ts +23 -0
- package/dist/types/helpers/a11y-tree/strategy-resolver.d.ts +59 -0
- package/dist/types/helpers/slimmers/a11y-tree-slimmer.d.ts +49 -0
- package/dist/types/helpers/slimmers/element-appender/element-appender-slimmer.d.ts +9 -0
- package/dist/types/helpers/slimmers/element-appender/visibility-modifiers/clip-on-scroll-modifier.d.ts +37 -0
- package/dist/types/helpers/slimmers/element-appender/visibility-modifiers/visibility-modifier.interface.d.ts +56 -0
- package/dist/types/helpers/ui/element-appender.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-9c39f90b.entry.js → p-1dfbc542.entry.js} +1 -1
- package/dist/vega/{p-e235020b.entry.js → p-22cc174e.entry.js} +1 -1
- package/dist/vega/{p-b187b82d.entry.js → p-2df5d59b.entry.js} +1 -1
- package/dist/vega/{p-f7e459cd.js → p-312d8205.js} +1 -1
- package/dist/vega/{p-a7209700.js → p-3345d903.js} +1 -1
- package/dist/vega/{p-02355de8.js → p-3c23ec90.js} +1 -1
- package/dist/vega/p-55e0014a.js +3 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-65fee02f.entry.js +1 -0
- package/dist/vega/p-6a51d720.js +1 -0
- package/dist/vega/{p-fe24b459.js → p-6c7b6d45.js} +1 -1
- package/dist/vega/{p-579cdeae.js → p-84b7a775.js} +1 -1
- package/dist/vega/{p-df828d90.entry.js → p-96da7d30.entry.js} +1 -1
- package/dist/vega/{p-88be9ec5.js → p-9d3f69cb.js} +1 -1
- package/dist/vega/{p-8a001caa.js → p-9f11b579.js} +1 -1
- package/dist/vega/{p-ba2b9663.entry.js → p-acaff62d.entry.js} +1 -1
- package/dist/vega/p-b63319e9.entry.js +1 -0
- package/dist/vega/{p-c079c935.entry.js → p-b660f38c.entry.js} +1 -1
- package/dist/vega/p-b8ffa42f.entry.js +1 -0
- package/dist/vega/{p-4fe40b76.js → p-c4564904.js} +1 -1
- package/dist/vega/p-d9158512.js +1 -0
- package/dist/vega/p-e62d41ee.js +1 -0
- package/dist/vega/{p-9f7154d2.js → p-ec5dee32.js} +1 -1
- package/dist/vega/{p-05d04c07.entry.js → p-f29d9707.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +3 -2
- package/dist/vega/p-0be4df0a.js +0 -1
- package/dist/vega/p-38c9d782.js +0 -1
- package/dist/vega/p-513bc0d9.js +0 -1
- package/dist/vega/p-8d4b85e7.entry.js +0 -1
- package/dist/vega/p-c5d3b008.entry.js +0 -1
- package/dist/vega/p-d25ca0c3.entry.js +0 -1
- package/dist/vega/p-f4da615a.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as ActionHandleStrategy,
|
|
1
|
+
import { d as ActionHandleStrategy, p as RTECodeBlock, g as InsertChildrenBeforeAction, k as RemoveChildrenAction, s as stateEntityRenderingRegistry, v as NodeAnnotation, N as NodeAnnotationTypeEnum, o as RTEDecoratorNode, w as NodeTypeEnum, x as CommonAnnotation, A as ActionHandleStrategyRegistry, j as AnnotationAction, i as ModifyContentActionType, y as ReplaceChildNodesAction, I as InsertChildrenAfterAction, e as AppendChildrenAction, M as ModifyContentAction, b as RTETextBlock, R as RTETextNode, S as SplitBlockWithNodeAction, a as RTEBlock, z as BlockMergeNodesStrategy, D as BlockReplaceNodesStrategy, H as HorizontalAlignmentAnnotationAction, E as BlockUpdateHorizontalAlignmentStrategy, F as BlockDeleteNodeContentStrategy, U as UpdateTextAction, G as RemoveChildrenStrategy, J as RemoveNestListAction, q as RTEListItemBlock, K as ReplaceNestListAction, L as RTEListBlock, O as BOLD_FONT_WEIGHT_KEYWORD, P as BOLD_FONT_WEIGHT, Q as createStyleMapFromElement, T as RTE_TEXT_COLORS, W as RTE_DEFAULT_TEXT_COLOR, X as ITALIC_FONT_STYLE, Y as STRIKETHROUGH_TEXT_DECORATION, Z as UNDERLINE_TEXT_DECORATION, u as RTEFilterStylesStrategyRegistry, _ as TextStyleAnnotation, $ as RTEHtmlBlock, n as RTEFilterStylesStrategy, a0 as Predicate$1, a1 as ListAnnotation, a2 as HorizontalAlignmentAnnotation, a3 as CodeAnnotation, m as RTEDTOClassManager, a4 as LinkFilterStylesStrategy, a5 as CodeBlockFilterStylesStrategy, r as RTECodeBlockNode, a6 as CodeBlockNodeFilterStylesStrategy, a7 as SyncUpSelectionAction } from './code-block-0a88b481.js';
|
|
2
2
|
import { g as generateUUID } from './misc-9fdbcfbb.js';
|
|
3
3
|
import { i as isNonNullable } from './type-guard-ec5e8628.js';
|
|
4
4
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
@@ -8,446 +8,6 @@ import { r as rgbToHex, i as isHTMLElement } from './ui-d73f756a.js';
|
|
|
8
8
|
import { c as cleanObject } from './object-0c277f57.js';
|
|
9
9
|
import { L as LogUtility } from './global-slimmer-registry-17c4efd4.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Remove list item nest list block strategy.
|
|
13
|
-
*/
|
|
14
|
-
class ListItemRemoveNestListStrategy extends ActionHandleStrategy {
|
|
15
|
-
/**
|
|
16
|
-
* Remove the nest list block from the list item, clear the property children when the children is empty.
|
|
17
|
-
*
|
|
18
|
-
* @param {RemoveNestListAction} action - The action instance.
|
|
19
|
-
* @param {RTEListItemBlock} target - The list item block.
|
|
20
|
-
*/
|
|
21
|
-
handleAction(action, target) {
|
|
22
|
-
if (target.nestList) {
|
|
23
|
-
if (target.nestList.length > 1) {
|
|
24
|
-
target.nestList = target.nestList.filter((child) => child !== action.nestListBlockToBeRemoved);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
target.nestList = undefined;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Replace list item nest list strategy.
|
|
35
|
-
*/
|
|
36
|
-
class ListItemReplaceNestListStrategy extends ActionHandleStrategy {
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc
|
|
39
|
-
*/
|
|
40
|
-
handleAction(action, target) {
|
|
41
|
-
action.newList.forEach((listBlock) => {
|
|
42
|
-
listBlock.parent = target;
|
|
43
|
-
});
|
|
44
|
-
target.nestList = action.newList;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Insert image node to list item block strategy.
|
|
50
|
-
*/
|
|
51
|
-
class ListItemInsertImageStrategy extends ActionHandleStrategy {
|
|
52
|
-
/**
|
|
53
|
-
* The image node can not insert into list item block, so insert image after parent list block.
|
|
54
|
-
*
|
|
55
|
-
* @param {InsertImageToBlockAction} action - The action instance.
|
|
56
|
-
* @param {RTEListItemBlock} target - The list item block.
|
|
57
|
-
*/
|
|
58
|
-
handleAction(action, target) {
|
|
59
|
-
target.parent.apply(action);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* List item block
|
|
65
|
-
*/
|
|
66
|
-
class RTEListItemBlock extends RTETextBlock {
|
|
67
|
-
constructor(id, nestList, options) {
|
|
68
|
-
super(id, 'list-item', options);
|
|
69
|
-
this.dtoName = RTEListItemBlock.dtoName;
|
|
70
|
-
/**
|
|
71
|
-
* TODO: Refactor the list item properties children and nestList, merge two properties together.
|
|
72
|
-
*
|
|
73
|
-
* 1. Update the type of `children` to include `RTEListBlock` as a possible type.
|
|
74
|
-
* 2. The list block children should text block array and nest list block array, The text block should wrap a `li` tag when rendering.
|
|
75
|
-
*/
|
|
76
|
-
this.nestList = [];
|
|
77
|
-
this.nestList = nestList;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Converts a VegaRTEListItemBlock object to an RTEListItemBlock
|
|
81
|
-
*
|
|
82
|
-
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
|
|
83
|
-
* @param {VegaRTETransformOptions} options - Optional transformation options.
|
|
84
|
-
* @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
|
|
85
|
-
*/
|
|
86
|
-
static from(block, options = { autoMatchFormat: true }) {
|
|
87
|
-
const listItemBlock = new RTEListItemBlock(block.id, undefined, options);
|
|
88
|
-
listItemBlock.children = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock, options));
|
|
89
|
-
if (block.children) {
|
|
90
|
-
listItemBlock.nestList = block.children.map((child) => {
|
|
91
|
-
const listBlock = RTEListBlock.from(child);
|
|
92
|
-
listBlock.parent = listItemBlock;
|
|
93
|
-
return listBlock;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
const { annotations } = block;
|
|
97
|
-
if (annotations) {
|
|
98
|
-
Object.entries(annotations).forEach(([type, value]) => {
|
|
99
|
-
const item = this.createAnnotationEntity(type, value);
|
|
100
|
-
if (isNonNullable(item)) {
|
|
101
|
-
listItemBlock.annotationMap.set(...item);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return listItemBlock;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @inheritDoc
|
|
109
|
-
*/
|
|
110
|
-
toJSON() {
|
|
111
|
-
var _a;
|
|
112
|
-
return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* @inheritDoc
|
|
116
|
-
*/
|
|
117
|
-
toHtml(options) {
|
|
118
|
-
const attrStr = super.generateAttributeString(options);
|
|
119
|
-
return [`<li${attrStr}>`, this.getChildrenHtml(options), `</li>`].join('');
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* @inheritDoc
|
|
123
|
-
*/
|
|
124
|
-
cloneWithNodes(nodes) {
|
|
125
|
-
const block = new RTEListItemBlock(generateUUID());
|
|
126
|
-
block.children = [];
|
|
127
|
-
block.apply(new AppendChildrenAction(nodes));
|
|
128
|
-
return block;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* @inheritDoc
|
|
132
|
-
*/
|
|
133
|
-
getLastNode() {
|
|
134
|
-
if (this.nestList && this.nestList.length > 0) {
|
|
135
|
-
const childListBlock = this.nestList[this.nestList.length - 1];
|
|
136
|
-
return childListBlock.getLastNode();
|
|
137
|
-
}
|
|
138
|
-
return super.getLastNode();
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Create a new list item block.
|
|
142
|
-
*
|
|
143
|
-
* @returns {RTEListItemBlock} - A list item block.
|
|
144
|
-
*/
|
|
145
|
-
createNewListItem() {
|
|
146
|
-
return new RTEListItemBlock(generateUUID());
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* @inheritDoc
|
|
150
|
-
*/
|
|
151
|
-
clone(parent) {
|
|
152
|
-
var _a;
|
|
153
|
-
const block = new RTEListItemBlock(this.id);
|
|
154
|
-
block.children = this.children.map((node) => node.clone(block));
|
|
155
|
-
block.annotationMap = super.cloneAnnotations();
|
|
156
|
-
block.nestList = (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((child) => child.clone(block));
|
|
157
|
-
block.parent = parent;
|
|
158
|
-
return block;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
(() => {
|
|
162
|
-
ActionHandleStrategyRegistry.register(TextStyleAnnotationAction.name, RTEListItemBlock.name, new BlockUpdateTextStyleStrategy());
|
|
163
|
-
ActionHandleStrategyRegistry.register(HorizontalAlignmentAnnotationAction.name, RTEListItemBlock.name, new BlockUpdateHorizontalAlignmentStrategy());
|
|
164
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new BlockInsertLineBreakStrategy());
|
|
165
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
|
|
166
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
|
|
167
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new BlockSplitWithTextNodeStrategy());
|
|
168
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new BlockReplaceNodesStrategy());
|
|
169
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
|
|
170
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new BlockMergeNodesStrategy());
|
|
171
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
|
|
172
|
-
})();
|
|
173
|
-
RTEListItemBlock.dtoName = 'RTEListItemBlock';
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Convert the selected blocks to list strategy.
|
|
177
|
-
*/
|
|
178
|
-
class ListTransformToListStrategy extends ActionHandleStrategy {
|
|
179
|
-
/**
|
|
180
|
-
* @inheritDoc
|
|
181
|
-
*/
|
|
182
|
-
handleAction(action, target) {
|
|
183
|
-
const selectedBlocks = action.selectedBlocks;
|
|
184
|
-
const bulletList = target.parent.createList(action.listType);
|
|
185
|
-
const isSameList = selectedBlocks.every((block) => block.parent === target);
|
|
186
|
-
if (isSameList) {
|
|
187
|
-
// Select one or more list items belonging to the same list, and all items in this list should be updated
|
|
188
|
-
bulletList.apply(new AppendChildrenAction(target.children));
|
|
189
|
-
target.parent.apply(new InsertChildrenAfterAction(target, bulletList));
|
|
190
|
-
target.parent.apply(new RemoveChildrenAction(target));
|
|
191
|
-
selectedBlocks.forEach((block) => block.children.map((node) => node.apply(new SyncUpSelectionAction())));
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
|
|
195
|
-
bulletList.apply(new AppendChildrenAction(listItems));
|
|
196
|
-
target.parent.apply(new InsertChildrenAfterAction(target, bulletList));
|
|
197
|
-
action.selectedBlocks.forEach((block) => {
|
|
198
|
-
block.parent.apply(new RemoveChildrenAction(block));
|
|
199
|
-
});
|
|
200
|
-
if (target.children.length === 0) {
|
|
201
|
-
target.parent.apply(new RemoveChildrenAction(target));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Convert the selected list block to paragraph strategy.
|
|
209
|
-
*/
|
|
210
|
-
class ListTransformToParagraphStrategy extends ActionHandleStrategy {
|
|
211
|
-
/**
|
|
212
|
-
* @inheritDoc
|
|
213
|
-
*/
|
|
214
|
-
handleAction(action, target) {
|
|
215
|
-
let isSelectedFirstBlock = false;
|
|
216
|
-
let isSelectedLastBlock = false;
|
|
217
|
-
const selectedBlocks = action.selectedBlocks;
|
|
218
|
-
const currentParagraph = selectedBlocks.map((block) => {
|
|
219
|
-
block.children.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
220
|
-
if (block === target.children[0])
|
|
221
|
-
isSelectedFirstBlock = true;
|
|
222
|
-
if (block === target.children[target.children.length - 1])
|
|
223
|
-
isSelectedLastBlock = true;
|
|
224
|
-
return this.toParagraph(block);
|
|
225
|
-
});
|
|
226
|
-
if (isSelectedFirstBlock) {
|
|
227
|
-
target.parent.apply(new InsertChildrenBeforeAction(target, ...currentParagraph));
|
|
228
|
-
}
|
|
229
|
-
else if (isSelectedLastBlock) {
|
|
230
|
-
target.parent.apply(new InsertChildrenAfterAction(target, ...currentParagraph));
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
const startIndex = target.children.indexOf(selectedBlocks[0]);
|
|
234
|
-
const lastIndex = target.children.indexOf(selectedBlocks[selectedBlocks.length - 1]);
|
|
235
|
-
const firstBulletList = target.parent.createList(target.type);
|
|
236
|
-
firstBulletList.apply(new AppendChildrenAction(target.children.slice(0, startIndex)));
|
|
237
|
-
const lastBulletList = target.parent.createList(target.type);
|
|
238
|
-
lastBulletList.apply(new AppendChildrenAction(target.children.slice(lastIndex + 1)));
|
|
239
|
-
target.parent.apply(new InsertChildrenBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
|
|
240
|
-
target.parent.apply(new RemoveChildrenAction(target));
|
|
241
|
-
}
|
|
242
|
-
selectedBlocks.map((block) => {
|
|
243
|
-
target.apply(new RemoveChildrenAction(block));
|
|
244
|
-
});
|
|
245
|
-
if (target.children.length === 0) {
|
|
246
|
-
target.parent.apply(new RemoveChildrenAction(target));
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
|
|
251
|
-
*
|
|
252
|
-
* @param {RTEListItemBlock} block - The block that will be covered
|
|
253
|
-
* @returns {RTETextBlock} Returns a `RTETextBlock`.
|
|
254
|
-
*/
|
|
255
|
-
toParagraph(block) {
|
|
256
|
-
const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
|
|
257
|
-
textBlock.apply(new AppendChildrenAction(block['children']));
|
|
258
|
-
textBlock['annotationMap'] = block['annotationMap'];
|
|
259
|
-
return textBlock;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Insert image to list block strategy.
|
|
265
|
-
*/
|
|
266
|
-
class ListInsertImageStrategy extends ActionHandleStrategy {
|
|
267
|
-
/**
|
|
268
|
-
* Insert image block at behind of the list item block.
|
|
269
|
-
*
|
|
270
|
-
* @param {InsertImageToBlockAction} action - The insert image action instance.
|
|
271
|
-
* @param {RTEListBlock} target - The list block.
|
|
272
|
-
*/
|
|
273
|
-
handleAction(action, target) {
|
|
274
|
-
const imageBlock = action.imageBlockToBeInserted;
|
|
275
|
-
if (target.parent['type'] !== 'list-item') {
|
|
276
|
-
target.parent.apply(new InsertChildrenAfterAction(target, imageBlock));
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
target.parent.apply(action);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* List annotation
|
|
286
|
-
*/
|
|
287
|
-
class ListAnnotation extends BlockAnnotation {
|
|
288
|
-
constructor() {
|
|
289
|
-
super(...arguments);
|
|
290
|
-
this.type = BlockAnnotationTypeEnum.LIST;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Get the default standalone styles for a list block.
|
|
294
|
-
*
|
|
295
|
-
* @returns {AnnotationStyle} The default styles.
|
|
296
|
-
*/
|
|
297
|
-
static getDefaultStyles() {
|
|
298
|
-
return {
|
|
299
|
-
paddingLeft: '8px',
|
|
300
|
-
marginLeft: '16px',
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* @inheritDoc
|
|
305
|
-
*/
|
|
306
|
-
renderStyle(options) {
|
|
307
|
-
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
308
|
-
return null;
|
|
309
|
-
return ListAnnotation.getDefaultStyles();
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* @inheritDoc
|
|
313
|
-
*/
|
|
314
|
-
renderClass(options) {
|
|
315
|
-
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
316
|
-
return null;
|
|
317
|
-
return 'v-rte--list';
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* @inheritDoc
|
|
321
|
-
*/
|
|
322
|
-
clone() {
|
|
323
|
-
return new ListAnnotation();
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* @inheritDoc
|
|
327
|
-
*/
|
|
328
|
-
toJSON() {
|
|
329
|
-
return undefined;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* List block
|
|
335
|
-
*/
|
|
336
|
-
class RTEListBlock extends RTEBlock {
|
|
337
|
-
constructor(id, type, options) {
|
|
338
|
-
super(id);
|
|
339
|
-
this.dtoName = RTEListBlock.dtoName;
|
|
340
|
-
this.type = 'bullet-list';
|
|
341
|
-
this.children = [];
|
|
342
|
-
this.type = type;
|
|
343
|
-
const { autoMatchFormat } = options || { autoMatchFormat: true };
|
|
344
|
-
if (autoMatchFormat) {
|
|
345
|
-
this.annotationMap.set(BlockAnnotationTypeEnum.LIST, new ListAnnotation());
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Converts a VegaRTEListBlock object to an RTEListBlock
|
|
350
|
-
*
|
|
351
|
-
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
|
|
352
|
-
* @param {VegaRTETransformOptions} options - Optional transformation options.
|
|
353
|
-
* @returns {RTEListBlock} Return an instance of `RTEListBlock`
|
|
354
|
-
*/
|
|
355
|
-
static from(block, options = { autoMatchFormat: true }) {
|
|
356
|
-
const listBlock = new RTEListBlock(block.id, block.type, options);
|
|
357
|
-
const { annotations } = block;
|
|
358
|
-
if (annotations) {
|
|
359
|
-
Object.entries(annotations).forEach(([type, value]) => {
|
|
360
|
-
const item = this.createAnnotationEntity(type, value);
|
|
361
|
-
if (isNonNullable(item)) {
|
|
362
|
-
listBlock.annotationMap.set(...item);
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
listBlock.children = block.blocks.map((item) => {
|
|
367
|
-
const listItemBlock = RTEListItemBlock.from(item, options);
|
|
368
|
-
listItemBlock.parent = listBlock;
|
|
369
|
-
return listItemBlock;
|
|
370
|
-
});
|
|
371
|
-
return listBlock;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
375
|
-
* and value.
|
|
376
|
-
*
|
|
377
|
-
* @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
|
|
378
|
-
* the type of annotation entity to create.
|
|
379
|
-
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
380
|
-
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
381
|
-
* annotation being created.
|
|
382
|
-
* @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
383
|
-
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
384
|
-
*/
|
|
385
|
-
static createAnnotationEntity(type, value) {
|
|
386
|
-
switch (type) {
|
|
387
|
-
case 'customAttribute':
|
|
388
|
-
return CustomAttributeAnnotation.from(value);
|
|
389
|
-
case 'customClass':
|
|
390
|
-
return CustomClassAnnotation.from(value);
|
|
391
|
-
case 'customStyle':
|
|
392
|
-
return CustomStyleAnnotation.from(value);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* @inheritDoc
|
|
397
|
-
*/
|
|
398
|
-
toJSON() {
|
|
399
|
-
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.children.map((block) => block.toJSON()) });
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* @inheritDoc
|
|
403
|
-
*/
|
|
404
|
-
toHtml(options) {
|
|
405
|
-
const BlockTag = this.getBlockTag();
|
|
406
|
-
const attrStr = super.generateAttributeString(options);
|
|
407
|
-
return [
|
|
408
|
-
`<${BlockTag}${attrStr}>`,
|
|
409
|
-
this.children.map((block) => block.toHtml(options)).join(''),
|
|
410
|
-
`</${BlockTag}>`,
|
|
411
|
-
].join('');
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* @inheritDoc
|
|
415
|
-
*/
|
|
416
|
-
isNotEmpty() {
|
|
417
|
-
return this.children.length > 0;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* @inheritDoc
|
|
421
|
-
*/
|
|
422
|
-
getLastNode() {
|
|
423
|
-
return this.children[this.children.length - 1].getLastNode();
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* @inheritDoc
|
|
427
|
-
*/
|
|
428
|
-
clone(parent) {
|
|
429
|
-
const clonedListBlock = new RTEListBlock(this.id, this.type);
|
|
430
|
-
clonedListBlock.children = this.children.map((item) => item.clone(clonedListBlock));
|
|
431
|
-
clonedListBlock.annotationMap = super.cloneAnnotations();
|
|
432
|
-
clonedListBlock.parent = parent;
|
|
433
|
-
return clonedListBlock;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Returns the block tag based on the type of the list block.
|
|
437
|
-
*
|
|
438
|
-
* @returns {RTEListBlockTagType} - The block tag for the list block, either 'ol' or 'ul'.
|
|
439
|
-
*/
|
|
440
|
-
getBlockTag() {
|
|
441
|
-
return this.type === 'number-list' ? 'ol' : 'ul';
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
(() => {
|
|
445
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
|
|
446
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
|
|
447
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
|
|
448
|
-
})();
|
|
449
|
-
RTEListBlock.dtoName = 'RTEListBlock';
|
|
450
|
-
|
|
451
11
|
/**
|
|
452
12
|
* Transform the selected text blocks to a code block strategy.
|
|
453
13
|
*/
|
|
@@ -1195,85 +755,6 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1195
755
|
})();
|
|
1196
756
|
RTEImageBlock.dtoName = 'RTEImageBlock';
|
|
1197
757
|
|
|
1198
|
-
/**
|
|
1199
|
-
* HTML Block
|
|
1200
|
-
*/
|
|
1201
|
-
class RTEHtmlBlock extends RTEBlock {
|
|
1202
|
-
constructor(id, htmlTag) {
|
|
1203
|
-
super(id);
|
|
1204
|
-
this.dtoName = RTEHtmlBlock.dtoName;
|
|
1205
|
-
this.type = 'html-block';
|
|
1206
|
-
this.children = [];
|
|
1207
|
-
this.htmlTag = htmlTag;
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Converts a VegaRTEHtmlBlock to an RTEHtmlBlock.
|
|
1211
|
-
*
|
|
1212
|
-
* @param {VegaRTEHtmlBlock} block - The VegaRTEHtmlBlock to convert.
|
|
1213
|
-
* @param {VegaRTETransformOptions} [options] - Optional transformation options.
|
|
1214
|
-
* @returns {RTEHtmlBlock} The converted RTEHtmlBlock.
|
|
1215
|
-
*/
|
|
1216
|
-
static from(block, options) {
|
|
1217
|
-
const htmlBlock = new RTEHtmlBlock(block.id, block.htmlTag);
|
|
1218
|
-
const { annotations } = block;
|
|
1219
|
-
if (annotations) {
|
|
1220
|
-
super.convertAnnotationsToMap(htmlBlock.annotationMap, annotations);
|
|
1221
|
-
}
|
|
1222
|
-
htmlBlock.children = this.generateBlockChildren(block.children, options, htmlBlock);
|
|
1223
|
-
return htmlBlock;
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* @inheritDoc
|
|
1227
|
-
*/
|
|
1228
|
-
clone(parent) {
|
|
1229
|
-
const clonedBlock = new RTEHtmlBlock(this.id, this.htmlTag);
|
|
1230
|
-
clonedBlock.children = this.children.map((child) => child.clone(clonedBlock));
|
|
1231
|
-
clonedBlock.annotationMap = super.cloneAnnotations();
|
|
1232
|
-
clonedBlock.parent = parent;
|
|
1233
|
-
return clonedBlock;
|
|
1234
|
-
}
|
|
1235
|
-
/**
|
|
1236
|
-
* @inheritDoc
|
|
1237
|
-
*/
|
|
1238
|
-
getLastNode() {
|
|
1239
|
-
return this.children[this.children.length - 1].getLastNode();
|
|
1240
|
-
}
|
|
1241
|
-
/**
|
|
1242
|
-
* @inheritDoc
|
|
1243
|
-
*/
|
|
1244
|
-
isNotEmpty() {
|
|
1245
|
-
// Any RTEHtmlBlock — whether void (hr, br), childless (canvas, iframe),
|
|
1246
|
-
// or with children — represents real user content. Only the default empty
|
|
1247
|
-
// text paragraph should make the editor report as empty.
|
|
1248
|
-
return true;
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* @inheritDoc
|
|
1252
|
-
*/
|
|
1253
|
-
toHtml(options) {
|
|
1254
|
-
const BlockTag = this.htmlTag;
|
|
1255
|
-
const attrStr = super.generateAttributeString(options);
|
|
1256
|
-
// Handle void/self-closing tags (hr, input, col, etc.)
|
|
1257
|
-
// Uses HTML5 syntax without self-closing slash for consistency with img and br tags
|
|
1258
|
-
if (HTML_VOID_TAGS.has(this.htmlTag)) {
|
|
1259
|
-
return `<${BlockTag}${attrStr}>`;
|
|
1260
|
-
}
|
|
1261
|
-
// Handle normal tags with children
|
|
1262
|
-
return [
|
|
1263
|
-
`<${BlockTag}${attrStr}>`,
|
|
1264
|
-
this.children.map((block) => block.toHtml(options)).join(''),
|
|
1265
|
-
`</${BlockTag}>`,
|
|
1266
|
-
].join('');
|
|
1267
|
-
}
|
|
1268
|
-
/**
|
|
1269
|
-
* @inheritDoc
|
|
1270
|
-
*/
|
|
1271
|
-
toJSON() {
|
|
1272
|
-
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, htmlTag: this.htmlTag, children: this.children.map((child) => child.toJSON()) });
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
RTEHtmlBlock.dtoName = 'RTEHtmlBlock';
|
|
1276
|
-
|
|
1277
758
|
/**
|
|
1278
759
|
* Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
|
|
1279
760
|
*
|
|
@@ -1325,6 +806,8 @@ class BlockDeleteTextOrDecoratorNodeStrategy extends BlockDeleteNodeContentStrat
|
|
|
1325
806
|
return;
|
|
1326
807
|
}
|
|
1327
808
|
else {
|
|
809
|
+
const nodeIndex = target.children.indexOf(startContainerNode);
|
|
810
|
+
const nextSiblingNode = target.children[nodeIndex + 1];
|
|
1328
811
|
const previousNode = this.getPreviousNode(startContainerNode);
|
|
1329
812
|
// Remove the last character will not delete paragraph, the paragraph will removed after press delete again
|
|
1330
813
|
if ((previousNode && previousNode.parent === target && previousNode['text'] === '\n') ||
|
|
@@ -1334,7 +817,14 @@ class BlockDeleteTextOrDecoratorNodeStrategy extends BlockDeleteNodeContentStrat
|
|
|
1334
817
|
}
|
|
1335
818
|
else {
|
|
1336
819
|
target.apply(new RemoveChildrenAction(startContainerNode));
|
|
1337
|
-
|
|
820
|
+
// If this was the first node, the previous node may belong to an ancestor list
|
|
821
|
+
// item. Keep the caret at the deletion boundary before the surviving sibling.
|
|
822
|
+
if (nextSiblingNode && (previousNode === null || previousNode === void 0 ? void 0 : previousNode.parent) !== target) {
|
|
823
|
+
action.nextNode = nextSiblingNode;
|
|
824
|
+
}
|
|
825
|
+
else {
|
|
826
|
+
action.previousNode = previousNode;
|
|
827
|
+
}
|
|
1338
828
|
return;
|
|
1339
829
|
}
|
|
1340
830
|
}
|
|
@@ -1712,19 +1202,6 @@ class ListItemInsertNewParagraphStrategy extends ActionHandleStrategy {
|
|
|
1712
1202
|
}
|
|
1713
1203
|
}
|
|
1714
1204
|
|
|
1715
|
-
/**
|
|
1716
|
-
* Delete the nest list block action
|
|
1717
|
-
*
|
|
1718
|
-
* @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
|
|
1719
|
-
*/
|
|
1720
|
-
class RemoveNestListAction extends ModifyContentAction {
|
|
1721
|
-
constructor(childList) {
|
|
1722
|
-
super();
|
|
1723
|
-
this.type = ModifyContentActionType.DELETE_NEST_LIST;
|
|
1724
|
-
this.nestListBlockToBeRemoved = childList;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
1205
|
/**
|
|
1729
1206
|
* List remove list item strategy.
|
|
1730
1207
|
*/
|
|
@@ -1736,18 +1213,94 @@ class ListRemoveListItemStrategy extends RemoveChildrenStrategy {
|
|
|
1736
1213
|
* @param {RTEListBlock} target - The list block.
|
|
1737
1214
|
*/
|
|
1738
1215
|
handleAction(action, target) {
|
|
1216
|
+
var _a, _b;
|
|
1217
|
+
const removingListItem = action.entityToBeRemoved instanceof RTEListItemBlock ? action.entityToBeRemoved : null;
|
|
1218
|
+
const removingIndex = removingListItem ? target.children.indexOf(removingListItem) : -1;
|
|
1219
|
+
if (((_a = removingListItem === null || removingListItem === void 0 ? void 0 : removingListItem.nestList) === null || _a === void 0 ? void 0 : _a.length) && removingIndex >= 0) {
|
|
1220
|
+
this.promoteNestListsToUpperLevel(removingListItem, target, removingIndex);
|
|
1221
|
+
}
|
|
1739
1222
|
super.handleAction(action, target);
|
|
1740
1223
|
const parent = target.parent;
|
|
1741
1224
|
if (target.children.length === 0 && parent) {
|
|
1742
1225
|
// The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
|
|
1743
1226
|
if (parent['type'] === 'list-item') {
|
|
1744
|
-
parent
|
|
1227
|
+
const parentListItem = parent;
|
|
1228
|
+
if ((_b = parentListItem.nestList) === null || _b === void 0 ? void 0 : _b.includes(target)) {
|
|
1229
|
+
parentListItem.apply(new RemoveNestListAction(target));
|
|
1230
|
+
}
|
|
1745
1231
|
}
|
|
1746
1232
|
else {
|
|
1747
1233
|
parent.apply(new RemoveChildrenAction(target));
|
|
1748
1234
|
}
|
|
1749
1235
|
}
|
|
1750
1236
|
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Promote nested lists of the list item being removed by one level.
|
|
1239
|
+
*
|
|
1240
|
+
* Same-type nested lists are flattened into the current (target) list to avoid
|
|
1241
|
+
* creating redundant list wrappers. Different-type nested lists stay nested under
|
|
1242
|
+
* the parent list item as siblings of the target list, positioned relative to the
|
|
1243
|
+
* target so document order is preserved. When the parent is the root content, the
|
|
1244
|
+
* different-type lists are inserted right after the target list instead.
|
|
1245
|
+
*
|
|
1246
|
+
* @param {RTEListItemBlock} removingListItem - The list item being removed.
|
|
1247
|
+
* @param {RTEListBlock} target - The list currently containing the item.
|
|
1248
|
+
* @param {number} removingIndex - The original index of the removing item.
|
|
1249
|
+
*/
|
|
1250
|
+
promoteNestListsToUpperLevel(removingListItem, target, removingIndex) {
|
|
1251
|
+
var _a, _b;
|
|
1252
|
+
const promotedLists = [...((_a = removingListItem.nestList) !== null && _a !== void 0 ? _a : [])];
|
|
1253
|
+
let insertionIndex = removingIndex + 1;
|
|
1254
|
+
const differentTypeLists = [];
|
|
1255
|
+
promotedLists.forEach((listBlock) => {
|
|
1256
|
+
if (listBlock.type === target.type) {
|
|
1257
|
+
const promotedItems = [...listBlock.children];
|
|
1258
|
+
if (promotedItems.length > 0) {
|
|
1259
|
+
promotedItems.forEach((item) => {
|
|
1260
|
+
item.parent = target;
|
|
1261
|
+
});
|
|
1262
|
+
target.children.splice(insertionIndex, 0, ...promotedItems);
|
|
1263
|
+
insertionIndex += promotedItems.length;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
differentTypeLists.push(listBlock);
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
const parent = target.parent;
|
|
1271
|
+
if (differentTypeLists.length > 0 && parent instanceof RTEListItemBlock) {
|
|
1272
|
+
// Different-type promoted lists stay nested under the parent item, as siblings
|
|
1273
|
+
// of the target list. When the removed item was merged into the parent, its
|
|
1274
|
+
// own nested lists follow it up one level and belong to the parent item — not
|
|
1275
|
+
// flattened into the grandparent list. Position them relative to the target so
|
|
1276
|
+
// document order is preserved.
|
|
1277
|
+
const currentNestLists = [...((_b = parent.nestList) !== null && _b !== void 0 ? _b : [])];
|
|
1278
|
+
const targetIndex = currentNestLists.indexOf(target);
|
|
1279
|
+
if (targetIndex >= 0) {
|
|
1280
|
+
// When removing the first item, its nested lists were visually above the
|
|
1281
|
+
// remaining items, so they must be placed before the target list to
|
|
1282
|
+
// preserve document order.
|
|
1283
|
+
const insertAt = removingIndex === 0 ? targetIndex : targetIndex + 1;
|
|
1284
|
+
currentNestLists.splice(insertAt, 0, ...differentTypeLists);
|
|
1285
|
+
}
|
|
1286
|
+
else {
|
|
1287
|
+
currentNestLists.push(...differentTypeLists);
|
|
1288
|
+
}
|
|
1289
|
+
parent.apply(new ReplaceNestListAction(currentNestLists));
|
|
1290
|
+
}
|
|
1291
|
+
else if (differentTypeLists.length > 0) {
|
|
1292
|
+
// Mirror the nested-parent ordering rule: when removing the first item,
|
|
1293
|
+
// its nested lists were visually above the remaining items, so insert
|
|
1294
|
+
// before the target to preserve document order.
|
|
1295
|
+
if (removingIndex === 0) {
|
|
1296
|
+
parent.apply(new InsertChildrenBeforeAction(target, ...differentTypeLists));
|
|
1297
|
+
}
|
|
1298
|
+
else {
|
|
1299
|
+
parent.apply(new InsertChildrenAfterAction(target, ...differentTypeLists));
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
removingListItem.apply(new ReplaceNestListAction([]));
|
|
1303
|
+
}
|
|
1751
1304
|
}
|
|
1752
1305
|
|
|
1753
1306
|
/** Handles pasted content in a block. */
|
|
@@ -3279,6 +2832,8 @@ class LiToRTEListItemBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
|
3279
2832
|
*/
|
|
3280
2833
|
appendChildBlocks(currentBlock, childBlocks) {
|
|
3281
2834
|
currentBlock.nestList = childBlocks.filter((block) => ['bullet-list', 'number-list'].includes(block.type));
|
|
2835
|
+
// Maintain bidirectional parent link so that nested list blocks can traverse up to the list item.
|
|
2836
|
+
currentBlock.nestList.forEach((block) => (block.parent = currentBlock));
|
|
3282
2837
|
}
|
|
3283
2838
|
/**
|
|
3284
2839
|
* Should continue process to child elements.
|
|
@@ -4006,11 +3561,15 @@ class ListBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
|
4006
3561
|
* @inheritDoc
|
|
4007
3562
|
*/
|
|
4008
3563
|
toCssText() {
|
|
4009
|
-
const
|
|
4010
|
-
|
|
4011
|
-
|
|
3564
|
+
const containerClass = RTEFilterStylesStrategy.RTE_CONTENT_CONTAINER_CLASS_NAME;
|
|
3565
|
+
const tags = this.elementTagName.split(',').map((tag) => tag.trim());
|
|
3566
|
+
const baseSelector = tags.map((tag) => `.${containerClass} ${tag}`).join(', ');
|
|
3567
|
+
const markerSelector = tags
|
|
3568
|
+
.map((tag) => `.${containerClass} ${tag} > li::marker`)
|
|
4012
3569
|
.join(', ');
|
|
4013
|
-
|
|
3570
|
+
const markerStyles = this.convertStylesMapToCssText(ListAnnotation.getDefaultMarkerStyles());
|
|
3571
|
+
return (`${baseSelector} { ${this.convertStylesMapToCssText(this.stylesToBeFiltered)} } ` +
|
|
3572
|
+
`${markerSelector} { ${markerStyles} }`);
|
|
4014
3573
|
}
|
|
4015
3574
|
}
|
|
4016
3575
|
|
|
@@ -4985,14 +4544,19 @@ class VegaRTEContent {
|
|
|
4985
4544
|
/**
|
|
4986
4545
|
* Convert text to list.
|
|
4987
4546
|
*
|
|
4988
|
-
* @param {RTETextBlock} block -
|
|
4547
|
+
* @param {RTETextBlock | RTEListItemBlock} block - Block to convert or rebuild.
|
|
4989
4548
|
* @returns {RTEListItemBlock} list item block dto.
|
|
4990
4549
|
*/
|
|
4991
4550
|
toListItem(block) {
|
|
4551
|
+
var _a;
|
|
4992
4552
|
block.children.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
4993
4553
|
const listItemBlock = new RTEListItemBlock(generateUUID());
|
|
4994
4554
|
listItemBlock.apply(new AppendChildrenAction(block['children']));
|
|
4995
4555
|
listItemBlock['annotationMap'] = block['annotationMap'];
|
|
4556
|
+
if (block instanceof RTEListItemBlock && ((_a = block.nestList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
4557
|
+
listItemBlock.apply(new ReplaceNestListAction([...block.nestList]));
|
|
4558
|
+
block.apply(new ReplaceNestListAction([]));
|
|
4559
|
+
}
|
|
4996
4560
|
return listItemBlock;
|
|
4997
4561
|
}
|
|
4998
4562
|
/**
|
|
@@ -5059,4 +4623,4 @@ class VegaRTEContent {
|
|
|
5059
4623
|
/** Minimize-safe type discriminator for VegaRTEContent. */
|
|
5060
4624
|
VegaRTEContent.dtoName = 'VegaRTEContent';
|
|
5061
4625
|
|
|
5062
|
-
export { AnnotationGeneratorStrategyAbstract as A, BlockToRTEBlockStrategyAbstract as B, ElementToDTOStrategy as E, InsertNewParagraphAction as I, MergeTwoBlocksNodesAction as M, PasteContentStrategy as P, RTEImageBlock as R, StylePreservator as S, UpdateCursorPositionAction as U, VegaRTEContent as V, InsertChildrenBeforeStrategy as a,
|
|
4626
|
+
export { AnnotationGeneratorStrategyAbstract as A, BlockToRTEBlockStrategyAbstract as B, ElementToDTOStrategy as E, InsertNewParagraphAction as I, MergeTwoBlocksNodesAction as M, PasteContentStrategy as P, RTEImageBlock as R, StylePreservator as S, UpdateCursorPositionAction as U, VegaRTEContent as V, InsertChildrenBeforeStrategy as a, RTEDTOActionStrategyManager$1 as b, ElementToDTOClassStrategyManager as c, RTEImageNode as d, ImageAnnotation as e, ElementToDtoStrategyProcessor$1 as f, htmlElementToAnnotationGenerator as h };
|