@globalpayments/vega 2.34.0 → 2.34.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-4e819773.js → app-globals-48582633.js} +2 -2
- package/dist/cjs/{content-state-3a2724f6.js → content-state-6a5b9736.js} +64 -294
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{text-color-toolbar-button-slimmer-b1c9f40e.js → text-color-toolbar-button-slimmer-21a166e4.js} +1 -1
- package/dist/cjs/{text-node-0d12da5a.js → text-node-494856f3.js} +0 -122
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +5 -2
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +2 -2
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +629 -416
- package/dist/cjs/vega-table_8.cjs.entry.js +1 -1
- package/dist/cjs/vega.cjs.js +3 -3
- package/dist/collection/components/vega-pagination/vega-pagination.js +5 -2
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +0 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +0 -44
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +0 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +0 -11
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +0 -26
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +0 -44
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +0 -11
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +0 -18
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +0 -13
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +0 -19
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +0 -27
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +2 -14
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +0 -32
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +258 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +71 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +85 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +56 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +7 -3
- package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.css +3 -0
- package/dist/esm/{app-globals-9971ccfd.js → app-globals-48531a04.js} +2 -2
- package/dist/esm/{content-state-acf55eb0.js → content-state-4b036bf1.js} +65 -295
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{text-color-toolbar-button-slimmer-d0255b98.js → text-color-toolbar-button-slimmer-b2270b64.js} +1 -1
- package/dist/esm/{text-node-6f7d736c.js → text-node-a652ca87.js} +0 -122
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-pagination.entry.js +5 -2
- package/dist/esm/vega-rich-text-content.entry.js +2 -2
- package/dist/esm/vega-rich-text-editor_4.entry.js +630 -417
- package/dist/esm/vega-table_8.entry.js +1 -1
- package/dist/esm/vega.js +3 -3
- package/dist/types/components/vega-pagination/vega-pagination.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +0 -8
- package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +0 -8
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +0 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +111 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +32 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +32 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +38 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.d.ts +35 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +31 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-d302f052.entry.js → p-0190095c.entry.js} +1 -1
- package/dist/vega/p-10393104.js +1 -0
- package/dist/vega/p-584dcd9b.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-c1d97d12.entry.js → p-734ea281.entry.js} +1 -1
- package/dist/vega/{p-49f4a666.js → p-8836c1b9.js} +1 -1
- package/dist/vega/p-8f004647.entry.js +1 -0
- package/dist/vega/p-9e732a26.entry.js +1 -0
- package/dist/vega/{p-2fc3af2f.js → p-9f39dd10.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.js +0 -135
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.js +0 -74
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.js +0 -47
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.js +0 -39
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.js +0 -50
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.js +0 -41
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.js +0 -57
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.js +0 -56
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.js +0 -77
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.js +0 -44
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.d.ts +0 -67
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.d.ts +0 -29
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.d.ts +0 -37
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.d.ts +0 -35
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.d.ts +0 -37
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.d.ts +0 -36
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.d.ts +0 -39
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.d.ts +0 -39
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.d.ts +0 -46
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.d.ts +0 -37
- package/dist/vega/p-315667f1.js +0 -1
- package/dist/vega/p-728b029a.entry.js +0 -1
- package/dist/vega/p-b6af0fc1.entry.js +0 -1
- package/dist/vega/p-e43c2a27.js +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { BlockToRTEBlockStrategyAbstract } from './block-to-rte-block-strategy.abstract';
|
|
2
|
+
import { generateUUID } from '../../../../../../utils/misc';
|
|
3
|
+
import { RTEImageBlock } from '../../../../dto/blocks/image-block';
|
|
4
|
+
/** Transform img in span or other inline element to image block DTO */
|
|
5
|
+
export class SpanImageToRTEImageBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
6
|
+
/**
|
|
7
|
+
* Can be handle.
|
|
8
|
+
*
|
|
9
|
+
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
10
|
+
* @param {number} currentIndex - Current element index.
|
|
11
|
+
* @returns {number} - can be handled element count.
|
|
12
|
+
*/
|
|
13
|
+
canHandle(elementsArray, currentIndex) {
|
|
14
|
+
const element = elementsArray[currentIndex];
|
|
15
|
+
return element.nodeType === Node.ELEMENT_NODE &&
|
|
16
|
+
element.textContent === '' &&
|
|
17
|
+
element.querySelector('img')
|
|
18
|
+
? 1
|
|
19
|
+
: 0;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse to a image block.
|
|
23
|
+
*
|
|
24
|
+
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
25
|
+
* @returns {Nullable<RTEContentBlock>} - Image block.
|
|
26
|
+
*/
|
|
27
|
+
handle(elementsArray) {
|
|
28
|
+
const element = elementsArray[0].querySelector('img');
|
|
29
|
+
return RTEImageBlock.from({
|
|
30
|
+
id: generateUUID(),
|
|
31
|
+
type: 'image',
|
|
32
|
+
nodes: [
|
|
33
|
+
{
|
|
34
|
+
id: generateUUID(),
|
|
35
|
+
type: 'image',
|
|
36
|
+
url: element.src,
|
|
37
|
+
annotations: {
|
|
38
|
+
size: 'md',
|
|
39
|
+
alt: element.alt,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
annotations: this.generateBlockAnnotations(element),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/* istanbul ignore next */
|
|
47
|
+
/**
|
|
48
|
+
* Append child blocks.
|
|
49
|
+
*/
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
51
|
+
appendChildBlocks() { }
|
|
52
|
+
/**
|
|
53
|
+
* Should continue process to child elements.
|
|
54
|
+
*
|
|
55
|
+
* @returns {boolean} - boolean.
|
|
56
|
+
*/
|
|
57
|
+
shouldProceedToElementChildren() {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { generateUUID } from '../../../../../../utils/misc';
|
|
2
|
+
import { RTEListBlock } from '../../../../dto/blocks/list-block';
|
|
3
|
+
import { BlockToRTEBlockStrategyAbstract } from './block-to-rte-block-strategy.abstract';
|
|
4
|
+
/** Transform ul element to list block DTO */
|
|
5
|
+
export class UlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
6
|
+
/**
|
|
7
|
+
* Can be handle.
|
|
8
|
+
*
|
|
9
|
+
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
10
|
+
* @param {number} currentIndex - Current element index.
|
|
11
|
+
* @returns {number} - can be handled element count.
|
|
12
|
+
*/
|
|
13
|
+
canHandle(elementsArray, currentIndex) {
|
|
14
|
+
return elementsArray[currentIndex].tagName === 'UL' ? 1 : 0;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse to a block.
|
|
18
|
+
*
|
|
19
|
+
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
20
|
+
* @returns {Nullable<RTEContentBlock>} - Bullet list block.
|
|
21
|
+
*/
|
|
22
|
+
handle(elementsArray) {
|
|
23
|
+
if (elementsArray[0].childNodes.length === 0)
|
|
24
|
+
return null;
|
|
25
|
+
return RTEListBlock.from({
|
|
26
|
+
id: generateUUID(),
|
|
27
|
+
type: 'bullet-list',
|
|
28
|
+
blocks: [],
|
|
29
|
+
annotations: this.generateBlockAnnotations(elementsArray[0]),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Append child list item blocks to current list block.
|
|
34
|
+
*
|
|
35
|
+
* @param {RTEListBlock} currentBlock - Current list block.
|
|
36
|
+
* @param {RTEListItemBlock[]} childBlocks - Current list item blocks.
|
|
37
|
+
*/
|
|
38
|
+
appendChildBlocks(currentBlock, childBlocks) {
|
|
39
|
+
currentBlock.blocks = childBlocks;
|
|
40
|
+
childBlocks.forEach((block) => (block.parent = currentBlock));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Should continue process to child elements.
|
|
44
|
+
*
|
|
45
|
+
* @returns {boolean} - boolean.
|
|
46
|
+
*/
|
|
47
|
+
shouldProceedToElementChildren() {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { generateUUID } from '../../../../../../utils/misc';
|
|
2
|
+
import { RTEImageBlock } from '../../../../dto/blocks/image-block';
|
|
3
|
+
import { BlockToRTEBlockStrategyAbstract } from './block-to-rte-block-strategy.abstract';
|
|
4
|
+
/** Transform vega-rich-text-image-editor element to image block DTO */
|
|
5
|
+
export class VegaImageToRTEImageBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
6
|
+
/**
|
|
7
|
+
* Can be handle.
|
|
8
|
+
*
|
|
9
|
+
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
10
|
+
* @param {number} currentIndex - Current element index.
|
|
11
|
+
* @returns {number} - can be handled element count.
|
|
12
|
+
*/
|
|
13
|
+
canHandle(elementsArray, currentIndex) {
|
|
14
|
+
return elementsArray[currentIndex].tagName === 'VEGA-RICH-TEXT-IMAGE-EDITOR' ? 1 : 0;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse to a image block.
|
|
18
|
+
*
|
|
19
|
+
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
20
|
+
* @returns {Nullable<RTEContentBlock>} - Image block.
|
|
21
|
+
*/
|
|
22
|
+
handle(elementsArray) {
|
|
23
|
+
const element = elementsArray[0];
|
|
24
|
+
const image = element.querySelector('img');
|
|
25
|
+
return RTEImageBlock.from({
|
|
26
|
+
id: generateUUID(),
|
|
27
|
+
type: 'image',
|
|
28
|
+
nodes: [
|
|
29
|
+
{
|
|
30
|
+
id: generateUUID(),
|
|
31
|
+
type: 'image',
|
|
32
|
+
url: image.src,
|
|
33
|
+
annotations: {
|
|
34
|
+
size: element.size || 'md',
|
|
35
|
+
alt: element.alt,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
annotations: this.generateBlockAnnotations(element),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/* istanbul ignore next */
|
|
43
|
+
/**
|
|
44
|
+
* Append child blocks.
|
|
45
|
+
*/
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
47
|
+
appendChildBlocks() { }
|
|
48
|
+
/**
|
|
49
|
+
* Should continue process to child elements.
|
|
50
|
+
*
|
|
51
|
+
* @returns {boolean} - boolean.
|
|
52
|
+
*/
|
|
53
|
+
shouldProceedToElementChildren() {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -2,15 +2,15 @@ import { BaseHandler } from './base-handler';
|
|
|
2
2
|
import { AppendChildNodesAction } from '../../../../dto/actions/append-child-nodes-action';
|
|
3
3
|
import { InsertBlocksAfterAction } from '../../../../dto/actions/insert-blocks-after-block';
|
|
4
4
|
import { SplitBlockWithNodeAction } from '../../../../dto/actions/split-block-with-node-action';
|
|
5
|
-
import { ElementToDTOProcessor } from '../element-to-dto-handler/element-to-dto-processor';
|
|
6
5
|
import { InsertBlocksBeforeAction } from '../../../../dto/actions/insert-blocks-before-block';
|
|
6
|
+
import { ElementToDtoStrategyProcessor } from '../element-to-dto-strategy/element-to-dto-strategy-processor';
|
|
7
7
|
/**
|
|
8
8
|
* Handle user paste
|
|
9
9
|
*/
|
|
10
10
|
export class InsertPasteHandler extends BaseHandler {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.elementToDTOProcessor = new
|
|
13
|
+
this.elementToDTOProcessor = new ElementToDtoStrategyProcessor();
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Update the state value when user paste html elements.
|
|
@@ -76,7 +76,11 @@ export class InsertPasteHandler extends BaseHandler {
|
|
|
76
76
|
const pastedHTML = event.dataTransfer.getData('text/html');
|
|
77
77
|
const tempContainer = document.createElement('div');
|
|
78
78
|
tempContainer.innerHTML = pastedHTML;
|
|
79
|
-
return this.elementToDTOProcessor
|
|
79
|
+
return this.elementToDTOProcessor
|
|
80
|
+
.process(Array.from(tempContainer.childNodes))
|
|
81
|
+
.filter(Boolean)
|
|
82
|
+
.map((output) => output.toDto())
|
|
83
|
+
.filter(Boolean);
|
|
80
84
|
}
|
|
81
85
|
/**
|
|
82
86
|
* Moves the caret to the next block element in a rich text editor.
|
|
@@ -97,12 +97,15 @@ th.break-word {
|
|
|
97
97
|
}
|
|
98
98
|
.vega-table-column.center {
|
|
99
99
|
justify-content: center;
|
|
100
|
+
text-align: center;
|
|
100
101
|
}
|
|
101
102
|
.vega-table-column.right {
|
|
102
103
|
justify-content: flex-end;
|
|
104
|
+
text-align: right;
|
|
103
105
|
}
|
|
104
106
|
.vega-table-column.left {
|
|
105
107
|
justify-content: flex-start;
|
|
108
|
+
text-align: left;
|
|
106
109
|
}
|
|
107
110
|
.vega-table-column .vega-table-column-label {
|
|
108
111
|
min-width: 0px;
|
|
@@ -9,8 +9,8 @@ import './ui-5600b48f.js';
|
|
|
9
9
|
import { V as VegaInternalTranslation, a as VegaTranslation, s as staticTranslations } from './translation-b3fe8e74.js';
|
|
10
10
|
import { T as TypographyUrls } from './typography-396de03f.js';
|
|
11
11
|
import { V as ValidCreditCardNumberRule } from './valid-credit-card-number-rule-2aef3ad5.js';
|
|
12
|
-
import { w as waitForVega } from './text-node-
|
|
13
|
-
import { V as VegaRTEContent } from './content-state-
|
|
12
|
+
import { w as waitForVega } from './text-node-a652ca87.js';
|
|
13
|
+
import { V as VegaRTEContent } from './content-state-4b036bf1.js';
|
|
14
14
|
import { U as UPDATE_TRANSLATION } from './static-subject-title-e06a3840.js';
|
|
15
15
|
import { C as ChangeManager } from './change-manager-8f5b72c2.js';
|
|
16
16
|
import { O as Observer } from './dom-node-subject-observer-factory-80358591.js';
|
|
@@ -5,7 +5,7 @@ import { d as domNodeSubjectFactory, D as DomNodeSubjectObserverFactory, V as Ve
|
|
|
5
5
|
import { M as ModifyContentAction, b as ModifyContentActionType, s as stateEntityRenderingRegistry, N as NodeAnnotation, a as NodeAnnotationTypeEnum, R as RTENode, c as NodeTypeEnum, I as InternalAnnotationTypeEnum } from './node.abstract-93746055.js';
|
|
6
6
|
import { V as VegaInternalRichTextEditorFlushChanges } from './vega-internal-event-id-4af5c6e9.js';
|
|
7
7
|
import { i as isNonNullable } from './type-guard-158f6d7a.js';
|
|
8
|
-
import { Z as ZERO_WIDTH_SPACE, A as AnnotationAction, T as TextSplittableAction, B as BoldAnnotation, R as RTETextNode, L as LinkAnnotationAction, D as DeleteNodeAnnotationAction, a as LinkGroupAnnotationAction, U as UpdateTextAction, S as SyncUpSelectionAction } from './text-node-
|
|
8
|
+
import { Z as ZERO_WIDTH_SPACE, A as AnnotationAction, T as TextSplittableAction, B as BoldAnnotation, R as RTETextNode, L as LinkAnnotationAction, D as DeleteNodeAnnotationAction, a as LinkGroupAnnotationAction, U as UpdateTextAction, S as SyncUpSelectionAction } from './text-node-a652ca87.js';
|
|
9
9
|
import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-14cb4599.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -26,50 +26,6 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
|
|
|
26
26
|
static from(textAlign) {
|
|
27
27
|
return [BlockAnnotationTypeEnum.ALIGNMENT, new HorizontalAlignmentAnnotation(textAlign)];
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Generate the map item for the annotation by html element
|
|
31
|
-
*
|
|
32
|
-
* @param {HTMLElement} node - An html element.
|
|
33
|
-
* @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
|
|
34
|
-
*/
|
|
35
|
-
static fromHTML(node) {
|
|
36
|
-
const alignment = this.getTextAlign(node);
|
|
37
|
-
return alignment ? this.from(alignment) : null;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get the text alignment of an HTML element.
|
|
41
|
-
*
|
|
42
|
-
* @param {HTMLElement} node - An HTMLElement.
|
|
43
|
-
* @returns {Nullable<VegaRTEBlockAlignment>} text alignment.
|
|
44
|
-
*/
|
|
45
|
-
static getTextAlign(node) {
|
|
46
|
-
const classList = node.classList;
|
|
47
|
-
if (classList.contains(`v-rte--horizontal-alignment-left`)) {
|
|
48
|
-
return 'left';
|
|
49
|
-
}
|
|
50
|
-
else if (classList.contains(`v-rte--horizontal-alignment-center`)) {
|
|
51
|
-
return 'center';
|
|
52
|
-
}
|
|
53
|
-
else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
|
|
54
|
-
return 'right';
|
|
55
|
-
}
|
|
56
|
-
else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
|
|
57
|
-
return 'justify';
|
|
58
|
-
}
|
|
59
|
-
const style = node.style;
|
|
60
|
-
switch (style.textAlign) {
|
|
61
|
-
case 'center':
|
|
62
|
-
return 'center';
|
|
63
|
-
case 'right':
|
|
64
|
-
return 'right';
|
|
65
|
-
case 'justify':
|
|
66
|
-
return 'justify';
|
|
67
|
-
case 'left':
|
|
68
|
-
return 'left';
|
|
69
|
-
default:
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
29
|
/**
|
|
74
30
|
* Generate the JSON item of the annotation
|
|
75
31
|
*
|
|
@@ -116,48 +72,6 @@ class IndentAnnotation extends BlockAnnotation {
|
|
|
116
72
|
static from(indent) {
|
|
117
73
|
return [BlockAnnotationTypeEnum.INDENT, new IndentAnnotation(indent)];
|
|
118
74
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Generate the map item for the annotation by html element
|
|
121
|
-
*
|
|
122
|
-
* @param {HTMLElement} node - An html element.
|
|
123
|
-
* @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
|
|
124
|
-
*/
|
|
125
|
-
static fromHTML(node) {
|
|
126
|
-
const marginLeft = this.getMarginLeft(node);
|
|
127
|
-
return marginLeft && marginLeft >= 0 ? this.from(Math.floor(marginLeft / 16)) : null;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Retrieves the left margin value of an HTML element.
|
|
131
|
-
*
|
|
132
|
-
* @param {HTMLElement} node - An html element.
|
|
133
|
-
* @returns {number} margin left.
|
|
134
|
-
*/
|
|
135
|
-
static getMarginLeft(node) {
|
|
136
|
-
const style = node.style;
|
|
137
|
-
let marginLeft;
|
|
138
|
-
if (style.marginLeft) {
|
|
139
|
-
marginLeft = style.marginLeft;
|
|
140
|
-
}
|
|
141
|
-
else if (style.margin) {
|
|
142
|
-
const margins = style.margin.split(' ');
|
|
143
|
-
switch (margins.length) {
|
|
144
|
-
case 4:
|
|
145
|
-
marginLeft = margins[3];
|
|
146
|
-
break;
|
|
147
|
-
case 2:
|
|
148
|
-
case 3:
|
|
149
|
-
marginLeft = margins[1];
|
|
150
|
-
break;
|
|
151
|
-
default:
|
|
152
|
-
marginLeft = margins[0];
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
return Number(marginLeft.replace('px', ''));
|
|
160
|
-
}
|
|
161
75
|
/**
|
|
162
76
|
* Generate the JSON item of the annotation
|
|
163
77
|
*
|
|
@@ -247,109 +161,6 @@ class RemoveChildAction extends ModifyContentAction {
|
|
|
247
161
|
}
|
|
248
162
|
}
|
|
249
163
|
|
|
250
|
-
/**
|
|
251
|
-
* Text style annotation
|
|
252
|
-
*/
|
|
253
|
-
class TextStyleAnnotation extends BlockAnnotation {
|
|
254
|
-
constructor(textStyle) {
|
|
255
|
-
super();
|
|
256
|
-
this.type = BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
257
|
-
this.textStyle = textStyle;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Generate the map item for the annotations
|
|
261
|
-
*
|
|
262
|
-
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
263
|
-
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
264
|
-
*/
|
|
265
|
-
static from(textStyle) {
|
|
266
|
-
return [BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Generate the map item for the annotation by html element
|
|
270
|
-
*
|
|
271
|
-
* @param {HTMLElement} node - An html element.
|
|
272
|
-
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
273
|
-
*/
|
|
274
|
-
static fromHTML(node) {
|
|
275
|
-
return this.from(this.getTextStyle(node));
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Get the type of block.
|
|
279
|
-
*
|
|
280
|
-
* @param {HTMLElement} node - An HTMLElement.
|
|
281
|
-
* @returns {VegaRTETextStyleType} text style type.
|
|
282
|
-
*/
|
|
283
|
-
static getTextStyle(node) {
|
|
284
|
-
if (node.nodeType !== Node.TEXT_NODE && node.hasAttribute('data-type')) {
|
|
285
|
-
return node.getAttribute('data-type');
|
|
286
|
-
}
|
|
287
|
-
switch (node.style.fontSize) {
|
|
288
|
-
case '36px':
|
|
289
|
-
return 'title';
|
|
290
|
-
case '28px':
|
|
291
|
-
return 'subtitle';
|
|
292
|
-
case '22px':
|
|
293
|
-
return 'heading-1';
|
|
294
|
-
case '20px':
|
|
295
|
-
return 'heading-2';
|
|
296
|
-
case '18px':
|
|
297
|
-
return 'heading-3';
|
|
298
|
-
}
|
|
299
|
-
switch (node.nodeName) {
|
|
300
|
-
case 'H1':
|
|
301
|
-
return 'heading-1';
|
|
302
|
-
case 'H2':
|
|
303
|
-
return 'heading-2';
|
|
304
|
-
case 'H3':
|
|
305
|
-
return 'heading-3';
|
|
306
|
-
default:
|
|
307
|
-
return 'paragraph';
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Generate the JSON representation of the annotation
|
|
312
|
-
*
|
|
313
|
-
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
314
|
-
*/
|
|
315
|
-
toJSON() {
|
|
316
|
-
return { textStyle: this.textStyle };
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Render the styles by block type
|
|
320
|
-
*
|
|
321
|
-
* @returns {AnnotationStyle} the styles to apply
|
|
322
|
-
*/
|
|
323
|
-
render() {
|
|
324
|
-
const paragraphStyle = {
|
|
325
|
-
fontFamily: 'Inter',
|
|
326
|
-
fontSize: '16px',
|
|
327
|
-
lineHeight: '22px',
|
|
328
|
-
fontWeight: '500',
|
|
329
|
-
};
|
|
330
|
-
switch (this.textStyle) {
|
|
331
|
-
case 'paragraph': {
|
|
332
|
-
return paragraphStyle;
|
|
333
|
-
}
|
|
334
|
-
case 'title': {
|
|
335
|
-
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
336
|
-
}
|
|
337
|
-
case 'subtitle': {
|
|
338
|
-
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
339
|
-
}
|
|
340
|
-
case 'heading-1': {
|
|
341
|
-
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
342
|
-
}
|
|
343
|
-
case 'heading-2': {
|
|
344
|
-
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
345
|
-
}
|
|
346
|
-
case 'heading-3': {
|
|
347
|
-
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
164
|
/**
|
|
354
165
|
* Abstract class for block
|
|
355
166
|
*/
|
|
@@ -379,23 +190,6 @@ class RTEBlock extends BlockBaseOperator {
|
|
|
379
190
|
return IndentAnnotation.from(value);
|
|
380
191
|
}
|
|
381
192
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Create annotations for block element.
|
|
384
|
-
*
|
|
385
|
-
* @param {string} type - Annotations type.
|
|
386
|
-
* @param {HTMLElement} node - current node.
|
|
387
|
-
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} - result.
|
|
388
|
-
*/
|
|
389
|
-
static createAnnotationEntityFromHTML(type, node) {
|
|
390
|
-
switch (type) {
|
|
391
|
-
case 'ALIGNMENT':
|
|
392
|
-
return HorizontalAlignmentAnnotation.fromHTML(node);
|
|
393
|
-
case 'TEXT_STYLE':
|
|
394
|
-
return TextStyleAnnotation.fromHTML(node);
|
|
395
|
-
case 'INDENT':
|
|
396
|
-
return IndentAnnotation.fromHTML(node);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
193
|
/**
|
|
400
194
|
* Class to JSON object
|
|
401
195
|
*
|
|
@@ -711,16 +505,6 @@ class ImageAnnotation extends NodeAnnotation {
|
|
|
711
505
|
static from(size, alt) {
|
|
712
506
|
return [NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
|
|
713
507
|
}
|
|
714
|
-
/**
|
|
715
|
-
* Generate the map item for the annotation
|
|
716
|
-
*
|
|
717
|
-
* @param {VegaRichTextImageEditorSizeType} size - size.
|
|
718
|
-
* @param {string} alt - alt.
|
|
719
|
-
* @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
|
|
720
|
-
*/
|
|
721
|
-
static fromHTML(size, alt) {
|
|
722
|
-
return this.from(size || 'md', alt);
|
|
723
|
-
}
|
|
724
508
|
/**
|
|
725
509
|
* Generate the JSON representation of the annotation
|
|
726
510
|
*
|
|
@@ -797,15 +581,6 @@ class RTEImageNode extends RTENode {
|
|
|
797
581
|
.filter(isNonNullable));
|
|
798
582
|
return imageNode;
|
|
799
583
|
}
|
|
800
|
-
static fromHTML(node, parentBlock) {
|
|
801
|
-
const src = node.nodeName === 'IMG'
|
|
802
|
-
? node.src
|
|
803
|
-
: node.querySelector('img').src;
|
|
804
|
-
const size = node.size;
|
|
805
|
-
const imageNode = new RTEImageNode(generateUUID(), src, parentBlock);
|
|
806
|
-
imageNode.annotationMap = new Map([ImageAnnotation.fromHTML(size, node.alt)]);
|
|
807
|
-
return imageNode;
|
|
808
|
-
}
|
|
809
584
|
toJSON() {
|
|
810
585
|
const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
|
|
811
586
|
const annotations = {};
|
|
@@ -910,6 +685,67 @@ class SplitBlockWithNodeAction extends ModifyContentAction {
|
|
|
910
685
|
}
|
|
911
686
|
}
|
|
912
687
|
|
|
688
|
+
/**
|
|
689
|
+
* Text style annotation
|
|
690
|
+
*/
|
|
691
|
+
class TextStyleAnnotation extends BlockAnnotation {
|
|
692
|
+
constructor(textStyle) {
|
|
693
|
+
super();
|
|
694
|
+
this.type = BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
695
|
+
this.textStyle = textStyle;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Generate the map item for the annotations
|
|
699
|
+
*
|
|
700
|
+
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
701
|
+
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
702
|
+
*/
|
|
703
|
+
static from(textStyle) {
|
|
704
|
+
return [BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Generate the JSON representation of the annotation
|
|
708
|
+
*
|
|
709
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
710
|
+
*/
|
|
711
|
+
toJSON() {
|
|
712
|
+
return { textStyle: this.textStyle };
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Render the styles by block type
|
|
716
|
+
*
|
|
717
|
+
* @returns {AnnotationStyle} the styles to apply
|
|
718
|
+
*/
|
|
719
|
+
render() {
|
|
720
|
+
const paragraphStyle = {
|
|
721
|
+
fontFamily: 'Inter',
|
|
722
|
+
fontSize: '16px',
|
|
723
|
+
lineHeight: '22px',
|
|
724
|
+
fontWeight: '500',
|
|
725
|
+
};
|
|
726
|
+
switch (this.textStyle) {
|
|
727
|
+
case 'paragraph': {
|
|
728
|
+
return paragraphStyle;
|
|
729
|
+
}
|
|
730
|
+
case 'title': {
|
|
731
|
+
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
732
|
+
}
|
|
733
|
+
case 'subtitle': {
|
|
734
|
+
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
735
|
+
}
|
|
736
|
+
case 'heading-1': {
|
|
737
|
+
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
738
|
+
}
|
|
739
|
+
case 'heading-2': {
|
|
740
|
+
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
741
|
+
}
|
|
742
|
+
case 'heading-3': {
|
|
743
|
+
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
913
749
|
/**
|
|
914
750
|
* Action to change the text style of a block
|
|
915
751
|
*/
|
|
@@ -985,10 +821,10 @@ class RTETextBlock extends RTEBlock {
|
|
|
985
821
|
this.nodes = [];
|
|
986
822
|
this.type = type;
|
|
987
823
|
if (RTETextBlock.isAcceptableTextStyle(type)) {
|
|
988
|
-
|
|
824
|
+
this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
|
|
989
825
|
}
|
|
990
826
|
else {
|
|
991
|
-
|
|
827
|
+
this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
992
828
|
}
|
|
993
829
|
}
|
|
994
830
|
static from(block) {
|
|
@@ -1005,17 +841,6 @@ class RTETextBlock extends RTEBlock {
|
|
|
1005
841
|
}
|
|
1006
842
|
return textBlock;
|
|
1007
843
|
}
|
|
1008
|
-
static fromHTML(node, blockType) {
|
|
1009
|
-
const textBlock = new RTETextBlock(generateUUID(), blockType);
|
|
1010
|
-
textBlock.nodes = Array.from(node.childNodes).map((item) => RTETextNode.fromHTML(item, textBlock));
|
|
1011
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1012
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1013
|
-
if (isNonNullable(item)) {
|
|
1014
|
-
textBlock.annotationMap.set(...item);
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
return textBlock;
|
|
1018
|
-
}
|
|
1019
844
|
/**
|
|
1020
845
|
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
1021
846
|
* and value.
|
|
@@ -1400,18 +1225,6 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1400
1225
|
}
|
|
1401
1226
|
return imageBlock;
|
|
1402
1227
|
}
|
|
1403
|
-
static fromHTML(node) {
|
|
1404
|
-
const nodes = node.nodeName === 'IMG' ? [node] : Array.from(node.children);
|
|
1405
|
-
const imageBlock = new RTEImageBlock(generateUUID());
|
|
1406
|
-
imageBlock.nodes = nodes.map((item) => RTEImageNode.fromHTML(item, imageBlock));
|
|
1407
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1408
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1409
|
-
if (isNonNullable(item)) {
|
|
1410
|
-
imageBlock.annotationMap.set(...item);
|
|
1411
|
-
}
|
|
1412
|
-
});
|
|
1413
|
-
return imageBlock;
|
|
1414
|
-
}
|
|
1415
1228
|
toJSON() {
|
|
1416
1229
|
return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
|
|
1417
1230
|
}
|
|
@@ -1649,32 +1462,6 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1649
1462
|
}
|
|
1650
1463
|
return listItemBlock;
|
|
1651
1464
|
}
|
|
1652
|
-
static fromHTML(node) {
|
|
1653
|
-
const listItem = new RTEListItemBlock(generateUUID());
|
|
1654
|
-
listItem.nodes = Array.from(node.childNodes)
|
|
1655
|
-
.map((item) => {
|
|
1656
|
-
if (!['UL', 'OL'].includes(item.nodeName)) {
|
|
1657
|
-
return RTETextNode.fromHTML(item, listItem);
|
|
1658
|
-
}
|
|
1659
|
-
})
|
|
1660
|
-
.filter(Boolean);
|
|
1661
|
-
listItem.children = Array.from(node.childNodes)
|
|
1662
|
-
.map((item) => {
|
|
1663
|
-
if (['UL', 'OL'].includes(item.nodeName)) {
|
|
1664
|
-
const listBlock = RTEListBlock.fromHTML(item);
|
|
1665
|
-
listBlock && (listBlock.parent = listItem);
|
|
1666
|
-
return listBlock;
|
|
1667
|
-
}
|
|
1668
|
-
})
|
|
1669
|
-
.filter(Boolean);
|
|
1670
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1671
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1672
|
-
if (isNonNullable(item)) {
|
|
1673
|
-
listItem.annotationMap.set(...item);
|
|
1674
|
-
}
|
|
1675
|
-
});
|
|
1676
|
-
return listItem;
|
|
1677
|
-
}
|
|
1678
1465
|
toJSON() {
|
|
1679
1466
|
var _a;
|
|
1680
1467
|
return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
|
|
@@ -1875,23 +1662,6 @@ class RTEListBlock extends RTEBlock {
|
|
|
1875
1662
|
});
|
|
1876
1663
|
return listBlock;
|
|
1877
1664
|
}
|
|
1878
|
-
static fromHTML(node) {
|
|
1879
|
-
const listBlock = new RTEListBlock(generateUUID(), node.nodeName === 'UL' ? 'bullet-list' : 'number-list');
|
|
1880
|
-
listBlock.blocks = Array.from(node.children)
|
|
1881
|
-
.map((item) => {
|
|
1882
|
-
const listItemBlock = RTEListItemBlock.fromHTML(item);
|
|
1883
|
-
listItemBlock && (listItemBlock.parent = listBlock);
|
|
1884
|
-
return listItemBlock;
|
|
1885
|
-
})
|
|
1886
|
-
.filter(Boolean);
|
|
1887
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1888
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1889
|
-
if (isNonNullable(item)) {
|
|
1890
|
-
listBlock.annotationMap.set(...item);
|
|
1891
|
-
}
|
|
1892
|
-
});
|
|
1893
|
-
return listBlock;
|
|
1894
|
-
}
|
|
1895
1665
|
toJSON() {
|
|
1896
1666
|
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
1897
1667
|
}
|
|
@@ -2161,4 +1931,4 @@ class VegaRTEContent extends BlockBaseOperator {
|
|
|
2161
1931
|
}
|
|
2162
1932
|
}
|
|
2163
1933
|
|
|
2164
|
-
export { AppendChildNodesAction as A, BoldAnnotationAction as B, HorizontalAlignmentAnnotation as H, IndentAnnotation as I, MergeTwoBlocksNodesAction as M, RTETextBlock as R, SplitBlockWithNodeAction as S, TextStyleAnnotationAction as T, VegaRTEContent as V, TextStyleAnnotation as a, RTEImageNode as b, RTEListItemBlock as c, RemoveChildAction as d, InsertBlocksBeforeAction as e, ReplaceChildNodesAction as f,
|
|
1934
|
+
export { AppendChildNodesAction as A, BoldAnnotationAction as B, HorizontalAlignmentAnnotation as H, IndentAnnotation as I, MergeTwoBlocksNodesAction as M, RTETextBlock as R, SplitBlockWithNodeAction as S, TextStyleAnnotationAction as T, VegaRTEContent as V, TextStyleAnnotation as a, RTEImageNode as b, RTEListItemBlock as c, RemoveChildAction as d, InsertBlocksBeforeAction as e, ReplaceChildNodesAction as f, RTEListBlock as g, RTEImageBlock as h, InsertBlocksAfterAction as i, ImageAnnotationAction as j };
|
package/dist/esm/index.js
CHANGED
|
@@ -15,9 +15,9 @@ export { V as VegaDialog } from './vega-dialog-controller-5b23f68c.js';
|
|
|
15
15
|
export { B as VegaJQueryDelegatedEventStrategy } from './internal-vega-event-manager-3a3815d3.js';
|
|
16
16
|
export { V as VegaIconManager } from './icon-manager-3cef32e7.js';
|
|
17
17
|
export { V as ValidCreditCardNumberRule } from './valid-credit-card-number-rule-2aef3ad5.js';
|
|
18
|
-
export { w as waitForVega } from './text-node-
|
|
18
|
+
export { w as waitForVega } from './text-node-a652ca87.js';
|
|
19
19
|
export { a as VegaTranslation, s as VegaTranslationResourceEN } from './translation-b3fe8e74.js';
|
|
20
|
-
export { V as VegaRTEContent } from './content-state-
|
|
20
|
+
export { V as VegaRTEContent } from './content-state-4b036bf1.js';
|
|
21
21
|
import './responsive-format-facade-559ec469.js';
|
|
22
22
|
import './number-4398f2e1.js';
|
|
23
23
|
import './pixel-f32c07ce.js';
|