roosterjs-content-model-plugins 9.41.0 → 9.43.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/autoFormat/AutoFormatPlugin.js +9 -10
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.js +0 -33
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib/paste/PastePlugin.js +8 -32
- package/lib/paste/PastePlugin.js.map +1 -1
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js +7 -31
- package/lib/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib/paste/parsers/adjustPercentileLineHeightParser.d.ts +8 -0
- package/lib/paste/parsers/adjustPercentileLineHeightParser.js +26 -0
- package/lib/paste/parsers/adjustPercentileLineHeightParser.js.map +1 -0
- package/lib/paste/parsers/blockElementParser.d.ts +7 -0
- package/lib/paste/parsers/blockElementParser.js +15 -0
- package/lib/paste/parsers/blockElementParser.js.map +1 -0
- package/lib/paste/parsers/imageSizeParser.d.ts +6 -0
- package/lib/paste/parsers/imageSizeParser.js +24 -0
- package/lib/paste/parsers/imageSizeParser.js.map +1 -0
- package/lib/paste/parsers/listLevelParser.d.ts +10 -0
- package/lib/paste/parsers/listLevelParser.js +19 -0
- package/lib/paste/parsers/listLevelParser.js.map +1 -0
- package/lib/paste/parsers/tableBorderParser.d.ts +5 -0
- package/lib/paste/parsers/tableBorderParser.js +28 -0
- package/lib/paste/parsers/tableBorderParser.js.map +1 -0
- package/lib/paste/parsers/wordTableParser.d.ts +8 -0
- package/lib/paste/parsers/wordTableParser.js +20 -0
- package/lib/paste/parsers/wordTableParser.js.map +1 -0
- package/lib-amd/autoFormat/AutoFormatPlugin.js +9 -10
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +0 -33
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-amd/paste/PastePlugin.js +5 -32
- package/lib-amd/paste/PastePlugin.js.map +1 -1
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js +5 -32
- package/lib-amd/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-amd/paste/parsers/adjustPercentileLineHeightParser.d.ts +8 -0
- package/lib-amd/paste/parsers/adjustPercentileLineHeightParser.js +28 -0
- package/lib-amd/paste/parsers/adjustPercentileLineHeightParser.js.map +1 -0
- package/lib-amd/paste/parsers/blockElementParser.d.ts +7 -0
- package/lib-amd/paste/parsers/blockElementParser.js +17 -0
- package/lib-amd/paste/parsers/blockElementParser.js.map +1 -0
- package/lib-amd/paste/parsers/imageSizeParser.d.ts +6 -0
- package/lib-amd/paste/parsers/imageSizeParser.js +25 -0
- package/lib-amd/paste/parsers/imageSizeParser.js.map +1 -0
- package/lib-amd/paste/parsers/listLevelParser.d.ts +10 -0
- package/lib-amd/paste/parsers/listLevelParser.js +21 -0
- package/lib-amd/paste/parsers/listLevelParser.js.map +1 -0
- package/lib-amd/paste/parsers/tableBorderParser.d.ts +5 -0
- package/lib-amd/paste/parsers/tableBorderParser.js +29 -0
- package/lib-amd/paste/parsers/tableBorderParser.js.map +1 -0
- package/lib-amd/paste/parsers/wordTableParser.d.ts +8 -0
- package/lib-amd/paste/parsers/wordTableParser.js +22 -0
- package/lib-amd/paste/parsers/wordTableParser.js.map +1 -0
- package/lib-mjs/autoFormat/AutoFormatPlugin.js +9 -10
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +1 -34
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-mjs/paste/PastePlugin.js +5 -29
- package/lib-mjs/paste/PastePlugin.js.map +1 -1
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js +3 -27
- package/lib-mjs/paste/WordDesktop/processPastedContentFromWordDesktop.js.map +1 -1
- package/lib-mjs/paste/parsers/adjustPercentileLineHeightParser.d.ts +8 -0
- package/lib-mjs/paste/parsers/adjustPercentileLineHeightParser.js +22 -0
- package/lib-mjs/paste/parsers/adjustPercentileLineHeightParser.js.map +1 -0
- package/lib-mjs/paste/parsers/blockElementParser.d.ts +7 -0
- package/lib-mjs/paste/parsers/blockElementParser.js +11 -0
- package/lib-mjs/paste/parsers/blockElementParser.js.map +1 -0
- package/lib-mjs/paste/parsers/imageSizeParser.d.ts +6 -0
- package/lib-mjs/paste/parsers/imageSizeParser.js +20 -0
- package/lib-mjs/paste/parsers/imageSizeParser.js.map +1 -0
- package/lib-mjs/paste/parsers/listLevelParser.d.ts +10 -0
- package/lib-mjs/paste/parsers/listLevelParser.js +15 -0
- package/lib-mjs/paste/parsers/listLevelParser.js.map +1 -0
- package/lib-mjs/paste/parsers/tableBorderParser.d.ts +5 -0
- package/lib-mjs/paste/parsers/tableBorderParser.js +24 -0
- package/lib-mjs/paste/parsers/tableBorderParser.js.map +1 -0
- package/lib-mjs/paste/parsers/wordTableParser.d.ts +8 -0
- package/lib-mjs/paste/parsers/wordTableParser.js +16 -0
- package/lib-mjs/paste/parsers/wordTableParser.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ContentModelBlockFormat } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Parser for adjusting percentage-based line heights and converting 'normal' to a specific percentage
|
|
5
|
+
* @param format The block format to modify
|
|
6
|
+
* @param element The HTML element being processed
|
|
7
|
+
*/
|
|
8
|
+
export declare function adjustPercentileLineHeight(format: ContentModelBlockFormat, element: HTMLElement): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var PERCENTAGE_REGEX = /%/;
|
|
2
|
+
// Default line height in browsers according to https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#normal
|
|
3
|
+
var DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE = 1.2;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* Parser for adjusting percentage-based line heights and converting 'normal' to a specific percentage
|
|
7
|
+
* @param format The block format to modify
|
|
8
|
+
* @param element The HTML element being processed
|
|
9
|
+
*/
|
|
10
|
+
export function adjustPercentileLineHeight(format, element) {
|
|
11
|
+
// If the line height is less than the browser default line height, line between the text is going to be too narrow
|
|
12
|
+
var parsedLineHeight;
|
|
13
|
+
if (PERCENTAGE_REGEX.test(element.style.lineHeight) &&
|
|
14
|
+
!isNaN((parsedLineHeight = parseInt(element.style.lineHeight)))) {
|
|
15
|
+
format.lineHeight = (DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE *
|
|
16
|
+
(parsedLineHeight / 100)).toString();
|
|
17
|
+
}
|
|
18
|
+
else if (element.style.lineHeight.toLowerCase() === 'normal') {
|
|
19
|
+
format.lineHeight = '120%';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=adjustPercentileLineHeightParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adjustPercentileLineHeightParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/parsers/adjustPercentileLineHeightParser.ts"],"names":[],"mappings":"AAEA,IAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,mHAAmH;AACnH,IAAM,sCAAsC,GAAG,GAAG,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACtC,MAA+B,EAC/B,OAAoB;IAEpB,mHAAmH;IACnH,IAAI,gBAAwB,CAAC;IAC7B,IACI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;QAC/C,CAAC,KAAK,CAAC,CAAC,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EACjE;QACE,MAAM,CAAC,UAAU,GAAG,CAChB,sCAAsC;YACtC,CAAC,gBAAgB,GAAG,GAAG,CAAC,CAC3B,CAAC,QAAQ,EAAE,CAAC;KAChB;SAAM,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,QAAQ,EAAE;QAC5D,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC;KAC9B;AACL,CAAC","sourcesContent":["import type { ContentModelBlockFormat } from 'roosterjs-content-model-types';\n\nconst PERCENTAGE_REGEX = /%/;\n// Default line height in browsers according to https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#normal\nconst DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE = 1.2;\n\n/**\n * @internal\n * Parser for adjusting percentage-based line heights and converting 'normal' to a specific percentage\n * @param format The block format to modify\n * @param element The HTML element being processed\n */\nexport function adjustPercentileLineHeight(\n format: ContentModelBlockFormat,\n element: HTMLElement\n): void {\n // If the line height is less than the browser default line height, line between the text is going to be too narrow\n let parsedLineHeight: number;\n if (\n PERCENTAGE_REGEX.test(element.style.lineHeight) &&\n !isNaN((parsedLineHeight = parseInt(element.style.lineHeight)))\n ) {\n format.lineHeight = (\n DEFAULT_BROWSER_LINE_HEIGHT_PERCENTAGE *\n (parsedLineHeight / 100)\n ).toString();\n } else if (element.style.lineHeight.toLowerCase() === 'normal') {\n format.lineHeight = '120%';\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ContentModelBlockFormat, FormatParser } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* For block elements that have background color style, remove the background color when user selects the merge current format
|
|
5
|
+
* paste option
|
|
6
|
+
*/
|
|
7
|
+
export declare const blockElementParser: FormatParser<ContentModelBlockFormat>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* For block elements that have background color style, remove the background color when user selects the merge current format
|
|
4
|
+
* paste option
|
|
5
|
+
*/
|
|
6
|
+
export var blockElementParser = function (format, element) {
|
|
7
|
+
if (element.style.backgroundColor) {
|
|
8
|
+
delete format.backgroundColor;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=blockElementParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockElementParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/parsers/blockElementParser.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAA0C,UACrE,MAA+B,EAC/B,OAAoB;IAEpB,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE;QAC/B,OAAO,MAAM,CAAC,eAAe,CAAC;KACjC;AACL,CAAC,CAAC","sourcesContent":["import type { ContentModelBlockFormat, FormatParser } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * For block elements that have background color style, remove the background color when user selects the merge current format\n * paste option\n */\nexport const blockElementParser: FormatParser<ContentModelBlockFormat> = (\n format: ContentModelBlockFormat,\n element: HTMLElement\n) => {\n if (element.style.backgroundColor) {\n delete format.backgroundColor;\n }\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContentModelImageFormat, FormatParser } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Remove image size if it is larger than editor view width to let it auto size
|
|
5
|
+
*/
|
|
6
|
+
export declare const imageSizeParser: FormatParser<ContentModelImageFormat>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { parseValueWithUnit } from 'roosterjs-content-model-dom';
|
|
2
|
+
// Only process absolute units (px, pt, in, cm, mm)
|
|
3
|
+
var AbsoluteUnitRegex = /^\s*\d+(\.\d+)?\s*(px|pt|in|cm|mm)\s*$/i;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* Remove image size if it is larger than editor view width to let it auto size
|
|
7
|
+
*/
|
|
8
|
+
export var imageSizeParser = function (format, element, context) {
|
|
9
|
+
var maxImageSize = context.editorViewWidth;
|
|
10
|
+
var width = format.width;
|
|
11
|
+
if (width && maxImageSize && AbsoluteUnitRegex.test(width)) {
|
|
12
|
+
var widthValue = parseValueWithUnit(width, element);
|
|
13
|
+
// If the given width is larger than editor view width, we clear both width and height to let it auto size
|
|
14
|
+
if (widthValue > maxImageSize) {
|
|
15
|
+
delete format.width;
|
|
16
|
+
delete format.height;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=imageSizeParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageSizeParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/parsers/imageSizeParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,mDAAmD;AACnD,IAAM,iBAAiB,GAAG,yCAAyC,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAC,IAAM,eAAe,GAA0C,UAClE,MAAM,EACN,OAAO,EACP,OAAO;IAEP,IAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IACrC,IAAA,KAAK,GAAK,MAAM,MAAX,CAAY;IAEzB,IAAI,KAAK,IAAI,YAAY,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACxD,IAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEtD,0GAA0G;QAC1G,IAAI,UAAU,GAAG,YAAY,EAAE;YAC3B,OAAO,MAAM,CAAC,KAAK,CAAC;YACpB,OAAO,MAAM,CAAC,MAAM,CAAC;SACxB;KACJ;AACL,CAAC,CAAC","sourcesContent":["import { parseValueWithUnit } from 'roosterjs-content-model-dom';\nimport type { ContentModelImageFormat, FormatParser } from 'roosterjs-content-model-types';\n\n// Only process absolute units (px, pt, in, cm, mm)\nconst AbsoluteUnitRegex = /^\\s*\\d+(\\.\\d+)?\\s*(px|pt|in|cm|mm)\\s*$/i;\n\n/**\n * @internal\n * Remove image size if it is larger than editor view width to let it auto size\n */\nexport const imageSizeParser: FormatParser<ContentModelImageFormat> = (\n format,\n element,\n context\n) => {\n const maxImageSize = context.editorViewWidth;\n const { width } = format;\n\n if (width && maxImageSize && AbsoluteUnitRegex.test(width)) {\n const widthValue = parseValueWithUnit(width, element);\n\n // If the given width is larger than editor view width, we clear both width and height to let it auto size\n if (widthValue > maxImageSize) {\n delete format.width;\n delete format.height;\n }\n }\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ContentModelListItemLevelFormat, FormatParser } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Parser for processing list level formatting specific to Word Desktop
|
|
5
|
+
* @param format The list item level format to modify
|
|
6
|
+
* @param element The HTML element being processed
|
|
7
|
+
* @param _context The DOM to model context
|
|
8
|
+
* @param defaultStyle The default style properties
|
|
9
|
+
*/
|
|
10
|
+
export declare const listLevelParser: FormatParser<ContentModelListItemLevelFormat>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* Parser for processing list level formatting specific to Word Desktop
|
|
4
|
+
* @param format The list item level format to modify
|
|
5
|
+
* @param element The HTML element being processed
|
|
6
|
+
* @param _context The DOM to model context
|
|
7
|
+
* @param defaultStyle The default style properties
|
|
8
|
+
*/
|
|
9
|
+
export var listLevelParser = function (format, element, _context, defaultStyle) {
|
|
10
|
+
if (element.style.marginLeft !== '') {
|
|
11
|
+
format.marginLeft = defaultStyle.marginLeft;
|
|
12
|
+
}
|
|
13
|
+
format.marginBottom = undefined;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=listLevelParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listLevelParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/parsers/listLevelParser.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,eAAe,GAAkD,UAC1E,MAAuC,EACvC,OAAoB,EACpB,QAA2B,EAC3B,YAAoD;IAEpD,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,EAAE,EAAE;QACjC,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;KAC/C;IAED,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;AACpC,CAAC,CAAC","sourcesContent":["import type {\n ContentModelListItemLevelFormat,\n DomToModelContext,\n FormatParser,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Parser for processing list level formatting specific to Word Desktop\n * @param format The list item level format to modify\n * @param element The HTML element being processed\n * @param _context The DOM to model context\n * @param defaultStyle The default style properties\n */\nexport const listLevelParser: FormatParser<ContentModelListItemLevelFormat> = (\n format: ContentModelListItemLevelFormat,\n element: HTMLElement,\n _context: DomToModelContext,\n defaultStyle: Readonly<Partial<CSSStyleDeclaration>>\n) => {\n if (element.style.marginLeft !== '') {\n format.marginLeft = defaultStyle.marginLeft;\n }\n\n format.marginBottom = undefined;\n};\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BorderKeys } from 'roosterjs-content-model-dom';
|
|
2
|
+
var ElementBorderKeys = new Map([
|
|
3
|
+
['borderTop', { w: 'borderTopWidth', s: 'borderTopStyle', c: 'borderTopColor' }],
|
|
4
|
+
['borderRight', { w: 'borderRightWidth', s: 'borderRightStyle', c: 'borderRightColor' }],
|
|
5
|
+
['borderBottom', { w: 'borderBottomWidth', s: 'borderBottomStyle', c: 'borderBottomColor' }],
|
|
6
|
+
['borderLeft', { w: 'borderLeftWidth', s: 'borderLeftStyle', c: 'borderLeftColor' }],
|
|
7
|
+
]);
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export var tableBorderParser = function (format, element) {
|
|
12
|
+
BorderKeys.forEach(function (key) {
|
|
13
|
+
if (!format[key]) {
|
|
14
|
+
var styleSet = ElementBorderKeys.get(key);
|
|
15
|
+
if (styleSet &&
|
|
16
|
+
element.style[styleSet.w] &&
|
|
17
|
+
element.style[styleSet.s] &&
|
|
18
|
+
!element.style[styleSet.c]) {
|
|
19
|
+
format[key] = element.style[styleSet.w] + " " + element.style[styleSet.s];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=tableBorderParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableBorderParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/parsers/tableBorderParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAOzD,IAAM,iBAAiB,GAAG,IAAI,GAAG,CAO/B;IACE,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAChF,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACxF,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC5F,CAAC,YAAY,EAAE,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACvF,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAA8C,UAAC,MAAM,EAAE,OAAO;IACxF,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;QAClB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YACd,IAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAE5C,IACI,QAAQ;gBACR,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACzB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAC5B;gBACE,MAAM,CAAC,GAAG,CAAC,GAAM,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAG,CAAC;aAC7E;SACJ;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["import { BorderKeys } from 'roosterjs-content-model-dom';\nimport type {\n BorderFormat,\n ContentModelTableCellFormat,\n FormatParser,\n} from 'roosterjs-content-model-types';\n\nconst ElementBorderKeys = new Map<\n keyof BorderFormat,\n {\n c: keyof CSSStyleDeclaration;\n s: keyof CSSStyleDeclaration;\n w: keyof CSSStyleDeclaration;\n }\n>([\n ['borderTop', { w: 'borderTopWidth', s: 'borderTopStyle', c: 'borderTopColor' }],\n ['borderRight', { w: 'borderRightWidth', s: 'borderRightStyle', c: 'borderRightColor' }],\n ['borderBottom', { w: 'borderBottomWidth', s: 'borderBottomStyle', c: 'borderBottomColor' }],\n ['borderLeft', { w: 'borderLeftWidth', s: 'borderLeftStyle', c: 'borderLeftColor' }],\n]);\n\n/**\n * @internal\n */\nexport const tableBorderParser: FormatParser<ContentModelTableCellFormat> = (format, element) => {\n BorderKeys.forEach(key => {\n if (!format[key]) {\n const styleSet = ElementBorderKeys.get(key);\n\n if (\n styleSet &&\n element.style[styleSet.w] &&\n element.style[styleSet.s] &&\n !element.style[styleSet.c]\n ) {\n format[key] = `${element.style[styleSet.w]} ${element.style[styleSet.s]}`;\n }\n }\n });\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ContentModelTableFormat, FormatParser } from 'roosterjs-content-model-types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Parser for processing table formatting specific to Word Desktop
|
|
5
|
+
* @param format The table format to modify
|
|
6
|
+
* @param element The HTML element being processed
|
|
7
|
+
*/
|
|
8
|
+
export declare const wordTableParser: FormatParser<ContentModelTableFormat>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* Parser for processing table formatting specific to Word Desktop
|
|
4
|
+
* @param format The table format to modify
|
|
5
|
+
* @param element The HTML element being processed
|
|
6
|
+
*/
|
|
7
|
+
export var wordTableParser = function (format, element) {
|
|
8
|
+
var _a;
|
|
9
|
+
if ((_a = format.marginLeft) === null || _a === void 0 ? void 0 : _a.startsWith('-')) {
|
|
10
|
+
delete format.marginLeft;
|
|
11
|
+
}
|
|
12
|
+
if (format.htmlAlign) {
|
|
13
|
+
delete format.htmlAlign;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=wordTableParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordTableParser.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/paste/parsers/wordTableParser.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,IAAM,eAAe,GAA0C,UAAC,MAAM,EAAE,OAAO;;IAClF,IAAI,MAAA,MAAM,CAAC,UAAU,0CAAE,UAAU,CAAC,GAAG,CAAC,EAAE;QACpC,OAAO,MAAM,CAAC,UAAU,CAAC;KAC5B;IACD,IAAI,MAAM,CAAC,SAAS,EAAE;QAClB,OAAO,MAAM,CAAC,SAAS,CAAC;KAC3B;AACL,CAAC,CAAC","sourcesContent":["import type { ContentModelTableFormat, FormatParser } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * Parser for processing table formatting specific to Word Desktop\n * @param format The table format to modify\n * @param element The HTML element being processed\n */\nexport const wordTableParser: FormatParser<ContentModelTableFormat> = (format, element): void => {\n if (format.marginLeft?.startsWith('-')) {\n delete format.marginLeft;\n }\n if (format.htmlAlign) {\n delete format.htmlAlign;\n }\n};\n"]}
|
package/package.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"description": "Plugins for roosterjs",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.1",
|
|
6
|
-
"roosterjs-content-model-core": "^9.
|
|
7
|
-
"roosterjs-content-model-dom": "^9.
|
|
8
|
-
"roosterjs-content-model-types": "^9.
|
|
9
|
-
"roosterjs-content-model-api": "^9.
|
|
6
|
+
"roosterjs-content-model-core": "^9.42.0",
|
|
7
|
+
"roosterjs-content-model-dom": "^9.42.0",
|
|
8
|
+
"roosterjs-content-model-types": "^9.43.0",
|
|
9
|
+
"roosterjs-content-model-api": "^9.43.0"
|
|
10
10
|
},
|
|
11
|
-
"version": "9.
|
|
11
|
+
"version": "9.43.0",
|
|
12
12
|
"main": "./lib/index.js",
|
|
13
13
|
"typings": "./lib/index.d.ts",
|
|
14
14
|
"module": "./lib-mjs/index.js",
|