roosterjs 9.45.1 → 9.45.2
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/dist/rooster-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +1 -1
- package/dist/rooster-amd.js +127 -60
- package/dist/rooster-amd.js.map +1 -1
- package/dist/rooster-min.js +1 -1
- package/dist/rooster-min.js.map +1 -1
- package/dist/rooster.d.ts +1 -1
- package/dist/rooster.js +127 -60
- package/dist/rooster.js.map +1 -1
- package/package.json +8 -8
package/dist/rooster.d.ts
CHANGED
package/dist/rooster.js
CHANGED
|
@@ -3910,13 +3910,17 @@ function setListType(model, listType, removeMargins) {
|
|
|
3910
3910
|
}
|
|
3911
3911
|
else {
|
|
3912
3912
|
var index = parent.blocks.indexOf(block);
|
|
3913
|
+
var isInsideTableCell = parent.blockGroupType == 'TableCell';
|
|
3913
3914
|
if (index >= 0) {
|
|
3914
|
-
if (paragraphOrListItems.length == 1 ||
|
|
3915
|
+
if (paragraphOrListItems.length == 1 ||
|
|
3916
|
+
!shouldIgnoreBlock(block) ||
|
|
3917
|
+
isInsideTableCell) {
|
|
3915
3918
|
var prevBlock = parent.blocks[index - 1];
|
|
3916
3919
|
var segmentFormat = (block.blockType == 'Paragraph' && ((_b = block.segments[0]) === null || _b === void 0 ? void 0 : _b.format)) || {};
|
|
3917
3920
|
var newListItem = (0, roosterjs_content_model_dom_1.createListItem)([
|
|
3918
3921
|
(0, roosterjs_content_model_dom_1.createListLevel)(listType, {
|
|
3919
|
-
startNumberOverride:
|
|
3922
|
+
startNumberOverride: isInsideTableCell ||
|
|
3923
|
+
itemIndex > 0 ||
|
|
3920
3924
|
((prevBlock === null || prevBlock === void 0 ? void 0 : prevBlock.blockType) == 'BlockGroup' &&
|
|
3921
3925
|
prevBlock.blockGroupType == 'ListItem' &&
|
|
3922
3926
|
((_c = prevBlock.levels[0]) === null || _c === void 0 ? void 0 : _c.listType) == 'OL')
|
|
@@ -4538,6 +4542,40 @@ function clearSelectedCells(table, sel) {
|
|
|
4538
4542
|
exports.clearSelectedCells = clearSelectedCells;
|
|
4539
4543
|
|
|
4540
4544
|
|
|
4545
|
+
/***/ }),
|
|
4546
|
+
|
|
4547
|
+
/***/ "./packages/roosterjs-content-model-api/lib/modelApi/table/copyPreviousCellSegmentFormat.ts":
|
|
4548
|
+
/*!**************************************************************************************************!*\
|
|
4549
|
+
!*** ./packages/roosterjs-content-model-api/lib/modelApi/table/copyPreviousCellSegmentFormat.ts ***!
|
|
4550
|
+
\**************************************************************************************************/
|
|
4551
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4552
|
+
|
|
4553
|
+
"use strict";
|
|
4554
|
+
|
|
4555
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4556
|
+
exports.copyPreviousCellSegmentFormat = void 0;
|
|
4557
|
+
var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
|
|
4558
|
+
/**
|
|
4559
|
+
* @internal
|
|
4560
|
+
*/
|
|
4561
|
+
function copyPreviousCellSegmentFormat(cell, newCell) {
|
|
4562
|
+
var block = cell.blocks[0];
|
|
4563
|
+
if (block && (block === null || block === void 0 ? void 0 : block.blockType) == 'Paragraph') {
|
|
4564
|
+
var firstSegment = block.segments[0];
|
|
4565
|
+
if (firstSegment &&
|
|
4566
|
+
(firstSegment.segmentType == 'Text' ||
|
|
4567
|
+
firstSegment.segmentType == 'Br' ||
|
|
4568
|
+
firstSegment.segmentType == 'SelectionMarker')) {
|
|
4569
|
+
var newCellParagraph = (0, roosterjs_content_model_dom_1.createParagraph)(false /* isImplicit */, block.format, block.segmentFormat);
|
|
4570
|
+
var br = (0, roosterjs_content_model_dom_1.createBr)(firstSegment.format);
|
|
4571
|
+
newCellParagraph.segments.push(br);
|
|
4572
|
+
(0, roosterjs_content_model_dom_1.mutateBlock)(newCell).blocks.push(newCellParagraph);
|
|
4573
|
+
}
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4576
|
+
exports.copyPreviousCellSegmentFormat = copyPreviousCellSegmentFormat;
|
|
4577
|
+
|
|
4578
|
+
|
|
4541
4579
|
/***/ }),
|
|
4542
4580
|
|
|
4543
4581
|
/***/ "./packages/roosterjs-content-model-api/lib/modelApi/table/createTableStructure.ts":
|
|
@@ -4738,6 +4776,7 @@ function createEmptyParagraph(model) {
|
|
|
4738
4776
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4739
4777
|
exports.insertTableColumn = void 0;
|
|
4740
4778
|
var clearSelectedCells_1 = __webpack_require__(/*! ./clearSelectedCells */ "./packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts");
|
|
4779
|
+
var copyPreviousCellSegmentFormat_1 = __webpack_require__(/*! ./copyPreviousCellSegmentFormat */ "./packages/roosterjs-content-model-api/lib/modelApi/table/copyPreviousCellSegmentFormat.ts");
|
|
4741
4780
|
var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
|
|
4742
4781
|
/**
|
|
4743
4782
|
* Insert a column to the table
|
|
@@ -4753,6 +4792,7 @@ function insertTableColumn(table, operation) {
|
|
|
4753
4792
|
table.rows.forEach(function (row) {
|
|
4754
4793
|
var cell = row.cells[insertLeft ? sel.firstColumn : sel.lastColumn];
|
|
4755
4794
|
var newCell = (0, roosterjs_content_model_dom_1.createTableCell)(cell.spanLeft, cell.spanAbove, cell.isHeader, cell.format, cell.dataset);
|
|
4795
|
+
(0, copyPreviousCellSegmentFormat_1.copyPreviousCellSegmentFormat)(cell, newCell);
|
|
4756
4796
|
newCell.isSelected = true;
|
|
4757
4797
|
row.cells.splice(insertLeft ? sel.firstColumn : sel.lastColumn + 1, 0, newCell);
|
|
4758
4798
|
});
|
|
@@ -4777,6 +4817,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
4777
4817
|
exports.insertTableRow = void 0;
|
|
4778
4818
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
|
|
4779
4819
|
var clearSelectedCells_1 = __webpack_require__(/*! ./clearSelectedCells */ "./packages/roosterjs-content-model-api/lib/modelApi/table/clearSelectedCells.ts");
|
|
4820
|
+
var copyPreviousCellSegmentFormat_1 = __webpack_require__(/*! ./copyPreviousCellSegmentFormat */ "./packages/roosterjs-content-model-api/lib/modelApi/table/copyPreviousCellSegmentFormat.ts");
|
|
4780
4821
|
var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
|
|
4781
4822
|
/**
|
|
4782
4823
|
* Insert a row to the table
|
|
@@ -4794,6 +4835,7 @@ function insertTableRow(table, operation) {
|
|
|
4794
4835
|
format: (0, tslib_1.__assign)({}, sourceRow.format),
|
|
4795
4836
|
cells: sourceRow.cells.map(function (cell) {
|
|
4796
4837
|
var newCell = (0, roosterjs_content_model_dom_1.createTableCell)(cell.spanLeft, cell.spanAbove, cell.isHeader, cell.format, cell.dataset);
|
|
4838
|
+
(0, copyPreviousCellSegmentFormat_1.copyPreviousCellSegmentFormat)(cell, newCell);
|
|
4797
4839
|
newCell.isSelected = true;
|
|
4798
4840
|
return newCell;
|
|
4799
4841
|
}),
|
|
@@ -17437,7 +17479,7 @@ exports.fontProcessor = fontProcessor;
|
|
|
17437
17479
|
"use strict";
|
|
17438
17480
|
|
|
17439
17481
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
17440
|
-
exports.formatContainerProcessor = exports.ContextStyles = void 0;
|
|
17482
|
+
exports.forceFormatContainerProcessor = exports.formatContainerProcessor = exports.ContextStyles = void 0;
|
|
17441
17483
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
|
|
17442
17484
|
var addBlock_1 = __webpack_require__(/*! ../../modelApi/common/addBlock */ "./packages/roosterjs-content-model-dom/lib/modelApi/common/addBlock.ts");
|
|
17443
17485
|
var createFormatContainer_1 = __webpack_require__(/*! ../../modelApi/creators/createFormatContainer */ "./packages/roosterjs-content-model-dom/lib/modelApi/creators/createFormatContainer.ts");
|
|
@@ -17464,6 +17506,17 @@ exports.ContextStyles = [
|
|
|
17464
17506
|
* @param context DOM to Content Model context
|
|
17465
17507
|
*/
|
|
17466
17508
|
var formatContainerProcessor = function (group, element, context) {
|
|
17509
|
+
formatContainerProcessorInternal(group, element, context, false /* forceFormatContainer */);
|
|
17510
|
+
};
|
|
17511
|
+
exports.formatContainerProcessor = formatContainerProcessor;
|
|
17512
|
+
/**
|
|
17513
|
+
* @internal
|
|
17514
|
+
*/
|
|
17515
|
+
var forceFormatContainerProcessor = function (group, element, context) {
|
|
17516
|
+
formatContainerProcessorInternal(group, element, context, true /* forceFormatContainer */);
|
|
17517
|
+
};
|
|
17518
|
+
exports.forceFormatContainerProcessor = forceFormatContainerProcessor;
|
|
17519
|
+
var formatContainerProcessorInternal = function (group, element, context, forceFormatContainer) {
|
|
17467
17520
|
(0, stackFormat_1.stackFormat)(context, { segment: 'shallowCloneForBlock', paragraph: 'shallowClone' }, function () {
|
|
17468
17521
|
(0, parseFormat_1.parseFormat)(element, context.formatParsers.block, context.blockFormat, context);
|
|
17469
17522
|
(0, parseFormat_1.parseFormat)(element, context.formatParsers.segmentOnBlock, context.segmentFormat, context);
|
|
@@ -17481,7 +17534,7 @@ var formatContainerProcessor = function (group, element, context) {
|
|
|
17481
17534
|
if (element.style.fontSize && parseInt(element.style.fontSize) == 0) {
|
|
17482
17535
|
formatContainer.zeroFontSize = true;
|
|
17483
17536
|
}
|
|
17484
|
-
if (shouldFallbackToParagraph(formatContainer)) {
|
|
17537
|
+
if (shouldFallbackToParagraph(formatContainer) && !forceFormatContainer) {
|
|
17485
17538
|
// For DIV container that only has one paragraph child, container style can be merged into paragraph
|
|
17486
17539
|
// and no need to have this container
|
|
17487
17540
|
var paragraph = formatContainer.blocks[0];
|
|
@@ -17500,7 +17553,6 @@ var formatContainerProcessor = function (group, element, context) {
|
|
|
17500
17553
|
});
|
|
17501
17554
|
(0, addBlock_1.addBlock)(group, (0, createParagraph_1.createParagraph)(true /*isImplicit*/, context.blockFormat));
|
|
17502
17555
|
};
|
|
17503
|
-
exports.formatContainerProcessor = formatContainerProcessor;
|
|
17504
17556
|
function shouldFallbackToParagraph(formatContainer) {
|
|
17505
17557
|
var firstChild = formatContainer.blocks[0];
|
|
17506
17558
|
return (formatContainer.tagName == 'div' &&
|
|
@@ -17719,12 +17771,12 @@ exports.knownElementProcessor = void 0;
|
|
|
17719
17771
|
var addBlock_1 = __webpack_require__(/*! ../../modelApi/common/addBlock */ "./packages/roosterjs-content-model-dom/lib/modelApi/common/addBlock.ts");
|
|
17720
17772
|
var blockProcessor_1 = __webpack_require__(/*! ./blockProcessor */ "./packages/roosterjs-content-model-dom/lib/domToModel/processors/blockProcessor.ts");
|
|
17721
17773
|
var createParagraph_1 = __webpack_require__(/*! ../../modelApi/creators/createParagraph */ "./packages/roosterjs-content-model-dom/lib/modelApi/creators/createParagraph.ts");
|
|
17722
|
-
var formatContainerProcessor_1 = __webpack_require__(/*! ./formatContainerProcessor */ "./packages/roosterjs-content-model-dom/lib/domToModel/processors/formatContainerProcessor.ts");
|
|
17723
17774
|
var getDefaultStyle_1 = __webpack_require__(/*! ../utils/getDefaultStyle */ "./packages/roosterjs-content-model-dom/lib/domToModel/utils/getDefaultStyle.ts");
|
|
17724
17775
|
var isBlockElement_1 = __webpack_require__(/*! ../utils/isBlockElement */ "./packages/roosterjs-content-model-dom/lib/domToModel/utils/isBlockElement.ts");
|
|
17725
17776
|
var entityUtils_1 = __webpack_require__(/*! ../../domUtils/entityUtils */ "./packages/roosterjs-content-model-dom/lib/domUtils/entityUtils.ts");
|
|
17726
17777
|
var parseFormat_1 = __webpack_require__(/*! ../utils/parseFormat */ "./packages/roosterjs-content-model-dom/lib/domToModel/utils/parseFormat.ts");
|
|
17727
17778
|
var stackFormat_1 = __webpack_require__(/*! ../utils/stackFormat */ "./packages/roosterjs-content-model-dom/lib/domToModel/utils/stackFormat.ts");
|
|
17779
|
+
var formatContainerProcessor_1 = __webpack_require__(/*! ./formatContainerProcessor */ "./packages/roosterjs-content-model-dom/lib/domToModel/processors/formatContainerProcessor.ts");
|
|
17728
17780
|
var FormatContainerTriggerStyles = [
|
|
17729
17781
|
'marginBottom',
|
|
17730
17782
|
'marginTop',
|
|
@@ -17751,8 +17803,12 @@ var SegmentDecoratorTags = ['A', 'CODE'];
|
|
|
17751
17803
|
*/
|
|
17752
17804
|
var knownElementProcessor = function (group, element, context) {
|
|
17753
17805
|
var isBlock = (0, isBlockElement_1.isBlockElement)(element);
|
|
17754
|
-
|
|
17755
|
-
|
|
17806
|
+
var isBlockContainer = isBlock || element.style.display == 'inline-block';
|
|
17807
|
+
if (isBlockContainer && // For inline-block here, we will also check if it should be represented as Format Container
|
|
17808
|
+
shouldForceUseFormatContainer(element, context)) {
|
|
17809
|
+
(0, formatContainerProcessor_1.forceFormatContainerProcessor)(group, element, context);
|
|
17810
|
+
}
|
|
17811
|
+
else if (isBlockContainer && shouldUseFormatContainer(element, context)) {
|
|
17756
17812
|
(0, formatContainerProcessor_1.formatContainerProcessor)(group, element, context);
|
|
17757
17813
|
}
|
|
17758
17814
|
else if ((0, entityUtils_1.isBlockEntityContainer)(element)) {
|
|
@@ -17786,6 +17842,9 @@ var knownElementProcessor = function (group, element, context) {
|
|
|
17786
17842
|
}
|
|
17787
17843
|
};
|
|
17788
17844
|
exports.knownElementProcessor = knownElementProcessor;
|
|
17845
|
+
function shouldForceUseFormatContainer(element, context) {
|
|
17846
|
+
return FormatContainerTriggerAttributes.some(function (attr) { return element.hasAttribute(attr); });
|
|
17847
|
+
}
|
|
17789
17848
|
function shouldUseFormatContainer(element, context) {
|
|
17790
17849
|
// For those tags that we know we should not use format container, just return false
|
|
17791
17850
|
if (ByPassFormatContainerTags.indexOf(element.tagName) >= 0) {
|
|
@@ -17800,8 +17859,7 @@ function shouldUseFormatContainer(element, context) {
|
|
|
17800
17859
|
}
|
|
17801
17860
|
// For block element with positive value of border width or top/bottom margin/padding,
|
|
17802
17861
|
// we need to use format container
|
|
17803
|
-
if (FormatContainerTriggerStyles.some(function (key) { return parseInt(style[key] || defaultStyle[key] || '') > 0; })
|
|
17804
|
-
FormatContainerTriggerAttributes.some(function (attr) { return element.hasAttribute(attr); })) {
|
|
17862
|
+
if (FormatContainerTriggerStyles.some(function (key) { return parseInt(style[key] || defaultStyle[key] || '') > 0; })) {
|
|
17805
17863
|
return true;
|
|
17806
17864
|
}
|
|
17807
17865
|
// For margin left/right with value "auto", we need to use format container
|
|
@@ -18304,8 +18362,8 @@ var textProcessor = function (group, textNode, context) {
|
|
|
18304
18362
|
(0, stackFormat_1.stackFormat)(context, { segment: 'shallowClone' }, function () {
|
|
18305
18363
|
context.formatParsers.text.forEach(function (parser) {
|
|
18306
18364
|
parser(context.segmentFormat, textNode, context);
|
|
18307
|
-
internalTextProcessor(group, textNode, context);
|
|
18308
18365
|
});
|
|
18366
|
+
internalTextProcessor(group, textNode, context);
|
|
18309
18367
|
});
|
|
18310
18368
|
}
|
|
18311
18369
|
else {
|
|
@@ -24735,9 +24793,12 @@ function setFirstColumnFormatBorders(rows, format) {
|
|
|
24735
24793
|
(0, mutate_1.mutateSegment)(block, segment, function (cellSegment) {
|
|
24736
24794
|
if (format.hasFirstColumn) {
|
|
24737
24795
|
cellSegment.format.fontWeight = 'bold';
|
|
24796
|
+
cell.format.fontWeight = 'bold';
|
|
24738
24797
|
}
|
|
24739
|
-
else if (cellSegment.format.fontWeight == 'bold'
|
|
24798
|
+
else if (cellSegment.format.fontWeight == 'bold' &&
|
|
24799
|
+
cell.format.fontWeight == 'bold') {
|
|
24740
24800
|
delete cellSegment.format.fontWeight;
|
|
24801
|
+
delete cell.format.fontWeight;
|
|
24741
24802
|
}
|
|
24742
24803
|
});
|
|
24743
24804
|
}
|
|
@@ -26356,7 +26417,7 @@ function setTableCellBackgroundColor(cell, color, isColorOverride, applyToSegmen
|
|
|
26356
26417
|
delete cell.format.textColor;
|
|
26357
26418
|
}
|
|
26358
26419
|
if (applyToSegments) {
|
|
26359
|
-
setAdaptiveCellColor(cell);
|
|
26420
|
+
setAdaptiveCellColor(cell, color);
|
|
26360
26421
|
}
|
|
26361
26422
|
}
|
|
26362
26423
|
else {
|
|
@@ -26370,34 +26431,38 @@ function setTableCellBackgroundColor(cell, color, isColorOverride, applyToSegmen
|
|
|
26370
26431
|
exports.setTableCellBackgroundColor = setTableCellBackgroundColor;
|
|
26371
26432
|
function removeAdaptiveCellColor(cell) {
|
|
26372
26433
|
cell.blocks.forEach(function (readonlyBlock) {
|
|
26373
|
-
var _a
|
|
26434
|
+
var _a;
|
|
26374
26435
|
if (readonlyBlock.blockType == 'Paragraph') {
|
|
26375
26436
|
var block = (0, mutate_1.mutateBlock)(readonlyBlock);
|
|
26376
26437
|
if (((_a = block.segmentFormat) === null || _a === void 0 ? void 0 : _a.textColor) &&
|
|
26377
|
-
|
|
26438
|
+
(areSameColor(block.segmentFormat.textColor, White) ||
|
|
26439
|
+
areSameColor(block.segmentFormat.textColor, Black))) {
|
|
26378
26440
|
delete block.segmentFormat.textColor;
|
|
26379
26441
|
}
|
|
26380
26442
|
block.segments.forEach(function (segment) {
|
|
26381
26443
|
if (segment.format.textColor &&
|
|
26382
|
-
|
|
26444
|
+
(areSameColor(segment.format.textColor, White) ||
|
|
26445
|
+
areSameColor(segment.format.textColor, Black))) {
|
|
26383
26446
|
delete segment.format.textColor;
|
|
26384
26447
|
}
|
|
26385
26448
|
});
|
|
26386
26449
|
}
|
|
26387
26450
|
});
|
|
26388
26451
|
}
|
|
26389
|
-
function setAdaptiveCellColor(cell) {
|
|
26452
|
+
function setAdaptiveCellColor(cell, backgroundColor) {
|
|
26390
26453
|
if (cell.format.textColor) {
|
|
26391
26454
|
cell.blocks.forEach(function (readonlyBlock) {
|
|
26392
26455
|
var _a;
|
|
26393
26456
|
if (readonlyBlock.blockType == 'Paragraph') {
|
|
26394
26457
|
var block = (0, mutate_1.mutateBlock)(readonlyBlock);
|
|
26395
|
-
if (!((_a = block.segmentFormat) === null || _a === void 0 ? void 0 : _a.textColor)
|
|
26458
|
+
if (!((_a = block.segmentFormat) === null || _a === void 0 ? void 0 : _a.textColor) ||
|
|
26459
|
+
areSameColor(backgroundColor, block.segmentFormat.textColor)) {
|
|
26396
26460
|
block.segmentFormat = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, block.segmentFormat), { textColor: cell.format.textColor });
|
|
26397
26461
|
}
|
|
26398
26462
|
block.segments.forEach(function (segment) {
|
|
26399
26463
|
var _a;
|
|
26400
|
-
if (!((_a = segment.format) === null || _a === void 0 ? void 0 : _a.textColor)
|
|
26464
|
+
if (!((_a = segment.format) === null || _a === void 0 ? void 0 : _a.textColor) ||
|
|
26465
|
+
areSameColor(backgroundColor, segment.format.textColor)) {
|
|
26401
26466
|
segment.format = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, segment.format), { textColor: cell.format.textColor });
|
|
26402
26467
|
}
|
|
26403
26468
|
});
|
|
@@ -26405,22 +26470,6 @@ function setAdaptiveCellColor(cell) {
|
|
|
26405
26470
|
});
|
|
26406
26471
|
}
|
|
26407
26472
|
}
|
|
26408
|
-
/**
|
|
26409
|
-
* If the cell background color is too dark or too bright, and the text color is white or black, we should remove the text color
|
|
26410
|
-
* @param textColor the segment or block text color
|
|
26411
|
-
* @param cellBackgroundColor the cell background color
|
|
26412
|
-
* @returns
|
|
26413
|
-
*/
|
|
26414
|
-
function shouldRemoveColor(textColor, cellBackgroundColor) {
|
|
26415
|
-
var lightness = calculateLightness(cellBackgroundColor);
|
|
26416
|
-
if (([White, 'rgb(255,255,255)'].indexOf(textColor) > -1 &&
|
|
26417
|
-
(lightness > BRIGHT_COLORS_LIGHTNESS || cellBackgroundColor == '')) ||
|
|
26418
|
-
([Black, 'rgb(0,0,0)'].indexOf(textColor) > -1 &&
|
|
26419
|
-
(lightness < DARK_COLORS_LIGHTNESS || cellBackgroundColor == ''))) {
|
|
26420
|
-
return true;
|
|
26421
|
-
}
|
|
26422
|
-
return false;
|
|
26423
|
-
}
|
|
26424
26473
|
function calculateLightness(color) {
|
|
26425
26474
|
var colorValues = (0, color_1.parseColor)(color);
|
|
26426
26475
|
// Use the values of r,g,b to calculate the lightness in the HSl representation
|
|
@@ -26436,6 +26485,17 @@ function calculateLightness(color) {
|
|
|
26436
26485
|
return 255;
|
|
26437
26486
|
}
|
|
26438
26487
|
}
|
|
26488
|
+
/**
|
|
26489
|
+
* Check if two colors are the same by comparing their RGB values
|
|
26490
|
+
*/
|
|
26491
|
+
function areSameColor(color1, color2) {
|
|
26492
|
+
var rgb1 = (0, color_1.parseColor)(color1);
|
|
26493
|
+
var rgb2 = (0, color_1.parseColor)(color2);
|
|
26494
|
+
if (rgb1 && rgb2) {
|
|
26495
|
+
return rgb1[0] === rgb2[0] && rgb1[1] === rgb2[1] && rgb1[2] === rgb2[2];
|
|
26496
|
+
}
|
|
26497
|
+
return false;
|
|
26498
|
+
}
|
|
26439
26499
|
|
|
26440
26500
|
|
|
26441
26501
|
/***/ }),
|
|
@@ -32696,7 +32756,7 @@ var deleteList = function (context) {
|
|
|
32696
32756
|
else {
|
|
32697
32757
|
var removedBlocks = mutableList.blocks.splice(mutableList.blocks.indexOf(paragraph), mutableList.blocks.length);
|
|
32698
32758
|
if (mutableList.levels.length > 1) {
|
|
32699
|
-
var newListItem = (0, roosterjs_content_model_dom_1.createListItem)(mutableList.levels.slice(0, -1), mutableList.format);
|
|
32759
|
+
var newListItem = (0, roosterjs_content_model_dom_1.createListItem)(mutableList.levels.slice(0, -1), mutableList.formatHolder.format);
|
|
32700
32760
|
newListItem.blocks = removedBlocks.map(function (block) { return (0, roosterjs_content_model_dom_1.mutateBlock)(block); });
|
|
32701
32761
|
(0, roosterjs_content_model_dom_1.mutateBlock)(parent).blocks.splice(listItemIndex + 1, 0, newListItem);
|
|
32702
32762
|
}
|
|
@@ -41555,31 +41615,38 @@ exports.VERTICAL_INSERTER_ID = 'verticalInserter';
|
|
|
41555
41615
|
function createTableInserter(editor, td, table, isRTL, isHorizontal, onBeforeInsert, onAfterInserted, anchorContainer, onTableEditorCreated) {
|
|
41556
41616
|
var tdRect = (0, roosterjs_content_model_dom_1.normalizeRect)(td.getBoundingClientRect());
|
|
41557
41617
|
var viewPort = editor.getVisibleViewport();
|
|
41558
|
-
|
|
41559
|
-
|
|
41560
|
-
|
|
41561
|
-
|
|
41562
|
-
|
|
41563
|
-
|
|
41564
|
-
|
|
41565
|
-
|
|
41566
|
-
|
|
41567
|
-
|
|
41568
|
-
|
|
41569
|
-
|
|
41570
|
-
|
|
41571
|
-
|
|
41618
|
+
if (tdRect && viewPort) {
|
|
41619
|
+
var isOutsideTop = tdRect.top <= viewPort.top;
|
|
41620
|
+
var isOutsideBottom = tdRect.bottom >= viewPort.bottom;
|
|
41621
|
+
if (isOutsideBottom || isOutsideTop) {
|
|
41622
|
+
return null;
|
|
41623
|
+
}
|
|
41624
|
+
var tableRect = table ? (0, getIntersectedRect_1.getIntersectedRect)([table], [viewPort]) : null;
|
|
41625
|
+
// set inserter position
|
|
41626
|
+
if (tableRect) {
|
|
41627
|
+
var document_1 = td.ownerDocument;
|
|
41628
|
+
var createElementData = getInsertElementData(isHorizontal, editor.isDarkMode(), isRTL, editor.getDOMHelper().getDomStyle('backgroundColor') || 'white');
|
|
41629
|
+
var div = (0, createElement_1.createElement)(createElementData, document_1);
|
|
41630
|
+
if (isHorizontal) {
|
|
41631
|
+
// tableRect.left/right is used because the Inserter is always intended to be on the side
|
|
41632
|
+
div.id = exports.HORIZONTAL_INSERTER_ID;
|
|
41633
|
+
div.style.left = (isRTL
|
|
41634
|
+
? tableRect.right
|
|
41635
|
+
: tableRect.left - (INSERTER_SIDE_LENGTH - 1 + 2 * INSERTER_BORDER_SIZE)) + "px";
|
|
41636
|
+
div.style.top = tdRect.bottom - 8 + "px";
|
|
41637
|
+
div.firstChild.style.width = tableRect.right - tableRect.left + "px";
|
|
41638
|
+
}
|
|
41639
|
+
else {
|
|
41640
|
+
div.id = exports.VERTICAL_INSERTER_ID;
|
|
41641
|
+
div.style.left = (isRTL ? tdRect.left - 8 : tdRect.right - 8) + "px";
|
|
41642
|
+
// tableRect.top is used because the Inserter is always intended to be on top
|
|
41643
|
+
div.style.top = tableRect.top - (INSERTER_SIDE_LENGTH - 1 + 2 * INSERTER_BORDER_SIZE) + "px";
|
|
41644
|
+
div.firstChild.style.height = tableRect.bottom - tableRect.top + "px";
|
|
41645
|
+
}
|
|
41646
|
+
(anchorContainer || document_1.body).appendChild(div);
|
|
41647
|
+
var handler = new TableInsertHandler(div, td, table, isHorizontal, editor, onBeforeInsert, onAfterInserted, onTableEditorCreated);
|
|
41648
|
+
return { div: div, featureHandler: handler, node: td };
|
|
41572
41649
|
}
|
|
41573
|
-
else {
|
|
41574
|
-
div.id = exports.VERTICAL_INSERTER_ID;
|
|
41575
|
-
div.style.left = (isRTL ? tdRect.left - 8 : tdRect.right - 8) + "px";
|
|
41576
|
-
// tableRect.top is used because the Inserter is always intended to be on top
|
|
41577
|
-
div.style.top = tableRect.top - (INSERTER_SIDE_LENGTH - 1 + 2 * INSERTER_BORDER_SIZE) + "px";
|
|
41578
|
-
div.firstChild.style.height = tableRect.bottom - tableRect.top + "px";
|
|
41579
|
-
}
|
|
41580
|
-
(anchorContainer || document_1.body).appendChild(div);
|
|
41581
|
-
var handler = new TableInsertHandler(div, td, table, isHorizontal, editor, onBeforeInsert, onAfterInserted, onTableEditorCreated);
|
|
41582
|
-
return { div: div, featureHandler: handler, node: td };
|
|
41583
41650
|
}
|
|
41584
41651
|
return null;
|
|
41585
41652
|
}
|