@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
|
@@ -11,8 +11,8 @@ require('./ui-b5906704.js');
|
|
|
11
11
|
const translation = require('./translation-f6b7ee84.js');
|
|
12
12
|
const typography = require('./typography-4560e7f1.js');
|
|
13
13
|
const validCreditCardNumberRule = require('./valid-credit-card-number-rule-4a9ae5d9.js');
|
|
14
|
-
const textNode = require('./text-node-
|
|
15
|
-
const contentState = require('./content-state-
|
|
14
|
+
const textNode = require('./text-node-494856f3.js');
|
|
15
|
+
const contentState = require('./content-state-6a5b9736.js');
|
|
16
16
|
const staticSubjectTitle = require('./static-subject-title-d66b88fb.js');
|
|
17
17
|
const changeManager = require('./change-manager-bda1d107.js');
|
|
18
18
|
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-093462f1.js');
|
|
@@ -7,7 +7,7 @@ const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-facto
|
|
|
7
7
|
const node_abstract = require('./node.abstract-f8075f84.js');
|
|
8
8
|
const vegaInternalEventId = require('./vega-internal-event-id-85b68849.js');
|
|
9
9
|
const typeGuard = require('./type-guard-4ba85fdc.js');
|
|
10
|
-
const textNode = require('./text-node-
|
|
10
|
+
const textNode = require('./text-node-494856f3.js');
|
|
11
11
|
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-8c6a8fb7.js');
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -28,50 +28,6 @@ class HorizontalAlignmentAnnotation extends blockAnnotation_abstract.BlockAnnota
|
|
|
28
28
|
static from(textAlign) {
|
|
29
29
|
return [blockAnnotation_abstract.BlockAnnotationTypeEnum.ALIGNMENT, new HorizontalAlignmentAnnotation(textAlign)];
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Generate the map item for the annotation by html element
|
|
33
|
-
*
|
|
34
|
-
* @param {HTMLElement} node - An html element.
|
|
35
|
-
* @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
|
|
36
|
-
*/
|
|
37
|
-
static fromHTML(node) {
|
|
38
|
-
const alignment = this.getTextAlign(node);
|
|
39
|
-
return alignment ? this.from(alignment) : null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get the text alignment of an HTML element.
|
|
43
|
-
*
|
|
44
|
-
* @param {HTMLElement} node - An HTMLElement.
|
|
45
|
-
* @returns {Nullable<VegaRTEBlockAlignment>} text alignment.
|
|
46
|
-
*/
|
|
47
|
-
static getTextAlign(node) {
|
|
48
|
-
const classList = node.classList;
|
|
49
|
-
if (classList.contains(`v-rte--horizontal-alignment-left`)) {
|
|
50
|
-
return 'left';
|
|
51
|
-
}
|
|
52
|
-
else if (classList.contains(`v-rte--horizontal-alignment-center`)) {
|
|
53
|
-
return 'center';
|
|
54
|
-
}
|
|
55
|
-
else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
|
|
56
|
-
return 'right';
|
|
57
|
-
}
|
|
58
|
-
else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
|
|
59
|
-
return 'justify';
|
|
60
|
-
}
|
|
61
|
-
const style = node.style;
|
|
62
|
-
switch (style.textAlign) {
|
|
63
|
-
case 'center':
|
|
64
|
-
return 'center';
|
|
65
|
-
case 'right':
|
|
66
|
-
return 'right';
|
|
67
|
-
case 'justify':
|
|
68
|
-
return 'justify';
|
|
69
|
-
case 'left':
|
|
70
|
-
return 'left';
|
|
71
|
-
default:
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
31
|
/**
|
|
76
32
|
* Generate the JSON item of the annotation
|
|
77
33
|
*
|
|
@@ -118,48 +74,6 @@ class IndentAnnotation extends blockAnnotation_abstract.BlockAnnotation {
|
|
|
118
74
|
static from(indent) {
|
|
119
75
|
return [blockAnnotation_abstract.BlockAnnotationTypeEnum.INDENT, new IndentAnnotation(indent)];
|
|
120
76
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Generate the map item for the annotation by html element
|
|
123
|
-
*
|
|
124
|
-
* @param {HTMLElement} node - An html element.
|
|
125
|
-
* @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
|
|
126
|
-
*/
|
|
127
|
-
static fromHTML(node) {
|
|
128
|
-
const marginLeft = this.getMarginLeft(node);
|
|
129
|
-
return marginLeft && marginLeft >= 0 ? this.from(Math.floor(marginLeft / 16)) : null;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Retrieves the left margin value of an HTML element.
|
|
133
|
-
*
|
|
134
|
-
* @param {HTMLElement} node - An html element.
|
|
135
|
-
* @returns {number} margin left.
|
|
136
|
-
*/
|
|
137
|
-
static getMarginLeft(node) {
|
|
138
|
-
const style = node.style;
|
|
139
|
-
let marginLeft;
|
|
140
|
-
if (style.marginLeft) {
|
|
141
|
-
marginLeft = style.marginLeft;
|
|
142
|
-
}
|
|
143
|
-
else if (style.margin) {
|
|
144
|
-
const margins = style.margin.split(' ');
|
|
145
|
-
switch (margins.length) {
|
|
146
|
-
case 4:
|
|
147
|
-
marginLeft = margins[3];
|
|
148
|
-
break;
|
|
149
|
-
case 2:
|
|
150
|
-
case 3:
|
|
151
|
-
marginLeft = margins[1];
|
|
152
|
-
break;
|
|
153
|
-
default:
|
|
154
|
-
marginLeft = margins[0];
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
return Number(marginLeft.replace('px', ''));
|
|
162
|
-
}
|
|
163
77
|
/**
|
|
164
78
|
* Generate the JSON item of the annotation
|
|
165
79
|
*
|
|
@@ -249,109 +163,6 @@ class RemoveChildAction extends node_abstract.ModifyContentAction {
|
|
|
249
163
|
}
|
|
250
164
|
}
|
|
251
165
|
|
|
252
|
-
/**
|
|
253
|
-
* Text style annotation
|
|
254
|
-
*/
|
|
255
|
-
class TextStyleAnnotation extends blockAnnotation_abstract.BlockAnnotation {
|
|
256
|
-
constructor(textStyle) {
|
|
257
|
-
super();
|
|
258
|
-
this.type = blockAnnotation_abstract.BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
259
|
-
this.textStyle = textStyle;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Generate the map item for the annotations
|
|
263
|
-
*
|
|
264
|
-
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
265
|
-
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
266
|
-
*/
|
|
267
|
-
static from(textStyle) {
|
|
268
|
-
return [blockAnnotation_abstract.BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Generate the map item for the annotation by html element
|
|
272
|
-
*
|
|
273
|
-
* @param {HTMLElement} node - An html element.
|
|
274
|
-
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
275
|
-
*/
|
|
276
|
-
static fromHTML(node) {
|
|
277
|
-
return this.from(this.getTextStyle(node));
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Get the type of block.
|
|
281
|
-
*
|
|
282
|
-
* @param {HTMLElement} node - An HTMLElement.
|
|
283
|
-
* @returns {VegaRTETextStyleType} text style type.
|
|
284
|
-
*/
|
|
285
|
-
static getTextStyle(node) {
|
|
286
|
-
if (node.nodeType !== Node.TEXT_NODE && node.hasAttribute('data-type')) {
|
|
287
|
-
return node.getAttribute('data-type');
|
|
288
|
-
}
|
|
289
|
-
switch (node.style.fontSize) {
|
|
290
|
-
case '36px':
|
|
291
|
-
return 'title';
|
|
292
|
-
case '28px':
|
|
293
|
-
return 'subtitle';
|
|
294
|
-
case '22px':
|
|
295
|
-
return 'heading-1';
|
|
296
|
-
case '20px':
|
|
297
|
-
return 'heading-2';
|
|
298
|
-
case '18px':
|
|
299
|
-
return 'heading-3';
|
|
300
|
-
}
|
|
301
|
-
switch (node.nodeName) {
|
|
302
|
-
case 'H1':
|
|
303
|
-
return 'heading-1';
|
|
304
|
-
case 'H2':
|
|
305
|
-
return 'heading-2';
|
|
306
|
-
case 'H3':
|
|
307
|
-
return 'heading-3';
|
|
308
|
-
default:
|
|
309
|
-
return 'paragraph';
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Generate the JSON representation of the annotation
|
|
314
|
-
*
|
|
315
|
-
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
316
|
-
*/
|
|
317
|
-
toJSON() {
|
|
318
|
-
return { textStyle: this.textStyle };
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Render the styles by block type
|
|
322
|
-
*
|
|
323
|
-
* @returns {AnnotationStyle} the styles to apply
|
|
324
|
-
*/
|
|
325
|
-
render() {
|
|
326
|
-
const paragraphStyle = {
|
|
327
|
-
fontFamily: 'Inter',
|
|
328
|
-
fontSize: '16px',
|
|
329
|
-
lineHeight: '22px',
|
|
330
|
-
fontWeight: '500',
|
|
331
|
-
};
|
|
332
|
-
switch (this.textStyle) {
|
|
333
|
-
case 'paragraph': {
|
|
334
|
-
return paragraphStyle;
|
|
335
|
-
}
|
|
336
|
-
case 'title': {
|
|
337
|
-
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
338
|
-
}
|
|
339
|
-
case 'subtitle': {
|
|
340
|
-
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
341
|
-
}
|
|
342
|
-
case 'heading-1': {
|
|
343
|
-
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
344
|
-
}
|
|
345
|
-
case 'heading-2': {
|
|
346
|
-
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
347
|
-
}
|
|
348
|
-
case 'heading-3': {
|
|
349
|
-
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
166
|
/**
|
|
356
167
|
* Abstract class for block
|
|
357
168
|
*/
|
|
@@ -381,23 +192,6 @@ class RTEBlock extends BlockBaseOperator {
|
|
|
381
192
|
return IndentAnnotation.from(value);
|
|
382
193
|
}
|
|
383
194
|
}
|
|
384
|
-
/**
|
|
385
|
-
* Create annotations for block element.
|
|
386
|
-
*
|
|
387
|
-
* @param {string} type - Annotations type.
|
|
388
|
-
* @param {HTMLElement} node - current node.
|
|
389
|
-
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} - result.
|
|
390
|
-
*/
|
|
391
|
-
static createAnnotationEntityFromHTML(type, node) {
|
|
392
|
-
switch (type) {
|
|
393
|
-
case 'ALIGNMENT':
|
|
394
|
-
return HorizontalAlignmentAnnotation.fromHTML(node);
|
|
395
|
-
case 'TEXT_STYLE':
|
|
396
|
-
return TextStyleAnnotation.fromHTML(node);
|
|
397
|
-
case 'INDENT':
|
|
398
|
-
return IndentAnnotation.fromHTML(node);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
195
|
/**
|
|
402
196
|
* Class to JSON object
|
|
403
197
|
*
|
|
@@ -713,16 +507,6 @@ class ImageAnnotation extends node_abstract.NodeAnnotation {
|
|
|
713
507
|
static from(size, alt) {
|
|
714
508
|
return [node_abstract.NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
|
|
715
509
|
}
|
|
716
|
-
/**
|
|
717
|
-
* Generate the map item for the annotation
|
|
718
|
-
*
|
|
719
|
-
* @param {VegaRichTextImageEditorSizeType} size - size.
|
|
720
|
-
* @param {string} alt - alt.
|
|
721
|
-
* @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
|
|
722
|
-
*/
|
|
723
|
-
static fromHTML(size, alt) {
|
|
724
|
-
return this.from(size || 'md', alt);
|
|
725
|
-
}
|
|
726
510
|
/**
|
|
727
511
|
* Generate the JSON representation of the annotation
|
|
728
512
|
*
|
|
@@ -799,15 +583,6 @@ class RTEImageNode extends node_abstract.RTENode {
|
|
|
799
583
|
.filter(typeGuard.isNonNullable));
|
|
800
584
|
return imageNode;
|
|
801
585
|
}
|
|
802
|
-
static fromHTML(node, parentBlock) {
|
|
803
|
-
const src = node.nodeName === 'IMG'
|
|
804
|
-
? node.src
|
|
805
|
-
: node.querySelector('img').src;
|
|
806
|
-
const size = node.size;
|
|
807
|
-
const imageNode = new RTEImageNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), src, parentBlock);
|
|
808
|
-
imageNode.annotationMap = new Map([ImageAnnotation.fromHTML(size, node.alt)]);
|
|
809
|
-
return imageNode;
|
|
810
|
-
}
|
|
811
586
|
toJSON() {
|
|
812
587
|
const imageAnnotation = this.annotationMap.get(node_abstract.NodeAnnotationTypeEnum.IMAGE);
|
|
813
588
|
const annotations = {};
|
|
@@ -912,6 +687,67 @@ class SplitBlockWithNodeAction extends node_abstract.ModifyContentAction {
|
|
|
912
687
|
}
|
|
913
688
|
}
|
|
914
689
|
|
|
690
|
+
/**
|
|
691
|
+
* Text style annotation
|
|
692
|
+
*/
|
|
693
|
+
class TextStyleAnnotation extends blockAnnotation_abstract.BlockAnnotation {
|
|
694
|
+
constructor(textStyle) {
|
|
695
|
+
super();
|
|
696
|
+
this.type = blockAnnotation_abstract.BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
697
|
+
this.textStyle = textStyle;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Generate the map item for the annotations
|
|
701
|
+
*
|
|
702
|
+
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
703
|
+
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
704
|
+
*/
|
|
705
|
+
static from(textStyle) {
|
|
706
|
+
return [blockAnnotation_abstract.BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Generate the JSON representation of the annotation
|
|
710
|
+
*
|
|
711
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
712
|
+
*/
|
|
713
|
+
toJSON() {
|
|
714
|
+
return { textStyle: this.textStyle };
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Render the styles by block type
|
|
718
|
+
*
|
|
719
|
+
* @returns {AnnotationStyle} the styles to apply
|
|
720
|
+
*/
|
|
721
|
+
render() {
|
|
722
|
+
const paragraphStyle = {
|
|
723
|
+
fontFamily: 'Inter',
|
|
724
|
+
fontSize: '16px',
|
|
725
|
+
lineHeight: '22px',
|
|
726
|
+
fontWeight: '500',
|
|
727
|
+
};
|
|
728
|
+
switch (this.textStyle) {
|
|
729
|
+
case 'paragraph': {
|
|
730
|
+
return paragraphStyle;
|
|
731
|
+
}
|
|
732
|
+
case 'title': {
|
|
733
|
+
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
734
|
+
}
|
|
735
|
+
case 'subtitle': {
|
|
736
|
+
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
737
|
+
}
|
|
738
|
+
case 'heading-1': {
|
|
739
|
+
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
740
|
+
}
|
|
741
|
+
case 'heading-2': {
|
|
742
|
+
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
743
|
+
}
|
|
744
|
+
case 'heading-3': {
|
|
745
|
+
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
915
751
|
/**
|
|
916
752
|
* Action to change the text style of a block
|
|
917
753
|
*/
|
|
@@ -987,10 +823,10 @@ class RTETextBlock extends RTEBlock {
|
|
|
987
823
|
this.nodes = [];
|
|
988
824
|
this.type = type;
|
|
989
825
|
if (RTETextBlock.isAcceptableTextStyle(type)) {
|
|
990
|
-
|
|
826
|
+
this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
|
|
991
827
|
}
|
|
992
828
|
else {
|
|
993
|
-
|
|
829
|
+
this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
994
830
|
}
|
|
995
831
|
}
|
|
996
832
|
static from(block) {
|
|
@@ -1007,17 +843,6 @@ class RTETextBlock extends RTEBlock {
|
|
|
1007
843
|
}
|
|
1008
844
|
return textBlock;
|
|
1009
845
|
}
|
|
1010
|
-
static fromHTML(node, blockType) {
|
|
1011
|
-
const textBlock = new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), blockType);
|
|
1012
|
-
textBlock.nodes = Array.from(node.childNodes).map((item) => textNode.RTETextNode.fromHTML(item, textBlock));
|
|
1013
|
-
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1014
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1015
|
-
if (typeGuard.isNonNullable(item)) {
|
|
1016
|
-
textBlock.annotationMap.set(...item);
|
|
1017
|
-
}
|
|
1018
|
-
});
|
|
1019
|
-
return textBlock;
|
|
1020
|
-
}
|
|
1021
846
|
/**
|
|
1022
847
|
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
1023
848
|
* and value.
|
|
@@ -1402,18 +1227,6 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1402
1227
|
}
|
|
1403
1228
|
return imageBlock;
|
|
1404
1229
|
}
|
|
1405
|
-
static fromHTML(node) {
|
|
1406
|
-
const nodes = node.nodeName === 'IMG' ? [node] : Array.from(node.children);
|
|
1407
|
-
const imageBlock = new RTEImageBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1408
|
-
imageBlock.nodes = nodes.map((item) => RTEImageNode.fromHTML(item, imageBlock));
|
|
1409
|
-
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1410
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1411
|
-
if (typeGuard.isNonNullable(item)) {
|
|
1412
|
-
imageBlock.annotationMap.set(...item);
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
return imageBlock;
|
|
1416
|
-
}
|
|
1417
1230
|
toJSON() {
|
|
1418
1231
|
return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
|
|
1419
1232
|
}
|
|
@@ -1651,32 +1464,6 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1651
1464
|
}
|
|
1652
1465
|
return listItemBlock;
|
|
1653
1466
|
}
|
|
1654
|
-
static fromHTML(node) {
|
|
1655
|
-
const listItem = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1656
|
-
listItem.nodes = Array.from(node.childNodes)
|
|
1657
|
-
.map((item) => {
|
|
1658
|
-
if (!['UL', 'OL'].includes(item.nodeName)) {
|
|
1659
|
-
return textNode.RTETextNode.fromHTML(item, listItem);
|
|
1660
|
-
}
|
|
1661
|
-
})
|
|
1662
|
-
.filter(Boolean);
|
|
1663
|
-
listItem.children = Array.from(node.childNodes)
|
|
1664
|
-
.map((item) => {
|
|
1665
|
-
if (['UL', 'OL'].includes(item.nodeName)) {
|
|
1666
|
-
const listBlock = RTEListBlock.fromHTML(item);
|
|
1667
|
-
listBlock && (listBlock.parent = listItem);
|
|
1668
|
-
return listBlock;
|
|
1669
|
-
}
|
|
1670
|
-
})
|
|
1671
|
-
.filter(Boolean);
|
|
1672
|
-
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1673
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1674
|
-
if (typeGuard.isNonNullable(item)) {
|
|
1675
|
-
listItem.annotationMap.set(...item);
|
|
1676
|
-
}
|
|
1677
|
-
});
|
|
1678
|
-
return listItem;
|
|
1679
|
-
}
|
|
1680
1467
|
toJSON() {
|
|
1681
1468
|
var _a;
|
|
1682
1469
|
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()) });
|
|
@@ -1877,23 +1664,6 @@ class RTEListBlock extends RTEBlock {
|
|
|
1877
1664
|
});
|
|
1878
1665
|
return listBlock;
|
|
1879
1666
|
}
|
|
1880
|
-
static fromHTML(node) {
|
|
1881
|
-
const listBlock = new RTEListBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), node.nodeName === 'UL' ? 'bullet-list' : 'number-list');
|
|
1882
|
-
listBlock.blocks = Array.from(node.children)
|
|
1883
|
-
.map((item) => {
|
|
1884
|
-
const listItemBlock = RTEListItemBlock.fromHTML(item);
|
|
1885
|
-
listItemBlock && (listItemBlock.parent = listBlock);
|
|
1886
|
-
return listItemBlock;
|
|
1887
|
-
})
|
|
1888
|
-
.filter(Boolean);
|
|
1889
|
-
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1890
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1891
|
-
if (typeGuard.isNonNullable(item)) {
|
|
1892
|
-
listBlock.annotationMap.set(...item);
|
|
1893
|
-
}
|
|
1894
|
-
});
|
|
1895
|
-
return listBlock;
|
|
1896
|
-
}
|
|
1897
1667
|
toJSON() {
|
|
1898
1668
|
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
1899
1669
|
}
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -19,9 +19,9 @@ const vegaDialogController = require('./vega-dialog-controller-aaf1f43e.js');
|
|
|
19
19
|
const internalVegaEventManager = require('./internal-vega-event-manager-d7643ec6.js');
|
|
20
20
|
const iconManager = require('./icon-manager-36dcfb65.js');
|
|
21
21
|
const validCreditCardNumberRule = require('./valid-credit-card-number-rule-4a9ae5d9.js');
|
|
22
|
-
const textNode = require('./text-node-
|
|
22
|
+
const textNode = require('./text-node-494856f3.js');
|
|
23
23
|
const translation = require('./translation-f6b7ee84.js');
|
|
24
|
-
const contentState = require('./content-state-
|
|
24
|
+
const contentState = require('./content-state-6a5b9736.js');
|
|
25
25
|
require('./responsive-format-facade-74079f1b.js');
|
|
26
26
|
require('./number-4816603d.js');
|
|
27
27
|
require('./pixel-98f2a10c.js');
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const globalSlimmerRegistry = require('./global-slimmer-registry-dd2691b8.js');
|
|
6
|
-
const appGlobals = require('./app-globals-
|
|
6
|
+
const appGlobals = require('./app-globals-48582633.js');
|
|
7
7
|
require('./feature-flag-controller-e97b5f29.js');
|
|
8
8
|
require('./index-8b247c17.js');
|
|
9
9
|
require('./_commonjsHelpers-537d719a.js');
|
|
@@ -30,10 +30,10 @@ require('./translation-f6b7ee84.js');
|
|
|
30
30
|
require('./typography-4560e7f1.js');
|
|
31
31
|
require('./valid-credit-card-number-rule-4a9ae5d9.js');
|
|
32
32
|
require('./regex-c1f70fd4.js');
|
|
33
|
-
require('./text-node-
|
|
33
|
+
require('./text-node-494856f3.js');
|
|
34
34
|
require('./type-guard-4ba85fdc.js');
|
|
35
35
|
require('./accessibility-bfa227f6.js');
|
|
36
|
-
require('./content-state-
|
|
36
|
+
require('./content-state-6a5b9736.js');
|
|
37
37
|
|
|
38
38
|
/*
|
|
39
39
|
Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const globalSlimmerRegistry = require('./global-slimmer-registry-dd2691b8.js');
|
|
4
4
|
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-093462f1.js');
|
|
5
5
|
const internalIconManager = require('./internal-icon-manager-2282a62f.js');
|
|
6
|
-
const textNode = require('./text-node-
|
|
6
|
+
const textNode = require('./text-node-494856f3.js');
|
|
7
7
|
const node_abstract = require('./node.abstract-f8075f84.js');
|
|
8
8
|
|
|
9
9
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -7,7 +7,6 @@ const vegaInternalEventId = require('./vega-internal-event-id-85b68849.js');
|
|
|
7
7
|
const globalSlimmerRegistry = require('./global-slimmer-registry-dd2691b8.js');
|
|
8
8
|
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-8c6a8fb7.js');
|
|
9
9
|
const typeGuard = require('./type-guard-4ba85fdc.js');
|
|
10
|
-
const ui = require('./ui-b5906704.js');
|
|
11
10
|
const accessibility = require('./accessibility-bfa227f6.js');
|
|
12
11
|
|
|
13
12
|
/* istanbul ignore next */
|
|
@@ -152,17 +151,6 @@ class StrikethroughAnnotation extends node_abstract.NodeAnnotation {
|
|
|
152
151
|
static from(strikethrough) {
|
|
153
152
|
return [node_abstract.NodeAnnotationTypeEnum.STRIKETHROUGH, new StrikethroughAnnotation(strikethrough)];
|
|
154
153
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Generate the map item for the annotation by html element
|
|
157
|
-
*
|
|
158
|
-
* @param {HTMLElement} node - An html element.
|
|
159
|
-
* @returns {[NodeAnnotationTypeEnum.STRIKETHROUGH, StrikethroughAnnotation]} Map item for the annotation
|
|
160
|
-
*/
|
|
161
|
-
static fromHTML(node) {
|
|
162
|
-
return this.from(node.style.textDecoration.includes('line-through') ||
|
|
163
|
-
node.nodeName === 'S' ||
|
|
164
|
-
node.classList.contains('v-rte--strikethrough'));
|
|
165
|
-
}
|
|
166
154
|
/**
|
|
167
155
|
* Generate the JSON representation of the annotation
|
|
168
156
|
*
|
|
@@ -209,17 +197,6 @@ class UnderlineAnnotation extends node_abstract.NodeAnnotation {
|
|
|
209
197
|
static from(underline) {
|
|
210
198
|
return [node_abstract.NodeAnnotationTypeEnum.UNDERLINE, new UnderlineAnnotation(underline)];
|
|
211
199
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Generate the map item for the annotation by html element
|
|
214
|
-
*
|
|
215
|
-
* @param {HTMLElement} node - An html element.
|
|
216
|
-
* @returns {[NodeAnnotationTypeEnum.UNDERLINE, UnderlineAnnotation]} Map item for the annotation
|
|
217
|
-
*/
|
|
218
|
-
static fromHTML(node) {
|
|
219
|
-
return this.from(node.style.textDecoration.includes('underline') ||
|
|
220
|
-
node.nodeName === 'U' ||
|
|
221
|
-
node.classList.contains('v-rte--underline'));
|
|
222
|
-
}
|
|
223
200
|
/**
|
|
224
201
|
* Generate the JSON representation of the annotation
|
|
225
202
|
*
|
|
@@ -266,15 +243,6 @@ class ItalicAnnotation extends node_abstract.NodeAnnotation {
|
|
|
266
243
|
static from(italic) {
|
|
267
244
|
return [node_abstract.NodeAnnotationTypeEnum.ITALIC, new ItalicAnnotation(italic)];
|
|
268
245
|
}
|
|
269
|
-
/**
|
|
270
|
-
* Generate the map item for the annotation by html element
|
|
271
|
-
*
|
|
272
|
-
* @param {HTMLElement} node - An html element.
|
|
273
|
-
* @returns {[NodeAnnotationTypeEnum.ITALIC, ItalicAnnotation]} Map item for the annotation
|
|
274
|
-
*/
|
|
275
|
-
static fromHTML(node) {
|
|
276
|
-
return this.from(node.nodeName === 'I' || node.style.fontStyle === 'italic' || node.nodeName === 'EM');
|
|
277
|
-
}
|
|
278
246
|
/**
|
|
279
247
|
* Generate the JSON representation of the annotation
|
|
280
248
|
*
|
|
@@ -313,16 +281,6 @@ class BoldAnnotation extends node_abstract.NodeAnnotation {
|
|
|
313
281
|
static from(bold) {
|
|
314
282
|
return [node_abstract.NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
|
|
315
283
|
}
|
|
316
|
-
/**
|
|
317
|
-
* Generate the map item for the annotation by html element
|
|
318
|
-
*
|
|
319
|
-
* @param {HTMLElement} node - An html element.
|
|
320
|
-
* @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
|
|
321
|
-
*/
|
|
322
|
-
static fromHTML(node) {
|
|
323
|
-
const style = node.style;
|
|
324
|
-
return this.from(node.nodeName === 'STRONG' || style.fontWeight === 'bold' || style.fontWeight === '700');
|
|
325
|
-
}
|
|
326
284
|
/**
|
|
327
285
|
* Generate the JSON representation of the annotation
|
|
328
286
|
*
|
|
@@ -379,15 +337,6 @@ class CodeAnnotation extends node_abstract.NodeAnnotation {
|
|
|
379
337
|
static from(code) {
|
|
380
338
|
return [node_abstract.NodeAnnotationTypeEnum.CODE, new CodeAnnotation(code)];
|
|
381
339
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Generate the map item for the annotation by html element
|
|
384
|
-
*
|
|
385
|
-
* @param {HTMLElement} node - An html element.
|
|
386
|
-
* @returns {[NodeAnnotationTypeEnum.CODE, CodeAnnotation]} Map item for the annotation
|
|
387
|
-
*/
|
|
388
|
-
static fromHTML(node) {
|
|
389
|
-
return this.from(node.classList.contains('v-rte--code') || node.nodeName === 'CODE');
|
|
390
|
-
}
|
|
391
340
|
/**
|
|
392
341
|
* Generate the JSON representation of the annotation
|
|
393
342
|
*
|
|
@@ -434,31 +383,6 @@ class TextColorAnnotation extends node_abstract.NodeAnnotation {
|
|
|
434
383
|
static from(textColor) {
|
|
435
384
|
return [node_abstract.NodeAnnotationTypeEnum.TEXT_COLOR, new TextColorAnnotation(textColor)];
|
|
436
385
|
}
|
|
437
|
-
/**
|
|
438
|
-
* Generate the map item for the annotation by html element
|
|
439
|
-
*
|
|
440
|
-
* @param {HTMLElement} node - An html element.
|
|
441
|
-
* @returns {[NodeAnnotationTypeEnum.TEXT_COLOR, TextColorAnnotation]} Map item for the annotation
|
|
442
|
-
*/
|
|
443
|
-
static fromHTML(node) {
|
|
444
|
-
var _a;
|
|
445
|
-
const color = node.style.color;
|
|
446
|
-
const hexColor = (_a = ui.rgbToHex(color)) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
447
|
-
if (hexColor) {
|
|
448
|
-
const colorSchema = RTE_TEXT_COLORS.find((schema) => schema.light === hexColor || schema.dark === hexColor);
|
|
449
|
-
if (colorSchema)
|
|
450
|
-
return this.from(colorSchema.key);
|
|
451
|
-
return null;
|
|
452
|
-
}
|
|
453
|
-
else {
|
|
454
|
-
for (const color of RTE_TEXT_COLORS) {
|
|
455
|
-
if (node.style.color.includes(color.key)) {
|
|
456
|
-
return this.from(color.key);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return null;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
386
|
/**
|
|
463
387
|
* Generate the JSON representation of the annotation
|
|
464
388
|
*
|
|
@@ -519,20 +443,6 @@ class LinkAnnotation extends node_abstract.NodeAnnotation {
|
|
|
519
443
|
new LinkAnnotation({ href: link.href, groupKey: link.groupKey }),
|
|
520
444
|
];
|
|
521
445
|
}
|
|
522
|
-
/**
|
|
523
|
-
* Generate the map item for the annotation by html element
|
|
524
|
-
*
|
|
525
|
-
* @param {HTMLElement} node - An html element.
|
|
526
|
-
* @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
|
|
527
|
-
*/
|
|
528
|
-
static fromHTML(node) {
|
|
529
|
-
return node.hasAttribute('data-href')
|
|
530
|
-
? this.from({
|
|
531
|
-
href: node.getAttribute('data-href'),
|
|
532
|
-
groupKey: node.getAttribute('data-group-key'),
|
|
533
|
-
})
|
|
534
|
-
: null;
|
|
535
|
-
}
|
|
536
446
|
/**
|
|
537
447
|
* Generate the JSON representation of the annotation
|
|
538
448
|
*
|
|
@@ -808,20 +718,6 @@ class RTETextNode extends node_abstract.RTENode {
|
|
|
808
718
|
}
|
|
809
719
|
return textNode;
|
|
810
720
|
}
|
|
811
|
-
static fromHTML(node, parentBlock) {
|
|
812
|
-
const textNode = new RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), node.textContent, parentBlock);
|
|
813
|
-
if (node.nodeType !== Node.TEXT_NODE) {
|
|
814
|
-
textNode.annotationMap = new Map(Object.keys(node_abstract.NodeAnnotationTypeEnum)
|
|
815
|
-
.map((nodeAnnotationType) => {
|
|
816
|
-
return this.createAnnotationEntityFromHTML(nodeAnnotationType, node);
|
|
817
|
-
})
|
|
818
|
-
.filter(typeGuard.isNonNullable));
|
|
819
|
-
if (node.hasAttribute('data-group-key')) {
|
|
820
|
-
parentBlock.apply(new LinkGroupAnnotationAction(node.getAttribute('data-group-key'), [textNode]));
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
return textNode;
|
|
824
|
-
}
|
|
825
721
|
static createAnnotationEntity(type, value) {
|
|
826
722
|
switch (type) {
|
|
827
723
|
case 'bold':
|
|
@@ -840,24 +736,6 @@ class RTETextNode extends node_abstract.RTENode {
|
|
|
840
736
|
return LinkAnnotation.from(value);
|
|
841
737
|
}
|
|
842
738
|
}
|
|
843
|
-
static createAnnotationEntityFromHTML(type, node) {
|
|
844
|
-
switch (type) {
|
|
845
|
-
case 'BOLD':
|
|
846
|
-
return BoldAnnotation.fromHTML(node);
|
|
847
|
-
case 'ITALIC':
|
|
848
|
-
return ItalicAnnotation.fromHTML(node);
|
|
849
|
-
case 'UNDERLINE':
|
|
850
|
-
return UnderlineAnnotation.fromHTML(node);
|
|
851
|
-
case 'STRIKETHROUGH':
|
|
852
|
-
return StrikethroughAnnotation.fromHTML(node);
|
|
853
|
-
case 'CODE':
|
|
854
|
-
return CodeAnnotation.fromHTML(node);
|
|
855
|
-
case 'TEXT_COLOR':
|
|
856
|
-
return TextColorAnnotation.fromHTML(node);
|
|
857
|
-
case 'LINK':
|
|
858
|
-
return LinkAnnotation.fromHTML(node);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
739
|
toJSON() {
|
|
862
740
|
const annotations = Array.from(this.annotationMap.values())
|
|
863
741
|
.filter((annotation) => annotation instanceof node_abstract.NodeAnnotation)
|