roosterjs-content-model-dom 9.55.0 → 9.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/domToModel/context/createDomToModelContext.js +3 -0
- package/lib/domToModel/context/createDomToModelContext.js.map +1 -1
- package/lib/domToModel/context/defaultProcessors.js +2 -0
- package/lib/domToModel/context/defaultProcessors.js.map +1 -1
- package/lib/domToModel/processors/dataProcessor.d.ts +5 -0
- package/lib/domToModel/processors/dataProcessor.js +17 -0
- package/lib/domToModel/processors/dataProcessor.js.map +1 -0
- package/lib/domToModel/utils/stackFormat.d.ts +1 -0
- package/lib/domToModel/utils/stackFormat.js +14 -2
- package/lib/domToModel/utils/stackFormat.js.map +1 -1
- package/lib/formatHandlers/defaultFormatHandlers.js +3 -0
- package/lib/formatHandlers/defaultFormatHandlers.js.map +1 -1
- package/lib/formatHandlers/segment/dataValueFormatHandler.d.ts +7 -0
- package/lib/formatHandlers/segment/dataValueFormatHandler.js +21 -0
- package/lib/formatHandlers/segment/dataValueFormatHandler.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/lib/modelApi/common/addDecorators.d.ts +8 -1
- package/lib/modelApi/common/addDecorators.js +16 -1
- package/lib/modelApi/common/addDecorators.js.map +1 -1
- package/lib/modelApi/common/mergeTextSegments.js +5 -1
- package/lib/modelApi/common/mergeTextSegments.js.map +1 -1
- package/lib/modelApi/creators/createText.d.ts +4 -3
- package/lib/modelApi/creators/createText.js +6 -2
- package/lib/modelApi/creators/createText.js.map +1 -1
- package/lib/modelApi/editing/cloneModel.js +4 -1
- package/lib/modelApi/editing/cloneModel.js.map +1 -1
- package/lib/modelToDom/handlers/handleSegmentDecorator.js +9 -1
- package/lib/modelToDom/handlers/handleSegmentDecorator.js.map +1 -1
- package/lib/modelToDom/optimizers/mergeNode.js +14 -1
- package/lib/modelToDom/optimizers/mergeNode.js.map +1 -1
- package/lib-amd/domToModel/context/createDomToModelContext.js +3 -0
- package/lib-amd/domToModel/context/createDomToModelContext.js.map +1 -1
- package/lib-amd/domToModel/context/defaultProcessors.js +2 -1
- package/lib-amd/domToModel/context/defaultProcessors.js.map +1 -1
- package/lib-amd/domToModel/processors/dataProcessor.d.ts +5 -0
- package/lib-amd/domToModel/processors/dataProcessor.js +16 -0
- package/lib-amd/domToModel/processors/dataProcessor.js.map +1 -0
- package/lib-amd/domToModel/utils/stackFormat.d.ts +1 -0
- package/lib-amd/domToModel/utils/stackFormat.js +14 -2
- package/lib-amd/domToModel/utils/stackFormat.js.map +1 -1
- package/lib-amd/formatHandlers/defaultFormatHandlers.js +3 -1
- package/lib-amd/formatHandlers/defaultFormatHandlers.js.map +1 -1
- package/lib-amd/formatHandlers/segment/dataValueFormatHandler.d.ts +7 -0
- package/lib-amd/formatHandlers/segment/dataValueFormatHandler.js +23 -0
- package/lib-amd/formatHandlers/segment/dataValueFormatHandler.js.map +1 -0
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +4 -3
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/common/addDecorators.d.ts +8 -1
- package/lib-amd/modelApi/common/addDecorators.js +16 -1
- package/lib-amd/modelApi/common/addDecorators.js.map +1 -1
- package/lib-amd/modelApi/common/mergeTextSegments.js +5 -1
- package/lib-amd/modelApi/common/mergeTextSegments.js.map +1 -1
- package/lib-amd/modelApi/creators/createText.d.ts +4 -3
- package/lib-amd/modelApi/creators/createText.js +6 -2
- package/lib-amd/modelApi/creators/createText.js.map +1 -1
- package/lib-amd/modelApi/editing/cloneModel.js +4 -1
- package/lib-amd/modelApi/editing/cloneModel.js.map +1 -1
- package/lib-amd/modelToDom/handlers/handleSegmentDecorator.js +9 -1
- package/lib-amd/modelToDom/handlers/handleSegmentDecorator.js.map +1 -1
- package/lib-amd/modelToDom/optimizers/mergeNode.js +14 -1
- package/lib-amd/modelToDom/optimizers/mergeNode.js.map +1 -1
- package/lib-mjs/domToModel/context/createDomToModelContext.js +3 -0
- package/lib-mjs/domToModel/context/createDomToModelContext.js.map +1 -1
- package/lib-mjs/domToModel/context/defaultProcessors.js +2 -0
- package/lib-mjs/domToModel/context/defaultProcessors.js.map +1 -1
- package/lib-mjs/domToModel/processors/dataProcessor.d.ts +5 -0
- package/lib-mjs/domToModel/processors/dataProcessor.js +13 -0
- package/lib-mjs/domToModel/processors/dataProcessor.js.map +1 -0
- package/lib-mjs/domToModel/utils/stackFormat.d.ts +1 -0
- package/lib-mjs/domToModel/utils/stackFormat.js +14 -2
- package/lib-mjs/domToModel/utils/stackFormat.js.map +1 -1
- package/lib-mjs/formatHandlers/defaultFormatHandlers.js +3 -0
- package/lib-mjs/formatHandlers/defaultFormatHandlers.js.map +1 -1
- package/lib-mjs/formatHandlers/segment/dataValueFormatHandler.d.ts +7 -0
- package/lib-mjs/formatHandlers/segment/dataValueFormatHandler.js +18 -0
- package/lib-mjs/formatHandlers/segment/dataValueFormatHandler.js.map +1 -0
- package/lib-mjs/index.d.ts +1 -0
- package/lib-mjs/index.js +1 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/common/addDecorators.d.ts +8 -1
- package/lib-mjs/modelApi/common/addDecorators.js +14 -0
- package/lib-mjs/modelApi/common/addDecorators.js.map +1 -1
- package/lib-mjs/modelApi/common/mergeTextSegments.js +5 -1
- package/lib-mjs/modelApi/common/mergeTextSegments.js.map +1 -1
- package/lib-mjs/modelApi/creators/createText.d.ts +4 -3
- package/lib-mjs/modelApi/creators/createText.js +7 -3
- package/lib-mjs/modelApi/creators/createText.js.map +1 -1
- package/lib-mjs/modelApi/editing/cloneModel.js +4 -1
- package/lib-mjs/modelApi/editing/cloneModel.js.map +1 -1
- package/lib-mjs/modelToDom/handlers/handleSegmentDecorator.js +9 -1
- package/lib-mjs/modelToDom/handlers/handleSegmentDecorator.js.map +1 -1
- package/lib-mjs/modelToDom/optimizers/mergeNode.js +14 -1
- package/lib-mjs/modelToDom/optimizers/mergeNode.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTextSegments.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/common/mergeTextSegments.ts"],"names":[],"mappings":";;;AAAA,wEAAuE;
|
|
1
|
+
{"version":3,"file":"mergeTextSegments.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/common/mergeTextSegments.ts"],"names":[],"mappings":";;;AAAA,wEAAuE;AAUvE;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAA0C;IACxE,IAAI,QAAQ,GAA4B,IAAI,CAAC;IAE7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC5C,IAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAElC,IAAI,OAAO,CAAC,WAAW,IAAI,MAAM,EAAE;YAC/B,QAAQ,GAAG,IAAI,CAAC;SACnB;aAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;YAChE,QAAQ,GAAG,OAAO,CAAC;SACtB;aAAM;YACH,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAC9B,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5B,CAAC,EAAE,CAAC;SACP;KACJ;AACL,CAAC;AAhBD,8CAgBC;AAED,SAAS,sBAAsB,CAC3B,IAAiC,EACjC,IAAiC;IAEjC,OAAO,CACH,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU;QACtC,IAAA,+BAAc,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QACxC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QAClC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QAClC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CACpC,CAAC;AACN,CAAC;AAED,SAAS,YAAY,CACjB,KAA2C,EAC3C,KAA2C;IAE3C,OAAO,CACH,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC;QAClB,CAAC,KAAK;YACF,KAAK;YACL,IAAA,+BAAc,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YAC1C,IAAA,+BAAc,EAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CACpD,CAAC;AACN,CAAC;AAED,SAAS,YAAY,CACjB,KAA2C,EAC3C,KAA2C;IAE3C,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,IAAI,IAAA,+BAAc,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,SAAS,WAAW,CAChB,KAA2C,EAC3C,KAA2C;IAE3C,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,IAAI,IAAA,+BAAc,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAChG,CAAC","sourcesContent":["import { areSameFormats } from '../../domToModel/utils/areSameFormats';\nimport type {\n ContentModelText,\n ReadonlyContentModelCode,\n ReadonlyContentModelData,\n ReadonlyContentModelLink,\n ReadonlyContentModelSegment,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\n/**\n * Find continuous text segments that have the same format and decorators, merge them, So we can reduce total count of segments\n * @param block The parent paragraph to check.\n */\nexport function mergeTextSegments(block: ShallowMutableContentModelParagraph) {\n let lastText: ContentModelText | null = null;\n\n for (let i = 0; i < block.segments.length; i++) {\n const segment = block.segments[i];\n\n if (segment.segmentType != 'Text') {\n lastText = null;\n } else if (!lastText || !segmentsWithSameFormat(lastText, segment)) {\n lastText = segment;\n } else {\n lastText.text += segment.text;\n block.segments.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction segmentsWithSameFormat(\n seg1: ReadonlyContentModelSegment,\n seg2: ReadonlyContentModelSegment\n) {\n return (\n !!seg1.isSelected == !!seg2.isSelected &&\n areSameFormats(seg1.format, seg2.format) &&\n areSameLinks(seg1.link, seg2.link) &&\n areSameCodes(seg1.code, seg2.code) &&\n areSameData(seg1.data, seg2.data)\n );\n}\n\nfunction areSameLinks(\n link1: ReadonlyContentModelLink | undefined,\n link2: ReadonlyContentModelLink | undefined\n) {\n return (\n (!link1 && !link2) ||\n (link1 &&\n link2 &&\n areSameFormats(link1.format, link2.format) &&\n areSameFormats(link1.dataset, link2.dataset))\n );\n}\n\nfunction areSameCodes(\n code1: ReadonlyContentModelCode | undefined,\n code2: ReadonlyContentModelCode | undefined\n) {\n return (!code1 && !code2) || (code1 && code2 && areSameFormats(code1.format, code2.format));\n}\n\nfunction areSameData(\n data1: ReadonlyContentModelData | undefined,\n data2: ReadonlyContentModelData | undefined\n) {\n return (!data1 && !data2) || (data1 && data2 && areSameFormats(data1.format, data2.format));\n}\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { ContentModelSegmentFormat, ContentModelText, ReadonlyContentModelCode, ReadonlyContentModelLink } from 'roosterjs-content-model-types';
|
|
1
|
+
import type { ContentModelSegmentFormat, ContentModelText, ReadonlyContentModelCode, ReadonlyContentModelData, ReadonlyContentModelLink } from 'roosterjs-content-model-types';
|
|
2
2
|
/**
|
|
3
3
|
* Create a ContentModelText model
|
|
4
4
|
* @param text Text of this model
|
|
5
5
|
* @param format @optional The format of this model
|
|
6
6
|
* @param link @optional The link decorator
|
|
7
|
-
* @param code @
|
|
7
|
+
* @param code @optional The code decorator
|
|
8
|
+
* @param data @optional The data decorator
|
|
8
9
|
*/
|
|
9
|
-
export declare function createText(text: string, format?: Readonly<ContentModelSegmentFormat>, link?: ReadonlyContentModelLink, code?: ReadonlyContentModelCode): ContentModelText;
|
|
10
|
+
export declare function createText(text: string, format?: Readonly<ContentModelSegmentFormat>, link?: ReadonlyContentModelLink, code?: ReadonlyContentModelCode, data?: ReadonlyContentModelData): ContentModelText;
|
|
@@ -8,9 +8,10 @@ var addDecorators_1 = require("../common/addDecorators");
|
|
|
8
8
|
* @param text Text of this model
|
|
9
9
|
* @param format @optional The format of this model
|
|
10
10
|
* @param link @optional The link decorator
|
|
11
|
-
* @param code @
|
|
11
|
+
* @param code @optional The code decorator
|
|
12
|
+
* @param data @optional The data decorator
|
|
12
13
|
*/
|
|
13
|
-
function createText(text, format, link, code) {
|
|
14
|
+
function createText(text, format, link, code, data) {
|
|
14
15
|
var result = {
|
|
15
16
|
segmentType: 'Text',
|
|
16
17
|
text: text,
|
|
@@ -22,6 +23,9 @@ function createText(text, format, link, code) {
|
|
|
22
23
|
if (code) {
|
|
23
24
|
(0, addDecorators_1.addCode)(result, code);
|
|
24
25
|
}
|
|
26
|
+
if (data) {
|
|
27
|
+
(0, addDecorators_1.addData)(result, data);
|
|
28
|
+
}
|
|
25
29
|
return result;
|
|
26
30
|
}
|
|
27
31
|
exports.createText = createText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createText.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/creators/createText.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"createText.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/creators/createText.ts"],"names":[],"mappings":";;;;AAAA,yDAAoE;AASpE;;;;;;;GAOG;AACH,SAAgB,UAAU,CACtB,IAAY,EACZ,MAA4C,EAC5C,IAA+B,EAC/B,IAA+B,EAC/B,IAA+B;IAE/B,IAAM,MAAM,GAAqB;QAC7B,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,IAAI;QACV,MAAM,4BAAO,MAAM,CAAE;KACxB,CAAC;IAEF,IAAI,IAAI,EAAE;QACN,IAAA,uBAAO,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACzB;IAED,IAAI,IAAI,EAAE;QACN,IAAA,uBAAO,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACzB;IAED,IAAI,IAAI,EAAE;QACN,IAAA,uBAAO,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACzB;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA1BD,gCA0BC","sourcesContent":["import { addCode, addData, addLink } from '../common/addDecorators';\nimport type {\n ContentModelSegmentFormat,\n ContentModelText,\n ReadonlyContentModelCode,\n ReadonlyContentModelData,\n ReadonlyContentModelLink,\n} from 'roosterjs-content-model-types';\n\n/**\n * Create a ContentModelText model\n * @param text Text of this model\n * @param format @optional The format of this model\n * @param link @optional The link decorator\n * @param code @optional The code decorator\n * @param data @optional The data decorator\n */\nexport function createText(\n text: string,\n format?: Readonly<ContentModelSegmentFormat>,\n link?: ReadonlyContentModelLink,\n code?: ReadonlyContentModelCode,\n data?: ReadonlyContentModelData\n): ContentModelText {\n const result: ContentModelText = {\n segmentType: 'Text',\n text: text,\n format: { ...format },\n };\n\n if (link) {\n addLink(result, link);\n }\n\n if (code) {\n addCode(result, code);\n }\n\n if (data) {\n addData(result, data);\n }\n\n return result;\n}\n"]}
|
|
@@ -89,7 +89,7 @@ function cloneBlockGroupBase(group, options) {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
function cloneSegmentBase(segment) {
|
|
92
|
-
var segmentType = segment.segmentType, isSelected = segment.isSelected, code = segment.code, link = segment.link;
|
|
92
|
+
var segmentType = segment.segmentType, isSelected = segment.isSelected, code = segment.code, link = segment.link, data = segment.data;
|
|
93
93
|
var newSegment = Object.assign({
|
|
94
94
|
segmentType: segmentType,
|
|
95
95
|
isSelected: isSelected,
|
|
@@ -100,6 +100,9 @@ function cloneSegmentBase(segment) {
|
|
|
100
100
|
if (link) {
|
|
101
101
|
newSegment.link = Object.assign(cloneModelWithFormat(link), cloneModelWithDataset(link));
|
|
102
102
|
}
|
|
103
|
+
if (data) {
|
|
104
|
+
newSegment.data = cloneModelWithFormat(data);
|
|
105
|
+
}
|
|
103
106
|
return newSegment;
|
|
104
107
|
}
|
|
105
108
|
function cloneEntity(entity, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloneModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/cloneModel.ts"],"names":[],"mappings":";;;;AAkDA,IAAM,WAAW,GAAsB;IACnC,oBAAoB,EAAE,UAAC,IAAI,EAAE,IAAI,IAAK,OAAA,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAApC,CAAoC;CAC7E,CAAC;AAEF;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,KAAmC;IAClE,OAAO,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC;AAFD,gDAEC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CACtB,KAAmC,EACnC,OAA2B;IAE3B,IAAM,QAAQ,GAAyB,mBAAmB,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAEjF,IAAI,KAAK,CAAC,MAAM,EAAE;QACd,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KACrD;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAXD,gCAWC;AAED,SAAS,UAAU,CACf,KAAgC,EAChC,OAA0B;IAE1B,QAAQ,KAAK,CAAC,SAAS,EAAE;QACrB,KAAK,YAAY;YACb,QAAQ,KAAK,CAAC,cAAc,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,CAAC,EACvB,qBAAqB,CAAC,KAAK,CAAC,CAC/B,CAAC;AACN,CAAC;AAED,SAAS,mBAAmB,CACxB,OAA2C,EAC3C,OAA0B;IAE1B,OAAO,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,SAAS,CAAC,WAAqC;IAC5C,IAAA,IAAI,GAAK,WAAW,KAAhB,CAAiB;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,MAAA,EAAE,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAClE,CAAC;AAcD,SAAS,mBAAmB,CACxB,IAAmB,EACnB,IAAoC,EACpC,OAA0B;IAElB,IAAA,oBAAoB,GAAK,OAAO,qBAAZ,CAAa;IAEzC,IAAI,CAAC,IAAI,EAAE;QACP,OAAO,SAAS,CAAC;KACpB;SAAM,IAAI,CAAC,oBAAoB,EAAE;QAC9B,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAO,CAAC;KAC7E;SAAM,IAAI,oBAAoB,KAAK,IAAI,EAAE;QACtC,OAAO,IAAI,CAAC;KACf;SAAM;QACH,IAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAkB,CAAC;QAEjE,IAAI,CAAC,IAAI,IAAI,SAAS,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE;YACpD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;SACxE;QAED,OAAO,MAAM,CAAC;KACjB;AACL,CAAC","sourcesContent":["import type {\n ContentModelBlock,\n ContentModelBlockBase,\n ContentModelBlockGroupBase,\n ContentModelBlockGroupType,\n ContentModelBlockType,\n ContentModelDivider,\n ContentModelDocument,\n ContentModelEntity,\n ContentModelFormatBase,\n ContentModelFormatContainer,\n ContentModelGeneralBlock,\n ContentModelImage,\n ContentModelListItem,\n ContentModelParagraph,\n ContentModelSegment,\n ContentModelSegmentBase,\n ContentModelSegmentType,\n ContentModelSelectionMarker,\n ContentModelTable,\n ContentModelTableCell,\n ContentModelWithDataset,\n ContentModelWithFormat,\n ContentModelGeneralSegment,\n ContentModelText,\n ContentModelTableRow,\n ContentModelListLevel,\n CloneModelOptions,\n ReadonlyContentModelDocument,\n ReadonlyContentModelBlockGroupBase,\n ReadonlyContentModelBlock,\n ReadonlyContentModelFormatContainer,\n ReadonlyContentModelBlockBase,\n ReadonlyContentModelGeneralBlock,\n ReadonlyContentModelListItem,\n ReadonlyContentModelSelectionMarker,\n ReadonlyContentModelSegmentBase,\n ReadonlyContentModelWithDataset,\n ReadonlyContentModelDivider,\n ReadonlyContentModelListLevel,\n ReadonlyContentModelParagraph,\n ReadonlyContentModelSegment,\n ReadonlyContentModelTable,\n ReadonlyContentModelTableRow,\n ReadonlyContentModelTableCell,\n ReadonlyContentModelGeneralSegment,\n ReadonlyContentModelImage,\n ReadonlyContentModelText,\n} from 'roosterjs-content-model-types';\n\nconst CloneOption: CloneModelOptions = {\n includeCachedElement: (node, type) => (type == 'cache' ? undefined : node),\n};\n\n/**\n * Clone a content model for paste operations, ensuring that cached elements are handled appropriately.\n * @param model The content model to clone\n * @returns A cloned content model suitable for paste operations\n */\nexport function cloneModelForPaste(model: ReadonlyContentModelDocument) {\n return cloneModel(model, CloneOption);\n}\n\n/**\n * Clone a content model\n * @param model The content model to clone\n * @param options @optional Options to specify customize the clone behavior\n */\nexport function cloneModel(\n model: ReadonlyContentModelDocument,\n options?: CloneModelOptions\n): ContentModelDocument {\n const newModel: ContentModelDocument = cloneBlockGroupBase(model, options || {});\n\n if (model.format) {\n newModel.format = Object.assign({}, model.format);\n }\n\n return newModel;\n}\n\nfunction cloneBlock(\n block: ReadonlyContentModelBlock,\n options: CloneModelOptions\n): ContentModelBlock {\n switch (block.blockType) {\n case 'BlockGroup':\n switch (block.blockGroupType) {\n case 'FormatContainer':\n return cloneFormatContainer(block, options);\n case 'General':\n return cloneGeneralBlock(block, options);\n case 'ListItem':\n return cloneListItem(block, options);\n }\n break;\n case 'Divider':\n return cloneDivider(block, options);\n case 'Entity':\n return cloneEntity(block, options);\n case 'Paragraph':\n return cloneParagraph(block, options);\n case 'Table':\n return cloneTable(block, options);\n }\n}\n\nfunction cloneSegment(\n segment: ReadonlyContentModelSegment,\n options: CloneModelOptions\n): ContentModelSegment {\n switch (segment.segmentType) {\n case 'Br':\n return cloneSegmentBase(segment);\n case 'Entity':\n return cloneEntity(segment, options);\n case 'General':\n return cloneGeneralSegment(segment, options);\n case 'Image':\n return cloneImage(segment);\n case 'SelectionMarker':\n return cloneSelectionMarker(segment);\n case 'Text':\n return cloneText(segment);\n }\n}\n\nfunction cloneModelWithFormat<T extends ContentModelFormatBase>(\n model: ContentModelWithFormat<T>\n): ContentModelWithFormat<T> {\n return {\n format: Object.assign({}, model.format),\n };\n}\n\nfunction cloneModelWithDataset<T>(\n model: ReadonlyContentModelWithDataset<T>\n): ContentModelWithDataset<T> {\n return {\n dataset: Object.assign({}, model.dataset),\n };\n}\n\nfunction cloneBlockBase<T extends ContentModelBlockType>(\n block: ReadonlyContentModelBlockBase<T>\n): ContentModelBlockBase<T> {\n const { blockType } = block;\n\n return Object.assign(\n {\n blockType,\n },\n cloneModelWithFormat(block)\n );\n}\n\nfunction cloneBlockGroupBase<T extends ContentModelBlockGroupType>(\n group: ReadonlyContentModelBlockGroupBase<T>,\n options: CloneModelOptions\n): ContentModelBlockGroupBase<T> {\n const { blockGroupType, blocks } = group;\n\n return {\n blockGroupType: blockGroupType,\n blocks: blocks.map(block => cloneBlock(block, options)),\n };\n}\n\nfunction cloneSegmentBase<T extends ContentModelSegmentType>(\n segment: ReadonlyContentModelSegmentBase<T>\n): ContentModelSegmentBase<T> {\n const { segmentType, isSelected, code, link } = segment;\n\n const newSegment: ContentModelSegmentBase<T> = Object.assign(\n {\n segmentType,\n isSelected,\n },\n cloneModelWithFormat(segment)\n );\n\n if (code) {\n newSegment.code = cloneModelWithFormat(code);\n }\n if (link) {\n newSegment.link = Object.assign(cloneModelWithFormat(link), cloneModelWithDataset(link));\n }\n\n return newSegment;\n}\n\nfunction cloneEntity(entity: ContentModelEntity, options: CloneModelOptions): ContentModelEntity {\n const { wrapper, entityFormat } = entity;\n\n return Object.assign(\n {\n wrapper: handleCachedElement(wrapper, 'entity', options),\n entityFormat: { ...entityFormat },\n },\n cloneBlockBase(entity),\n cloneSegmentBase(entity)\n );\n}\n\nfunction cloneParagraph(\n paragraph: ReadonlyContentModelParagraph,\n options: CloneModelOptions\n): ContentModelParagraph {\n const { cachedElement, segments, isImplicit, decorator, segmentFormat } = paragraph;\n\n const newParagraph: ContentModelParagraph = Object.assign(\n {\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n isImplicit,\n segments: segments.map(segment => cloneSegment(segment, options)),\n segmentFormat: segmentFormat ? { ...segmentFormat } : undefined,\n },\n cloneBlockBase(paragraph),\n cloneModelWithFormat(paragraph)\n );\n\n if (decorator) {\n newParagraph.decorator = Object.assign(\n {\n tagName: decorator.tagName,\n },\n cloneModelWithFormat(decorator)\n );\n }\n\n return newParagraph;\n}\n\nfunction cloneTable(\n table: ReadonlyContentModelTable,\n options: CloneModelOptions\n): ContentModelTable {\n const { cachedElement, widths, rows } = table;\n\n return Object.assign(\n {\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n widths: Array.from(widths),\n rows: rows.map(row => cloneTableRow(row, options)),\n },\n cloneBlockBase(table),\n cloneModelWithDataset(table)\n );\n}\n\nfunction cloneTableRow(\n row: ReadonlyContentModelTableRow,\n options: CloneModelOptions\n): ContentModelTableRow {\n const { height, cells, cachedElement } = row;\n\n return Object.assign(\n {\n height,\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n cells: cells.map(cell => cloneTableCell(cell, options)),\n },\n cloneModelWithFormat(row)\n );\n}\n\nfunction cloneTableCell(\n cell: ReadonlyContentModelTableCell,\n options: CloneModelOptions\n): ContentModelTableCell {\n const { cachedElement, isSelected, spanAbove, spanLeft, isHeader } = cell;\n\n return Object.assign(\n {\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n isSelected,\n spanAbove,\n spanLeft,\n isHeader,\n },\n cloneBlockGroupBase(cell, options),\n cloneModelWithFormat(cell),\n cloneModelWithDataset(cell)\n );\n}\n\nfunction cloneFormatContainer(\n container: ReadonlyContentModelFormatContainer,\n options: CloneModelOptions\n): ContentModelFormatContainer {\n const { tagName, cachedElement } = container;\n const newContainer: ContentModelFormatContainer = Object.assign(\n { tagName, cachedElement: handleCachedElement(cachedElement, 'cache', options) },\n cloneBlockBase(container),\n cloneBlockGroupBase(container, options)\n );\n\n if (container.zeroFontSize) {\n newContainer.zeroFontSize = true;\n }\n\n return newContainer;\n}\n\nfunction cloneListItem(\n item: ReadonlyContentModelListItem,\n options: CloneModelOptions\n): ContentModelListItem {\n const { formatHolder, levels, cachedElement } = item;\n\n return Object.assign(\n {\n formatHolder: cloneSelectionMarker(formatHolder),\n levels: levels.map(cloneListLevel),\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n },\n cloneBlockBase(item),\n cloneBlockGroupBase(item, options)\n );\n}\n\nfunction cloneListLevel(level: ReadonlyContentModelListLevel): ContentModelListLevel {\n const { listType } = level;\n\n return Object.assign({ listType }, cloneModelWithFormat(level), cloneModelWithDataset(level));\n}\nfunction cloneDivider(\n divider: ReadonlyContentModelDivider,\n options: CloneModelOptions\n): ContentModelDivider {\n const { tagName, isSelected, cachedElement } = divider;\n\n return Object.assign(\n {\n isSelected,\n tagName,\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n },\n cloneBlockBase(divider)\n );\n}\n\nfunction cloneGeneralBlock(\n general: ReadonlyContentModelGeneralBlock,\n options: CloneModelOptions\n): ContentModelGeneralBlock {\n const { element } = general;\n\n return Object.assign(\n {\n element: handleCachedElement(element, 'general', options),\n },\n cloneBlockBase(general),\n cloneBlockGroupBase(general, options)\n );\n}\n\nfunction cloneSelectionMarker(\n marker: ReadonlyContentModelSelectionMarker\n): ContentModelSelectionMarker {\n return Object.assign({ isSelected: marker.isSelected }, cloneSegmentBase(marker));\n}\n\nfunction cloneImage(image: ReadonlyContentModelImage): ContentModelImage {\n const { src, alt, title, isSelectedAsImageSelection } = image;\n\n return Object.assign(\n { src, alt, title, isSelectedAsImageSelection },\n cloneSegmentBase(image),\n cloneModelWithDataset(image)\n );\n}\n\nfunction cloneGeneralSegment(\n general: ReadonlyContentModelGeneralSegment,\n options: CloneModelOptions\n): ContentModelGeneralSegment {\n return Object.assign(cloneGeneralBlock(general, options), cloneSegmentBase(general));\n}\n\nfunction cloneText(textSegment: ReadonlyContentModelText): ContentModelText {\n const { text } = textSegment;\n return Object.assign({ text }, cloneSegmentBase(textSegment));\n}\n\nfunction handleCachedElement<T extends HTMLElement>(\n node: T,\n type: 'general' | 'entity',\n options: CloneModelOptions\n): T;\n\nfunction handleCachedElement<T extends HTMLElement>(\n node: T | undefined,\n type: 'cache',\n options: CloneModelOptions\n): T | undefined;\n\nfunction handleCachedElement<T extends HTMLElement>(\n node: T | undefined,\n type: 'general' | 'entity' | 'cache',\n options: CloneModelOptions\n): T | undefined {\n const { includeCachedElement } = options;\n\n if (!node) {\n return undefined;\n } else if (!includeCachedElement) {\n return type == 'cache' ? undefined : (node.cloneNode(true /*deep*/) as T);\n } else if (includeCachedElement === true) {\n return node;\n } else {\n const result = includeCachedElement(node, type) as T | undefined;\n\n if ((type == 'general' || type == 'entity') && !result) {\n throw new Error('Entity and General Model must has wrapper element');\n }\n\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cloneModel.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/editing/cloneModel.ts"],"names":[],"mappings":";;;;AAkDA,IAAM,WAAW,GAAsB;IACnC,oBAAoB,EAAE,UAAC,IAAI,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BAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAClE,CAAC;AAcD,SAAS,mBAAmB,CACxB,IAAmB,EACnB,IAAoC,EACpC,OAA0B;IAElB,IAAA,oBAAoB,GAAK,OAAO,qBAAZ,CAAa;IAEzC,IAAI,CAAC,IAAI,EAAE;QACP,OAAO,SAAS,CAAC;KACpB;SAAM,IAAI,CAAC,oBAAoB,EAAE;QAC9B,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAO,CAAC;KAC7E;SAAM,IAAI,oBAAoB,KAAK,IAAI,EAAE;QACtC,OAAO,IAAI,CAAC;KACf;SAAM;QACH,IAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAkB,CAAC;QAEjE,IAAI,CAAC,IAAI,IAAI,SAAS,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE;YACpD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;SACxE;QAED,OAAO,MAAM,CAAC;KACjB;AACL,CAAC","sourcesContent":["import type {\n ContentModelBlock,\n ContentModelBlockBase,\n ContentModelBlockGroupBase,\n ContentModelBlockGroupType,\n ContentModelBlockType,\n ContentModelDivider,\n ContentModelDocument,\n ContentModelEntity,\n ContentModelFormatBase,\n ContentModelFormatContainer,\n ContentModelGeneralBlock,\n ContentModelImage,\n ContentModelListItem,\n ContentModelParagraph,\n ContentModelSegment,\n ContentModelSegmentBase,\n ContentModelSegmentType,\n ContentModelSelectionMarker,\n ContentModelTable,\n ContentModelTableCell,\n ContentModelWithDataset,\n ContentModelWithFormat,\n ContentModelGeneralSegment,\n ContentModelText,\n ContentModelTableRow,\n ContentModelListLevel,\n CloneModelOptions,\n ReadonlyContentModelDocument,\n ReadonlyContentModelBlockGroupBase,\n ReadonlyContentModelBlock,\n ReadonlyContentModelFormatContainer,\n ReadonlyContentModelBlockBase,\n ReadonlyContentModelGeneralBlock,\n ReadonlyContentModelListItem,\n ReadonlyContentModelSelectionMarker,\n ReadonlyContentModelSegmentBase,\n ReadonlyContentModelWithDataset,\n ReadonlyContentModelDivider,\n ReadonlyContentModelListLevel,\n ReadonlyContentModelParagraph,\n ReadonlyContentModelSegment,\n ReadonlyContentModelTable,\n ReadonlyContentModelTableRow,\n ReadonlyContentModelTableCell,\n ReadonlyContentModelGeneralSegment,\n ReadonlyContentModelImage,\n ReadonlyContentModelText,\n} from 'roosterjs-content-model-types';\n\nconst CloneOption: CloneModelOptions = {\n includeCachedElement: (node, type) => (type == 'cache' ? undefined : node),\n};\n\n/**\n * Clone a content model for paste operations, ensuring that cached elements are handled appropriately.\n * @param model The content model to clone\n * @returns A cloned content model suitable for paste operations\n */\nexport function cloneModelForPaste(model: ReadonlyContentModelDocument) {\n return cloneModel(model, CloneOption);\n}\n\n/**\n * Clone a content model\n * @param model The content model to clone\n * @param options @optional Options to specify customize the clone behavior\n */\nexport function cloneModel(\n model: ReadonlyContentModelDocument,\n options?: CloneModelOptions\n): ContentModelDocument {\n const newModel: ContentModelDocument = cloneBlockGroupBase(model, options || {});\n\n if (model.format) {\n newModel.format = Object.assign({}, model.format);\n }\n\n return newModel;\n}\n\nfunction cloneBlock(\n block: ReadonlyContentModelBlock,\n options: CloneModelOptions\n): ContentModelBlock {\n switch (block.blockType) {\n case 'BlockGroup':\n switch (block.blockGroupType) {\n case 'FormatContainer':\n return cloneFormatContainer(block, options);\n case 'General':\n return cloneGeneralBlock(block, options);\n case 'ListItem':\n return cloneListItem(block, options);\n }\n break;\n case 'Divider':\n return cloneDivider(block, options);\n case 'Entity':\n return cloneEntity(block, options);\n case 'Paragraph':\n return cloneParagraph(block, options);\n case 'Table':\n return cloneTable(block, options);\n }\n}\n\nfunction cloneSegment(\n segment: ReadonlyContentModelSegment,\n options: CloneModelOptions\n): ContentModelSegment {\n switch (segment.segmentType) {\n case 'Br':\n return cloneSegmentBase(segment);\n case 'Entity':\n return cloneEntity(segment, options);\n case 'General':\n return cloneGeneralSegment(segment, options);\n case 'Image':\n return cloneImage(segment);\n case 'SelectionMarker':\n return cloneSelectionMarker(segment);\n case 'Text':\n return cloneText(segment);\n }\n}\n\nfunction cloneModelWithFormat<T extends ContentModelFormatBase>(\n model: ContentModelWithFormat<T>\n): ContentModelWithFormat<T> {\n return {\n format: Object.assign({}, model.format),\n };\n}\n\nfunction cloneModelWithDataset<T>(\n model: ReadonlyContentModelWithDataset<T>\n): ContentModelWithDataset<T> {\n return {\n dataset: Object.assign({}, model.dataset),\n };\n}\n\nfunction cloneBlockBase<T extends ContentModelBlockType>(\n block: ReadonlyContentModelBlockBase<T>\n): ContentModelBlockBase<T> {\n const { blockType } = block;\n\n return Object.assign(\n {\n blockType,\n },\n cloneModelWithFormat(block)\n );\n}\n\nfunction cloneBlockGroupBase<T extends ContentModelBlockGroupType>(\n group: ReadonlyContentModelBlockGroupBase<T>,\n options: CloneModelOptions\n): ContentModelBlockGroupBase<T> {\n const { blockGroupType, blocks } = group;\n\n return {\n blockGroupType: blockGroupType,\n blocks: blocks.map(block => cloneBlock(block, options)),\n };\n}\n\nfunction cloneSegmentBase<T extends ContentModelSegmentType>(\n segment: ReadonlyContentModelSegmentBase<T>\n): ContentModelSegmentBase<T> {\n const { segmentType, isSelected, code, link, data } = segment;\n\n const newSegment: ContentModelSegmentBase<T> = Object.assign(\n {\n segmentType,\n isSelected,\n },\n cloneModelWithFormat(segment)\n );\n\n if (code) {\n newSegment.code = cloneModelWithFormat(code);\n }\n if (link) {\n newSegment.link = Object.assign(cloneModelWithFormat(link), cloneModelWithDataset(link));\n }\n if (data) {\n newSegment.data = cloneModelWithFormat(data);\n }\n\n return newSegment;\n}\n\nfunction cloneEntity(entity: ContentModelEntity, options: CloneModelOptions): ContentModelEntity {\n const { wrapper, entityFormat } = entity;\n\n return Object.assign(\n {\n wrapper: handleCachedElement(wrapper, 'entity', options),\n entityFormat: { ...entityFormat },\n },\n cloneBlockBase(entity),\n cloneSegmentBase(entity)\n );\n}\n\nfunction cloneParagraph(\n paragraph: ReadonlyContentModelParagraph,\n options: CloneModelOptions\n): ContentModelParagraph {\n const { cachedElement, segments, isImplicit, decorator, segmentFormat } = paragraph;\n\n const newParagraph: ContentModelParagraph = Object.assign(\n {\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n isImplicit,\n segments: segments.map(segment => cloneSegment(segment, options)),\n segmentFormat: segmentFormat ? { ...segmentFormat } : undefined,\n },\n cloneBlockBase(paragraph),\n cloneModelWithFormat(paragraph)\n );\n\n if (decorator) {\n newParagraph.decorator = Object.assign(\n {\n tagName: decorator.tagName,\n },\n cloneModelWithFormat(decorator)\n );\n }\n\n return newParagraph;\n}\n\nfunction cloneTable(\n table: ReadonlyContentModelTable,\n options: CloneModelOptions\n): ContentModelTable {\n const { cachedElement, widths, rows } = table;\n\n return Object.assign(\n {\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n widths: Array.from(widths),\n rows: rows.map(row => cloneTableRow(row, options)),\n },\n cloneBlockBase(table),\n cloneModelWithDataset(table)\n );\n}\n\nfunction cloneTableRow(\n row: ReadonlyContentModelTableRow,\n options: CloneModelOptions\n): ContentModelTableRow {\n const { height, cells, cachedElement } = row;\n\n return Object.assign(\n {\n height,\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n cells: cells.map(cell => cloneTableCell(cell, options)),\n },\n cloneModelWithFormat(row)\n );\n}\n\nfunction cloneTableCell(\n cell: ReadonlyContentModelTableCell,\n options: CloneModelOptions\n): ContentModelTableCell {\n const { cachedElement, isSelected, spanAbove, spanLeft, isHeader } = cell;\n\n return Object.assign(\n {\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n isSelected,\n spanAbove,\n spanLeft,\n isHeader,\n },\n cloneBlockGroupBase(cell, options),\n cloneModelWithFormat(cell),\n cloneModelWithDataset(cell)\n );\n}\n\nfunction cloneFormatContainer(\n container: ReadonlyContentModelFormatContainer,\n options: CloneModelOptions\n): ContentModelFormatContainer {\n const { tagName, cachedElement } = container;\n const newContainer: ContentModelFormatContainer = Object.assign(\n { tagName, cachedElement: handleCachedElement(cachedElement, 'cache', options) },\n cloneBlockBase(container),\n cloneBlockGroupBase(container, options)\n );\n\n if (container.zeroFontSize) {\n newContainer.zeroFontSize = true;\n }\n\n return newContainer;\n}\n\nfunction cloneListItem(\n item: ReadonlyContentModelListItem,\n options: CloneModelOptions\n): ContentModelListItem {\n const { formatHolder, levels, cachedElement } = item;\n\n return Object.assign(\n {\n formatHolder: cloneSelectionMarker(formatHolder),\n levels: levels.map(cloneListLevel),\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n },\n cloneBlockBase(item),\n cloneBlockGroupBase(item, options)\n );\n}\n\nfunction cloneListLevel(level: ReadonlyContentModelListLevel): ContentModelListLevel {\n const { listType } = level;\n\n return Object.assign({ listType }, cloneModelWithFormat(level), cloneModelWithDataset(level));\n}\nfunction cloneDivider(\n divider: ReadonlyContentModelDivider,\n options: CloneModelOptions\n): ContentModelDivider {\n const { tagName, isSelected, cachedElement } = divider;\n\n return Object.assign(\n {\n isSelected,\n tagName,\n cachedElement: handleCachedElement(cachedElement, 'cache', options),\n },\n cloneBlockBase(divider)\n );\n}\n\nfunction cloneGeneralBlock(\n general: ReadonlyContentModelGeneralBlock,\n options: CloneModelOptions\n): ContentModelGeneralBlock {\n const { element } = general;\n\n return Object.assign(\n {\n element: handleCachedElement(element, 'general', options),\n },\n cloneBlockBase(general),\n cloneBlockGroupBase(general, options)\n );\n}\n\nfunction cloneSelectionMarker(\n marker: ReadonlyContentModelSelectionMarker\n): ContentModelSelectionMarker {\n return Object.assign({ isSelected: marker.isSelected }, cloneSegmentBase(marker));\n}\n\nfunction cloneImage(image: ReadonlyContentModelImage): ContentModelImage {\n const { src, alt, title, isSelectedAsImageSelection } = image;\n\n return Object.assign(\n { src, alt, title, isSelectedAsImageSelection },\n cloneSegmentBase(image),\n cloneModelWithDataset(image)\n );\n}\n\nfunction cloneGeneralSegment(\n general: ReadonlyContentModelGeneralSegment,\n options: CloneModelOptions\n): ContentModelGeneralSegment {\n return Object.assign(cloneGeneralBlock(general, options), cloneSegmentBase(general));\n}\n\nfunction cloneText(textSegment: ReadonlyContentModelText): ContentModelText {\n const { text } = textSegment;\n return Object.assign({ text }, cloneSegmentBase(textSegment));\n}\n\nfunction handleCachedElement<T extends HTMLElement>(\n node: T,\n type: 'general' | 'entity',\n options: CloneModelOptions\n): T;\n\nfunction handleCachedElement<T extends HTMLElement>(\n node: T | undefined,\n type: 'cache',\n options: CloneModelOptions\n): T | undefined;\n\nfunction handleCachedElement<T extends HTMLElement>(\n node: T | undefined,\n type: 'general' | 'entity' | 'cache',\n options: CloneModelOptions\n): T | undefined {\n const { includeCachedElement } = options;\n\n if (!node) {\n return undefined;\n } else if (!includeCachedElement) {\n return type == 'cache' ? undefined : (node.cloneNode(true /*deep*/) as T);\n } else if (includeCachedElement === true) {\n return node;\n } else {\n const result = includeCachedElement(node, type) as T | undefined;\n\n if ((type == 'general' || type == 'entity') && !result) {\n throw new Error('Entity and General Model must has wrapper element');\n }\n\n return result;\n }\n}\n"]}
|
|
@@ -9,7 +9,7 @@ var moveChildNodes_1 = require("../../domUtils/moveChildNodes");
|
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
var handleSegmentDecorator = function (_, parent, segment, context) {
|
|
12
|
-
var code = segment.code, link = segment.link;
|
|
12
|
+
var code = segment.code, link = segment.link, data = segment.data;
|
|
13
13
|
if ((0, isNodeOfType_1.isNodeOfType)(parent, 'ELEMENT_NODE')) {
|
|
14
14
|
if (link) {
|
|
15
15
|
(0, stackFormat_1.stackFormat)(context, 'a', function () {
|
|
@@ -28,6 +28,14 @@ var handleSegmentDecorator = function (_, parent, segment, context) {
|
|
|
28
28
|
(_a = context.onNodeCreated) === null || _a === void 0 ? void 0 : _a.call(context, code, codeNode);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
if (data) {
|
|
32
|
+
(0, stackFormat_1.stackFormat)(context, 'data', function () {
|
|
33
|
+
var _a;
|
|
34
|
+
var dataNode = (0, moveChildNodes_1.wrapAllChildNodes)(parent, 'data');
|
|
35
|
+
(0, applyFormat_1.applyFormat)(dataNode, context.formatAppliers.data, data.format, context);
|
|
36
|
+
(_a = context.onNodeCreated) === null || _a === void 0 ? void 0 : _a.call(context, data, dataNode);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
};
|
|
33
41
|
exports.handleSegmentDecorator = handleSegmentDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSegmentDecorator.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelToDom/handlers/handleSegmentDecorator.ts"],"names":[],"mappings":";;;AAAA,oDAAmD;AACnD,4DAA2D;AAC3D,oDAAmD;AACnD,gEAAkE;AAMlE;;GAEG;AACI,IAAM,sBAAsB,GAAoD,UACnF,CAAC,EACD,MAAM,EACN,OAAO,EACP,OAAO;IAEC,IAAA,IAAI,GAAW,OAAO,KAAlB,EAAE,IAAI,GAAK,OAAO,KAAZ,CAAa;
|
|
1
|
+
{"version":3,"file":"handleSegmentDecorator.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelToDom/handlers/handleSegmentDecorator.ts"],"names":[],"mappings":";;;AAAA,oDAAmD;AACnD,4DAA2D;AAC3D,oDAAmD;AACnD,gEAAkE;AAMlE;;GAEG;AACI,IAAM,sBAAsB,GAAoD,UACnF,CAAC,EACD,MAAM,EACN,OAAO,EACP,OAAO;IAEC,IAAA,IAAI,GAAiB,OAAO,KAAxB,EAAE,IAAI,GAAW,OAAO,KAAlB,EAAE,IAAI,GAAK,OAAO,KAAZ,CAAa;IAErC,IAAI,IAAA,2BAAY,EAAC,MAAM,EAAE,cAAc,CAAC,EAAE;QACtC,IAAI,IAAI,EAAE;YACN,IAAA,yBAAW,EAAC,OAAO,EAAE,GAAG,EAAE;;g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BAwCjC","sourcesContent":["import { applyFormat } from '../utils/applyFormat';\nimport { isNodeOfType } from '../../domUtils/isNodeOfType';\nimport { stackFormat } from '../utils/stackFormat';\nimport { wrapAllChildNodes } from '../../domUtils/moveChildNodes';\nimport type {\n ContentModelSegment,\n ContentModelSegmentHandler,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const handleSegmentDecorator: ContentModelSegmentHandler<ContentModelSegment> = (\n _,\n parent,\n segment,\n context\n) => {\n const { code, link, data } = segment;\n\n if (isNodeOfType(parent, 'ELEMENT_NODE')) {\n if (link) {\n stackFormat(context, 'a', () => {\n const a = wrapAllChildNodes(parent, 'a');\n\n applyFormat(a, context.formatAppliers.link, link.format, context);\n applyFormat(a, context.formatAppliers.dataset, link.dataset, context);\n\n context.onNodeCreated?.(link, a);\n });\n }\n\n if (code) {\n stackFormat(context, 'code', () => {\n const codeNode = wrapAllChildNodes(parent, 'code');\n\n applyFormat(codeNode, context.formatAppliers.code, code.format, context);\n\n context.onNodeCreated?.(code, codeNode);\n });\n }\n\n if (data) {\n stackFormat(context, 'data', () => {\n const dataNode = wrapAllChildNodes(parent, 'data');\n\n applyFormat(dataNode, context.formatAppliers.data, data.format, context);\n\n context.onNodeCreated?.(data, dataNode);\n });\n }\n }\n};\n"]}
|
|
@@ -2,7 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeNode = void 0;
|
|
4
4
|
var isNodeOfType_1 = require("../../domUtils/isNodeOfType");
|
|
5
|
-
var OptimizeTags = [
|
|
5
|
+
var OptimizeTags = [
|
|
6
|
+
'SPAN',
|
|
7
|
+
'B',
|
|
8
|
+
'EM',
|
|
9
|
+
'I',
|
|
10
|
+
'U',
|
|
11
|
+
'SUB',
|
|
12
|
+
'SUP',
|
|
13
|
+
'STRIKE',
|
|
14
|
+
'S',
|
|
15
|
+
'A',
|
|
16
|
+
'CODE',
|
|
17
|
+
'DATA',
|
|
18
|
+
];
|
|
6
19
|
/**
|
|
7
20
|
* @internal
|
|
8
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeNode.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/mergeNode.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAE3D,IAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"mergeNode.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/mergeNode.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAE3D,IAAM,YAAY,GAAG;IACjB,MAAM;IACN,GAAG;IACH,IAAI;IACJ,GAAG;IACH,GAAG;IACH,KAAK;IACL,KAAK;IACL,QAAQ;IACR,GAAG;IACH,GAAG;IACH,MAAM;IACN,MAAM;CACT,CAAC;AAEF;;GAEG;AACH,SAAgB,SAAS,CAAC,IAAU;IAChC,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,GAAI;QACvC,IAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAE/B,IACI,IAAI;YACJ,IAAA,2BAAY,EAAC,KAAK,EAAE,cAAc,CAAC;YACnC,IAAA,2BAAY,EAAC,IAAI,EAAE,cAAc,CAAC;YAClC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO;YAC7B,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YACxC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,EAChC;YACE,OAAO,IAAI,CAAC,UAAU,EAAE;gBACpB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACtC;YAED,IAAI,CAAC,UAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SACtC;aAAM;YACH,KAAK,GAAG,IAAI,CAAC;SAChB;KACJ;AACL,CAAC;AArBD,8BAqBC;AAED,SAAS,iBAAiB,CAAC,QAAqB,EAAE,QAAqB;IACnE,IAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC;IAClC,IAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC;IAElC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE;QAC9B,OAAO,KAAK,CAAC;KAChB;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;YACpE,OAAO,KAAK,CAAC;SAChB;KACJ;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { isNodeOfType } from '../../domUtils/isNodeOfType';\n\nconst OptimizeTags = [\n 'SPAN',\n 'B',\n 'EM',\n 'I',\n 'U',\n 'SUB',\n 'SUP',\n 'STRIKE',\n 'S',\n 'A',\n 'CODE',\n 'DATA',\n];\n\n/**\n * @internal\n */\nexport function mergeNode(root: Node) {\n for (let child = root.firstChild; child; ) {\n const next = child.nextSibling;\n\n if (\n next &&\n isNodeOfType(child, 'ELEMENT_NODE') &&\n isNodeOfType(next, 'ELEMENT_NODE') &&\n child.tagName == next.tagName &&\n OptimizeTags.indexOf(child.tagName) >= 0 &&\n hasSameAttributes(child, next)\n ) {\n while (next.firstChild) {\n child.appendChild(next.firstChild);\n }\n\n next.parentNode!.removeChild(next);\n } else {\n child = next;\n }\n }\n}\n\nfunction hasSameAttributes(element1: HTMLElement, element2: HTMLElement) {\n const attr1 = element1.attributes;\n const attr2 = element2.attributes;\n\n if (attr1.length != attr2.length) {\n return false;\n }\n\n for (let i = 0; i < attr1.length; i++) {\n if (attr1[i].name != attr2[i].name || attr1[i].value != attr2[i].value) {\n return false;\n }\n }\n\n return true;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDomToModelContext.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/context/createDomToModelContext.ts"],"names":[],"mappings":";;;;IAqBA;;;;OAIG;IACH,SAAgB,uBAAuB,CACnC,aAA6B;QAC7B,iBAA4C;aAA5C,UAA4C,EAA5C,qBAA4C,EAA5C,IAA4C;YAA5C,gCAA4C;;QAE5C,OAAO,iCAAiC,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;IAC7F,CAAC;IALD,0DAKC;IAED;;;;OAIG;IACH,SAAgB,iCAAiC,CAC7C,MAA0B,EAC1B,aAA6B;QAE7B,OAAO,MAAM,CAAC,MAAM,CAChB,EAAE,EACF,aAAa,EACb,gCAAgC,EAAE,EAClC,6BAA6B,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,CAAC,EACvD,gCAAgC,EAAE,EAClC,MAAM,CACT,CAAC;IACN,CAAC;IAZD,8EAYC;IAED,SAAS,gCAAgC;QACrC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IACpC,CAAC;IAED,SAAS,6BAA6B,CAAC,SAAmB;QACtD,IAAM,WAAW,GAA4B,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEnF,OAAO;YACH,WAAW,aAAA;YACX,aAAa,EAAE,EAAE;YAEjB,UAAU,EAAE;gBACR,MAAM,EAAE,EAAE;gBACV,gBAAgB,EAAE,EAAE;aACvB;SACJ,CAAC;IACN,CAAC;IAED,SAAS,gCAAgC;QACrC,OAAO;YACH,IAAI,EAAE;gBACF,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE,EAAE;aACd;YACD,IAAI,EAAE;gBACF,MAAM,EAAE,EAAE;aACb;YACD,cAAc,EAAE;gBACZ,MAA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CAAC;iBAC1C,GAAG,CACA,UAAA,SAAS;gBACL,OAAA,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,SAAS;oBACvC,CAAC,CAAC,4CAAoB,CAAC,SAAS,CAAC;oBACjC,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAsB;YAFxD,CAEwD,CAC/D,CAAA;iBACA,MAAM,8DACA,sBAAsB,CAAC,GAAG,CACzB,UAAA,OAAO,YAAI,OAAA,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,mCAAI,EAAE,CAAwB,CAAA,EAAA,CAC3D,UACJ,CAAC;YAEN,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAEpB,OAAO,MAAM,CAAC;QAClB,CAAC,EACD;YACI,IAAI,EAAE,EAAwB;SACL,CAChC,CAAC;QAEF,sBAAsB,CAAC,OAAO,CAAC,UAAA,OAAO;YAClC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;gBACf,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAClD;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAClB,CAAC;IArCD,gDAqCC","sourcesContent":["import { defaultProcessorMap } from './defaultProcessors';\nimport { getObjectKeys } from '../../domUtils/getObjectKeys';\nimport {\n defaultFormatKeysPerCategory,\n defaultFormatParsers,\n} from '../../formatHandlers/defaultFormatHandlers';\nimport type {\n ContentModelBlockFormat,\n DomToModelContext,\n DomToModelDecoratorContext,\n DomToModelFormatContext,\n DomToModelOption,\n DomToModelSelectionContext,\n DomToModelSettings,\n EditorContext,\n FormatParser,\n FormatParsers,\n FormatParsersPerCategory,\n TextFormatParser,\n} from 'roosterjs-content-model-types';\n\n/**\n * Create context object for DOM to Content Model conversion\n * @param editorContext Context of editor\n * @param options Option array to customize the DOM to Model conversion behavior\n */\nexport function createDomToModelContext(\n editorContext?: EditorContext,\n ...options: (DomToModelOption | undefined)[]\n): DomToModelContext {\n return createDomToModelContextWithConfig(createDomToModelConfig(options), editorContext);\n}\n\n/**\n * Create context object for DOM to Content Model conversion with an existing configure\n * @param config A full config object to define how to convert DOM tree to Content Model\n * @param editorContext Context of editor\n */\nexport function createDomToModelContextWithConfig(\n config: DomToModelSettings,\n editorContext?: EditorContext\n): DomToModelContext {\n return Object.assign(\n {},\n editorContext,\n createDomToModelSelectionContext(),\n createDomToModelFormatContext(editorContext?.isRootRtl),\n createDomToModelDecoratorContext(),\n config\n );\n}\n\nfunction createDomToModelSelectionContext(): DomToModelSelectionContext {\n return { isInSelection: false };\n}\n\nfunction createDomToModelFormatContext(isRootRtl?: boolean): DomToModelFormatContext {\n const blockFormat: ContentModelBlockFormat = isRootRtl ? { direction: 'rtl' } : {};\n\n return {\n blockFormat,\n segmentFormat: {},\n\n listFormat: {\n levels: [],\n threadItemCounts: [],\n },\n };\n}\n\nfunction createDomToModelDecoratorContext(): DomToModelDecoratorContext {\n return {\n link: {\n format: {},\n dataset: {},\n },\n code: {\n format: {},\n },\n blockDecorator: {\n format: {},\n tagName: '',\n },\n };\n}\n\n/**\n * Create Dom to Content Model Config object\n * @param options All customizations of content model creation\n */\nexport function createDomToModelConfig(\n options: (DomToModelOption | undefined)[]\n): DomToModelSettings {\n return {\n elementProcessors: Object.assign(\n {},\n defaultProcessorMap,\n ...options.map(x => x?.processorOverride)\n ),\n formatParsers: buildFormatParsers(\n options.map(x => x?.formatParserOverride),\n options.map(x => x?.additionalFormatParsers)\n ),\n defaultElementProcessors: defaultProcessorMap,\n defaultFormatParsers,\n processNonVisibleElements: options.some(x => !!x?.processNonVisibleElements),\n };\n}\n\n/**\n * @internal Export for test only\n * Build format parsers used by DOM to Content Model conversion\n * @param override\n * @param additionalParsersArray\n * @returns\n */\nexport function buildFormatParsers(\n overrides: (Partial<FormatParsers> | undefined)[] = [],\n additionalParsersArray: (Partial<FormatParsersPerCategory> | undefined)[] = []\n): FormatParsersPerCategory {\n const combinedOverrides = Object.assign({}, ...overrides);\n\n const result = getObjectKeys(defaultFormatKeysPerCategory).reduce(\n (result, key) => {\n const value = defaultFormatKeysPerCategory[key]\n .map(\n formatKey =>\n (combinedOverrides[formatKey] === undefined\n ? defaultFormatParsers[formatKey]\n : combinedOverrides[formatKey]) as FormatParser<any>\n )\n .concat(\n ...additionalParsersArray.map(\n parsers => (parsers?.[key] ?? []) as FormatParser<any>[]\n )\n );\n\n result[key] = value;\n\n return result;\n },\n {\n text: [] as TextFormatParser[],\n } as FormatParsersPerCategory\n );\n\n additionalParsersArray.forEach(parsers => {\n if (parsers?.text) {\n result.text = result.text.concat(parsers.text);\n }\n });\n\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"createDomToModelContext.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/context/createDomToModelContext.ts"],"names":[],"mappings":";;;;IAqBA;;;;OAIG;IACH,SAAgB,uBAAuB,CACnC,aAA6B;QAC7B,iBAA4C;aAA5C,UAA4C,EAA5C,qBAA4C,EAA5C,IAA4C;YAA5C,gCAA4C;;QAE5C,OAAO,iCAAiC,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;IAC7F,CAAC;IALD,0DAKC;IAED;;;;OAIG;IACH,SAAgB,iCAAiC,CAC7C,MAA0B,EAC1B,aAA6B;QAE7B,OAAO,MAAM,CAAC,MAAM,CAChB,EAAE,EACF,aAAa,EACb,gCAAgC,EAAE,EAClC,6BAA6B,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,CAAC,EACvD,gCAAgC,EAAE,EAClC,MAAM,CACT,CAAC;IACN,CAAC;IAZD,8EAYC;IAED,SAAS,gCAAgC;QACrC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IACpC,CAAC;IAED,SAAS,6BAA6B,CAAC,SAAmB;QACtD,IAAM,WAA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EH,OAAO,MAAM,CAAC;IAClB,CAAC;IArCD,gDAqCC","sourcesContent":["import { defaultProcessorMap } from './defaultProcessors';\nimport { getObjectKeys } from '../../domUtils/getObjectKeys';\nimport {\n defaultFormatKeysPerCategory,\n defaultFormatParsers,\n} from '../../formatHandlers/defaultFormatHandlers';\nimport type {\n ContentModelBlockFormat,\n DomToModelContext,\n DomToModelDecoratorContext,\n DomToModelFormatContext,\n DomToModelOption,\n DomToModelSelectionContext,\n DomToModelSettings,\n EditorContext,\n FormatParser,\n FormatParsers,\n FormatParsersPerCategory,\n TextFormatParser,\n} from 'roosterjs-content-model-types';\n\n/**\n * Create context object for DOM to Content Model conversion\n * @param editorContext Context of editor\n * @param options Option array to customize the DOM to Model conversion behavior\n */\nexport function createDomToModelContext(\n editorContext?: EditorContext,\n ...options: (DomToModelOption | undefined)[]\n): DomToModelContext {\n return createDomToModelContextWithConfig(createDomToModelConfig(options), editorContext);\n}\n\n/**\n * Create context object for DOM to Content Model conversion with an existing configure\n * @param config A full config object to define how to convert DOM tree to Content Model\n * @param editorContext Context of editor\n */\nexport function createDomToModelContextWithConfig(\n config: DomToModelSettings,\n editorContext?: EditorContext\n): DomToModelContext {\n return Object.assign(\n {},\n editorContext,\n createDomToModelSelectionContext(),\n createDomToModelFormatContext(editorContext?.isRootRtl),\n createDomToModelDecoratorContext(),\n config\n );\n}\n\nfunction createDomToModelSelectionContext(): DomToModelSelectionContext {\n return { isInSelection: false };\n}\n\nfunction createDomToModelFormatContext(isRootRtl?: boolean): DomToModelFormatContext {\n const blockFormat: ContentModelBlockFormat = isRootRtl ? { direction: 'rtl' } : {};\n\n return {\n blockFormat,\n segmentFormat: {},\n\n listFormat: {\n levels: [],\n threadItemCounts: [],\n },\n };\n}\n\nfunction createDomToModelDecoratorContext(): DomToModelDecoratorContext {\n return {\n link: {\n format: {},\n dataset: {},\n },\n code: {\n format: {},\n },\n data: {\n format: {},\n },\n blockDecorator: {\n format: {},\n tagName: '',\n },\n };\n}\n\n/**\n * Create Dom to Content Model Config object\n * @param options All customizations of content model creation\n */\nexport function createDomToModelConfig(\n options: (DomToModelOption | undefined)[]\n): DomToModelSettings {\n return {\n elementProcessors: Object.assign(\n {},\n defaultProcessorMap,\n ...options.map(x => x?.processorOverride)\n ),\n formatParsers: buildFormatParsers(\n options.map(x => x?.formatParserOverride),\n options.map(x => x?.additionalFormatParsers)\n ),\n defaultElementProcessors: defaultProcessorMap,\n defaultFormatParsers,\n processNonVisibleElements: options.some(x => !!x?.processNonVisibleElements),\n };\n}\n\n/**\n * @internal Export for test only\n * Build format parsers used by DOM to Content Model conversion\n * @param override\n * @param additionalParsersArray\n * @returns\n */\nexport function buildFormatParsers(\n overrides: (Partial<FormatParsers> | undefined)[] = [],\n additionalParsersArray: (Partial<FormatParsersPerCategory> | undefined)[] = []\n): FormatParsersPerCategory {\n const combinedOverrides = Object.assign({}, ...overrides);\n\n const result = getObjectKeys(defaultFormatKeysPerCategory).reduce(\n (result, key) => {\n const value = defaultFormatKeysPerCategory[key]\n .map(\n formatKey =>\n (combinedOverrides[formatKey] === undefined\n ? defaultFormatParsers[formatKey]\n : combinedOverrides[formatKey]) as FormatParser<any>\n )\n .concat(\n ...additionalParsersArray.map(\n parsers => (parsers?.[key] ?? []) as FormatParser<any>[]\n )\n );\n\n result[key] = value;\n\n return result;\n },\n {\n text: [] as TextFormatParser[],\n } as FormatParsersPerCategory\n );\n\n additionalParsersArray.forEach(parsers => {\n if (parsers?.text) {\n result.text = result.text.concat(parsers.text);\n }\n });\n\n return result;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "../processors/brProcessor", "../processors/childProcessor", "../processors/codeProcessor", "../processors/delimiterProcessor", "../processors/elementProcessor", "../processors/entityProcessor", "../processors/fontProcessor", "../processors/formatContainerProcessor", "../processors/generalProcessor", "../processors/headingProcessor", "../processors/hrProcessor", "../processors/imageProcessor", "../processors/knownElementProcessor", "../processors/linkProcessor", "../processors/listItemProcessor", "../processors/listProcessor", "../processors/pProcessor", "../processors/tableProcessor", "../processors/textProcessor", "../processors/textWithSelectionProcessor"], function (require, exports, brProcessor_1, childProcessor_1, codeProcessor_1, delimiterProcessor_1, elementProcessor_1, entityProcessor_1, fontProcessor_1, formatContainerProcessor_1, generalProcessor_1, headingProcessor_1, hrProcessor_1, imageProcessor_1, knownElementProcessor_1, linkProcessor_1, listItemProcessor_1, listProcessor_1, pProcessor_1, tableProcessor_1, textProcessor_1, textWithSelectionProcessor_1) {
|
|
1
|
+
define(["require", "exports", "../processors/brProcessor", "../processors/childProcessor", "../processors/codeProcessor", "../processors/dataProcessor", "../processors/delimiterProcessor", "../processors/elementProcessor", "../processors/entityProcessor", "../processors/fontProcessor", "../processors/formatContainerProcessor", "../processors/generalProcessor", "../processors/headingProcessor", "../processors/hrProcessor", "../processors/imageProcessor", "../processors/knownElementProcessor", "../processors/linkProcessor", "../processors/listItemProcessor", "../processors/listProcessor", "../processors/pProcessor", "../processors/tableProcessor", "../processors/textProcessor", "../processors/textWithSelectionProcessor"], function (require, exports, brProcessor_1, childProcessor_1, codeProcessor_1, dataProcessor_1, delimiterProcessor_1, elementProcessor_1, entityProcessor_1, fontProcessor_1, formatContainerProcessor_1, generalProcessor_1, headingProcessor_1, hrProcessor_1, imageProcessor_1, knownElementProcessor_1, linkProcessor_1, listItemProcessor_1, listProcessor_1, pProcessor_1, tableProcessor_1, textProcessor_1, textWithSelectionProcessor_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.defaultProcessorMap = void 0;
|
|
@@ -11,6 +11,7 @@ define(["require", "exports", "../processors/brProcessor", "../processors/childP
|
|
|
11
11
|
blockquote: knownElementProcessor_1.knownElementProcessor,
|
|
12
12
|
br: brProcessor_1.brProcessor,
|
|
13
13
|
code: codeProcessor_1.codeProcessor,
|
|
14
|
+
data: dataProcessor_1.dataProcessor,
|
|
14
15
|
dd: formatContainerProcessor_1.formatContainerProcessor,
|
|
15
16
|
del: knownElementProcessor_1.knownElementProcessor,
|
|
16
17
|
div: knownElementProcessor_1.knownElementProcessor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultProcessors.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/context/defaultProcessors.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"defaultProcessors.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/context/defaultProcessors.ts"],"names":[],"mappings":";;;;IAuBA;;OAEG;IACU,QAAA,mBAAmB,GAAwB;QACpD,CAAC,EAAE,6BAAa;QAChB,CAAC,EAAE,6CAAqB;QACxB,UAAU,EAAE,6CAAqB;QACjC,EAAE,EAAE,yBAAW;QACf,IAAI,EAAE,6BAAa;QACnB,IAAI,EAAE,6BAAa;QACnB,EAAE,EAAE,mDAAwB;QAC5B,GAAG,EAAE,6CAAqB;QAC1B,GAAG,EAAE,6CAAqB;QAC1B,EAAE,EAAE,mDAAwB;QAC5B,EAAE,EAAE,mDAAwB;QAC5B,EAAE,EAAE,6CAAqB;QACzB,IAAI,EAAE,6BAAa;QACnB,CAAC,EAAE,6CAAqB;QACxB,GAAG,EAAE,+BAAc;QACnB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,mCAAgB;QACpB,EAAE,EAAE,yBAAW;QACf,EAAE,EAAE,qCAAiB;QACrB,EAAE,EAAE,6BAAa;QACjB,CAAC,EAAE,uBAAU;QACb,GAAG,EAAE,mDAAwB;QAC7B,CAAC,EAAE,6CAAqB;QACxB,OAAO,EAAE,6CAAqB;QAC9B,IAAI,EAAE,6CAAqB;QAC3B,MAAM,EAAE,6CAAqB;QAC7B,MAAM,EAAE,6CAAqB;QAC7B,GAAG,EAAE,6CAAqB;QAC1B,GAAG,EAAE,6CAAqB;QAC1B,KAAK,EAAE,+BAAc;QACrB,CAAC,EAAE,6CAAqB;QACxB,EAAE,EAAE,6BAAa;QAEjB,GAAG,EAAE,mCAAgB;QACrB,OAAO,EAAE,6BAAa;QACtB,iBAAiB,EAAE,uDAA0B;QAC7C,OAAO,EAAE,mCAAgB;QACzB,MAAM,EAAE,iCAAe;QACvB,KAAK,EAAE,+BAAc;QACrB,SAAS,EAAE,uCAAkB;KAChC,CAAC","sourcesContent":["import { brProcessor } from '../processors/brProcessor';\nimport { childProcessor } from '../processors/childProcessor';\nimport { codeProcessor } from '../processors/codeProcessor';\nimport { dataProcessor } from '../processors/dataProcessor';\nimport { delimiterProcessor } from '../processors/delimiterProcessor';\nimport { elementProcessor } from '../processors/elementProcessor';\nimport { entityProcessor } from '../processors/entityProcessor';\nimport { fontProcessor } from '../processors/fontProcessor';\nimport { formatContainerProcessor } from '../processors/formatContainerProcessor';\nimport { generalProcessor } from '../processors/generalProcessor';\nimport { headingProcessor } from '../processors/headingProcessor';\nimport { hrProcessor } from '../processors/hrProcessor';\nimport { imageProcessor } from '../processors/imageProcessor';\nimport { knownElementProcessor } from '../processors/knownElementProcessor';\nimport { linkProcessor } from '../processors/linkProcessor';\nimport { listItemProcessor } from '../processors/listItemProcessor';\nimport { listProcessor } from '../processors/listProcessor';\nimport { pProcessor } from '../processors/pProcessor';\nimport { tableProcessor } from '../processors/tableProcessor';\nimport { textProcessor } from '../processors/textProcessor';\nimport { textWithSelectionProcessor } from '../processors/textWithSelectionProcessor';\nimport type { ElementProcessorMap } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const defaultProcessorMap: ElementProcessorMap = {\n a: linkProcessor,\n b: knownElementProcessor,\n blockquote: knownElementProcessor,\n br: brProcessor,\n code: codeProcessor,\n data: dataProcessor,\n dd: formatContainerProcessor,\n del: knownElementProcessor,\n div: knownElementProcessor,\n dl: formatContainerProcessor,\n dt: formatContainerProcessor,\n em: knownElementProcessor,\n font: fontProcessor,\n i: knownElementProcessor,\n img: imageProcessor,\n h1: headingProcessor,\n h2: headingProcessor,\n h3: headingProcessor,\n h4: headingProcessor,\n h5: headingProcessor,\n h6: headingProcessor,\n hr: hrProcessor,\n li: listItemProcessor,\n ol: listProcessor,\n p: pProcessor,\n pre: formatContainerProcessor,\n s: knownElementProcessor,\n section: knownElementProcessor,\n span: knownElementProcessor,\n strike: knownElementProcessor,\n strong: knownElementProcessor,\n sub: knownElementProcessor,\n sup: knownElementProcessor,\n table: tableProcessor,\n u: knownElementProcessor,\n ul: listProcessor,\n\n '*': generalProcessor,\n '#text': textProcessor,\n textWithSelection: textWithSelectionProcessor,\n element: elementProcessor,\n entity: entityProcessor,\n child: childProcessor,\n delimiter: delimiterProcessor,\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
define(["require", "exports", "./knownElementProcessor", "../utils/parseFormat", "../utils/stackFormat"], function (require, exports, knownElementProcessor_1, parseFormat_1, stackFormat_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.dataProcessor = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
var dataProcessor = function (group, element, context) {
|
|
9
|
+
(0, stackFormat_1.stackFormat)(context, { data: 'empty' }, function () {
|
|
10
|
+
(0, parseFormat_1.parseFormat)(element, context.formatParsers.data, context.data.format, context);
|
|
11
|
+
(0, knownElementProcessor_1.knownElementProcessor)(group, element, context);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.dataProcessor = dataProcessor;
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=dataProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataProcessor.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/processors/dataProcessor.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,aAAa,GAAsC,UAAC,KAAK,EAAE,OAAO,EAAE,OAAO;QACpF,IAAA,yBAAW,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;YACpC,IAAA,yBAAW,EAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAE/E,IAAA,6CAAqB,EAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IANW,QAAA,aAAa,iBAMxB","sourcesContent":["import { knownElementProcessor } from './knownElementProcessor';\nimport { parseFormat } from '../utils/parseFormat';\nimport { stackFormat } from '../utils/stackFormat';\nimport type { ElementProcessor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport const dataProcessor: ElementProcessor<HTMLDataElement> = (group, element, context) => {\n stackFormat(context, { data: 'empty' }, () => {\n parseFormat(element, context.formatParsers.data, context.data.format, context);\n\n knownElementProcessor(group, element, context);\n });\n};\n"]}
|
|
@@ -22,13 +22,14 @@ define(["require", "exports", "tslib", "../../domUtils/getObjectKeys"], function
|
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
24
|
function stackFormat(context, options, callback) {
|
|
25
|
-
var segmentFormat = context.segmentFormat, blockFormat = context.blockFormat, linkFormat = context.link, codeFormat = context.code, decoratorFormat = context.blockDecorator;
|
|
26
|
-
var segment = options.segment, paragraph = options.paragraph, link = options.link, code = options.code, blockDecorator = options.blockDecorator;
|
|
25
|
+
var segmentFormat = context.segmentFormat, blockFormat = context.blockFormat, linkFormat = context.link, codeFormat = context.code, dataFormat = context.data, decoratorFormat = context.blockDecorator;
|
|
26
|
+
var segment = options.segment, paragraph = options.paragraph, link = options.link, code = options.code, data = options.data, blockDecorator = options.blockDecorator;
|
|
27
27
|
try {
|
|
28
28
|
context.segmentFormat = stackFormatInternal(segmentFormat, segment);
|
|
29
29
|
context.blockFormat = stackFormatInternal(blockFormat, paragraph);
|
|
30
30
|
context.link = stackLinkInternal(linkFormat, link);
|
|
31
31
|
context.code = stackCodeInternal(codeFormat, code);
|
|
32
|
+
context.data = stackDataInternal(dataFormat, data);
|
|
32
33
|
context.blockDecorator = stackDecoratorInternal(decoratorFormat, blockDecorator);
|
|
33
34
|
callback();
|
|
34
35
|
}
|
|
@@ -37,6 +38,7 @@ define(["require", "exports", "tslib", "../../domUtils/getObjectKeys"], function
|
|
|
37
38
|
context.blockFormat = blockFormat;
|
|
38
39
|
context.link = linkFormat;
|
|
39
40
|
context.code = codeFormat;
|
|
41
|
+
context.data = dataFormat;
|
|
40
42
|
context.blockDecorator = decoratorFormat;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -79,6 +81,16 @@ define(["require", "exports", "tslib", "../../domUtils/getObjectKeys"], function
|
|
|
79
81
|
return codeFormat;
|
|
80
82
|
}
|
|
81
83
|
}
|
|
84
|
+
function stackDataInternal(dataFormat, data) {
|
|
85
|
+
switch (data) {
|
|
86
|
+
case 'empty':
|
|
87
|
+
return {
|
|
88
|
+
format: {},
|
|
89
|
+
};
|
|
90
|
+
default:
|
|
91
|
+
return dataFormat;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
82
94
|
function stackDecoratorInternal(format, decorator) {
|
|
83
95
|
switch (decorator) {
|
|
84
96
|
case 'empty':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stackFormat.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/utils/stackFormat.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"stackFormat.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/domToModel/utils/stackFormat.ts"],"names":[],"mappings":";;;;IAwBA,kGAAkG;IAClG,4DAA4D;IAC5D,OAAO;IACP,uCAAuC;IACvC,2DAA2D;IAC3D,+DAA+D;IAC/D,UAAU;IACV,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AC;SACrB;IACL,CAAC;IAED,SAAS,mBAAmB,CACxB,MAAS,EACT,WAAwF;QAExF,QAAQ,WAAW,EAAE;YACjB,KAAK,OAAO;gBACR,OAAO,EAAE,CAAC;YAEd,KAAK,SAAS;gBACV,OAAO,MAAM,CAAC;YAElB;gBACI,IAAM,QAAM,6BAAQ,MAAM,CAAE,CAAC;gBAE7B,IAAA,6BAAa,EAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;oBAC7B,IACI,CAAC,WAAW,IAAI,sBAAsB;wBAClC,uCAAuC,CAAC,OAAO,CAC3C,GAAsC,CACzC,IAAI,CAAC,CAAC;wBACX,CAAC,WAAW,IAAI,sBAAsB;4BAClC,qBAAqB,CAAC,OAAO,CAAC,GAAoC,CAAC,IAAI,CAAC,CAAC,EAC/E;wBACE,OAAO,QAAM,CAAC,GAAG,CAAC,CAAC;qBACtB;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAI,WAAW,IAAI,cAAc,IAAI,WAAW,IAAI,sBAAsB,EAAE;oBACxE,IAAM,WAAW,GAAG,MAAiC,CAAC;oBAEtD,sGAAsG;oBACtG,+DAA+D;oBAC/D,IAAI,WAAW,CAAC,UAAU,EAAE;wBACxB,OAAQ,QAAkC,CAAC,mBAAmB,CAAC;wBAC/D,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC;qBAC1C;iBACJ;gBAED,OAAO,QAAM,CAAC;SACrB;IACL,CAAC","sourcesContent":["import { getObjectKeys } from '../../domUtils/getObjectKeys';\nimport type {\n ContentModelBlockFormat,\n ContentModelCode,\n ContentModelData,\n ContentModelFormatBase,\n ContentModelLink,\n ContentModelParagraphDecorator,\n ContentModelSegmentFormat,\n DomToModelContext,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport interface StackFormatOptions {\n segment?: 'shallowClone' | 'shallowCloneForBlock' | 'empty';\n paragraph?: 'shallowClone' | 'shallowCloneForGroup' | 'empty';\n blockDecorator?: 'empty';\n link?: 'linkDefault' | 'cloneFormat' | 'empty';\n code?: 'codeDefault' | 'empty';\n data?: 'empty';\n}\n\n// Some styles, such as background color, won't be inherited by block element if it was originally\n// declared from an inline element. So we need to skip them.\n// e.g.\n// <span style=\"background-color: red\">\n// line 1 <---------------------------- in red here\n// <div>line 2</div> <---------------------- not in red here\n// </span>\nconst SkippedStylesForBlockOnSegmentOnSegment: (keyof ContentModelSegmentFormat)[] = [\n 'backgroundColor',\n];\nconst SkippedStylesForTable: (keyof ContentModelBlockFormat)[] = [\n 'marginLeft',\n 'marginRight',\n 'paddingLeft',\n 'paddingRight',\n];\n\n/**\n * @internal\n */\nexport function stackFormat(\n context: DomToModelContext,\n options: StackFormatOptions,\n callback: () => void\n) {\n const {\n segmentFormat,\n blockFormat,\n link: linkFormat,\n code: codeFormat,\n data: dataFormat,\n blockDecorator: decoratorFormat,\n } = context;\n const { segment, paragraph, link, code, data, blockDecorator } = options;\n\n try {\n context.segmentFormat = stackFormatInternal(segmentFormat, segment);\n context.blockFormat = stackFormatInternal(blockFormat, paragraph);\n context.link = stackLinkInternal(linkFormat, link);\n context.code = stackCodeInternal(codeFormat, code);\n context.data = stackDataInternal(dataFormat, data);\n context.blockDecorator = stackDecoratorInternal(decoratorFormat, blockDecorator);\n\n callback();\n } finally {\n context.segmentFormat = segmentFormat;\n context.blockFormat = blockFormat;\n context.link = linkFormat;\n context.code = codeFormat;\n context.data = dataFormat;\n context.blockDecorator = decoratorFormat;\n }\n}\n\nfunction stackLinkInternal(\n linkFormat: ContentModelLink,\n link?: 'linkDefault' | 'cloneFormat' | 'empty'\n) {\n switch (link) {\n case 'linkDefault':\n return {\n format: {\n underline: true,\n },\n dataset: {},\n };\n\n case 'empty':\n return {\n format: {},\n dataset: {},\n };\n\n case 'cloneFormat':\n default:\n return {\n dataset: linkFormat.dataset,\n format: { ...linkFormat.format },\n };\n }\n}\n\nfunction stackCodeInternal(codeFormat: ContentModelCode, code?: 'codeDefault' | 'empty') {\n switch (code) {\n case 'codeDefault':\n return {\n format: {\n fontFamily: 'monospace',\n },\n };\n case 'empty':\n return {\n format: {},\n };\n default:\n return codeFormat;\n }\n}\n\nfunction stackDataInternal(dataFormat: ContentModelData, data?: 'empty') {\n switch (data) {\n case 'empty':\n return {\n format: {},\n };\n default:\n return dataFormat;\n }\n}\n\nfunction stackDecoratorInternal(\n format: ContentModelParagraphDecorator,\n decorator?: 'decoratorDefault' | 'empty'\n) {\n switch (decorator) {\n case 'empty':\n return {\n format: {},\n tagName: '',\n };\n default:\n return format;\n }\n}\n\nfunction stackFormatInternal<T extends ContentModelFormatBase>(\n format: T,\n processType?: 'shallowClone' | 'shallowCloneForBlock' | 'shallowCloneForGroup' | 'empty'\n): T | {} {\n switch (processType) {\n case 'empty':\n return {};\n\n case undefined:\n return format;\n\n default:\n const result = { ...format };\n\n getObjectKeys(format).forEach(key => {\n if (\n (processType == 'shallowCloneForBlock' &&\n SkippedStylesForBlockOnSegmentOnSegment.indexOf(\n key as keyof ContentModelSegmentFormat\n ) >= 0) ||\n (processType == 'shallowCloneForGroup' &&\n SkippedStylesForTable.indexOf(key as keyof ContentModelBlockFormat) >= 0)\n ) {\n delete result[key];\n }\n });\n\n if (processType == 'shallowClone' || processType == 'shallowCloneForGroup') {\n const blockFormat = format as ContentModelBlockFormat;\n\n // For a new paragraph, if current text indent is already applied to previous block in the same level,\n // we need to ignore it according to browser rendering behavior\n if (blockFormat.textIndent) {\n delete (result as ContentModelBlockFormat).isTextIndentApplied;\n blockFormat.isTextIndentApplied = true;\n }\n }\n\n return result;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./common/ariaFormatHandler", "./common/backgroundColorFormatHandler", "./segment/boldFormatHandler", "./common/borderBoxFormatHandler", "./common/borderColorFormatHandler", "./common/borderFormatHandler", "./common/boxShadowFormatHandler", "./common/datasetFormatHandler", "./block/directionFormatHandler", "./block/displayFormatHandler", "./entity/entityFormatHandler", "./common/floatFormatHandler", "./segment/fontFamilyFormatHandler", "./segment/fontSizeFormatHandler", "../domUtils/getObjectKeys", "./block/htmlAlignFormatHandler", "./common/idFormatHandler", "./segment/imageStateFormatHandler", "./segment/italicFormatHandler", "./table/legacyTableBorderFormatHandler", "./segment/letterSpacingFormatHandler", "./block/lineHeightFormatHandler", "./segment/linkFormatHandler", "./list/listItemAlignFormatHandler", "./list/listItemThreadFormatHandler", "./list/listLevelThreadFormatHandler", "./list/listStyleFormatHandler", "./block/marginFormatHandler", "./block/paddingFormatHandler", "./common/roleFormatHandler", "./common/sizeFormatHandler", "./segment/strikeFormatHandler", "./segment/superOrSubScriptFormatHandler", "./table/tableLayoutFormatHandler", "./table/tableSpacingFormatHandler", "./block/textAlignFormatHandler", "./segment/textColorFormatHandler", "./table/textColorOnTableCellFormatHandler", "./block/textIndentFormatHandler", "./segment/undeletableLinkFormatHandler", "./segment/underlineFormatHandler", "./common/verticalAlignFormatHandler", "./block/whiteSpaceFormatHandler", "./common/wordBreakFormatHandler"], function (require, exports, tslib_1, ariaFormatHandler_1, backgroundColorFormatHandler_1, boldFormatHandler_1, borderBoxFormatHandler_1, borderColorFormatHandler_1, borderFormatHandler_1, boxShadowFormatHandler_1, datasetFormatHandler_1, directionFormatHandler_1, displayFormatHandler_1, entityFormatHandler_1, floatFormatHandler_1, fontFamilyFormatHandler_1, fontSizeFormatHandler_1, getObjectKeys_1, htmlAlignFormatHandler_1, idFormatHandler_1, imageStateFormatHandler_1, italicFormatHandler_1, legacyTableBorderFormatHandler_1, letterSpacingFormatHandler_1, lineHeightFormatHandler_1, linkFormatHandler_1, listItemAlignFormatHandler_1, listItemThreadFormatHandler_1, listLevelThreadFormatHandler_1, listStyleFormatHandler_1, marginFormatHandler_1, paddingFormatHandler_1, roleFormatHandler_1, sizeFormatHandler_1, strikeFormatHandler_1, superOrSubScriptFormatHandler_1, tableLayoutFormatHandler_1, tableSpacingFormatHandler_1, textAlignFormatHandler_1, textColorFormatHandler_1, textColorOnTableCellFormatHandler_1, textIndentFormatHandler_1, undeletableLinkFormatHandler_1, underlineFormatHandler_1, verticalAlignFormatHandler_1, whiteSpaceFormatHandler_1, wordBreakFormatHandler_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "./common/ariaFormatHandler", "./common/backgroundColorFormatHandler", "./segment/boldFormatHandler", "./common/borderBoxFormatHandler", "./common/borderColorFormatHandler", "./common/borderFormatHandler", "./common/boxShadowFormatHandler", "./common/datasetFormatHandler", "./segment/dataValueFormatHandler", "./block/directionFormatHandler", "./block/displayFormatHandler", "./entity/entityFormatHandler", "./common/floatFormatHandler", "./segment/fontFamilyFormatHandler", "./segment/fontSizeFormatHandler", "../domUtils/getObjectKeys", "./block/htmlAlignFormatHandler", "./common/idFormatHandler", "./segment/imageStateFormatHandler", "./segment/italicFormatHandler", "./table/legacyTableBorderFormatHandler", "./segment/letterSpacingFormatHandler", "./block/lineHeightFormatHandler", "./segment/linkFormatHandler", "./list/listItemAlignFormatHandler", "./list/listItemThreadFormatHandler", "./list/listLevelThreadFormatHandler", "./list/listStyleFormatHandler", "./block/marginFormatHandler", "./block/paddingFormatHandler", "./common/roleFormatHandler", "./common/sizeFormatHandler", "./segment/strikeFormatHandler", "./segment/superOrSubScriptFormatHandler", "./table/tableLayoutFormatHandler", "./table/tableSpacingFormatHandler", "./block/textAlignFormatHandler", "./segment/textColorFormatHandler", "./table/textColorOnTableCellFormatHandler", "./block/textIndentFormatHandler", "./segment/undeletableLinkFormatHandler", "./segment/underlineFormatHandler", "./common/verticalAlignFormatHandler", "./block/whiteSpaceFormatHandler", "./common/wordBreakFormatHandler"], function (require, exports, tslib_1, ariaFormatHandler_1, backgroundColorFormatHandler_1, boldFormatHandler_1, borderBoxFormatHandler_1, borderColorFormatHandler_1, borderFormatHandler_1, boxShadowFormatHandler_1, datasetFormatHandler_1, dataValueFormatHandler_1, directionFormatHandler_1, displayFormatHandler_1, entityFormatHandler_1, floatFormatHandler_1, fontFamilyFormatHandler_1, fontSizeFormatHandler_1, getObjectKeys_1, htmlAlignFormatHandler_1, idFormatHandler_1, imageStateFormatHandler_1, italicFormatHandler_1, legacyTableBorderFormatHandler_1, letterSpacingFormatHandler_1, lineHeightFormatHandler_1, linkFormatHandler_1, listItemAlignFormatHandler_1, listItemThreadFormatHandler_1, listLevelThreadFormatHandler_1, listStyleFormatHandler_1, marginFormatHandler_1, paddingFormatHandler_1, roleFormatHandler_1, sizeFormatHandler_1, strikeFormatHandler_1, superOrSubScriptFormatHandler_1, tableLayoutFormatHandler_1, tableSpacingFormatHandler_1, textAlignFormatHandler_1, textColorFormatHandler_1, textColorOnTableCellFormatHandler_1, textIndentFormatHandler_1, undeletableLinkFormatHandler_1, underlineFormatHandler_1, verticalAlignFormatHandler_1, whiteSpaceFormatHandler_1, wordBreakFormatHandler_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.defaultFormatAppliers = exports.defaultFormatParsers = exports.defaultFormatKeysPerCategory = void 0;
|
|
@@ -11,6 +11,7 @@ define(["require", "exports", "tslib", "./common/ariaFormatHandler", "./common/b
|
|
|
11
11
|
borderColor: borderColorFormatHandler_1.borderColorFormatHandler,
|
|
12
12
|
boxShadow: boxShadowFormatHandler_1.boxShadowFormatHandler,
|
|
13
13
|
dataset: datasetFormatHandler_1.datasetFormatHandler,
|
|
14
|
+
dataValue: dataValueFormatHandler_1.dataValueFormatHandler,
|
|
14
15
|
direction: directionFormatHandler_1.directionFormatHandler,
|
|
15
16
|
display: displayFormatHandler_1.displayFormatHandler,
|
|
16
17
|
float: floatFormatHandler_1.floatFormatHandler,
|
|
@@ -152,6 +153,7 @@ define(["require", "exports", "tslib", "./common/ariaFormatHandler", "./common/b
|
|
|
152
153
|
],
|
|
153
154
|
segmentUnderLink: ['textColor'],
|
|
154
155
|
code: ['fontFamily', 'display'],
|
|
156
|
+
data: ['dataValue'],
|
|
155
157
|
dataset: ['dataset'],
|
|
156
158
|
divider: (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(sharedBlockFormats), false), (0, tslib_1.__read)(sharedContainerFormats), false), ['display', 'size', 'htmlAlign'], false),
|
|
157
159
|
container: (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(sharedContainerFormats), false), ['htmlAlign', 'size', 'display', 'id'], false),
|