roosterjs-content-model-api 9.59.0 → 9.61.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/modelApi/table/mergeTableCells.js +36 -2
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.js +1 -2
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.js +1 -2
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/publicApi/link/insertLink.js +1 -2
- package/lib/publicApi/link/insertLink.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.d.ts +1 -0
- package/lib/publicApi/table/applyTableBorderFormat.js +104 -26
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.js +37 -2
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.js +2 -2
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.js +2 -2
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/publicApi/link/insertLink.js +2 -2
- package/lib-amd/publicApi/link/insertLink.js.map +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.d.ts +1 -0
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +104 -26
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js +36 -2
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js +1 -2
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js +1 -2
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/publicApi/link/insertLink.js +2 -3
- package/lib-mjs/publicApi/link/insertLink.js.map +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.d.ts +1 -0
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +106 -28
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/package.json +3 -3
- package/lib/modelApi/table/canMergeCells.d.ts +0 -5
- package/lib/modelApi/table/canMergeCells.js +0 -57
- package/lib/modelApi/table/canMergeCells.js.map +0 -1
- package/lib/publicApi/utils/checkXss.d.ts +0 -8
- package/lib/publicApi/utils/checkXss.js +0 -15
- package/lib/publicApi/utils/checkXss.js.map +0 -1
- package/lib-amd/modelApi/table/canMergeCells.d.ts +0 -5
- package/lib-amd/modelApi/table/canMergeCells.js +0 -59
- package/lib-amd/modelApi/table/canMergeCells.js.map +0 -1
- package/lib-amd/publicApi/utils/checkXss.d.ts +0 -8
- package/lib-amd/publicApi/utils/checkXss.js +0 -17
- package/lib-amd/publicApi/utils/checkXss.js.map +0 -1
- package/lib-mjs/modelApi/table/canMergeCells.d.ts +0 -5
- package/lib-mjs/modelApi/table/canMergeCells.js +0 -53
- package/lib-mjs/modelApi/table/canMergeCells.js.map +0 -1
- package/lib-mjs/publicApi/utils/checkXss.d.ts +0 -8
- package/lib-mjs/publicApi/utils/checkXss.js +0 -11
- package/lib-mjs/publicApi/utils/checkXss.js.map +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal Check if there is XSS attack in the link
|
|
3
|
-
* @param link The link to be checked
|
|
4
|
-
* @returns The safe link, or empty string if there is XSS attack
|
|
5
|
-
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
6
|
-
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
7
|
-
*/
|
|
8
|
-
export declare function checkXss(link: string): string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.checkXss = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal Check if there is XSS attack in the link
|
|
7
|
-
* @param link The link to be checked
|
|
8
|
-
* @returns The safe link, or empty string if there is XSS attack
|
|
9
|
-
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
10
|
-
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
11
|
-
*/
|
|
12
|
-
function checkXss(link) {
|
|
13
|
-
return link.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : link;
|
|
14
|
-
}
|
|
15
|
-
exports.checkXss = checkXss;
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=checkXss.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":";;;;IAAA;;;;;;OAMG;IACH,SAAgB,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,CAAC;IAFD,4BAEC","sourcesContent":["/**\n * @internal Check if there is XSS attack in the link\n * @param link The link to be checked\n * @returns The safe link, or empty string if there is XSS attack\n * @remarks This function checks for patterns like s\\nc\\nr\\ni\\np\\nt: to prevent XSS attacks. This may block some valid links,\n * but it is necessary for security reasons. We treat the word \"script\" as safe if there are \"/\" before it.\n */\nexport function checkXss(link: string): string {\n return link.match(/^[^\\/]*s\\n*c\\n*r\\n*i\\n*p\\n*t\\n*:/i) ? '' : link;\n}\n"]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export function canMergeCells(rows, firstRow, firstCol, lastRow, lastCol) {
|
|
5
|
-
var noSpanAbove = firstCol == lastCol ||
|
|
6
|
-
rows[firstRow].cells.every(function (cell, colIndex) { return colIndex < firstCol || colIndex > lastCol || !cell.spanAbove; });
|
|
7
|
-
var noSpanLeft = firstRow == lastRow ||
|
|
8
|
-
rows.every(function (row, rowIndex) {
|
|
9
|
-
return rowIndex < firstRow || rowIndex > lastRow || !row.cells[firstCol].spanLeft;
|
|
10
|
-
});
|
|
11
|
-
var noDifferentBelowSpan = rows[lastRow].cells
|
|
12
|
-
.map(function (_, colIndex) {
|
|
13
|
-
return colIndex >= firstCol && colIndex <= lastCol
|
|
14
|
-
? getBelowSpanCount(rows, lastRow, colIndex)
|
|
15
|
-
: -1;
|
|
16
|
-
})
|
|
17
|
-
.every(function (x, _, a) { return x < 0 || x == a[firstCol]; });
|
|
18
|
-
var noDifferentRightSpan = rows
|
|
19
|
-
.map(function (_, rowIndex) {
|
|
20
|
-
return rowIndex >= firstRow && rowIndex <= lastRow
|
|
21
|
-
? getRightSpanCount(rows, rowIndex, lastCol)
|
|
22
|
-
: -1;
|
|
23
|
-
})
|
|
24
|
-
.every(function (x, _, a) { return x < 0 || x == a[firstRow]; });
|
|
25
|
-
return noSpanAbove && noSpanLeft && noDifferentBelowSpan && noDifferentRightSpan;
|
|
26
|
-
}
|
|
27
|
-
function getBelowSpanCount(rows, rowIndex, colIndex) {
|
|
28
|
-
var _a, _b;
|
|
29
|
-
var spanCount = 0;
|
|
30
|
-
for (var row = rowIndex + 1; row < rows.length; row++) {
|
|
31
|
-
if ((_b = (_a = rows[row]) === null || _a === void 0 ? void 0 : _a.cells[colIndex]) === null || _b === void 0 ? void 0 : _b.spanAbove) {
|
|
32
|
-
spanCount++;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return spanCount;
|
|
39
|
-
}
|
|
40
|
-
function getRightSpanCount(rows, rowIndex, colIndex) {
|
|
41
|
-
var _a, _b, _c;
|
|
42
|
-
var spanCount = 0;
|
|
43
|
-
for (var col = colIndex + 1; col < ((_a = rows[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.length); col++) {
|
|
44
|
-
if ((_c = (_b = rows[rowIndex]) === null || _b === void 0 ? void 0 : _b.cells[col]) === null || _c === void 0 ? void 0 : _c.spanLeft) {
|
|
45
|
-
spanCount++;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return spanCount;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=canMergeCells.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canMergeCells.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/modelApi/table/canMergeCells.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,IAAoC,EACpC,QAAgB,EAChB,QAAgB,EAChB,OAAe,EACf,OAAe;IAEf,IAAM,WAAW,GACb,QAAQ,IAAI,OAAO;QACnB,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,KAAK,CACtB,UAAC,IAAI,EAAE,QAAQ,IAAK,OAAA,QAAQ,GAAG,QAAQ,IAAI,QAAQ,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAA5D,CAA4D,CACnF,CAAC;IACN,IAAM,UAAU,GACZ,QAAQ,IAAI,OAAO;QACnB,IAAI,CAAC,KAAK,CACN,UAAC,GAAG,EAAE,QAAQ;YACV,OAAA,QAAQ,GAAG,QAAQ,IAAI,QAAQ,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ;QAA1E,CAA0E,CACjF,CAAC;IAEN,IAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK;SAC3C,GAAG,CAAC,UAAC,CAAC,EAAE,QAAQ;QACb,OAAA,QAAQ,IAAI,Q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AChB,QAAgB;;IAEhB,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAK,IAAI,GAAG,GAAG,QAAQ,GAAG,CAAC,EAAE,GAAG,IAAG,MAAA,IAAI,CAAC,QAAQ,CAAC,0CAAE,KAAK,CAAC,MAAM,CAAA,EAAE,GAAG,EAAE,EAAE;QACpE,IAAI,MAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,0CAAE,KAAK,CAAC,GAAG,CAAC,0CAAE,QAAQ,EAAE;YACtC,SAAS,EAAE,CAAC;SACf;aAAM;YACH,MAAM;SACT;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import type { ReadonlyContentModelTableRow } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function canMergeCells(\n rows: ReadonlyContentModelTableRow[],\n firstRow: number,\n firstCol: number,\n lastRow: number,\n lastCol: number\n): boolean {\n const noSpanAbove =\n firstCol == lastCol ||\n rows[firstRow].cells.every(\n (cell, colIndex) => colIndex < firstCol || colIndex > lastCol || !cell.spanAbove\n );\n const noSpanLeft =\n firstRow == lastRow ||\n rows.every(\n (row, rowIndex) =>\n rowIndex < firstRow || rowIndex > lastRow || !row.cells[firstCol].spanLeft\n );\n\n const noDifferentBelowSpan = rows[lastRow].cells\n .map((_, colIndex) =>\n colIndex >= firstCol && colIndex <= lastCol\n ? getBelowSpanCount(rows, lastRow, colIndex)\n : -1\n )\n .every((x, _, a) => x < 0 || x == a[firstCol]);\n const noDifferentRightSpan = rows\n .map((_, rowIndex) =>\n rowIndex >= firstRow && rowIndex <= lastRow\n ? getRightSpanCount(rows, rowIndex, lastCol)\n : -1\n )\n .every((x, _, a) => x < 0 || x == a[firstRow]);\n\n return noSpanAbove && noSpanLeft && noDifferentBelowSpan && noDifferentRightSpan;\n}\n\nfunction getBelowSpanCount(\n rows: ReadonlyContentModelTableRow[],\n rowIndex: number,\n colIndex: number\n) {\n let spanCount = 0;\n\n for (let row = rowIndex + 1; row < rows.length; row++) {\n if (rows[row]?.cells[colIndex]?.spanAbove) {\n spanCount++;\n } else {\n break;\n }\n }\n\n return spanCount;\n}\n\nfunction getRightSpanCount(\n rows: ReadonlyContentModelTableRow[],\n rowIndex: number,\n colIndex: number\n) {\n let spanCount = 0;\n\n for (let col = colIndex + 1; col < rows[rowIndex]?.cells.length; col++) {\n if (rows[rowIndex]?.cells[col]?.spanLeft) {\n spanCount++;\n } else {\n break;\n }\n }\n\n return spanCount;\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal Check if there is XSS attack in the link
|
|
3
|
-
* @param link The link to be checked
|
|
4
|
-
* @returns The safe link, or empty string if there is XSS attack
|
|
5
|
-
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
6
|
-
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
7
|
-
*/
|
|
8
|
-
export declare function checkXss(link: string): string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal Check if there is XSS attack in the link
|
|
3
|
-
* @param link The link to be checked
|
|
4
|
-
* @returns The safe link, or empty string if there is XSS attack
|
|
5
|
-
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
6
|
-
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
7
|
-
*/
|
|
8
|
-
export function checkXss(link) {
|
|
9
|
-
return link.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : link;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=checkXss.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC","sourcesContent":["/**\n * @internal Check if there is XSS attack in the link\n * @param link The link to be checked\n * @returns The safe link, or empty string if there is XSS attack\n * @remarks This function checks for patterns like s\\nc\\nr\\ni\\np\\nt: to prevent XSS attacks. This may block some valid links,\n * but it is necessary for security reasons. We treat the word \"script\" as safe if there are \"/\" before it.\n */\nexport function checkXss(link: string): string {\n return link.match(/^[^\\/]*s\\n*c\\n*r\\n*i\\n*p\\n*t\\n*:/i) ? '' : link;\n}\n"]}
|