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