roosterjs 9.11.0 → 9.11.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 +9 -3
- package/dist/rooster-amd.js +49 -12
- 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 +9 -3
- package/dist/rooster.js +49 -12
- package/dist/rooster.js.map +1 -1
- package/package.json +6 -6
package/dist/rooster.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 9.11.
|
|
1
|
+
// Type definitions for roosterjs (Version 9.11.2)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -9277,7 +9277,10 @@ class ImageEditPlugin implements ImageEditor, EditorPlugin {
|
|
|
9277
9277
|
private mouseDownHandler;
|
|
9278
9278
|
private onDropHandler;
|
|
9279
9279
|
private keyDownHandler;
|
|
9280
|
-
|
|
9280
|
+
/**
|
|
9281
|
+
* EXPOSED FOR TESTING PURPOSE ONLY
|
|
9282
|
+
*/
|
|
9283
|
+
protected applyFormatWithContentModel(editor: IEditor, isCropMode: boolean, shouldSelectImage: boolean, isApiOperation?: boolean): void;
|
|
9281
9284
|
private startEditing;
|
|
9282
9285
|
startRotateAndResize(editor: IEditor, image: HTMLImageElement): void;
|
|
9283
9286
|
private updateRotateHandleState;
|
|
@@ -9286,7 +9289,10 @@ class ImageEditPlugin implements ImageEditor, EditorPlugin {
|
|
|
9286
9289
|
private startCropMode;
|
|
9287
9290
|
cropImage(): void;
|
|
9288
9291
|
private editImage;
|
|
9289
|
-
|
|
9292
|
+
/**
|
|
9293
|
+
* Exported for testing purpose only
|
|
9294
|
+
*/
|
|
9295
|
+
cleanInfo(): void;
|
|
9290
9296
|
private removeImageWrapper;
|
|
9291
9297
|
flipImage(direction: 'horizontal' | 'vertical'): void;
|
|
9292
9298
|
rotateImage(angleRad: number): void;
|
package/dist/rooster.js
CHANGED
|
@@ -10397,8 +10397,8 @@ var DomIndexerImpl = /** @class */ (function () {
|
|
|
10397
10397
|
};
|
|
10398
10398
|
DomIndexerImpl.prototype.reconcileTextSelection = function (textNode, startOffset, endOffset) {
|
|
10399
10399
|
var _a;
|
|
10400
|
-
var _b;
|
|
10401
|
-
var
|
|
10400
|
+
var _b, _c;
|
|
10401
|
+
var _d = textNode.__roosterjsContentModel, paragraph = _d.paragraph, segments = _d.segments;
|
|
10402
10402
|
var first = segments[0];
|
|
10403
10403
|
var last = segments[segments.length - 1];
|
|
10404
10404
|
var selectable;
|
|
@@ -10420,6 +10420,14 @@ var DomIndexerImpl = /** @class */ (function () {
|
|
|
10420
10420
|
if (endOffset === undefined) {
|
|
10421
10421
|
var marker = (0, roosterjs_content_model_dom_1.createSelectionMarker)(first.format);
|
|
10422
10422
|
newSegments.push(marker);
|
|
10423
|
+
if (startOffset < ((_b = textNode.nodeValue) !== null && _b !== void 0 ? _b : '').length) {
|
|
10424
|
+
if (first.link) {
|
|
10425
|
+
(0, roosterjs_content_model_dom_1.addLink)(marker, first.link);
|
|
10426
|
+
}
|
|
10427
|
+
if (first.code) {
|
|
10428
|
+
(0, roosterjs_content_model_dom_1.addCode)(marker, first.code);
|
|
10429
|
+
}
|
|
10430
|
+
}
|
|
10423
10431
|
selectable = marker;
|
|
10424
10432
|
endOffset = startOffset;
|
|
10425
10433
|
}
|
|
@@ -10461,7 +10469,7 @@ var DomIndexerImpl = /** @class */ (function () {
|
|
|
10461
10469
|
var isBefore = wrapper.previousSibling == delimiter;
|
|
10462
10470
|
var isAfter = wrapper.nextSibling == delimiter;
|
|
10463
10471
|
if (index >= 0 && delimiter && (0, roosterjs_content_model_dom_1.isEntityDelimiter)(delimiter) && (isBefore || isAfter)) {
|
|
10464
|
-
var marker = (0, roosterjs_content_model_dom_1.createSelectionMarker)(((
|
|
10472
|
+
var marker = (0, roosterjs_content_model_dom_1.createSelectionMarker)(((_c = paragraph.segments[isAfter ? index + 1 : index - 1]) !== null && _c !== void 0 ? _c : first).format);
|
|
10465
10473
|
paragraph.segments.splice(isAfter ? index + 1 : index, 0, marker);
|
|
10466
10474
|
selectable = marker;
|
|
10467
10475
|
}
|
|
@@ -10879,6 +10887,7 @@ var deleteEmptyList_1 = __webpack_require__(/*! ./utils/deleteEmptyList */ "./pa
|
|
|
10879
10887
|
var pasteCopyBlockEntityParser_1 = __webpack_require__(/*! ../../override/pasteCopyBlockEntityParser */ "./packages/roosterjs-content-model-core/lib/override/pasteCopyBlockEntityParser.ts");
|
|
10880
10888
|
var paste_1 = __webpack_require__(/*! ../../command/paste/paste */ "./packages/roosterjs-content-model-core/lib/command/paste/paste.ts");
|
|
10881
10889
|
var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
|
|
10890
|
+
var TEMP_DIV_ID = 'roosterJS_copyCutTempDiv';
|
|
10882
10891
|
/**
|
|
10883
10892
|
* Copy and paste plugin for handling onCopy and onPaste event
|
|
10884
10893
|
*/
|
|
@@ -11042,6 +11051,7 @@ var CopyPastePlugin = /** @class */ (function () {
|
|
|
11042
11051
|
div.style.color = 'black';
|
|
11043
11052
|
div.childNodes.forEach(function (node) { return div.removeChild(node); });
|
|
11044
11053
|
div.style.display = '';
|
|
11054
|
+
div.id = TEMP_DIV_ID;
|
|
11045
11055
|
div.focus();
|
|
11046
11056
|
return div;
|
|
11047
11057
|
};
|
|
@@ -20978,8 +20988,6 @@ function isSegmentEmpty(segment) {
|
|
|
20978
20988
|
switch (segment.segmentType) {
|
|
20979
20989
|
case 'Text':
|
|
20980
20990
|
return !segment.text;
|
|
20981
|
-
case 'Image':
|
|
20982
|
-
return !segment.src;
|
|
20983
20991
|
default:
|
|
20984
20992
|
return false;
|
|
20985
20993
|
}
|
|
@@ -21193,6 +21201,7 @@ function normalizeParagraph(paragraph) {
|
|
|
21193
21201
|
(0, mutate_1.mutateBlock)(paragraph).segments.pop();
|
|
21194
21202
|
}
|
|
21195
21203
|
}
|
|
21204
|
+
normalizeParagraphStyle(paragraph);
|
|
21196
21205
|
}
|
|
21197
21206
|
if (!(0, isWhiteSpacePreserved_1.isWhiteSpacePreserved)(paragraph.format.whiteSpace)) {
|
|
21198
21207
|
(0, normalizeSegment_1.normalizeAllSegments)(paragraph);
|
|
@@ -21202,6 +21211,13 @@ function normalizeParagraph(paragraph) {
|
|
|
21202
21211
|
moveUpSegmentFormat(paragraph);
|
|
21203
21212
|
}
|
|
21204
21213
|
exports.normalizeParagraph = normalizeParagraph;
|
|
21214
|
+
function normalizeParagraphStyle(paragraph) {
|
|
21215
|
+
// New paragraph should not have white-space style
|
|
21216
|
+
if (paragraph.format.whiteSpace &&
|
|
21217
|
+
paragraph.segments.every(function (seg) { return seg.segmentType == 'Br' || seg.segmentType == 'SelectionMarker'; })) {
|
|
21218
|
+
delete (0, mutate_1.mutateBlock)(paragraph).format.whiteSpace;
|
|
21219
|
+
}
|
|
21220
|
+
}
|
|
21205
21221
|
function removeEmptySegments(block) {
|
|
21206
21222
|
for (var j = block.segments.length - 1; j >= 0; j--) {
|
|
21207
21223
|
if ((0, isEmpty_1.isSegmentEmpty)(block.segments[j])) {
|
|
@@ -29622,14 +29638,22 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
29622
29638
|
};
|
|
29623
29639
|
ImageEditPlugin.prototype.keyDownHandler = function (editor, event) {
|
|
29624
29640
|
if (this.isEditing) {
|
|
29625
|
-
if (event.rawEvent.key === 'Escape'
|
|
29626
|
-
|
|
29641
|
+
if (event.rawEvent.key === 'Escape' ||
|
|
29642
|
+
event.rawEvent.key === 'Delete' ||
|
|
29643
|
+
event.rawEvent.key === 'Backspace') {
|
|
29644
|
+
if (event.rawEvent.key === 'Escape') {
|
|
29645
|
+
this.removeImageWrapper();
|
|
29646
|
+
}
|
|
29647
|
+
this.cleanInfo();
|
|
29627
29648
|
}
|
|
29628
29649
|
else {
|
|
29629
29650
|
this.applyFormatWithContentModel(editor, this.isCropMode, true /** should selectImage */, false /* isApiOperation */);
|
|
29630
29651
|
}
|
|
29631
29652
|
}
|
|
29632
29653
|
};
|
|
29654
|
+
/**
|
|
29655
|
+
* EXPOSED FOR TESTING PURPOSE ONLY
|
|
29656
|
+
*/
|
|
29633
29657
|
ImageEditPlugin.prototype.applyFormatWithContentModel = function (editor, isCropMode, shouldSelectImage, isApiOperation) {
|
|
29634
29658
|
var _this = this;
|
|
29635
29659
|
var editingImageModel;
|
|
@@ -29656,6 +29680,15 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
29656
29680
|
image.isSelected = shouldSelectImage;
|
|
29657
29681
|
image.isSelectedAsImageSelection = shouldSelectImage;
|
|
29658
29682
|
delete image.dataset.isEditing;
|
|
29683
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'range' && !selection.range.collapsed) {
|
|
29684
|
+
var selectedParagraphs = (0, roosterjs_content_model_dom_1.getSelectedParagraphs)(model, true);
|
|
29685
|
+
var isImageInRange = selectedParagraphs.some(function (paragraph) {
|
|
29686
|
+
return paragraph.segments.includes(image);
|
|
29687
|
+
});
|
|
29688
|
+
if (isImageInRange) {
|
|
29689
|
+
image.isSelected = true;
|
|
29690
|
+
}
|
|
29691
|
+
}
|
|
29659
29692
|
});
|
|
29660
29693
|
if (shouldSelectImage) {
|
|
29661
29694
|
(0, normalizeImageSelection_1.normalizeImageSelection)(previousSelectedImage);
|
|
@@ -29727,6 +29760,7 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
29727
29760
|
if (this.imageEditInfo) {
|
|
29728
29761
|
this.startEditing(editor, image, ['resize', 'rotate']);
|
|
29729
29762
|
if (this.selectedImage && this.imageEditInfo && this.wrapper && this.clonedImage) {
|
|
29763
|
+
var isMobileOrTable = !!editor.getEnvironment().isMobileOrTablet;
|
|
29730
29764
|
this.dndHelpers = (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)((0, getDropAndDragHelpers_1.getDropAndDragHelpers)(this.wrapper, this.imageEditInfo, this.options, ImageEditElementClass_1.ImageEditElementClass.ResizeHandle, resizerContext_1.Resizer, function () {
|
|
29731
29765
|
if (_this.imageEditInfo &&
|
|
29732
29766
|
_this.selectedImage &&
|
|
@@ -29735,7 +29769,7 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
29735
29769
|
(0, updateWrapper_1.updateWrapper)(_this.imageEditInfo, _this.options, _this.selectedImage, _this.clonedImage, _this.wrapper, _this.resizers);
|
|
29736
29770
|
_this.wasImageResized = true;
|
|
29737
29771
|
}
|
|
29738
|
-
}, this.zoomScale)), false), (0, tslib_1.__read)((0, getDropAndDragHelpers_1.getDropAndDragHelpers)(this.wrapper, this.imageEditInfo, this.options, ImageEditElementClass_1.ImageEditElementClass.RotateHandle, rotatorContext_1.Rotator, function () {
|
|
29772
|
+
}, this.zoomScale, isMobileOrTable)), false), (0, tslib_1.__read)((0, getDropAndDragHelpers_1.getDropAndDragHelpers)(this.wrapper, this.imageEditInfo, this.options, ImageEditElementClass_1.ImageEditElementClass.RotateHandle, rotatorContext_1.Rotator, function () {
|
|
29739
29773
|
var _a;
|
|
29740
29774
|
if (_this.imageEditInfo &&
|
|
29741
29775
|
_this.selectedImage &&
|
|
@@ -29744,7 +29778,7 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
29744
29778
|
(0, updateWrapper_1.updateWrapper)(_this.imageEditInfo, _this.options, _this.selectedImage, _this.clonedImage, _this.wrapper);
|
|
29745
29779
|
_this.updateRotateHandleState(editor, _this.selectedImage, _this.wrapper, _this.rotators, (_a = _this.imageEditInfo) === null || _a === void 0 ? void 0 : _a.angleRad);
|
|
29746
29780
|
}
|
|
29747
|
-
}, this.zoomScale)), false);
|
|
29781
|
+
}, this.zoomScale, isMobileOrTable)), false);
|
|
29748
29782
|
(0, updateWrapper_1.updateWrapper)(this.imageEditInfo, this.options, this.selectedImage, this.clonedImage, this.wrapper, this.resizers);
|
|
29749
29783
|
this.updateRotateHandleState(editor, this.selectedImage, this.wrapper, this.rotators, (_a = this.imageEditInfo) === null || _a === void 0 ? void 0 : _a.angleRad);
|
|
29750
29784
|
}
|
|
@@ -29784,7 +29818,7 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
29784
29818
|
(0, updateWrapper_1.updateWrapper)(_this.imageEditInfo, _this.options, _this.selectedImage, _this.clonedImage, _this.wrapper, undefined, _this.croppers);
|
|
29785
29819
|
_this.isCropMode = true;
|
|
29786
29820
|
}
|
|
29787
|
-
}, this.zoomScale)), false);
|
|
29821
|
+
}, this.zoomScale, !!editor.getEnvironment().isMobileOrTablet)), false);
|
|
29788
29822
|
(0, updateWrapper_1.updateWrapper)(this.imageEditInfo, this.options, this.selectedImage, this.clonedImage, this.wrapper, undefined, this.croppers);
|
|
29789
29823
|
}
|
|
29790
29824
|
}
|
|
@@ -29810,6 +29844,9 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
29810
29844
|
(0, updateWrapper_1.updateWrapper)(this.imageEditInfo, this.options, this.selectedImage, this.clonedImage, this.wrapper);
|
|
29811
29845
|
this.applyFormatWithContentModel(editor, false /* isCrop */, true /* shouldSelect*/, true /* isApiOperation */);
|
|
29812
29846
|
};
|
|
29847
|
+
/**
|
|
29848
|
+
* Exported for testing purpose only
|
|
29849
|
+
*/
|
|
29813
29850
|
ImageEditPlugin.prototype.cleanInfo = function () {
|
|
29814
29851
|
var _a, _b;
|
|
29815
29852
|
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.setEditorStyle(IMAGE_EDIT_CLASS, null);
|
|
@@ -30984,7 +31021,7 @@ var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-mo
|
|
|
30984
31021
|
/**
|
|
30985
31022
|
* @internal
|
|
30986
31023
|
*/
|
|
30987
|
-
function getDropAndDragHelpers(wrapper, editInfo, options, elementClass, helper, updateWrapper, zoomScale) {
|
|
31024
|
+
function getDropAndDragHelpers(wrapper, editInfo, options, elementClass, helper, updateWrapper, zoomScale, useTouch) {
|
|
30988
31025
|
return getEditElements(wrapper, elementClass).map(function (element) {
|
|
30989
31026
|
return new DragAndDropHelper_1.DragAndDropHelper(element, {
|
|
30990
31027
|
editInfo: editInfo,
|
|
@@ -30992,7 +31029,7 @@ function getDropAndDragHelpers(wrapper, editInfo, options, elementClass, helper,
|
|
|
30992
31029
|
elementClass: elementClass,
|
|
30993
31030
|
x: element.dataset.x,
|
|
30994
31031
|
y: element.dataset.y,
|
|
30995
|
-
}, updateWrapper, helper, zoomScale);
|
|
31032
|
+
}, updateWrapper, helper, zoomScale, useTouch);
|
|
30996
31033
|
});
|
|
30997
31034
|
}
|
|
30998
31035
|
exports.getDropAndDragHelpers = getDropAndDragHelpers;
|