roosterjs 8.26.0 → 8.27.1
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 +17 -6
- package/dist/rooster-amd.js +65 -42
- 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 +17 -6
- package/dist/rooster.js +65 -42
- package/dist/rooster.js.map +1 -1
- package/lib-mjs/createEditor.d.ts +10 -0
- package/lib-mjs/createEditor.js +29 -0
- package/lib-mjs/createEditor.js.map +1 -0
- package/lib-mjs/index.d.ts +8 -0
- package/lib-mjs/index.js +9 -0
- package/lib-mjs/index.js.map +1 -0
- package/package.json +7 -7
- package/test/createEditorTest.js +49 -52
- package/test/createEditorTest.js.map +1 -1
- package/tsconfig.child.tsbuildinfo +1 -1
package/dist/rooster.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 8.
|
|
1
|
+
// Type definitions for roosterjs (Version 8.27.1)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -2002,7 +2002,7 @@ class Editor implements IEditor {
|
|
|
2002
2002
|
* a ContentChangedEvent will be fired with change source equal to this value
|
|
2003
2003
|
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
|
|
2004
2004
|
*/
|
|
2005
|
-
addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean): void;
|
|
2005
|
+
addUndoSnapshot(callback?: (start: NodePosition, end: NodePosition) => any, changeSource?: ChangeSource | CompatibleChangeSource | string, canUndoByBackspace?: boolean, additionalData?: ContentChangedData): void;
|
|
2006
2006
|
/**
|
|
2007
2007
|
* Whether there is an available undo/redo snapshot
|
|
2008
2008
|
*/
|
|
@@ -2429,8 +2429,9 @@ function toggleBold(editor: IEditor): void;
|
|
|
2429
2429
|
* browser execCommand API
|
|
2430
2430
|
* @param editor The editor instance
|
|
2431
2431
|
* @param listStyle (Optional) the style of the bullet list. If not defined, the style will be set to disc.
|
|
2432
|
+
* @param apiNameOverride (Optional) Set a new api name, if empty the api name will be 'toggleListType'.
|
|
2432
2433
|
*/
|
|
2433
|
-
function toggleBullet(editor: IEditor, listStyle?: BulletListType | CompatibleBulletListType): void;
|
|
2434
|
+
function toggleBullet(editor: IEditor, listStyle?: BulletListType | CompatibleBulletListType, apiNameOverride?: string): void;
|
|
2434
2435
|
|
|
2435
2436
|
/**
|
|
2436
2437
|
* Toggle italic at selection
|
|
@@ -2451,8 +2452,9 @@ function toggleItalic(editor: IEditor): void;
|
|
|
2451
2452
|
* @param editor The editor instance
|
|
2452
2453
|
* @param startNumber (Optional) Start number of the list
|
|
2453
2454
|
* @param listStyle (Optional) The style of the numbering list. If not defined, the style will be set to decimal.
|
|
2455
|
+
* @param apiNameOverride (Optional) Set a new api name, if empty the api name will be 'toggleListType'.
|
|
2454
2456
|
*/
|
|
2455
|
-
function toggleNumbering(editor: IEditor, startNumber?: number, listStyle?: NumberingListType | CompatibleNumberingListType): void;
|
|
2457
|
+
function toggleNumbering(editor: IEditor, startNumber?: number, listStyle?: NumberingListType | CompatibleNumberingListType, apiNameOverride?: string): void;
|
|
2456
2458
|
|
|
2457
2459
|
/**
|
|
2458
2460
|
* Resets Ordered List Numbering back to the value of the parameter startNumber
|
|
@@ -2556,8 +2558,9 @@ function applyCellShading(editor: IEditor, color: string | ModeIndependentColor)
|
|
|
2556
2558
|
* @param includeSiblingLists Sets wether the operation should include Sibling Lists, by default true
|
|
2557
2559
|
* @param orderedStyle (Optional) the style of an ordered. If not defined, the style will be set to decimal.
|
|
2558
2560
|
* @param unorderedStyle (Optional) the style of an unordered list. If not defined, the style will be set to disc.
|
|
2561
|
+
* @param apiNameOverride (Optional) Set a new api name, if empty the api name will be 'toggleListType'.
|
|
2559
2562
|
*/
|
|
2560
|
-
function toggleListType(editor: IEditor, listType: ListType | CompatibleListType, startNumber?: number, includeSiblingLists?: boolean, orderedStyle?: NumberingListType | CompatibleNumberingListType, unorderedStyle?: BulletListType | CompatibleBulletListType): void;
|
|
2563
|
+
function toggleListType(editor: IEditor, listType: ListType | CompatibleListType, startNumber?: number, includeSiblingLists?: boolean, orderedStyle?: NumberingListType | CompatibleNumberingListType, unorderedStyle?: BulletListType | CompatibleBulletListType, apiNameOverride?: string): void;
|
|
2561
2564
|
|
|
2562
2565
|
/**
|
|
2563
2566
|
* Split selection into regions, and perform a block-wise formatting action for each region.
|
|
@@ -3121,6 +3124,10 @@ const enum NodeType {
|
|
|
3121
3124
|
* An Element node such as <p> or <div>.
|
|
3122
3125
|
*/
|
|
3123
3126
|
Element = 1,
|
|
3127
|
+
/**
|
|
3128
|
+
* An Attribute node such as name="value".
|
|
3129
|
+
*/
|
|
3130
|
+
Attribute = 2,
|
|
3124
3131
|
/**
|
|
3125
3132
|
* The actual Text of Element or Attr.
|
|
3126
3133
|
*/
|
|
@@ -6272,7 +6279,7 @@ interface IEditor {
|
|
|
6272
6279
|
/**
|
|
6273
6280
|
* ContentEditFeature interface that handles keyboard event
|
|
6274
6281
|
*/
|
|
6275
|
-
type ContentEditFeature = GenericContentEditFeature<PluginKeyboardEvent>;
|
|
6282
|
+
type ContentEditFeature = GenericContentEditFeature<PluginKeyboardEvent | CompatiblePluginKeyboardEvent>;
|
|
6276
6283
|
|
|
6277
6284
|
/**
|
|
6278
6285
|
* Generic ContentEditFeature interface
|
|
@@ -8793,6 +8800,10 @@ enum CompatibleNodeType {
|
|
|
8793
8800
|
* An Element node such as <p> or <div>.
|
|
8794
8801
|
*/
|
|
8795
8802
|
Element = 1,
|
|
8803
|
+
/**
|
|
8804
|
+
* An Attribute node such as name="value".
|
|
8805
|
+
*/
|
|
8806
|
+
Attribute = 2,
|
|
8796
8807
|
/**
|
|
8797
8808
|
* The actual Text of Element or Attr.
|
|
8798
8809
|
*/
|
package/dist/rooster.js
CHANGED
|
@@ -3108,7 +3108,7 @@ function setAlignment(editor, alignment) {
|
|
|
3108
3108
|
else {
|
|
3109
3109
|
alignText(editor, alignment);
|
|
3110
3110
|
}
|
|
3111
|
-
}, '
|
|
3111
|
+
}, 'setAlignment');
|
|
3112
3112
|
}
|
|
3113
3113
|
exports.default = setAlignment;
|
|
3114
3114
|
/**
|
|
@@ -3155,7 +3155,7 @@ function alignText(editor, alignment) {
|
|
|
3155
3155
|
editor.queryElements('[align]', 1 /* OnSelection */, function (node) { return (node.style.textAlign = align); });
|
|
3156
3156
|
}
|
|
3157
3157
|
function isList(element) {
|
|
3158
|
-
return
|
|
3158
|
+
return (0, roosterjs_editor_dom_1.findClosestElementAncestor)(element, undefined /** root */, 'LI');
|
|
3159
3159
|
}
|
|
3160
3160
|
function alignList(editor, alignment) {
|
|
3161
3161
|
(0, blockFormat_1.default)(editor, function (region, start, end) {
|
|
@@ -3586,9 +3586,10 @@ var toggleListType_1 = __webpack_require__(/*! ../utils/toggleListType */ "./pac
|
|
|
3586
3586
|
* browser execCommand API
|
|
3587
3587
|
* @param editor The editor instance
|
|
3588
3588
|
* @param listStyle (Optional) the style of the bullet list. If not defined, the style will be set to disc.
|
|
3589
|
+
* @param apiNameOverride (Optional) Set a new api name, if empty the api name will be 'toggleListType'.
|
|
3589
3590
|
*/
|
|
3590
|
-
function toggleBullet(editor, listStyle) {
|
|
3591
|
-
(0, toggleListType_1.default)(editor, 2 /* Unordered */, undefined /* startNumber */, false /* includeSiblingLists */, undefined /** orderedStyle */, listStyle);
|
|
3591
|
+
function toggleBullet(editor, listStyle, apiNameOverride) {
|
|
3592
|
+
(0, toggleListType_1.default)(editor, 2 /* Unordered */, undefined /* startNumber */, false /* includeSiblingLists */, undefined /** orderedStyle */, listStyle, apiNameOverride);
|
|
3592
3593
|
}
|
|
3593
3594
|
exports.default = toggleBullet;
|
|
3594
3595
|
|
|
@@ -3738,9 +3739,10 @@ var toggleListType_1 = __webpack_require__(/*! ../utils/toggleListType */ "./pac
|
|
|
3738
3739
|
* @param editor The editor instance
|
|
3739
3740
|
* @param startNumber (Optional) Start number of the list
|
|
3740
3741
|
* @param listStyle (Optional) The style of the numbering list. If not defined, the style will be set to decimal.
|
|
3742
|
+
* @param apiNameOverride (Optional) Set a new api name, if empty the api name will be 'toggleListType'.
|
|
3741
3743
|
*/
|
|
3742
|
-
function toggleNumbering(editor, startNumber, listStyle) {
|
|
3743
|
-
(0, toggleListType_1.default)(editor, 1 /* Ordered */, startNumber, undefined /* includeSiblingLists */, listStyle);
|
|
3744
|
+
function toggleNumbering(editor, startNumber, listStyle, apiNameOverride) {
|
|
3745
|
+
(0, toggleListType_1.default)(editor, 1 /* Ordered */, startNumber, undefined /* includeSiblingLists */, listStyle, undefined /* unorderedStyle */, apiNameOverride);
|
|
3744
3746
|
}
|
|
3745
3747
|
exports.default = toggleNumbering;
|
|
3746
3748
|
|
|
@@ -4533,8 +4535,9 @@ var roosterjs_editor_dom_1 = __webpack_require__(/*! roosterjs-editor-dom */ "./
|
|
|
4533
4535
|
* @param includeSiblingLists Sets wether the operation should include Sibling Lists, by default true
|
|
4534
4536
|
* @param orderedStyle (Optional) the style of an ordered. If not defined, the style will be set to decimal.
|
|
4535
4537
|
* @param unorderedStyle (Optional) the style of an unordered list. If not defined, the style will be set to disc.
|
|
4538
|
+
* @param apiNameOverride (Optional) Set a new api name, if empty the api name will be 'toggleListType'.
|
|
4536
4539
|
*/
|
|
4537
|
-
function toggleListType(editor, listType, startNumber, includeSiblingLists, orderedStyle, unorderedStyle) {
|
|
4540
|
+
function toggleListType(editor, listType, startNumber, includeSiblingLists, orderedStyle, unorderedStyle, apiNameOverride) {
|
|
4538
4541
|
if (includeSiblingLists === void 0) { includeSiblingLists = true; }
|
|
4539
4542
|
(0, blockFormat_1.default)(editor, function (region, start, end, chains) {
|
|
4540
4543
|
var _a;
|
|
@@ -4549,7 +4552,7 @@ function toggleListType(editor, listType, startNumber, includeSiblingLists, orde
|
|
|
4549
4552
|
}
|
|
4550
4553
|
vList.writeBack();
|
|
4551
4554
|
}
|
|
4552
|
-
}, undefined /* beforeRunCallback */, 'toggleListType');
|
|
4555
|
+
}, undefined /* beforeRunCallback */, apiNameOverride || 'toggleListType');
|
|
4553
4556
|
}
|
|
4554
4557
|
exports.default = toggleListType;
|
|
4555
4558
|
|
|
@@ -4658,7 +4661,7 @@ function addUndoSnapshotInternal(core, canUndoByBackspace) {
|
|
|
4658
4661
|
|
|
4659
4662
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4660
4663
|
exports.attachDomEvent = void 0;
|
|
4661
|
-
var
|
|
4664
|
+
var roosterjs_editor_dom_1 = __webpack_require__(/*! roosterjs-editor-dom */ "./packages/roosterjs-editor-dom/lib/index.ts");
|
|
4662
4665
|
/**
|
|
4663
4666
|
* @internal
|
|
4664
4667
|
* Attach a DOM event to the editor content DIV
|
|
@@ -4668,7 +4671,7 @@ var lib_1 = __webpack_require__(/*! roosterjs-editor-dom/lib */ "./packages/roos
|
|
|
4668
4671
|
* @param beforeDispatch Optional callback function to be invoked when the DOM event is triggered before trigger plugin event
|
|
4669
4672
|
*/
|
|
4670
4673
|
var attachDomEvent = function (core, eventMap) {
|
|
4671
|
-
var disposers = (0,
|
|
4674
|
+
var disposers = (0, roosterjs_editor_dom_1.getObjectKeys)(eventMap || {}).map(function (eventName) {
|
|
4672
4675
|
var _a = extractHandler(eventMap[eventName]), pluginEventType = _a.pluginEventType, beforeDispatch = _a.beforeDispatch;
|
|
4673
4676
|
var onEvent = function (event) {
|
|
4674
4677
|
if (beforeDispatch) {
|
|
@@ -5840,8 +5843,8 @@ function ensureUniqueId(el, idPrefix) {
|
|
|
5840
5843
|
//Ensure that there are no elements with the same ID
|
|
5841
5844
|
var element = getElement();
|
|
5842
5845
|
while (element) {
|
|
5843
|
-
element = getElement();
|
|
5844
5846
|
cont_1++;
|
|
5847
|
+
element = getElement();
|
|
5845
5848
|
}
|
|
5846
5849
|
el.id = idPrefix + cont_1;
|
|
5847
5850
|
}
|
|
@@ -7591,6 +7594,15 @@ var TypeInContainerPlugin = /** @class */ (function () {
|
|
|
7591
7594
|
TypeInContainerPlugin.prototype.dispose = function () {
|
|
7592
7595
|
this.editor = null;
|
|
7593
7596
|
};
|
|
7597
|
+
TypeInContainerPlugin.prototype.isRangeEmpty = function (range) {
|
|
7598
|
+
if (range.collapsed &&
|
|
7599
|
+
range.startContainer.nodeType === Node.ELEMENT_NODE &&
|
|
7600
|
+
(0, roosterjs_editor_dom_1.getTagOfNode)(range.startContainer) == 'DIV' &&
|
|
7601
|
+
!range.startContainer.firstChild) {
|
|
7602
|
+
return true;
|
|
7603
|
+
}
|
|
7604
|
+
return false;
|
|
7605
|
+
};
|
|
7594
7606
|
/**
|
|
7595
7607
|
* Handle events triggered from editor
|
|
7596
7608
|
* @param event PluginEvent object
|
|
@@ -7606,7 +7618,8 @@ var TypeInContainerPlugin = /** @class */ (function () {
|
|
|
7606
7618
|
// Only schedule when the range is not collapsed to catch this edge case.
|
|
7607
7619
|
var range = this.editor.getSelectionRange();
|
|
7608
7620
|
if (!range ||
|
|
7609
|
-
this.
|
|
7621
|
+
(!this.isRangeEmpty(range) &&
|
|
7622
|
+
this.editor.contains((0, roosterjs_editor_dom_1.findClosestElementAncestor)(range.startContainer, null /* root */, '[style]')))) {
|
|
7610
7623
|
return;
|
|
7611
7624
|
}
|
|
7612
7625
|
if (range.collapsed) {
|
|
@@ -8338,8 +8351,8 @@ var Editor = /** @class */ (function () {
|
|
|
8338
8351
|
* a ContentChangedEvent will be fired with change source equal to this value
|
|
8339
8352
|
* @param canUndoByBackspace True if this action can be undone when user press Backspace key (aka Auto Complete).
|
|
8340
8353
|
*/
|
|
8341
|
-
Editor.prototype.addUndoSnapshot = function (callback, changeSource, canUndoByBackspace) {
|
|
8342
|
-
this.core.api.addUndoSnapshot(this.core, callback, changeSource, canUndoByBackspace);
|
|
8354
|
+
Editor.prototype.addUndoSnapshot = function (callback, changeSource, canUndoByBackspace, additionalData) {
|
|
8355
|
+
this.core.api.addUndoSnapshot(this.core, callback, changeSource, canUndoByBackspace, additionalData);
|
|
8343
8356
|
};
|
|
8344
8357
|
/**
|
|
8345
8358
|
* Whether there is an available undo/redo snapshot
|
|
@@ -9780,24 +9793,13 @@ var SelectionBlockScoper = /** @class */ (function () {
|
|
|
9780
9793
|
* @param startFrom Where to start, can be Begin, End, SelectionStart
|
|
9781
9794
|
*/
|
|
9782
9795
|
function SelectionBlockScoper(rootNode, position, startFrom) {
|
|
9783
|
-
var _a;
|
|
9784
9796
|
this.rootNode = rootNode;
|
|
9785
9797
|
this.startFrom = startFrom;
|
|
9786
|
-
// Debugging info, will be removed later
|
|
9787
|
-
var isPosition = false;
|
|
9788
9798
|
if ((0, safeInstanceOf_1.default)(position, 'Range')) {
|
|
9789
9799
|
position = Position_1.default.getStart(position);
|
|
9790
9800
|
}
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
}
|
|
9794
|
-
try {
|
|
9795
|
-
this.position = position.normalize();
|
|
9796
|
-
this.block = (0, getBlockElementAtNode_1.default)(this.rootNode, this.position.node);
|
|
9797
|
-
}
|
|
9798
|
-
catch (e) {
|
|
9799
|
-
throw new Error(((_a = e) === null || _a === void 0 ? void 0 : _a.message) + "; isPosition: " + isPosition + "; actual type: " + typeof position + "; String name: " + (typeof (position === null || position === void 0 ? void 0 : position.toString) === 'function' ? position.toString() : 'No toString()'));
|
|
9800
|
-
}
|
|
9801
|
+
this.position = position.normalize();
|
|
9802
|
+
this.block = (0, getBlockElementAtNode_1.default)(this.rootNode, this.position.node);
|
|
9801
9803
|
}
|
|
9802
9804
|
/**
|
|
9803
9805
|
* Get the start block element
|
|
@@ -10164,7 +10166,8 @@ function adjustInsertPositionForMoveCursorOutOfALink(root, nodeToInsert, positio
|
|
|
10164
10166
|
* Adjust the position cursor out of a not contenteditable element.
|
|
10165
10167
|
*/
|
|
10166
10168
|
function adjustInsertPositionForNotEditableNode(root, nodeToInsert, position, range) {
|
|
10167
|
-
|
|
10169
|
+
var _a;
|
|
10170
|
+
if (!((_a = position.element) === null || _a === void 0 ? void 0 : _a.isContentEditable)) {
|
|
10168
10171
|
var nonEditableElement = void 0;
|
|
10169
10172
|
var lastNonEditableElement = (0, findClosestElementAncestor_1.default)(position.node, root, NOT_EDITABLE_SELECTOR);
|
|
10170
10173
|
while (lastNonEditableElement) {
|
|
@@ -15565,6 +15568,7 @@ var VTable = /** @class */ (function () {
|
|
|
15565
15568
|
*/
|
|
15566
15569
|
VTable.prototype.edit = function (operation) {
|
|
15567
15570
|
var _this = this;
|
|
15571
|
+
var _a, _b;
|
|
15568
15572
|
if (!this.table || !this.cells || this.row === undefined || this.col == undefined) {
|
|
15569
15573
|
return;
|
|
15570
15574
|
}
|
|
@@ -15659,6 +15663,9 @@ var VTable = /** @class */ (function () {
|
|
|
15659
15663
|
? this.selection.lastCell.y - this.selection.firstCell.y
|
|
15660
15664
|
: 0;
|
|
15661
15665
|
this.cells.splice(firstRow, removedRows + 1);
|
|
15666
|
+
if (this.cells.length === 0) {
|
|
15667
|
+
this.cells = null;
|
|
15668
|
+
}
|
|
15662
15669
|
break;
|
|
15663
15670
|
case 5 /* DeleteColumn */:
|
|
15664
15671
|
var deletedColumns_1 = 0;
|
|
@@ -15679,6 +15686,9 @@ var VTable = /** @class */ (function () {
|
|
|
15679
15686
|
for (var colIndex = firstColumn; colIndex <= lastColumn; colIndex++) {
|
|
15680
15687
|
_loop_5(colIndex);
|
|
15681
15688
|
}
|
|
15689
|
+
if (((_a = this.cells) === null || _a === void 0 ? void 0 : _a.length) === 0 || ((_b = this.cells) === null || _b === void 0 ? void 0 : _b.every(function (row) { return row.length === 0; }))) {
|
|
15690
|
+
this.cells = null;
|
|
15691
|
+
}
|
|
15682
15692
|
break;
|
|
15683
15693
|
case 7 /* MergeAbove */:
|
|
15684
15694
|
case 8 /* MergeBelow */:
|
|
@@ -18497,12 +18507,12 @@ __exportStar(__webpack_require__(/*! ./AutoFormat */ "./packages/roosterjs-edito
|
|
|
18497
18507
|
"use strict";
|
|
18498
18508
|
|
|
18499
18509
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18500
|
-
var
|
|
18510
|
+
var roosterjs_editor_dom_1 = __webpack_require__(/*! roosterjs-editor-dom */ "./packages/roosterjs-editor-dom/lib/index.ts");
|
|
18501
18511
|
/**
|
|
18502
18512
|
* Generate event names and getXY function based on different platforms to be compatible with desktop and mobile browsers
|
|
18503
18513
|
*/
|
|
18504
18514
|
var MOUSE_EVENT_INFO = (function () {
|
|
18505
|
-
if (
|
|
18515
|
+
if (roosterjs_editor_dom_1.Browser.isMobileOrTablet) {
|
|
18506
18516
|
return {
|
|
18507
18517
|
MOUSEDOWN: 'touchstart',
|
|
18508
18518
|
MOUSEMOVE: 'touchmove',
|
|
@@ -18679,7 +18689,7 @@ var AutoFormat = /** @class */ (function () {
|
|
|
18679
18689
|
textRange_1.deleteContents();
|
|
18680
18690
|
textRange_1.insertNode(nodeHyphen_1);
|
|
18681
18691
|
_this.editor.select(nodeHyphen_1, -1 /* End */);
|
|
18682
|
-
},
|
|
18692
|
+
}, "Format" /* Format */, true /*canUndoByBackspace*/, { formatApiName: 'autoHyphen' });
|
|
18683
18693
|
//After the substitution the last key typed needs to be cleaned
|
|
18684
18694
|
this.lastKeyTyped = '';
|
|
18685
18695
|
}
|
|
@@ -18723,7 +18733,7 @@ Object.defineProperty(exports, "AutoFormat", { enumerable: true, get: function (
|
|
|
18723
18733
|
|
|
18724
18734
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18725
18735
|
var getAllFeatures_1 = __webpack_require__(/*! ./getAllFeatures */ "./packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/getAllFeatures.ts");
|
|
18726
|
-
var
|
|
18736
|
+
var roosterjs_editor_dom_1 = __webpack_require__(/*! roosterjs-editor-dom */ "./packages/roosterjs-editor-dom/lib/index.ts");
|
|
18727
18737
|
/**
|
|
18728
18738
|
* An editor plugin to handle content edit event.
|
|
18729
18739
|
* The following cases are included:
|
|
@@ -18760,7 +18770,7 @@ var ContentEdit = /** @class */ (function () {
|
|
|
18760
18770
|
var _this = this;
|
|
18761
18771
|
var features = [];
|
|
18762
18772
|
var allFeatures = (0, getAllFeatures_1.default)();
|
|
18763
|
-
(0,
|
|
18773
|
+
(0, roosterjs_editor_dom_1.getObjectKeys)(allFeatures).forEach(function (key) {
|
|
18764
18774
|
var feature = allFeatures[key];
|
|
18765
18775
|
var hasSettingForKey = _this.settingsOverride && _this.settingsOverride[key] !== undefined;
|
|
18766
18776
|
if ((hasSettingForKey && _this.settingsOverride[key]) ||
|
|
@@ -19295,7 +19305,7 @@ var AutoBulletList = {
|
|
|
19295
19305
|
var listStyle = (0, getAutoBulletListStyle_1.default)(textBeforeCursor);
|
|
19296
19306
|
if (textRange) {
|
|
19297
19307
|
prepareAutoBullet(editor, textRange);
|
|
19298
|
-
(0, roosterjs_editor_api_1.toggleBullet)(editor, listStyle);
|
|
19308
|
+
(0, roosterjs_editor_api_1.toggleBullet)(editor, listStyle, 'autoToggleList' /** apiNameOverride */);
|
|
19299
19309
|
}
|
|
19300
19310
|
(_a = searcher.getRangeFromText(textBeforeCursor, true /*exactMatch*/)) === null || _a === void 0 ? void 0 : _a.deleteContents();
|
|
19301
19311
|
}, null /*changeSource*/, true /*canUndoByBackspace*/);
|
|
@@ -19330,11 +19340,11 @@ var AutoNumberingList = {
|
|
|
19330
19340
|
else if ((regions = editor.getSelectedRegions()) && regions.length == 1) {
|
|
19331
19341
|
var num = parseInt(textBeforeCursor);
|
|
19332
19342
|
prepareAutoBullet(editor, textRange);
|
|
19333
|
-
(0, roosterjs_editor_api_1.toggleNumbering)(editor, num, listStyle);
|
|
19343
|
+
(0, roosterjs_editor_api_1.toggleNumbering)(editor, num, listStyle, 'autoToggleList' /** apiNameOverride */);
|
|
19334
19344
|
}
|
|
19335
19345
|
else {
|
|
19336
19346
|
prepareAutoBullet(editor, textRange);
|
|
19337
|
-
(0, roosterjs_editor_api_1.toggleNumbering)(editor, undefined /* startNumber*/, listStyle);
|
|
19347
|
+
(0, roosterjs_editor_api_1.toggleNumbering)(editor, undefined /* startNumber*/, listStyle, 'autoToggleList' /** apiNameOverride */);
|
|
19338
19348
|
}
|
|
19339
19349
|
(_a = searcher.getRangeFromText(textBeforeCursor, true /*exactMatch*/)) === null || _a === void 0 ? void 0 : _a.deleteContents();
|
|
19340
19350
|
}, null /*changeSource*/, true /*canUndoByBackspace*/);
|
|
@@ -19404,8 +19414,9 @@ function cacheGetListElement(event, editor) {
|
|
|
19404
19414
|
}
|
|
19405
19415
|
function shouldTriggerList(event, editor, getListStyle) {
|
|
19406
19416
|
var searcher = editor.getContentSearcherOfCursor(event);
|
|
19407
|
-
var textBeforeCursor = searcher.getSubStringBefore(
|
|
19408
|
-
|
|
19417
|
+
var textBeforeCursor = searcher.getSubStringBefore(4);
|
|
19418
|
+
var itHasSpace = /\s/g.test(textBeforeCursor);
|
|
19419
|
+
return (!itHasSpace && !searcher.getNearestNonTextInlineElement() && getListStyle(textBeforeCursor));
|
|
19409
19420
|
}
|
|
19410
19421
|
/**
|
|
19411
19422
|
* @internal
|
|
@@ -19658,7 +19669,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19658
19669
|
exports.ShortcutFeatures = void 0;
|
|
19659
19670
|
var roosterjs_editor_dom_1 = __webpack_require__(/*! roosterjs-editor-dom */ "./packages/roosterjs-editor-dom/lib/index.ts");
|
|
19660
19671
|
var roosterjs_editor_api_1 = __webpack_require__(/*! roosterjs-editor-api */ "./packages/roosterjs-editor-api/lib/index.ts");
|
|
19661
|
-
function createCommand(winKey, macKey, action) {
|
|
19672
|
+
function createCommand(winKey, macKey, action, disabled) {
|
|
19673
|
+
if (disabled === void 0) { disabled = false; }
|
|
19674
|
+
if (disabled) {
|
|
19675
|
+
return null;
|
|
19676
|
+
}
|
|
19662
19677
|
return {
|
|
19663
19678
|
winKey: winKey,
|
|
19664
19679
|
macKey: macKey,
|
|
@@ -19671,13 +19686,13 @@ var commands = [
|
|
|
19671
19686
|
createCommand(4096 /* Ctrl */ | 85 /* U */, 8192 /* Meta */ | 85 /* U */, roosterjs_editor_api_1.toggleUnderline),
|
|
19672
19687
|
createCommand(4096 /* Ctrl */ | 32 /* SPACE */, 8192 /* Meta */ | 32 /* SPACE */, roosterjs_editor_api_1.clearFormat),
|
|
19673
19688
|
createCommand(4096 /* Ctrl */ | 90 /* Z */, 8192 /* Meta */ | 90 /* Z */, function (editor) { return editor.undo(); }),
|
|
19674
|
-
createCommand(18 /* ALT */ | 8 /* BACKSPACE */, 18 /* ALT */ | 8 /* BACKSPACE */, function (editor) { return editor.undo(); }),
|
|
19689
|
+
createCommand(18 /* ALT */ | 8 /* BACKSPACE */, 18 /* ALT */ | 8 /* BACKSPACE */, function (editor) { return editor.undo(); }, roosterjs_editor_dom_1.Browser.isMac /* Option+Backspace to be handled by browsers on Mac */),
|
|
19675
19690
|
createCommand(4096 /* Ctrl */ | 89 /* Y */, 8192 /* Meta */ | 16384 /* Shift */ | 90 /* Z */, function (editor) { return editor.redo(); }),
|
|
19676
19691
|
createCommand(4096 /* Ctrl */ | 190 /* PERIOD */, 8192 /* Meta */ | 190 /* PERIOD */, roosterjs_editor_api_1.toggleBullet),
|
|
19677
19692
|
createCommand(4096 /* Ctrl */ | 191 /* FORWARD_SLASH */, 8192 /* Meta */ | 191 /* FORWARD_SLASH */, roosterjs_editor_api_1.toggleNumbering),
|
|
19678
19693
|
createCommand(4096 /* Ctrl */ | 16384 /* Shift */ | 190 /* PERIOD */, 8192 /* Meta */ | 16384 /* Shift */ | 190 /* PERIOD */, function (editor) { return (0, roosterjs_editor_api_1.changeFontSize)(editor, 0 /* Increase */); }),
|
|
19679
19694
|
createCommand(4096 /* Ctrl */ | 16384 /* Shift */ | 188 /* COMMA */, 8192 /* Meta */ | 16384 /* Shift */ | 188 /* COMMA */, function (editor) { return (0, roosterjs_editor_api_1.changeFontSize)(editor, 1 /* Decrease */); }),
|
|
19680
|
-
];
|
|
19695
|
+
].filter(function (command) { return !!command; });
|
|
19681
19696
|
/**
|
|
19682
19697
|
* DefaultShortcut edit feature, provides shortcuts for the following features:
|
|
19683
19698
|
* Ctrl/Meta+B: toggle bold style
|
|
@@ -25825,9 +25840,13 @@ var TableEditor = /** @class */ (function () {
|
|
|
25825
25840
|
this.verticalResizer = (0, CellResizer_1.default)(td, zoomScale, this.isRTL, false /*isHorizontal*/, this.onStartCellResize, this.onFinishEditing, this.onShowHelperElement);
|
|
25826
25841
|
}
|
|
25827
25842
|
};
|
|
25843
|
+
/**
|
|
25844
|
+
* create or remove TableInserter
|
|
25845
|
+
* @param td td to attach to, set this to null to remove inserters (both horizontal and vertical)
|
|
25846
|
+
*/
|
|
25828
25847
|
TableEditor.prototype.setInserterTd = function (td, isHorizontal) {
|
|
25829
25848
|
var inserter = isHorizontal ? this.horizontalInserter : this.verticalInserter;
|
|
25830
|
-
if (inserter && inserter.node != td) {
|
|
25849
|
+
if (td === null || (inserter && inserter.node != td)) {
|
|
25831
25850
|
this.disposeTableInserter();
|
|
25832
25851
|
}
|
|
25833
25852
|
if (!this.horizontalInserter && !this.verticalInserter && td) {
|
|
@@ -27680,6 +27699,10 @@ var CompatibleNodeType;
|
|
|
27680
27699
|
* An Element node such as <p> or <div>.
|
|
27681
27700
|
*/
|
|
27682
27701
|
CompatibleNodeType[CompatibleNodeType["Element"] = 1] = "Element";
|
|
27702
|
+
/**
|
|
27703
|
+
* An Attribute node such as name="value".
|
|
27704
|
+
*/
|
|
27705
|
+
CompatibleNodeType[CompatibleNodeType["Attribute"] = 2] = "Attribute";
|
|
27683
27706
|
/**
|
|
27684
27707
|
* The actual Text of Element or Attr.
|
|
27685
27708
|
*/
|