roosterjs-content-model-api 0.21.2 → 0.22.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/index.d.ts +0 -3
- package/lib/index.js +1 -7
- package/lib/index.js.map +1 -1
- package/lib/modelApi/list/setListType.js +25 -0
- package/lib/modelApi/list/setListType.js.map +1 -1
- package/lib/modelApi/selection/collapseTableSelection.d.ts +1 -2
- package/lib/modelApi/selection/collapseTableSelection.js +2 -2
- package/lib/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib/modelApi/table/alignTableCell.js +2 -3
- package/lib/modelApi/table/alignTableCell.js.map +1 -1
- package/lib/modelApi/table/deleteTableColumn.js +6 -6
- package/lib/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib/modelApi/table/deleteTableRow.js +2 -2
- package/lib/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib/modelApi/table/insertTableColumn.js +6 -6
- package/lib/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib/modelApi/table/insertTableRow.js +3 -3
- package/lib/modelApi/table/insertTableRow.js.map +1 -1
- package/lib/modelApi/table/mergeTableCells.js +6 -5
- package/lib/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib/modelApi/table/mergeTableColumn.js +3 -3
- package/lib/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib/modelApi/table/mergeTableRow.js +3 -3
- package/lib/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib/modelApi/table/splitTableCellHorizontally.js +3 -3
- package/lib/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib/modelApi/table/splitTableCellVertically.js +7 -5
- package/lib/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib/publicApi/format/getFormatState.js +7 -1
- package/lib/publicApi/format/getFormatState.js.map +1 -1
- package/lib/publicApi/image/changeImage.js +1 -2
- package/lib/publicApi/image/changeImage.js.map +1 -1
- package/lib/publicApi/image/insertImage.js +1 -2
- package/lib/publicApi/image/insertImage.js.map +1 -1
- package/lib/publicApi/table/applyTableBorderFormat.js +29 -30
- package/lib/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib/publicApi/table/editTable.js +1 -2
- package/lib/publicApi/table/editTable.js.map +1 -1
- package/lib/publicApi/table/setTableCellShade.js +1 -2
- package/lib/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-amd/index.d.ts +0 -3
- package/lib-amd/index.js +2 -5
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/modelApi/list/setListType.js +25 -0
- package/lib-amd/modelApi/list/setListType.js.map +1 -1
- package/lib-amd/modelApi/selection/collapseTableSelection.d.ts +1 -2
- package/lib-amd/modelApi/selection/collapseTableSelection.js +2 -2
- package/lib-amd/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-amd/modelApi/table/alignTableCell.js +3 -3
- package/lib-amd/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableColumn.js +6 -6
- package/lib-amd/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/deleteTableRow.js +2 -2
- package/lib-amd/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableColumn.js +6 -6
- package/lib-amd/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/insertTableRow.js +3 -3
- package/lib-amd/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableCells.js +6 -5
- package/lib-amd/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableColumn.js +3 -3
- package/lib-amd/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-amd/modelApi/table/mergeTableRow.js +3 -3
- package/lib-amd/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js +3 -3
- package/lib-amd/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-amd/modelApi/table/splitTableCellVertically.js +7 -5
- package/lib-amd/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-amd/publicApi/format/getFormatState.js +7 -1
- package/lib-amd/publicApi/format/getFormatState.js.map +1 -1
- package/lib-amd/publicApi/image/changeImage.js +2 -2
- package/lib-amd/publicApi/image/changeImage.js.map +1 -1
- package/lib-amd/publicApi/image/insertImage.js +2 -2
- package/lib-amd/publicApi/image/insertImage.js.map +1 -1
- package/lib-amd/publicApi/table/applyTableBorderFormat.js +30 -30
- package/lib-amd/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-amd/publicApi/table/editTable.js +2 -2
- package/lib-amd/publicApi/table/editTable.js.map +1 -1
- package/lib-amd/publicApi/table/setTableCellShade.js +2 -2
- package/lib-amd/publicApi/table/setTableCellShade.js.map +1 -1
- package/lib-mjs/index.d.ts +0 -3
- package/lib-mjs/index.js +0 -3
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/modelApi/list/setListType.js +25 -0
- package/lib-mjs/modelApi/list/setListType.js.map +1 -1
- package/lib-mjs/modelApi/selection/collapseTableSelection.d.ts +1 -2
- package/lib-mjs/modelApi/selection/collapseTableSelection.js +2 -2
- package/lib-mjs/modelApi/selection/collapseTableSelection.js.map +1 -1
- package/lib-mjs/modelApi/table/alignTableCell.js +2 -3
- package/lib-mjs/modelApi/table/alignTableCell.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableColumn.js +5 -5
- package/lib-mjs/modelApi/table/deleteTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js +1 -1
- package/lib-mjs/modelApi/table/deleteTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableColumn.js +5 -5
- package/lib-mjs/modelApi/table/insertTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/insertTableRow.js +2 -2
- package/lib-mjs/modelApi/table/insertTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableCells.js +5 -4
- package/lib-mjs/modelApi/table/mergeTableCells.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableColumn.js +2 -2
- package/lib-mjs/modelApi/table/mergeTableColumn.js.map +1 -1
- package/lib-mjs/modelApi/table/mergeTableRow.js +2 -2
- package/lib-mjs/modelApi/table/mergeTableRow.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js +2 -2
- package/lib-mjs/modelApi/table/splitTableCellHorizontally.js.map +1 -1
- package/lib-mjs/modelApi/table/splitTableCellVertically.js +6 -4
- package/lib-mjs/modelApi/table/splitTableCellVertically.js.map +1 -1
- package/lib-mjs/publicApi/format/getFormatState.js +8 -2
- package/lib-mjs/publicApi/format/getFormatState.js.map +1 -1
- package/lib-mjs/publicApi/image/changeImage.js +1 -2
- package/lib-mjs/publicApi/image/changeImage.js.map +1 -1
- package/lib-mjs/publicApi/image/insertImage.js +1 -2
- package/lib-mjs/publicApi/image/insertImage.js.map +1 -1
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js +29 -30
- package/lib-mjs/publicApi/table/applyTableBorderFormat.js.map +1 -1
- package/lib-mjs/publicApi/table/editTable.js +1 -2
- package/lib-mjs/publicApi/table/editTable.js.map +1 -1
- package/lib-mjs/publicApi/table/setTableCellShade.js +1 -2
- package/lib-mjs/publicApi/table/setTableCellShade.js.map +1 -1
- package/package.json +4 -4
- package/lib/modelApi/domUtils/readFile.d.ts +0 -8
- package/lib/modelApi/domUtils/readFile.js +0 -24
- package/lib/modelApi/domUtils/readFile.js.map +0 -1
- package/lib/modelApi/table/getSelectedCells.d.ts +0 -14
- package/lib/modelApi/table/getSelectedCells.js +0 -32
- package/lib/modelApi/table/getSelectedCells.js.map +0 -1
- package/lib/publicApi/selection/hasSelectionInBlock.d.ts +0 -6
- package/lib/publicApi/selection/hasSelectionInBlock.js +0 -25
- package/lib/publicApi/selection/hasSelectionInBlock.js.map +0 -1
- package/lib/publicApi/selection/hasSelectionInBlockGroup.d.ts +0 -6
- package/lib/publicApi/selection/hasSelectionInBlockGroup.js +0 -18
- package/lib/publicApi/selection/hasSelectionInBlockGroup.js.map +0 -1
- package/lib/publicApi/selection/hasSelectionInSegment.d.ts +0 -6
- package/lib/publicApi/selection/hasSelectionInSegment.js +0 -13
- package/lib/publicApi/selection/hasSelectionInSegment.js.map +0 -1
- package/lib-amd/modelApi/domUtils/readFile.d.ts +0 -8
- package/lib-amd/modelApi/domUtils/readFile.js +0 -26
- package/lib-amd/modelApi/domUtils/readFile.js.map +0 -1
- package/lib-amd/modelApi/table/getSelectedCells.d.ts +0 -14
- package/lib-amd/modelApi/table/getSelectedCells.js +0 -33
- package/lib-amd/modelApi/table/getSelectedCells.js.map +0 -1
- package/lib-amd/publicApi/selection/hasSelectionInBlock.d.ts +0 -6
- package/lib-amd/publicApi/selection/hasSelectionInBlock.js +0 -25
- package/lib-amd/publicApi/selection/hasSelectionInBlock.js.map +0 -1
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.d.ts +0 -6
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.js +0 -19
- package/lib-amd/publicApi/selection/hasSelectionInBlockGroup.js.map +0 -1
- package/lib-amd/publicApi/selection/hasSelectionInSegment.d.ts +0 -6
- package/lib-amd/publicApi/selection/hasSelectionInSegment.js +0 -14
- package/lib-amd/publicApi/selection/hasSelectionInSegment.js.map +0 -1
- package/lib-mjs/modelApi/domUtils/readFile.d.ts +0 -8
- package/lib-mjs/modelApi/domUtils/readFile.js +0 -20
- package/lib-mjs/modelApi/domUtils/readFile.js.map +0 -1
- package/lib-mjs/modelApi/table/getSelectedCells.d.ts +0 -14
- package/lib-mjs/modelApi/table/getSelectedCells.js +0 -28
- package/lib-mjs/modelApi/table/getSelectedCells.js.map +0 -1
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.d.ts +0 -6
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.js +0 -22
- package/lib-mjs/publicApi/selection/hasSelectionInBlock.js.map +0 -1
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.d.ts +0 -6
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.js +0 -15
- package/lib-mjs/publicApi/selection/hasSelectionInBlockGroup.js.map +0 -1
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.d.ts +0 -6
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.js +0 -10
- package/lib-mjs/publicApi/selection/hasSelectionInSegment.js.map +0 -1
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSelectedCells = void 0;
|
|
4
|
-
var hasSelectionInBlockGroup_1 = require("../../publicApi/selection/hasSelectionInBlockGroup");
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
function getSelectedCells(table) {
|
|
9
|
-
var firstRow = -1;
|
|
10
|
-
var firstCol = -1;
|
|
11
|
-
var lastRow = -1;
|
|
12
|
-
var lastCol = -1;
|
|
13
|
-
var hasSelection = false;
|
|
14
|
-
table.rows.forEach(function (row, rowIndex) {
|
|
15
|
-
return row.cells.forEach(function (cell, colIndex) {
|
|
16
|
-
if ((0, hasSelectionInBlockGroup_1.default)(cell)) {
|
|
17
|
-
hasSelection = true;
|
|
18
|
-
if (firstRow < 0) {
|
|
19
|
-
firstRow = rowIndex;
|
|
20
|
-
}
|
|
21
|
-
if (firstCol < 0) {
|
|
22
|
-
firstCol = colIndex;
|
|
23
|
-
}
|
|
24
|
-
lastRow = Math.max(lastRow, rowIndex);
|
|
25
|
-
lastCol = Math.max(lastCol, colIndex);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
return hasSelection ? { firstRow: firstRow, firstCol: firstCol, lastRow: lastRow, lastCol: lastCol } : null;
|
|
30
|
-
}
|
|
31
|
-
exports.getSelectedCells = getSelectedCells;
|
|
32
|
-
//# sourceMappingURL=getSelectedCells.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSelectedCells.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/getSelectedCells.ts"],"names":[],"mappings":";;;AAAA,+FAA0F;AAa1F;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAAwB;IACrD,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;IAClB,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;IAClB,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;IACjB,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;IACjB,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,QAAQ;QAC7B,OAAA,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,QAAQ;YAC7B,IAAI,IAAA,kCAAwB,EAAC,IAAI,CAAC,EAAE;gBAChC,YAAY,GAAG,IAAI,CAAC;gBAEpB,IAAI,QAAQ,GAAG,CAAC,EAAE;oBACd,QAAQ,GAAG,QAAQ,CAAC;iBACvB;gBAED,IAAI,QAAQ,GAAG,CAAC,EAAE;oBACd,QAAQ,GAAG,QAAQ,CAAC;iBACvB;gBAED,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;gBACtC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;aACzC;QACL,CAAC,CAAC;IAfF,CAeE,CACL,CAAC;IAEF,OAAO,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,UAAA,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC;AA3BD,4CA2BC","sourcesContent":["import hasSelectionInBlockGroup from '../../publicApi/selection/hasSelectionInBlockGroup';\nimport type { ContentModelTable } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport interface TableSelectionCoordinates {\n firstRow: number;\n firstCol: number;\n lastRow: number;\n lastCol: number;\n}\n\n/**\n * @internal\n */\nexport function getSelectedCells(table: ContentModelTable): TableSelectionCoordinates | null {\n let firstRow = -1;\n let firstCol = -1;\n let lastRow = -1;\n let lastCol = -1;\n let hasSelection = false;\n\n table.rows.forEach((row, rowIndex) =>\n row.cells.forEach((cell, colIndex) => {\n if (hasSelectionInBlockGroup(cell)) {\n hasSelection = true;\n\n if (firstRow < 0) {\n firstRow = rowIndex;\n }\n\n if (firstCol < 0) {\n firstCol = colIndex;\n }\n\n lastRow = Math.max(lastRow, rowIndex);\n lastCol = Math.max(lastCol, colIndex);\n }\n })\n );\n\n return hasSelection ? { firstRow, firstCol, lastRow, lastCol } : null;\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var hasSelectionInBlockGroup_1 = require("./hasSelectionInBlockGroup");
|
|
4
|
-
var hasSelectionInSegment_1 = require("./hasSelectionInSegment");
|
|
5
|
-
/**
|
|
6
|
-
* Check if there is selection within the given block
|
|
7
|
-
* @param block The block to check
|
|
8
|
-
*/
|
|
9
|
-
function hasSelectionInBlock(block) {
|
|
10
|
-
switch (block.blockType) {
|
|
11
|
-
case 'Paragraph':
|
|
12
|
-
return block.segments.some(hasSelectionInSegment_1.default);
|
|
13
|
-
case 'Table':
|
|
14
|
-
return block.rows.some(function (row) { return row.cells.some(hasSelectionInBlockGroup_1.default); });
|
|
15
|
-
case 'BlockGroup':
|
|
16
|
-
return (0, hasSelectionInBlockGroup_1.default)(block);
|
|
17
|
-
case 'Divider':
|
|
18
|
-
case 'Entity':
|
|
19
|
-
return !!block.isSelected;
|
|
20
|
-
default:
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.default = hasSelectionInBlock;
|
|
25
|
-
//# sourceMappingURL=hasSelectionInBlock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInBlock.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInBlock.ts"],"names":[],"mappings":";;AAAA,uEAAkE;AAClE,iEAA4D;AAG5D;;;GAGG;AACH,SAAwB,mBAAmB,CAAC,KAAwB;IAChE,QAAQ,KAAK,CAAC,SAAS,EAAE;QACrB,KAAK,WAAW;YACZ,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,+BAAqB,CAAC,CAAC;QAEtD,KAAK,OAAO;YACR,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kCAAwB,CAAC,EAAxC,CAAwC,CAAC,CAAC;QAE5E,KAAK,YAAY;YACb,OAAO,IAAA,kCAAwB,EAAC,KAAK,CAAC,CAAC;QAE3C,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACT,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;QAE9B;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC;AAlBD,sCAkBC","sourcesContent":["import hasSelectionInBlockGroup from './hasSelectionInBlockGroup';\nimport hasSelectionInSegment from './hasSelectionInSegment';\nimport type { ContentModelBlock } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given block\n * @param block The block to check\n */\nexport default function hasSelectionInBlock(block: ContentModelBlock): boolean {\n switch (block.blockType) {\n case 'Paragraph':\n return block.segments.some(hasSelectionInSegment);\n\n case 'Table':\n return block.rows.some(row => row.cells.some(hasSelectionInBlockGroup));\n\n case 'BlockGroup':\n return hasSelectionInBlockGroup(block);\n\n case 'Divider':\n case 'Entity':\n return !!block.isSelected;\n\n default:\n return false;\n }\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ContentModelBlockGroup } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* Check if there is selection within the given block
|
|
4
|
-
* @param block The block to check
|
|
5
|
-
*/
|
|
6
|
-
export default function hasSelectionInBlockGroup(group: ContentModelBlockGroup): boolean;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var hasSelectionInBlock_1 = require("./hasSelectionInBlock");
|
|
4
|
-
/**
|
|
5
|
-
* Check if there is selection within the given block
|
|
6
|
-
* @param block The block to check
|
|
7
|
-
*/
|
|
8
|
-
function hasSelectionInBlockGroup(group) {
|
|
9
|
-
if (group.blockGroupType == 'TableCell' && group.isSelected) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
if (group.blocks.some(hasSelectionInBlock_1.default)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
exports.default = hasSelectionInBlockGroup;
|
|
18
|
-
//# sourceMappingURL=hasSelectionInBlockGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInBlockGroup.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInBlockGroup.ts"],"names":[],"mappings":";;AAAA,6DAAwD;AAGxD;;;GAGG;AACH,SAAwB,wBAAwB,CAAC,KAA6B;IAC1E,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,IAAI,KAAK,CAAC,UAAU,EAAE;QACzD,OAAO,IAAI,CAAC;KACf;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,6BAAmB,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACf;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAVD,2CAUC","sourcesContent":["import hasSelectionInBlock from './hasSelectionInBlock';\nimport type { ContentModelBlockGroup } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given block\n * @param block The block to check\n */\nexport default function hasSelectionInBlockGroup(group: ContentModelBlockGroup): boolean {\n if (group.blockGroupType == 'TableCell' && group.isSelected) {\n return true;\n }\n\n if (group.blocks.some(hasSelectionInBlock)) {\n return true;\n }\n\n return false;\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var hasSelectionInBlock_1 = require("./hasSelectionInBlock");
|
|
4
|
-
/**
|
|
5
|
-
* Check if there is selection within the given segment
|
|
6
|
-
* @param segment The segment to check
|
|
7
|
-
*/
|
|
8
|
-
function hasSelectionInSegment(segment) {
|
|
9
|
-
return (segment.isSelected ||
|
|
10
|
-
(segment.segmentType == 'General' && segment.blocks.some(hasSelectionInBlock_1.default)));
|
|
11
|
-
}
|
|
12
|
-
exports.default = hasSelectionInSegment;
|
|
13
|
-
//# sourceMappingURL=hasSelectionInSegment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInSegment.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInSegment.ts"],"names":[],"mappings":";;AAAA,6DAAwD;AAGxD;;;GAGG;AACH,SAAwB,qBAAqB,CAAC,OAA4B;IACtE,OAAO,CACH,OAAO,CAAC,UAAU;QAClB,CAAC,OAAO,CAAC,WAAW,IAAI,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,6BAAmB,CAAC,CAAC,CACjF,CAAC;AACN,CAAC;AALD,wCAKC","sourcesContent":["import hasSelectionInBlock from './hasSelectionInBlock';\nimport type { ContentModelSegment } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given segment\n * @param segment The segment to check\n */\nexport default function hasSelectionInSegment(segment: ContentModelSegment): boolean {\n return (\n segment.isSelected ||\n (segment.segmentType == 'General' && segment.blocks.some(hasSelectionInBlock))\n );\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
* Read a file object and invoke a callback function with the data url of this file
|
|
4
|
-
* @param file The file to read
|
|
5
|
-
* @param callback the callback to invoke with data url of the file.
|
|
6
|
-
* If fail to read, dataUrl will be null
|
|
7
|
-
*/
|
|
8
|
-
export declare function readFile(file: File, callback: (dataUrl: string | null) => void): void;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.readFile = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* Read a file object and invoke a callback function with the data url of this file
|
|
8
|
-
* @param file The file to read
|
|
9
|
-
* @param callback the callback to invoke with data url of the file.
|
|
10
|
-
* If fail to read, dataUrl will be null
|
|
11
|
-
*/
|
|
12
|
-
function readFile(file, callback) {
|
|
13
|
-
if (file) {
|
|
14
|
-
var reader_1 = new FileReader();
|
|
15
|
-
reader_1.onload = function () {
|
|
16
|
-
callback(reader_1.result);
|
|
17
|
-
};
|
|
18
|
-
reader_1.onerror = function () {
|
|
19
|
-
callback(null);
|
|
20
|
-
};
|
|
21
|
-
reader_1.readAsDataURL(file);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.readFile = readFile;
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=readFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readFile.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/domUtils/readFile.ts"],"names":[],"mappings":";;;;IAAA;;;;;;OAMG;IACH,SAAgB,QAAQ,CAAC,IAAU,EAAE,QAA0C;QAC3E,IAAI,IAAI,EAAE;YACN,IAAM,QAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAChC,QAAM,CAAC,MAAM,GAAG;gBACZ,QAAQ,CAAC,QAAM,CAAC,MAAgB,CAAC,CAAC;YACtC,CAAC,CAAC;YACF,QAAM,CAAC,OAAO,GAAG;gBACb,QAAQ,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC,CAAC;YACF,QAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SAC9B;IACL,CAAC;IAXD,4BAWC","sourcesContent":["/**\n * @internal\n * Read a file object and invoke a callback function with the data url of this file\n * @param file The file to read\n * @param callback the callback to invoke with data url of the file.\n * If fail to read, dataUrl will be null\n */\nexport function readFile(file: File, callback: (dataUrl: string | null) => void) {\n if (file) {\n const reader = new FileReader();\n reader.onload = () => {\n callback(reader.result as string);\n };\n reader.onerror = () => {\n callback(null);\n };\n reader.readAsDataURL(file);\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ContentModelTable } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export interface TableSelectionCoordinates {
|
|
6
|
-
firstRow: number;
|
|
7
|
-
firstCol: number;
|
|
8
|
-
lastRow: number;
|
|
9
|
-
lastCol: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare function getSelectedCells(table: ContentModelTable): TableSelectionCoordinates | null;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "../../publicApi/selection/hasSelectionInBlockGroup"], function (require, exports, hasSelectionInBlockGroup_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getSelectedCells = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
function getSelectedCells(table) {
|
|
9
|
-
var firstRow = -1;
|
|
10
|
-
var firstCol = -1;
|
|
11
|
-
var lastRow = -1;
|
|
12
|
-
var lastCol = -1;
|
|
13
|
-
var hasSelection = false;
|
|
14
|
-
table.rows.forEach(function (row, rowIndex) {
|
|
15
|
-
return row.cells.forEach(function (cell, colIndex) {
|
|
16
|
-
if ((0, hasSelectionInBlockGroup_1.default)(cell)) {
|
|
17
|
-
hasSelection = true;
|
|
18
|
-
if (firstRow < 0) {
|
|
19
|
-
firstRow = rowIndex;
|
|
20
|
-
}
|
|
21
|
-
if (firstCol < 0) {
|
|
22
|
-
firstCol = colIndex;
|
|
23
|
-
}
|
|
24
|
-
lastRow = Math.max(lastRow, rowIndex);
|
|
25
|
-
lastCol = Math.max(lastCol, colIndex);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
return hasSelection ? { firstRow: firstRow, firstCol: firstCol, lastRow: lastRow, lastCol: lastCol } : null;
|
|
30
|
-
}
|
|
31
|
-
exports.getSelectedCells = getSelectedCells;
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=getSelectedCells.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSelectedCells.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/getSelectedCells.ts"],"names":[],"mappings":";;;;IAaA;;OAEG;IACH,SAAgB,gBAAgB,CAAC,KAAwB;QACrD,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;QAClB,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;QAClB,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;QACjB,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;QACjB,IAAI,YAAY,GAAG,KAAK,CAAC;QAEzB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,QAAQ;YAC7B,OAAA,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,QAAQ;gBAC7B,IAAI,IAAA,kCAAwB,EAAC,IAAI,CAAC,EAAE;oBAChC,YAAY,GAAG,IAAI,CAAC;oBAEpB,IAAI,QAAQ,GAAG,CAAC,EAAE;wBACd,QAAQ,GAAG,QAAQ,CAAC;qBACvB;oBAED,IAAI,QAAQ,GAAG,CAAC,EAAE;wBACd,QAAQ,GAAG,QAAQ,CAAC;qBACvB;oBAED,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;oBACtC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;iBACzC;YACL,CAAC,CAAC;QAfF,CAeE,CACL,CAAC;QAEF,OAAO,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,UAAA,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1E,CAAC;IA3BD,4CA2BC","sourcesContent":["import hasSelectionInBlockGroup from '../../publicApi/selection/hasSelectionInBlockGroup';\nimport type { ContentModelTable } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport interface TableSelectionCoordinates {\n firstRow: number;\n firstCol: number;\n lastRow: number;\n lastCol: number;\n}\n\n/**\n * @internal\n */\nexport function getSelectedCells(table: ContentModelTable): TableSelectionCoordinates | null {\n let firstRow = -1;\n let firstCol = -1;\n let lastRow = -1;\n let lastCol = -1;\n let hasSelection = false;\n\n table.rows.forEach((row, rowIndex) =>\n row.cells.forEach((cell, colIndex) => {\n if (hasSelectionInBlockGroup(cell)) {\n hasSelection = true;\n\n if (firstRow < 0) {\n firstRow = rowIndex;\n }\n\n if (firstCol < 0) {\n firstCol = colIndex;\n }\n\n lastRow = Math.max(lastRow, rowIndex);\n lastCol = Math.max(lastCol, colIndex);\n }\n })\n );\n\n return hasSelection ? { firstRow, firstCol, lastRow, lastCol } : null;\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "./hasSelectionInBlockGroup", "./hasSelectionInSegment"], function (require, exports, hasSelectionInBlockGroup_1, hasSelectionInSegment_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/**
|
|
5
|
-
* Check if there is selection within the given block
|
|
6
|
-
* @param block The block to check
|
|
7
|
-
*/
|
|
8
|
-
function hasSelectionInBlock(block) {
|
|
9
|
-
switch (block.blockType) {
|
|
10
|
-
case 'Paragraph':
|
|
11
|
-
return block.segments.some(hasSelectionInSegment_1.default);
|
|
12
|
-
case 'Table':
|
|
13
|
-
return block.rows.some(function (row) { return row.cells.some(hasSelectionInBlockGroup_1.default); });
|
|
14
|
-
case 'BlockGroup':
|
|
15
|
-
return (0, hasSelectionInBlockGroup_1.default)(block);
|
|
16
|
-
case 'Divider':
|
|
17
|
-
case 'Entity':
|
|
18
|
-
return !!block.isSelected;
|
|
19
|
-
default:
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.default = hasSelectionInBlock;
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=hasSelectionInBlock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInBlock.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInBlock.ts"],"names":[],"mappings":";;;IAIA;;;OAGG;IACH,SAAwB,mBAAmB,CAAC,KAAwB;QAChE,QAAQ,KAAK,CAAC,SAAS,EAAE;YACrB,KAAK,WAAW;gBACZ,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,+BAAqB,CAAC,CAAC;YAEtD,KAAK,OAAO;gBACR,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kCAAwB,CAAC,EAAxC,CAAwC,CAAC,CAAC;YAE5E,KAAK,YAAY;gBACb,OAAO,IAAA,kCAAwB,EAAC,KAAK,CAAC,CAAC;YAE3C,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ;gBACT,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;YAE9B;gBACI,OAAO,KAAK,CAAC;SACpB;IACL,CAAC;IAlBD,sCAkBC","sourcesContent":["import hasSelectionInBlockGroup from './hasSelectionInBlockGroup';\nimport hasSelectionInSegment from './hasSelectionInSegment';\nimport type { ContentModelBlock } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given block\n * @param block The block to check\n */\nexport default function hasSelectionInBlock(block: ContentModelBlock): boolean {\n switch (block.blockType) {\n case 'Paragraph':\n return block.segments.some(hasSelectionInSegment);\n\n case 'Table':\n return block.rows.some(row => row.cells.some(hasSelectionInBlockGroup));\n\n case 'BlockGroup':\n return hasSelectionInBlockGroup(block);\n\n case 'Divider':\n case 'Entity':\n return !!block.isSelected;\n\n default:\n return false;\n }\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ContentModelBlockGroup } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* Check if there is selection within the given block
|
|
4
|
-
* @param block The block to check
|
|
5
|
-
*/
|
|
6
|
-
export default function hasSelectionInBlockGroup(group: ContentModelBlockGroup): boolean;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "./hasSelectionInBlock"], function (require, exports, hasSelectionInBlock_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/**
|
|
5
|
-
* Check if there is selection within the given block
|
|
6
|
-
* @param block The block to check
|
|
7
|
-
*/
|
|
8
|
-
function hasSelectionInBlockGroup(group) {
|
|
9
|
-
if (group.blockGroupType == 'TableCell' && group.isSelected) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
if (group.blocks.some(hasSelectionInBlock_1.default)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
exports.default = hasSelectionInBlockGroup;
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=hasSelectionInBlockGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInBlockGroup.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInBlockGroup.ts"],"names":[],"mappings":";;;IAGA;;;OAGG;IACH,SAAwB,wBAAwB,CAAC,KAA6B;QAC1E,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,IAAI,KAAK,CAAC,UAAU,EAAE;YACzD,OAAO,IAAI,CAAC;SACf;QAED,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,6BAAmB,CAAC,EAAE;YACxC,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAVD,2CAUC","sourcesContent":["import hasSelectionInBlock from './hasSelectionInBlock';\nimport type { ContentModelBlockGroup } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given block\n * @param block The block to check\n */\nexport default function hasSelectionInBlockGroup(group: ContentModelBlockGroup): boolean {\n if (group.blockGroupType == 'TableCell' && group.isSelected) {\n return true;\n }\n\n if (group.blocks.some(hasSelectionInBlock)) {\n return true;\n }\n\n return false;\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "./hasSelectionInBlock"], function (require, exports, hasSelectionInBlock_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/**
|
|
5
|
-
* Check if there is selection within the given segment
|
|
6
|
-
* @param segment The segment to check
|
|
7
|
-
*/
|
|
8
|
-
function hasSelectionInSegment(segment) {
|
|
9
|
-
return (segment.isSelected ||
|
|
10
|
-
(segment.segmentType == 'General' && segment.blocks.some(hasSelectionInBlock_1.default)));
|
|
11
|
-
}
|
|
12
|
-
exports.default = hasSelectionInSegment;
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=hasSelectionInSegment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInSegment.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInSegment.ts"],"names":[],"mappings":";;;IAGA;;;OAGG;IACH,SAAwB,qBAAqB,CAAC,OAA4B;QACtE,OAAO,CACH,OAAO,CAAC,UAAU;YAClB,CAAC,OAAO,CAAC,WAAW,IAAI,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,6BAAmB,CAAC,CAAC,CACjF,CAAC;IACN,CAAC;IALD,wCAKC","sourcesContent":["import hasSelectionInBlock from './hasSelectionInBlock';\nimport type { ContentModelSegment } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given segment\n * @param segment The segment to check\n */\nexport default function hasSelectionInSegment(segment: ContentModelSegment): boolean {\n return (\n segment.isSelected ||\n (segment.segmentType == 'General' && segment.blocks.some(hasSelectionInBlock))\n );\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
* Read a file object and invoke a callback function with the data url of this file
|
|
4
|
-
* @param file The file to read
|
|
5
|
-
* @param callback the callback to invoke with data url of the file.
|
|
6
|
-
* If fail to read, dataUrl will be null
|
|
7
|
-
*/
|
|
8
|
-
export declare function readFile(file: File, callback: (dataUrl: string | null) => void): void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
* Read a file object and invoke a callback function with the data url of this file
|
|
4
|
-
* @param file The file to read
|
|
5
|
-
* @param callback the callback to invoke with data url of the file.
|
|
6
|
-
* If fail to read, dataUrl will be null
|
|
7
|
-
*/
|
|
8
|
-
export function readFile(file, callback) {
|
|
9
|
-
if (file) {
|
|
10
|
-
var reader_1 = new FileReader();
|
|
11
|
-
reader_1.onload = function () {
|
|
12
|
-
callback(reader_1.result);
|
|
13
|
-
};
|
|
14
|
-
reader_1.onerror = function () {
|
|
15
|
-
callback(null);
|
|
16
|
-
};
|
|
17
|
-
reader_1.readAsDataURL(file);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=readFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readFile.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/domUtils/readFile.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAU,EAAE,QAA0C;IAC3E,IAAI,IAAI,EAAE;QACN,IAAM,QAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAChC,QAAM,CAAC,MAAM,GAAG;YACZ,QAAQ,CAAC,QAAM,CAAC,MAAgB,CAAC,CAAC;QACtC,CAAC,CAAC;QACF,QAAM,CAAC,OAAO,GAAG;YACb,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC;QACF,QAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC9B;AACL,CAAC","sourcesContent":["/**\n * @internal\n * Read a file object and invoke a callback function with the data url of this file\n * @param file The file to read\n * @param callback the callback to invoke with data url of the file.\n * If fail to read, dataUrl will be null\n */\nexport function readFile(file: File, callback: (dataUrl: string | null) => void) {\n if (file) {\n const reader = new FileReader();\n reader.onload = () => {\n callback(reader.result as string);\n };\n reader.onerror = () => {\n callback(null);\n };\n reader.readAsDataURL(file);\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ContentModelTable } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export interface TableSelectionCoordinates {
|
|
6
|
-
firstRow: number;
|
|
7
|
-
firstCol: number;
|
|
8
|
-
lastRow: number;
|
|
9
|
-
lastCol: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare function getSelectedCells(table: ContentModelTable): TableSelectionCoordinates | null;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import hasSelectionInBlockGroup from '../../publicApi/selection/hasSelectionInBlockGroup';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export function getSelectedCells(table) {
|
|
6
|
-
var firstRow = -1;
|
|
7
|
-
var firstCol = -1;
|
|
8
|
-
var lastRow = -1;
|
|
9
|
-
var lastCol = -1;
|
|
10
|
-
var hasSelection = false;
|
|
11
|
-
table.rows.forEach(function (row, rowIndex) {
|
|
12
|
-
return row.cells.forEach(function (cell, colIndex) {
|
|
13
|
-
if (hasSelectionInBlockGroup(cell)) {
|
|
14
|
-
hasSelection = true;
|
|
15
|
-
if (firstRow < 0) {
|
|
16
|
-
firstRow = rowIndex;
|
|
17
|
-
}
|
|
18
|
-
if (firstCol < 0) {
|
|
19
|
-
firstCol = colIndex;
|
|
20
|
-
}
|
|
21
|
-
lastRow = Math.max(lastRow, rowIndex);
|
|
22
|
-
lastCol = Math.max(lastCol, colIndex);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
return hasSelection ? { firstRow: firstRow, firstCol: firstCol, lastRow: lastRow, lastCol: lastCol } : null;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=getSelectedCells.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSelectedCells.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/modelApi/table/getSelectedCells.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,oDAAoD,CAAC;AAa1F;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAwB;IACrD,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;IAClB,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;IAClB,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;IACjB,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;IACjB,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,QAAQ;QAC7B,OAAA,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,QAAQ;YAC7B,IAAI,wBAAwB,CAAC,IAAI,CAAC,EAAE;gBAChC,YAAY,GAAG,IAAI,CAAC;gBAEpB,IAAI,QAAQ,GAAG,CAAC,EAAE;oBACd,QAAQ,GAAG,QAAQ,CAAC;iBACvB;gBAED,IAAI,QAAQ,GAAG,CAAC,EAAE;oBACd,QAAQ,GAAG,QAAQ,CAAC;iBACvB;gBAED,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;gBACtC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;aACzC;QACL,CAAC,CAAC;IAfF,CAeE,CACL,CAAC;IAEF,OAAO,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,UAAA,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC","sourcesContent":["import hasSelectionInBlockGroup from '../../publicApi/selection/hasSelectionInBlockGroup';\nimport type { ContentModelTable } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport interface TableSelectionCoordinates {\n firstRow: number;\n firstCol: number;\n lastRow: number;\n lastCol: number;\n}\n\n/**\n * @internal\n */\nexport function getSelectedCells(table: ContentModelTable): TableSelectionCoordinates | null {\n let firstRow = -1;\n let firstCol = -1;\n let lastRow = -1;\n let lastCol = -1;\n let hasSelection = false;\n\n table.rows.forEach((row, rowIndex) =>\n row.cells.forEach((cell, colIndex) => {\n if (hasSelectionInBlockGroup(cell)) {\n hasSelection = true;\n\n if (firstRow < 0) {\n firstRow = rowIndex;\n }\n\n if (firstCol < 0) {\n firstCol = colIndex;\n }\n\n lastRow = Math.max(lastRow, rowIndex);\n lastCol = Math.max(lastCol, colIndex);\n }\n })\n );\n\n return hasSelection ? { firstRow, firstCol, lastRow, lastCol } : null;\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import hasSelectionInBlockGroup from './hasSelectionInBlockGroup';
|
|
2
|
-
import hasSelectionInSegment from './hasSelectionInSegment';
|
|
3
|
-
/**
|
|
4
|
-
* Check if there is selection within the given block
|
|
5
|
-
* @param block The block to check
|
|
6
|
-
*/
|
|
7
|
-
export default function hasSelectionInBlock(block) {
|
|
8
|
-
switch (block.blockType) {
|
|
9
|
-
case 'Paragraph':
|
|
10
|
-
return block.segments.some(hasSelectionInSegment);
|
|
11
|
-
case 'Table':
|
|
12
|
-
return block.rows.some(function (row) { return row.cells.some(hasSelectionInBlockGroup); });
|
|
13
|
-
case 'BlockGroup':
|
|
14
|
-
return hasSelectionInBlockGroup(block);
|
|
15
|
-
case 'Divider':
|
|
16
|
-
case 'Entity':
|
|
17
|
-
return !!block.isSelected;
|
|
18
|
-
default:
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=hasSelectionInBlock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInBlock.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInBlock.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAG5D;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAwB;IAChE,QAAQ,KAAK,CAAC,SAAS,EAAE;QACrB,KAAK,WAAW;YACZ,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAEtD,KAAK,OAAO;YACR,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,EAAxC,CAAwC,CAAC,CAAC;QAE5E,KAAK,YAAY;YACb,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAE3C,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACT,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;QAE9B;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC","sourcesContent":["import hasSelectionInBlockGroup from './hasSelectionInBlockGroup';\nimport hasSelectionInSegment from './hasSelectionInSegment';\nimport type { ContentModelBlock } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given block\n * @param block The block to check\n */\nexport default function hasSelectionInBlock(block: ContentModelBlock): boolean {\n switch (block.blockType) {\n case 'Paragraph':\n return block.segments.some(hasSelectionInSegment);\n\n case 'Table':\n return block.rows.some(row => row.cells.some(hasSelectionInBlockGroup));\n\n case 'BlockGroup':\n return hasSelectionInBlockGroup(block);\n\n case 'Divider':\n case 'Entity':\n return !!block.isSelected;\n\n default:\n return false;\n }\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ContentModelBlockGroup } from 'roosterjs-content-model-types';
|
|
2
|
-
/**
|
|
3
|
-
* Check if there is selection within the given block
|
|
4
|
-
* @param block The block to check
|
|
5
|
-
*/
|
|
6
|
-
export default function hasSelectionInBlockGroup(group: ContentModelBlockGroup): boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import hasSelectionInBlock from './hasSelectionInBlock';
|
|
2
|
-
/**
|
|
3
|
-
* Check if there is selection within the given block
|
|
4
|
-
* @param block The block to check
|
|
5
|
-
*/
|
|
6
|
-
export default function hasSelectionInBlockGroup(group) {
|
|
7
|
-
if (group.blockGroupType == 'TableCell' && group.isSelected) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
if (group.blocks.some(hasSelectionInBlock)) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=hasSelectionInBlockGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInBlockGroup.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInBlockGroup.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAGxD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAA6B;IAC1E,IAAI,KAAK,CAAC,cAAc,IAAI,WAAW,IAAI,KAAK,CAAC,UAAU,EAAE;QACzD,OAAO,IAAI,CAAC;KACf;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACf;IAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import hasSelectionInBlock from './hasSelectionInBlock';\nimport type { ContentModelBlockGroup } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given block\n * @param block The block to check\n */\nexport default function hasSelectionInBlockGroup(group: ContentModelBlockGroup): boolean {\n if (group.blockGroupType == 'TableCell' && group.isSelected) {\n return true;\n }\n\n if (group.blocks.some(hasSelectionInBlock)) {\n return true;\n }\n\n return false;\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import hasSelectionInBlock from './hasSelectionInBlock';
|
|
2
|
-
/**
|
|
3
|
-
* Check if there is selection within the given segment
|
|
4
|
-
* @param segment The segment to check
|
|
5
|
-
*/
|
|
6
|
-
export default function hasSelectionInSegment(segment) {
|
|
7
|
-
return (segment.isSelected ||
|
|
8
|
-
(segment.segmentType == 'General' && segment.blocks.some(hasSelectionInBlock)));
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=hasSelectionInSegment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSelectionInSegment.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-api/lib/publicApi/selection/hasSelectionInSegment.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAGxD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,OAA4B;IACtE,OAAO,CACH,OAAO,CAAC,UAAU;QAClB,CAAC,OAAO,CAAC,WAAW,IAAI,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CACjF,CAAC;AACN,CAAC","sourcesContent":["import hasSelectionInBlock from './hasSelectionInBlock';\nimport type { ContentModelSegment } from 'roosterjs-content-model-types';\n\n/**\n * Check if there is selection within the given segment\n * @param segment The segment to check\n */\nexport default function hasSelectionInSegment(segment: ContentModelSegment): boolean {\n return (\n segment.isSelected ||\n (segment.segmentType == 'General' && segment.blocks.some(hasSelectionInBlock))\n );\n}\n"]}
|