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
|
@@ -24,7 +24,8 @@ function segmentsWithSameFormat(seg1, seg2) {
|
|
|
24
24
|
return (!!seg1.isSelected == !!seg2.isSelected &&
|
|
25
25
|
areSameFormats(seg1.format, seg2.format) &&
|
|
26
26
|
areSameLinks(seg1.link, seg2.link) &&
|
|
27
|
-
areSameCodes(seg1.code, seg2.code)
|
|
27
|
+
areSameCodes(seg1.code, seg2.code) &&
|
|
28
|
+
areSameData(seg1.data, seg2.data));
|
|
28
29
|
}
|
|
29
30
|
function areSameLinks(link1, link2) {
|
|
30
31
|
return ((!link1 && !link2) ||
|
|
@@ -36,4 +37,7 @@ function areSameLinks(link1, link2) {
|
|
|
36
37
|
function areSameCodes(code1, code2) {
|
|
37
38
|
return (!code1 && !code2) || (code1 && code2 && areSameFormats(code1.format, code2.format));
|
|
38
39
|
}
|
|
40
|
+
function areSameData(data1, data2) {
|
|
41
|
+
return (!data1 && !data2) || (data1 && data2 && areSameFormats(data1.format, data2.format));
|
|
42
|
+
}
|
|
39
43
|
//# sourceMappingURL=mergeTextSegments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTextSegments.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/common/mergeTextSegments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"mergeTextSegments.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/common/mergeTextSegments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAUvE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA0C;IACxE,IAAI,QAAQ,GAA4B,IAAI,CAAC;IAE7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAA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E3C,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,IAAI,cAAc,CAAC,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,cAAc,CAAC,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;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import { addCode, addLink } from '../common/addDecorators';
|
|
2
|
+
import { addCode, addData, addLink } from '../common/addDecorators';
|
|
3
3
|
/**
|
|
4
4
|
* Create a ContentModelText model
|
|
5
5
|
* @param text Text of this model
|
|
6
6
|
* @param format @optional The format of this model
|
|
7
7
|
* @param link @optional The link decorator
|
|
8
|
-
* @param code @
|
|
8
|
+
* @param code @optional The code decorator
|
|
9
|
+
* @param data @optional The data decorator
|
|
9
10
|
*/
|
|
10
|
-
export function createText(text, format, link, code) {
|
|
11
|
+
export function createText(text, format, link, code, data) {
|
|
11
12
|
var result = {
|
|
12
13
|
segmentType: 'Text',
|
|
13
14
|
text: text,
|
|
@@ -19,6 +20,9 @@ export function createText(text, format, link, code) {
|
|
|
19
20
|
if (code) {
|
|
20
21
|
addCode(result, code);
|
|
21
22
|
}
|
|
23
|
+
if (data) {
|
|
24
|
+
addData(result, data);
|
|
25
|
+
}
|
|
22
26
|
return result;
|
|
23
27
|
}
|
|
24
28
|
//# sourceMappingURL=createText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createText.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/creators/createText.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"createText.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelApi/creators/createText.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AASpE;;;;;;;GAOG;AACH,MAAM,UAAU,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,eAAO,MAAM,CAAE;KACxB,CAAC;IAEF,IAAI,IAAI,EAAE;QACN,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACzB;IAED,IAAI,IAAI,EAAE;QACN,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACzB;IAED,IAAI,IAAI,EAAE;QACN,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACzB;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","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"]}
|
|
@@ -84,7 +84,7 @@ function cloneBlockGroupBase(group, options) {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
function cloneSegmentBase(segment) {
|
|
87
|
-
var segmentType = segment.segmentType, isSelected = segment.isSelected, code = segment.code, link = segment.link;
|
|
87
|
+
var segmentType = segment.segmentType, isSelected = segment.isSelected, code = segment.code, link = segment.link, data = segment.data;
|
|
88
88
|
var newSegment = Object.assign({
|
|
89
89
|
segmentType: segmentType,
|
|
90
90
|
isSelected: isSelected,
|
|
@@ -95,6 +95,9 @@ function cloneSegmentBase(segment) {
|
|
|
95
95
|
if (link) {
|
|
96
96
|
newSegment.link = Object.assign(cloneModelWithFormat(link), cloneModelWithDataset(link));
|
|
97
97
|
}
|
|
98
|
+
if (data) {
|
|
99
|
+
newSegment.data = cloneModelWithFormat(data);
|
|
100
|
+
}
|
|
98
101
|
return newSegment;
|
|
99
102
|
}
|
|
100
103
|
function cloneEntity(entity, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloneModel.js","sourceR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C,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,EAAE,IAAI,IAAK,OAAA,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAApC,CAAoC;CAC7E,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAmC;IAClE,OAAO,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACtB,KAAmC,EACnC,OAA2B;IAE3B,IAAM,QAAQ,GAAyB,mBAAmB,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAE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E;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"]}
|
|
@@ -6,7 +6,7 @@ import { wrapAllChildNodes } from '../../domUtils/moveChildNodes';
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export var handleSegmentDecorator = function (_, parent, segment, context) {
|
|
9
|
-
var code = segment.code, link = segment.link;
|
|
9
|
+
var code = segment.code, link = segment.link, data = segment.data;
|
|
10
10
|
if (isNodeOfType(parent, 'ELEMENT_NODE')) {
|
|
11
11
|
if (link) {
|
|
12
12
|
stackFormat(context, 'a', function () {
|
|
@@ -25,6 +25,14 @@ export var handleSegmentDecorator = function (_, parent, segment, context) {
|
|
|
25
25
|
(_a = context.onNodeCreated) === null || _a === void 0 ? void 0 : _a.call(context, code, codeNode);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
+
if (data) {
|
|
29
|
+
stackFormat(context, 'data', function () {
|
|
30
|
+
var _a;
|
|
31
|
+
var dataNode = wrapAllChildNodes(parent, 'data');
|
|
32
|
+
applyFormat(dataNode, context.formatAppliers.data, data.format, context);
|
|
33
|
+
(_a = context.onNodeCreated) === null || _a === void 0 ? void 0 : _a.call(context, data, dataNode);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
38
|
//# sourceMappingURL=handleSegmentDecorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSegmentDecorator.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelToDom/handlers/handleSegmentDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE;;GAEG;AACH,MAAM,CAAC,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,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE;;GAEG;AACH,MAAM,CAAC,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,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE;QACtC,IAAI,IAAI,EAAE;YACN,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE;;gBACtB,IAAM,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAEzC,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAClE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAEtE,MAAA,OAAO,CAAC,aAAa,+CAArB,OAAO,EAAiB,IAAI,EAAE,CAAC,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;SACN;QAED,IAAI,IAAI,EAAE;YACN,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE;;gBACzB,IAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEnD,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEzE,MAAA,OAAO,CAAC,aAAa,+CAArB,OAAO,EAAiB,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;SACN;QAED,IAAI,IAAI,EAAE;YACN,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE;;gBACzB,IAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEnD,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEzE,MAAA,OAAO,CAAC,aAAa,+CAArB,OAAO,EAAiB,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;SACN;KACJ;AACL,CAAC,CAAC","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"]}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { isNodeOfType } from '../../domUtils/isNodeOfType';
|
|
2
|
-
var OptimizeTags = [
|
|
2
|
+
var OptimizeTags = [
|
|
3
|
+
'SPAN',
|
|
4
|
+
'B',
|
|
5
|
+
'EM',
|
|
6
|
+
'I',
|
|
7
|
+
'U',
|
|
8
|
+
'SUB',
|
|
9
|
+
'SUP',
|
|
10
|
+
'STRIKE',
|
|
11
|
+
'S',
|
|
12
|
+
'A',
|
|
13
|
+
'CODE',
|
|
14
|
+
'DATA',
|
|
15
|
+
];
|
|
3
16
|
/**
|
|
4
17
|
* @internal
|
|
5
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeNode.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/mergeNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,IAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"mergeNode.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/mergeNode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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"]}
|
package/package.json
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"description": "Content Model for roosterjs",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.1",
|
|
6
|
-
"roosterjs-content-model-types": "^9.
|
|
6
|
+
"roosterjs-content-model-types": "^9.56.0"
|
|
7
7
|
},
|
|
8
|
-
"version": "9.
|
|
8
|
+
"version": "9.56.0",
|
|
9
9
|
"main": "./lib/index.js",
|
|
10
10
|
"typings": "./lib/index.d.ts",
|
|
11
11
|
"module": "./lib-mjs/index.js",
|