roosterjs 8.35.0 → 8.35.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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 8.35.0)
1
+ // Type definitions for roosterjs (Version 8.35.2)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
package/dist/rooster.js CHANGED
@@ -19871,6 +19871,7 @@ var AutoFormat = /** @class */ (function () {
19871
19871
  */
19872
19872
  AutoFormat.prototype.dispose = function () {
19873
19873
  this.editor = null;
19874
+ this.lastKeyTyped = null;
19874
19875
  };
19875
19876
  /**
19876
19877
  * Handle events triggered from editor
@@ -19888,7 +19889,7 @@ var AutoFormat = /** @class */ (function () {
19888
19889
  }
19889
19890
  if (event.eventType === 0 /* KeyDown */) {
19890
19891
  var keyTyped = event.rawEvent.key;
19891
- if (keyTyped.length > 1) {
19892
+ if (keyTyped && keyTyped.length > 1) {
19892
19893
  this.lastKeyTyped = '';
19893
19894
  }
19894
19895
  if (this.lastKeyTyped === '-' &&
@@ -19917,7 +19918,7 @@ var AutoFormat = /** @class */ (function () {
19917
19918
  }
19918
19919
  }, "Format" /* Format */, true /*canUndoByBackspace*/, { formatApiName: 'autoHyphen' });
19919
19920
  //After the substitution the last key typed needs to be cleaned
19920
- this.lastKeyTyped = '';
19921
+ this.lastKeyTyped = null;
19921
19922
  }
19922
19923
  else {
19923
19924
  this.lastKeyTyped = keyTyped;
@@ -20578,7 +20579,7 @@ var AutoNumberingList = {
20578
20579
  var number = isFirstItemOfAList(textBeforeCursor)
20579
20580
  ? 1
20580
20581
  : parseInt(textBeforeCursor);
20581
- var isLi = getPreviousList(editor, textRange);
20582
+ var isLi = getPreviousListItem(editor, textRange);
20582
20583
  var listStyle = (0, getAutoNumberingListStyle_1.default)(textBeforeCursor);
20583
20584
  prepareAutoBullet(editor, textRange);
20584
20585
  (0, roosterjs_editor_api_1.toggleNumbering)(editor, isLi && number !== 1 ? undefined : number /** startNumber */, listStyle, 'autoToggleList' /** apiNameOverride */);
@@ -20587,7 +20588,7 @@ var AutoNumberingList = {
20587
20588
  }, null /*changeSource*/, true /*canUndoByBackspace*/);
20588
20589
  },
20589
20590
  };
20590
- var getPreviousList = function (editor, textRange) {
20591
+ var getPreviousListItem = function (editor, textRange) {
20591
20592
  var _a;
20592
20593
  var previousNode = (_a = editor
20593
20594
  .getBodyTraverser(textRange === null || textRange === void 0 ? void 0 : textRange.startContainer)
@@ -20596,10 +20597,12 @@ var getPreviousList = function (editor, textRange) {
20596
20597
  };
20597
20598
  var getPreviousListType = function (editor, textRange, listType) {
20598
20599
  var type = listType === 1 /* Ordered */ ? 'orderedStyleType' : 'unorderedStyleType';
20599
- var previousNode = getPreviousList(editor, textRange);
20600
- return previousNode && (0, roosterjs_editor_dom_1.getTagOfNode)(previousNode) === 'LI'
20601
- ? (0, roosterjs_editor_dom_1.getMetadata)(previousNode.parentElement, ListStyleDefinitionMetadata)[type]
20600
+ var listItem = getPreviousListItem(editor, textRange);
20601
+ var list = listItem
20602
+ ? (0, roosterjs_editor_dom_1.findClosestElementAncestor)(listItem, undefined /** root*/, listType === 1 /* Ordered */ ? 'ol' : 'ul')
20602
20603
  : null;
20604
+ var metadata = list ? (0, roosterjs_editor_dom_1.getMetadata)(list, ListStyleDefinitionMetadata) : null;
20605
+ return metadata ? metadata[type] : null;
20603
20606
  };
20604
20607
  var isFirstItemOfAList = function (item) {
20605
20608
  var number = parseInt(item);