roosterjs 9.62.0 → 9.63.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/dist/rooster-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +27 -2
- package/dist/rooster-amd.js +172 -37
- 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-react-amd.js +55 -55
- package/dist/rooster-react-amd.js.map +1 -1
- package/dist/rooster-react.js +53 -53
- package/dist/rooster-react.js.map +1 -1
- package/dist/rooster.d.ts +27 -2
- package/dist/rooster.js +172 -37
- package/dist/rooster.js.map +1 -1
- package/package.json +7 -7
package/dist/rooster-amd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 9.
|
|
1
|
+
// Type definitions for roosterjs (Version 9.63.0)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -3930,7 +3930,12 @@ export type ExperimentalFeature = GraduatedExperimentalFeature
|
|
|
3930
3930
|
/**
|
|
3931
3931
|
* Handle the drop event for content that is dropped from the same editor instance.
|
|
3932
3932
|
*/
|
|
3933
|
-
| 'HandleDropInternalContent'
|
|
3933
|
+
| 'HandleDropInternalContent'
|
|
3934
|
+
/**
|
|
3935
|
+
* Apply Word-like spacing to list items and their direct element children,
|
|
3936
|
+
* and default images without an explicit vertical alignment to middle.
|
|
3937
|
+
*/
|
|
3938
|
+
| 'WordLikeStyles';
|
|
3934
3939
|
|
|
3935
3940
|
/**
|
|
3936
3941
|
* Predefined experiment features (Graduated, only keep them for backward compatibility)
|
|
@@ -9295,6 +9300,13 @@ export function setListStartNumber(editor: IEditor, value: number): void;
|
|
|
9295
9300
|
*/
|
|
9296
9301
|
export function setIndentation(editor: IEditor, indentation: 'indent' | 'outdent', length?: number): void;
|
|
9297
9302
|
|
|
9303
|
+
/**
|
|
9304
|
+
* Insert a horizontal line into editor at current selection, replacing selected content
|
|
9305
|
+
* @param editor The editor instance
|
|
9306
|
+
* @param format Optional divider format. Defaults to a thin solid line with 98% width
|
|
9307
|
+
*/
|
|
9308
|
+
export function insertHorizontalLine(editor: IEditor, format?: ContentModelDividerFormat): void;
|
|
9309
|
+
|
|
9298
9310
|
/**
|
|
9299
9311
|
* Set text alignment of selected paragraphs
|
|
9300
9312
|
* @param editor The editor to set alignment
|
|
@@ -9349,6 +9361,14 @@ export function setImageBorder(editor: IEditor, border: Border | null, borderRad
|
|
|
9349
9361
|
*/
|
|
9350
9362
|
export function setImageBoxShadow(editor: IEditor, boxShadow: string, margin?: string | null): void;
|
|
9351
9363
|
|
|
9364
|
+
/**
|
|
9365
|
+
* Set the width and height of all selected images.
|
|
9366
|
+
* @param editor The editor instance
|
|
9367
|
+
* @param width The image width as a CSS value (e.g. "200px" or "50%"). An empty string clears the explicit width.
|
|
9368
|
+
* @param height The image height as a CSS value (e.g. "100px" or "auto"). An empty string clears the explicit height.
|
|
9369
|
+
*/
|
|
9370
|
+
export function setImageSize(editor: IEditor, width: string, height: string): void;
|
|
9371
|
+
|
|
9352
9372
|
/**
|
|
9353
9373
|
* Change the selected image src
|
|
9354
9374
|
* @param editor The editor instance
|
|
@@ -9579,6 +9599,11 @@ export function findListItemsInSameThread(group: ReadonlyContentModelBlockGroup,
|
|
|
9579
9599
|
*/
|
|
9580
9600
|
export function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
|
|
9581
9601
|
|
|
9602
|
+
/**
|
|
9603
|
+
* Insert a horizontal line into the model at current selection
|
|
9604
|
+
*/
|
|
9605
|
+
export function insertHorizontalLineIntoModel(model: ReadonlyContentModelDocument, context: FormatContentModelContext, format?: ContentModelDividerFormat): boolean;
|
|
9606
|
+
|
|
9582
9607
|
/**
|
|
9583
9608
|
* Determine text direction from the first strong directional character
|
|
9584
9609
|
* @param text Text to scan
|
package/dist/rooster-amd.js
CHANGED
|
@@ -2549,8 +2549,8 @@ exports["default"] = getDarkColor;
|
|
|
2549
2549
|
"use strict";
|
|
2550
2550
|
|
|
2551
2551
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2552
|
-
exports.
|
|
2553
|
-
exports.adjustWordSelection = exports.queryContentModelBlocks = exports.getListAnnounceData = exports.getPromoteLink = exports.promoteLink = exports.matchLink = exports.getTextDirection = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatInsertPointWithContentModel = exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = void 0;
|
|
2552
|
+
exports.formatTableWithContentModel = exports.createEditorContextForEntity = exports.clearSelectedCells = exports.insertTableColumn = exports.insertTableRow = exports.insertEntity = exports.toggleCode = exports.setParagraphMargin = exports.adjustImageSelection = exports.setImageAltText = exports.adjustLinkSelection = exports.removeLink = exports.insertLink = exports.clearFormat = exports.getFormatState = exports.changeImage = exports.setImageSize = exports.setImageBoxShadow = exports.setImageBorder = exports.setSpacing = exports.toggleBlockQuote = exports.setHeadingLevel = exports.setDirection = exports.setAlignment = exports.insertHorizontalLine = exports.setIndentation = exports.setListStartNumber = exports.setListStyle = exports.insertImage = exports.splitTextSegment = exports.changeCapitalization = exports.applySegmentFormat = exports.changeFontSize = exports.setTextColor = exports.setFontSize = exports.setFontName = exports.setBackgroundColor = exports.toggleSuperscript = exports.toggleSubscript = exports.toggleStrikethrough = exports.toggleUnderline = exports.toggleItalic = exports.toggleBold = exports.toggleNumbering = exports.toggleBullet = exports.applyTableBorderFormat = exports.editTable = exports.setTableCellShade = exports.formatTable = exports.insertTable = void 0;
|
|
2553
|
+
exports.adjustWordSelection = exports.queryContentModelBlocks = exports.getListAnnounceData = exports.getPromoteLink = exports.promoteLink = exports.matchLink = exports.getTextDirection = exports.insertHorizontalLineIntoModel = exports.setModelIndentation = exports.findListItemsInSameThread = exports.setModelListStartNumber = exports.setModelListStyle = exports.setListType = exports.formatInsertPointWithContentModel = exports.formatTextSegmentBeforeSelectionMarker = exports.formatSegmentWithContentModel = exports.formatParagraphWithContentModel = exports.formatImageWithContentModel = void 0;
|
|
2554
2554
|
var insertTable_1 = __webpack_require__(/*! ./publicApi/table/insertTable */ "./packages/roosterjs-content-model-api/lib/publicApi/table/insertTable.ts");
|
|
2555
2555
|
Object.defineProperty(exports, "insertTable", ({ enumerable: true, get: function () { return insertTable_1.insertTable; } }));
|
|
2556
2556
|
var formatTable_1 = __webpack_require__(/*! ./publicApi/table/formatTable */ "./packages/roosterjs-content-model-api/lib/publicApi/table/formatTable.ts");
|
|
@@ -2601,6 +2601,8 @@ var setListStartNumber_1 = __webpack_require__(/*! ./publicApi/list/setListStart
|
|
|
2601
2601
|
Object.defineProperty(exports, "setListStartNumber", ({ enumerable: true, get: function () { return setListStartNumber_1.setListStartNumber; } }));
|
|
2602
2602
|
var setIndentation_1 = __webpack_require__(/*! ./publicApi/block/setIndentation */ "./packages/roosterjs-content-model-api/lib/publicApi/block/setIndentation.ts");
|
|
2603
2603
|
Object.defineProperty(exports, "setIndentation", ({ enumerable: true, get: function () { return setIndentation_1.setIndentation; } }));
|
|
2604
|
+
var insertHorizontalLine_1 = __webpack_require__(/*! ./publicApi/block/insertHorizontalLine */ "./packages/roosterjs-content-model-api/lib/publicApi/block/insertHorizontalLine.ts");
|
|
2605
|
+
Object.defineProperty(exports, "insertHorizontalLine", ({ enumerable: true, get: function () { return insertHorizontalLine_1.insertHorizontalLine; } }));
|
|
2604
2606
|
var setAlignment_1 = __webpack_require__(/*! ./publicApi/block/setAlignment */ "./packages/roosterjs-content-model-api/lib/publicApi/block/setAlignment.ts");
|
|
2605
2607
|
Object.defineProperty(exports, "setAlignment", ({ enumerable: true, get: function () { return setAlignment_1.setAlignment; } }));
|
|
2606
2608
|
var setDirection_1 = __webpack_require__(/*! ./publicApi/block/setDirection */ "./packages/roosterjs-content-model-api/lib/publicApi/block/setDirection.ts");
|
|
@@ -2615,6 +2617,8 @@ var setImageBorder_1 = __webpack_require__(/*! ./publicApi/image/setImageBorder
|
|
|
2615
2617
|
Object.defineProperty(exports, "setImageBorder", ({ enumerable: true, get: function () { return setImageBorder_1.setImageBorder; } }));
|
|
2616
2618
|
var setImageBoxShadow_1 = __webpack_require__(/*! ./publicApi/image/setImageBoxShadow */ "./packages/roosterjs-content-model-api/lib/publicApi/image/setImageBoxShadow.ts");
|
|
2617
2619
|
Object.defineProperty(exports, "setImageBoxShadow", ({ enumerable: true, get: function () { return setImageBoxShadow_1.setImageBoxShadow; } }));
|
|
2620
|
+
var setImageSize_1 = __webpack_require__(/*! ./publicApi/image/setImageSize */ "./packages/roosterjs-content-model-api/lib/publicApi/image/setImageSize.ts");
|
|
2621
|
+
Object.defineProperty(exports, "setImageSize", ({ enumerable: true, get: function () { return setImageSize_1.setImageSize; } }));
|
|
2618
2622
|
var changeImage_1 = __webpack_require__(/*! ./publicApi/image/changeImage */ "./packages/roosterjs-content-model-api/lib/publicApi/image/changeImage.ts");
|
|
2619
2623
|
Object.defineProperty(exports, "changeImage", ({ enumerable: true, get: function () { return changeImage_1.changeImage; } }));
|
|
2620
2624
|
var getFormatState_1 = __webpack_require__(/*! ./publicApi/format/getFormatState */ "./packages/roosterjs-content-model-api/lib/publicApi/format/getFormatState.ts");
|
|
@@ -2667,6 +2671,8 @@ var findListItemsInSameThread_1 = __webpack_require__(/*! ./modelApi/list/findLi
|
|
|
2667
2671
|
Object.defineProperty(exports, "findListItemsInSameThread", ({ enumerable: true, get: function () { return findListItemsInSameThread_1.findListItemsInSameThread; } }));
|
|
2668
2672
|
var setModelIndentation_1 = __webpack_require__(/*! ./modelApi/block/setModelIndentation */ "./packages/roosterjs-content-model-api/lib/modelApi/block/setModelIndentation.ts");
|
|
2669
2673
|
Object.defineProperty(exports, "setModelIndentation", ({ enumerable: true, get: function () { return setModelIndentation_1.setModelIndentation; } }));
|
|
2674
|
+
var insertHorizontalLineIntoModel_1 = __webpack_require__(/*! ./modelApi/block/insertHorizontalLineIntoModel */ "./packages/roosterjs-content-model-api/lib/modelApi/block/insertHorizontalLineIntoModel.ts");
|
|
2675
|
+
Object.defineProperty(exports, "insertHorizontalLineIntoModel", ({ enumerable: true, get: function () { return insertHorizontalLineIntoModel_1.insertHorizontalLineIntoModel; } }));
|
|
2670
2676
|
var setModelDirection_1 = __webpack_require__(/*! ./modelApi/block/setModelDirection */ "./packages/roosterjs-content-model-api/lib/modelApi/block/setModelDirection.ts");
|
|
2671
2677
|
Object.defineProperty(exports, "getTextDirection", ({ enumerable: true, get: function () { return setModelDirection_1.getTextDirection; } }));
|
|
2672
2678
|
var matchLink_1 = __webpack_require__(/*! ./modelApi/link/matchLink */ "./packages/roosterjs-content-model-api/lib/modelApi/link/matchLink.ts");
|
|
@@ -2682,6 +2688,39 @@ var adjustWordSelection_1 = __webpack_require__(/*! ./modelApi/selection/adjustW
|
|
|
2682
2688
|
Object.defineProperty(exports, "adjustWordSelection", ({ enumerable: true, get: function () { return adjustWordSelection_1.adjustWordSelection; } }));
|
|
2683
2689
|
|
|
2684
2690
|
|
|
2691
|
+
/***/ },
|
|
2692
|
+
|
|
2693
|
+
/***/ "./packages/roosterjs-content-model-api/lib/modelApi/block/insertHorizontalLineIntoModel.ts"
|
|
2694
|
+
/*!**************************************************************************************************!*\
|
|
2695
|
+
!*** ./packages/roosterjs-content-model-api/lib/modelApi/block/insertHorizontalLineIntoModel.ts ***!
|
|
2696
|
+
\**************************************************************************************************/
|
|
2697
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
2698
|
+
|
|
2699
|
+
"use strict";
|
|
2700
|
+
|
|
2701
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2702
|
+
exports.insertHorizontalLineIntoModel = void 0;
|
|
2703
|
+
var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
|
|
2704
|
+
/**
|
|
2705
|
+
* Insert a horizontal line into the model at current selection
|
|
2706
|
+
*/
|
|
2707
|
+
function insertHorizontalLineIntoModel(model, context, format) {
|
|
2708
|
+
if (format === void 0) { format = {
|
|
2709
|
+
borderTop: '1px solid',
|
|
2710
|
+
borderRight: '1px solid',
|
|
2711
|
+
borderBottom: '1px solid',
|
|
2712
|
+
borderLeft: '1px solid',
|
|
2713
|
+
width: '98%',
|
|
2714
|
+
display: 'table',
|
|
2715
|
+
height: '1px',
|
|
2716
|
+
}; }
|
|
2717
|
+
var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
|
|
2718
|
+
(0, roosterjs_content_model_dom_1.addBlock)(doc, (0, roosterjs_content_model_dom_1.createDivider)('hr', format));
|
|
2719
|
+
return !!(0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context);
|
|
2720
|
+
}
|
|
2721
|
+
exports.insertHorizontalLineIntoModel = insertHorizontalLineIntoModel;
|
|
2722
|
+
|
|
2723
|
+
|
|
2685
2724
|
/***/ },
|
|
2686
2725
|
|
|
2687
2726
|
/***/ "./packages/roosterjs-content-model-api/lib/modelApi/block/setModelAlignment.ts"
|
|
@@ -5739,6 +5778,33 @@ function insertTableContent(table, contentRows, colNumber, customCellFormat) {
|
|
|
5739
5778
|
exports.insertTableContent = insertTableContent;
|
|
5740
5779
|
|
|
5741
5780
|
|
|
5781
|
+
/***/ },
|
|
5782
|
+
|
|
5783
|
+
/***/ "./packages/roosterjs-content-model-api/lib/publicApi/block/insertHorizontalLine.ts"
|
|
5784
|
+
/*!******************************************************************************************!*\
|
|
5785
|
+
!*** ./packages/roosterjs-content-model-api/lib/publicApi/block/insertHorizontalLine.ts ***!
|
|
5786
|
+
\******************************************************************************************/
|
|
5787
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
5788
|
+
|
|
5789
|
+
"use strict";
|
|
5790
|
+
|
|
5791
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5792
|
+
exports.insertHorizontalLine = void 0;
|
|
5793
|
+
var insertHorizontalLineIntoModel_1 = __webpack_require__(/*! ../../modelApi/block/insertHorizontalLineIntoModel */ "./packages/roosterjs-content-model-api/lib/modelApi/block/insertHorizontalLineIntoModel.ts");
|
|
5794
|
+
/**
|
|
5795
|
+
* Insert a horizontal line into editor at current selection, replacing selected content
|
|
5796
|
+
* @param editor The editor instance
|
|
5797
|
+
* @param format Optional divider format. Defaults to a thin solid line with 98% width
|
|
5798
|
+
*/
|
|
5799
|
+
function insertHorizontalLine(editor, format) {
|
|
5800
|
+
editor.focus();
|
|
5801
|
+
editor.formatContentModel(function (model, context) { return (0, insertHorizontalLineIntoModel_1.insertHorizontalLineIntoModel)(model, context, format); }, {
|
|
5802
|
+
apiName: 'insertHorizontalLine',
|
|
5803
|
+
});
|
|
5804
|
+
}
|
|
5805
|
+
exports.insertHorizontalLine = insertHorizontalLine;
|
|
5806
|
+
|
|
5807
|
+
|
|
5742
5808
|
/***/ },
|
|
5743
5809
|
|
|
5744
5810
|
/***/ "./packages/roosterjs-content-model-api/lib/publicApi/block/setAlignment.ts"
|
|
@@ -6410,6 +6476,35 @@ function setImageBoxShadow(editor, boxShadow, margin) {
|
|
|
6410
6476
|
exports.setImageBoxShadow = setImageBoxShadow;
|
|
6411
6477
|
|
|
6412
6478
|
|
|
6479
|
+
/***/ },
|
|
6480
|
+
|
|
6481
|
+
/***/ "./packages/roosterjs-content-model-api/lib/publicApi/image/setImageSize.ts"
|
|
6482
|
+
/*!**********************************************************************************!*\
|
|
6483
|
+
!*** ./packages/roosterjs-content-model-api/lib/publicApi/image/setImageSize.ts ***!
|
|
6484
|
+
\**********************************************************************************/
|
|
6485
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
6486
|
+
|
|
6487
|
+
"use strict";
|
|
6488
|
+
|
|
6489
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6490
|
+
exports.setImageSize = void 0;
|
|
6491
|
+
var formatImageWithContentModel_1 = __webpack_require__(/*! ../utils/formatImageWithContentModel */ "./packages/roosterjs-content-model-api/lib/publicApi/utils/formatImageWithContentModel.ts");
|
|
6492
|
+
/**
|
|
6493
|
+
* Set the width and height of all selected images.
|
|
6494
|
+
* @param editor The editor instance
|
|
6495
|
+
* @param width The image width as a CSS value (e.g. "200px" or "50%"). An empty string clears the explicit width.
|
|
6496
|
+
* @param height The image height as a CSS value (e.g. "100px" or "auto"). An empty string clears the explicit height.
|
|
6497
|
+
*/
|
|
6498
|
+
function setImageSize(editor, width, height) {
|
|
6499
|
+
editor.focus();
|
|
6500
|
+
(0, formatImageWithContentModel_1.formatImageWithContentModel)(editor, 'setImageSize', function (image) {
|
|
6501
|
+
image.format.width = width;
|
|
6502
|
+
image.format.height = height;
|
|
6503
|
+
});
|
|
6504
|
+
}
|
|
6505
|
+
exports.setImageSize = setImageSize;
|
|
6506
|
+
|
|
6507
|
+
|
|
6413
6508
|
/***/ },
|
|
6414
6509
|
|
|
6415
6510
|
/***/ "./packages/roosterjs-content-model-api/lib/publicApi/link/adjustLinkSelection.ts"
|
|
@@ -18930,6 +19025,7 @@ exports.linkProcessor = linkProcessor;
|
|
|
18930
19025
|
|
|
18931
19026
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18932
19027
|
exports.listItemProcessor = void 0;
|
|
19028
|
+
var applyWordLikeListStyles_1 = __webpack_require__(/*! ../../modelApi/list/applyWordLikeListStyles */ "./packages/roosterjs-content-model-dom/lib/modelApi/list/applyWordLikeListStyles.ts");
|
|
18933
19029
|
var createListItem_1 = __webpack_require__(/*! ../../modelApi/creators/createListItem */ "./packages/roosterjs-content-model-dom/lib/modelApi/creators/createListItem.ts");
|
|
18934
19030
|
var createListLevel_1 = __webpack_require__(/*! ../../modelApi/creators/createListLevel */ "./packages/roosterjs-content-model-dom/lib/modelApi/creators/createListLevel.ts");
|
|
18935
19031
|
var parseFormat_1 = __webpack_require__(/*! ../utils/parseFormat */ "./packages/roosterjs-content-model-dom/lib/domToModel/utils/parseFormat.ts");
|
|
@@ -18938,12 +19034,13 @@ var stackFormat_1 = __webpack_require__(/*! ../utils/stackFormat */ "./packages/
|
|
|
18938
19034
|
* @internal
|
|
18939
19035
|
*/
|
|
18940
19036
|
var listItemProcessor = function (group, element, context) {
|
|
18941
|
-
var _a;
|
|
19037
|
+
var _a, _b, _c;
|
|
18942
19038
|
var listFormat = context.listFormat;
|
|
19039
|
+
var wordLikeStyles = ((_b = (_a = context.experimentalFeatures) === null || _a === void 0 ? void 0 : _a.indexOf('WordLikeStyles')) !== null && _b !== void 0 ? _b : -1) >= 0;
|
|
18943
19040
|
var originalListParent = listFormat.listParent;
|
|
18944
19041
|
var shouldPopListLevel = false;
|
|
18945
19042
|
try {
|
|
18946
|
-
listFormat.listParent = (
|
|
19043
|
+
listFormat.listParent = (_c = listFormat.listParent) !== null && _c !== void 0 ? _c : group;
|
|
18947
19044
|
var listParent_1 = listFormat.listParent;
|
|
18948
19045
|
if (listFormat.levels.length == 0) {
|
|
18949
19046
|
listFormat.levels.push((0, createListLevel_1.createListLevel)(listFormat.potentialListType || 'UL', context.blockFormat));
|
|
@@ -18951,12 +19048,16 @@ var listItemProcessor = function (group, element, context) {
|
|
|
18951
19048
|
}
|
|
18952
19049
|
(0, stackFormat_1.stackFormat)(context, {
|
|
18953
19050
|
segment: 'shallowCloneForBlock',
|
|
19051
|
+
paragraph: wordLikeStyles ? 'shallowClone' : undefined,
|
|
18954
19052
|
}, function () {
|
|
18955
19053
|
(0, parseFormat_1.parseFormat)(element, context.formatParsers.segmentOnBlock, context.segmentFormat, context);
|
|
18956
19054
|
var listItem = (0, createListItem_1.createListItem)(listFormat.levels, context.segmentFormat);
|
|
18957
19055
|
(0, parseFormat_1.parseFormat)(element, context.formatParsers.listItemElement, listItem.format, context);
|
|
18958
19056
|
listParent_1.blocks.push(listItem);
|
|
18959
19057
|
(0, parseFormat_1.parseFormat)(element, context.formatParsers.listItemThread, listItem.levels[listItem.levels.length - 1].format, context);
|
|
19058
|
+
if (wordLikeStyles && listItem.format.direction) {
|
|
19059
|
+
context.blockFormat.direction = listItem.format.direction;
|
|
19060
|
+
}
|
|
18960
19061
|
context.elementProcessors.child(listItem, element, context);
|
|
18961
19062
|
var firstChild = listItem.blocks[0];
|
|
18962
19063
|
if (listItem.blocks.length == 1 &&
|
|
@@ -18965,6 +19066,9 @@ var listItemProcessor = function (group, element, context) {
|
|
|
18965
19066
|
Object.assign(listItem.format, firstChild.format);
|
|
18966
19067
|
firstChild.format = {};
|
|
18967
19068
|
}
|
|
19069
|
+
if (wordLikeStyles) {
|
|
19070
|
+
(0, applyWordLikeListStyles_1.applyWordLikeListStyles)(listItem, context.blockFormat.direction);
|
|
19071
|
+
}
|
|
18968
19072
|
});
|
|
18969
19073
|
}
|
|
18970
19074
|
finally {
|
|
@@ -21951,11 +22055,12 @@ var LTR = {
|
|
|
21951
22055
|
exports.marginFormatHandler = {
|
|
21952
22056
|
parse: function (format, element, _, defaultStyle) {
|
|
21953
22057
|
MarginKeys.forEach(function (key) {
|
|
21954
|
-
var _a, _b;
|
|
22058
|
+
var _a, _b, _c;
|
|
21955
22059
|
var alternativeKey = DefaultMarginKey[(_a = format.direction) !== null && _a !== void 0 ? _a : 'ltr'][key];
|
|
21956
22060
|
var value = element.style[key] ||
|
|
22061
|
+
(alternativeKey ? (_b = element.style[alternativeKey]) === null || _b === void 0 ? void 0 : _b.toString() : '') ||
|
|
21957
22062
|
defaultStyle[key] ||
|
|
21958
|
-
(alternativeKey ? (
|
|
22063
|
+
(alternativeKey ? (_c = defaultStyle[alternativeKey]) === null || _c === void 0 ? void 0 : _c.toString() : '');
|
|
21959
22064
|
if (value) {
|
|
21960
22065
|
switch (key) {
|
|
21961
22066
|
case 'marginTop':
|
|
@@ -22665,8 +22770,13 @@ exports.verticalAlignFormatHandler = {
|
|
|
22665
22770
|
break;
|
|
22666
22771
|
}
|
|
22667
22772
|
},
|
|
22668
|
-
apply: function (format, element) {
|
|
22669
|
-
|
|
22773
|
+
apply: function (format, element, context) {
|
|
22774
|
+
var _a, _b, _c;
|
|
22775
|
+
if (element.tagName == 'IMG' &&
|
|
22776
|
+
((_b = (_a = context.experimentalFeatures) === null || _a === void 0 ? void 0 : _a.indexOf('WordLikeStyles')) !== null && _b !== void 0 ? _b : -1) >= 0) {
|
|
22777
|
+
element.style.verticalAlign = (_c = format.verticalAlign) !== null && _c !== void 0 ? _c : 'middle';
|
|
22778
|
+
}
|
|
22779
|
+
else if (format.verticalAlign) {
|
|
22670
22780
|
element.style.verticalAlign = format.verticalAlign;
|
|
22671
22781
|
}
|
|
22672
22782
|
},
|
|
@@ -28513,6 +28623,44 @@ function areSameColor(color1, color2) {
|
|
|
28513
28623
|
}
|
|
28514
28624
|
|
|
28515
28625
|
|
|
28626
|
+
/***/ },
|
|
28627
|
+
|
|
28628
|
+
/***/ "./packages/roosterjs-content-model-dom/lib/modelApi/list/applyWordLikeListStyles.ts"
|
|
28629
|
+
/*!*******************************************************************************************!*\
|
|
28630
|
+
!*** ./packages/roosterjs-content-model-dom/lib/modelApi/list/applyWordLikeListStyles.ts ***!
|
|
28631
|
+
\*******************************************************************************************/
|
|
28632
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
28633
|
+
|
|
28634
|
+
"use strict";
|
|
28635
|
+
|
|
28636
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
28637
|
+
exports.applyWordLikeListStyles = void 0;
|
|
28638
|
+
var mutate_1 = __webpack_require__(/*! ../common/mutate */ "./packages/roosterjs-content-model-dom/lib/modelApi/common/mutate.ts");
|
|
28639
|
+
var setParagraphNotImplicit_1 = __webpack_require__(/*! ../block/setParagraphNotImplicit */ "./packages/roosterjs-content-model-dom/lib/modelApi/block/setParagraphNotImplicit.ts");
|
|
28640
|
+
/**
|
|
28641
|
+
* @internal
|
|
28642
|
+
* Store default Word-like list spacing in the model and retain paragraph wrappers.
|
|
28643
|
+
*/
|
|
28644
|
+
function applyWordLikeListStyles(listItem, inheritedDirection) {
|
|
28645
|
+
var _a;
|
|
28646
|
+
listItem.format.marginBottom = (_a = listItem.format.marginBottom) !== null && _a !== void 0 ? _a : '2px';
|
|
28647
|
+
listItem.blocks.forEach(function (block) {
|
|
28648
|
+
var _a, _b, _c, _d;
|
|
28649
|
+
(0, setParagraphNotImplicit_1.setParagraphNotImplicit)(block);
|
|
28650
|
+
var direction = (_d = (_b = (_a = block.format.direction) !== null && _a !== void 0 ? _a : listItem.format.direction) !== null && _b !== void 0 ? _b : (_c = listItem.levels[listItem.levels.length - 1]) === null || _c === void 0 ? void 0 : _c.format.direction) !== null && _d !== void 0 ? _d : inheritedDirection;
|
|
28651
|
+
var marginKey = direction == 'rtl' ? 'marginRight' : 'marginLeft';
|
|
28652
|
+
if (block.format[marginKey] == undefined) {
|
|
28653
|
+
var format = (0, mutate_1.mutateBlock)(block).format;
|
|
28654
|
+
format[marginKey] = '8px';
|
|
28655
|
+
if (direction == 'rtl') {
|
|
28656
|
+
format.direction = direction;
|
|
28657
|
+
}
|
|
28658
|
+
}
|
|
28659
|
+
});
|
|
28660
|
+
}
|
|
28661
|
+
exports.applyWordLikeListStyles = applyWordLikeListStyles;
|
|
28662
|
+
|
|
28663
|
+
|
|
28516
28664
|
/***/ },
|
|
28517
28665
|
|
|
28518
28666
|
/***/ "./packages/roosterjs-content-model-dom/lib/modelApi/list/getAutoListStyleType.ts"
|
|
@@ -30658,6 +30806,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
30658
30806
|
exports.handleListItem = void 0;
|
|
30659
30807
|
var applyFormat_1 = __webpack_require__(/*! ../utils/applyFormat */ "./packages/roosterjs-content-model-dom/lib/modelToDom/utils/applyFormat.ts");
|
|
30660
30808
|
var applyMetadata_1 = __webpack_require__(/*! ../utils/applyMetadata */ "./packages/roosterjs-content-model-dom/lib/modelToDom/utils/applyMetadata.ts");
|
|
30809
|
+
var applyWordLikeListStyles_1 = __webpack_require__(/*! ../../modelApi/list/applyWordLikeListStyles */ "./packages/roosterjs-content-model-dom/lib/modelApi/list/applyWordLikeListStyles.ts");
|
|
30661
30810
|
var isGenericRoleElement_1 = __webpack_require__(/*! ../../domUtils/isGenericRoleElement */ "./packages/roosterjs-content-model-dom/lib/domUtils/isGenericRoleElement.ts");
|
|
30662
30811
|
var reuseCachedElement_1 = __webpack_require__(/*! ../../domUtils/reuseCachedElement */ "./packages/roosterjs-content-model-dom/lib/domUtils/reuseCachedElement.ts");
|
|
30663
30812
|
var setParagraphNotImplicit_1 = __webpack_require__(/*! ../../modelApi/block/setParagraphNotImplicit */ "./packages/roosterjs-content-model-dom/lib/modelApi/block/setParagraphNotImplicit.ts");
|
|
@@ -30669,10 +30818,11 @@ var PresentationRoleValue = 'presentation';
|
|
|
30669
30818
|
* @internal
|
|
30670
30819
|
*/
|
|
30671
30820
|
var handleListItem = function (doc, parent, listItem, context, refNode) {
|
|
30672
|
-
var _a, _b;
|
|
30821
|
+
var _a, _b, _c, _d;
|
|
30673
30822
|
refNode = context.modelHandlers.list(doc, parent, listItem, context, refNode);
|
|
30674
30823
|
var nodeStack = context.listFormat.nodeStack;
|
|
30675
|
-
var
|
|
30824
|
+
var wordLikeStyles = ((_b = (_a = context.experimentalFeatures) === null || _a === void 0 ? void 0 : _a.indexOf('WordLikeStyles')) !== null && _b !== void 0 ? _b : -1) >= 0;
|
|
30825
|
+
var leafLevel = (_c = nodeStack === null || nodeStack === void 0 ? void 0 : nodeStack[nodeStack.length - 1]) !== null && _c !== void 0 ? _c : {};
|
|
30676
30826
|
var itemRefNode = leafLevel.refNode || null;
|
|
30677
30827
|
var listParent = leafLevel.node || parent;
|
|
30678
30828
|
var level = listItem.levels[listItem.levels.length - 1];
|
|
@@ -30700,6 +30850,9 @@ var handleListItem = function (doc, parent, listItem, context, refNode) {
|
|
|
30700
30850
|
listItem.cachedElement = li;
|
|
30701
30851
|
}
|
|
30702
30852
|
if (level) {
|
|
30853
|
+
if (wordLikeStyles) {
|
|
30854
|
+
(0, applyWordLikeListStyles_1.applyWordLikeListStyles)(listItem, context.implicitFormat.direction);
|
|
30855
|
+
}
|
|
30703
30856
|
(0, applyFormat_1.applyFormat)(li, context.formatAppliers.segment, listItem.formatHolder.format, context);
|
|
30704
30857
|
(0, applyFormat_1.applyFormat)(li, context.formatAppliers.listItemThread, level.format, context);
|
|
30705
30858
|
// Need to apply metadata after applying listItem format since the list numbers value relies on the result of list thread handling
|
|
@@ -30729,7 +30882,7 @@ var handleListItem = function (doc, parent, listItem, context, refNode) {
|
|
|
30729
30882
|
}
|
|
30730
30883
|
}
|
|
30731
30884
|
if (isNewlyCreated) {
|
|
30732
|
-
(
|
|
30885
|
+
(_d = context.onNodeCreated) === null || _d === void 0 ? void 0 : _d.call(context, listItem, li);
|
|
30733
30886
|
}
|
|
30734
30887
|
return refNode;
|
|
30735
30888
|
};
|
|
@@ -33710,9 +33863,10 @@ var createAnchor = function (doc, url, text) {
|
|
|
33710
33863
|
"use strict";
|
|
33711
33864
|
|
|
33712
33865
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
33713
|
-
exports.checkAndInsertHorizontalLine =
|
|
33866
|
+
exports.checkAndInsertHorizontalLine = void 0;
|
|
33714
33867
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
|
|
33715
33868
|
var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
|
|
33869
|
+
var roosterjs_content_model_api_1 = __webpack_require__(/*! roosterjs-content-model-api */ "./packages/roosterjs-content-model-api/lib/index.ts");
|
|
33716
33870
|
var HorizontalLineTriggerCharacters = [
|
|
33717
33871
|
'-',
|
|
33718
33872
|
'=',
|
|
@@ -33751,28 +33905,14 @@ var HorizontalLineStyles = new Map([
|
|
|
33751
33905
|
(0, tslib_1.__assign)({ borderTop: '3pt double', borderRight: '3pt none', borderBottom: '3pt double', borderLeft: '3pt none' }, commonStyles),
|
|
33752
33906
|
],
|
|
33753
33907
|
]);
|
|
33754
|
-
/**
|
|
33755
|
-
* @internal exported only for unit test
|
|
33756
|
-
*
|
|
33757
|
-
* Create a horizontal line and insert it into the model
|
|
33758
|
-
*
|
|
33759
|
-
* @param model the model to insert horizontal line into
|
|
33760
|
-
* @param context the formatting context
|
|
33761
|
-
*/
|
|
33762
|
-
function insertHorizontalLineIntoModel(model, context, triggerChar) {
|
|
33763
|
-
var hr = (0, roosterjs_content_model_dom_1.createDivider)('hr', HorizontalLineStyles.get(triggerChar));
|
|
33764
|
-
var doc = (0, roosterjs_content_model_dom_1.createContentModelDocument)();
|
|
33765
|
-
(0, roosterjs_content_model_dom_1.addBlock)(doc, hr);
|
|
33766
|
-
(0, roosterjs_content_model_dom_1.mergeModel)(model, doc, context);
|
|
33767
|
-
}
|
|
33768
|
-
exports.insertHorizontalLineIntoModel = insertHorizontalLineIntoModel;
|
|
33769
33908
|
/**
|
|
33770
33909
|
* @internal
|
|
33771
33910
|
*
|
|
33772
33911
|
* Check if the current line should be formatted as horizontal line, and insert horizontal line if needed
|
|
33773
33912
|
*
|
|
33774
|
-
* @param
|
|
33775
|
-
* @param
|
|
33913
|
+
* @param model The model to check and insert horizontal line into
|
|
33914
|
+
* @param paragraph The paragraph to check for trigger characters
|
|
33915
|
+
* @param context The formatting context
|
|
33776
33916
|
* @returns True if horizontal line is inserted, otherwise false
|
|
33777
33917
|
*/
|
|
33778
33918
|
var checkAndInsertHorizontalLine = function (model, paragraph, context) {
|
|
@@ -33792,7 +33932,7 @@ var checkAndInsertHorizontalLine = function (model, paragraph, context) {
|
|
|
33792
33932
|
var shouldFormat = allText.split('').every(function (char) { return char === triggerCharacter; });
|
|
33793
33933
|
if (shouldFormat) {
|
|
33794
33934
|
paragraph.segments = paragraph.segments.filter(function (s) { return s.segmentType != 'Text'; });
|
|
33795
|
-
insertHorizontalLineIntoModel(model, context, triggerCharacter);
|
|
33935
|
+
(0, roosterjs_content_model_api_1.insertHorizontalLineIntoModel)(model, context, HorizontalLineStyles.get(triggerCharacter));
|
|
33796
33936
|
context.canUndoByBackspace = true;
|
|
33797
33937
|
}
|
|
33798
33938
|
return shouldFormat;
|
|
@@ -39999,15 +40139,10 @@ exports.setFlipped = setFlipped;
|
|
|
39999
40139
|
/**
|
|
40000
40140
|
* @internal
|
|
40001
40141
|
*/
|
|
40002
|
-
function setWrapperSizeDimensions(wrapper, image, width, height
|
|
40142
|
+
function setWrapperSizeDimensions(wrapper, image, width, height) {
|
|
40003
40143
|
var hasBorder = image.style.borderStyle;
|
|
40004
40144
|
if (hasBorder) {
|
|
40005
40145
|
var borderWidth = image.style.borderWidth ? 2 * parseInt(image.style.borderWidth) : 2;
|
|
40006
|
-
if (isRotating) {
|
|
40007
|
-
wrapper.style.width = getPx(parseInt(image.style.width) + borderWidth);
|
|
40008
|
-
wrapper.style.height = getPx(parseInt(image.style.height) + borderWidth);
|
|
40009
|
-
return;
|
|
40010
|
-
}
|
|
40011
40146
|
wrapper.style.width = getPx(width + borderWidth);
|
|
40012
40147
|
wrapper.style.height = getPx(height + borderWidth);
|
|
40013
40148
|
return;
|
|
@@ -40259,7 +40394,7 @@ function updateWrapper(editInfo, options, image, clonedImage, wrapper, resizers,
|
|
|
40259
40394
|
wrapper.style.marginLeft = marginHorizontal + "px";
|
|
40260
40395
|
wrapper.style.marginRight = marginHorizontal + "px";
|
|
40261
40396
|
wrapper.style.transform = "rotate(" + angleRad + "rad)";
|
|
40262
|
-
(0, imageEditUtils_1.setWrapperSizeDimensions)(wrapper, image, visibleWidth, visibleHeight
|
|
40397
|
+
(0, imageEditUtils_1.setWrapperSizeDimensions)(wrapper, image, visibleWidth, visibleHeight);
|
|
40263
40398
|
wrapper.style.verticalAlign = 'text-bottom';
|
|
40264
40399
|
// Update the text-alignment to avoid the image to overflow if the parent element have align center or right
|
|
40265
40400
|
// or if the direction is Right To Left
|