roosterjs 9.50.1 → 9.51.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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for roosterjs (Version 9.50.1)
1
+ // Type definitions for roosterjs (Version 9.51.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -2976,6 +2976,7 @@ interface EditorContext {
2976
2976
  */
2977
2977
  allowCacheElement?: boolean;
2978
2978
  /**
2979
+ * @deprecated This is now always be treated as true
2979
2980
  * Whether to allow caching list item elements separately.
2980
2981
  */
2981
2982
  allowCacheListItem?: boolean;
@@ -3058,6 +3059,11 @@ interface DomToModelListFormat {
3058
3059
  * Current list type stack
3059
3060
  */
3060
3061
  levels: ContentModelListLevel[];
3062
+ /**
3063
+ * This is used for handling an abnormal case where list items are not inside a ul or ol tag
3064
+ * It is not common and against the HTML specification, but we need to handle it for robustness
3065
+ */
3066
+ potentialListType?: 'OL' | 'UL';
3061
3067
  }
3062
3068
 
3063
3069
  /**
@@ -3812,11 +3818,6 @@ interface IEditor {
3812
3818
  * when create editor
3813
3819
  */
3814
3820
  type ExperimentalFeature = GraduatedExperimentalFeature
3815
- /**
3816
- * @deprecated Please use the shouldHandleEnterKey option of the EditPlugin Options
3817
- * Use Content Model handle ENTER key
3818
- */
3819
- | 'HandleEnterKey'
3820
3821
  /**
3821
3822
  * For CJK keyboard input on mobile, if the user toggles bold/italic/underline on an empty div,
3822
3823
  * the pending format will be applied on the selection marker. When typing text, the selection moves to the text node and the
@@ -3824,19 +3825,6 @@ type ExperimentalFeature = GraduatedExperimentalFeature
3824
3825
  * the original formatting of the selection marker is kept to match the pending format.
3825
3826
  */
3826
3827
  | 'KeepSelectionMarkerWhenEnteringTextNode'
3827
- /**
3828
- * Export editor content as HTML using HTMLFast option
3829
- */
3830
- | 'ExportHTMLFast'
3831
- /**
3832
- * Get cloned root element from an independent HTML document instead of current document.
3833
- * So any operation to the cloned root won't trigger network request for resources like images
3834
- */
3835
- | 'CloneIndependentRoot'
3836
- /**
3837
- * Allow caching list item elements.
3838
- */
3839
- | 'CacheList'
3840
3828
  /**
3841
3829
  * Transform the table border colors when switching from light to dark mode
3842
3830
  */
@@ -3860,7 +3848,28 @@ type GraduatedExperimentalFeature = /**
3860
3848
  * Prevent default browser behavior for copy/cut event,
3861
3849
  * and set the clipboard data with custom implementation.
3862
3850
  */
3863
- | 'CustomCopyCut';
3851
+ | 'CustomCopyCut'
3852
+ /**
3853
+ * @deprecated
3854
+ * Export editor content as HTML using HTMLFast option
3855
+ */
3856
+ | 'ExportHTMLFast'
3857
+ /**
3858
+ * @deprecated Please use the shouldHandleEnterKey option of the EditPlugin Options
3859
+ * Use Content Model handle ENTER key
3860
+ */
3861
+ | 'HandleEnterKey'
3862
+ /**
3863
+ * @deprecated
3864
+ * Get cloned root element from an independent HTML document instead of current document.
3865
+ * So any operation to the cloned root won't trigger network request for resources like images
3866
+ */
3867
+ | 'CloneIndependentRoot'
3868
+ /**
3869
+ * @deprecated
3870
+ * Allow caching list item elements.
3871
+ */
3872
+ | 'CacheList';
3864
3873
 
3865
3874
  /**
3866
3875
  * Options for editor
@@ -8745,7 +8754,7 @@ function createModelFromHtml(html: string, options?: Partial<DomToModelOptionFor
8745
8754
  /**
8746
8755
  * Export HTML content. If there are entities, this will cause EntityOperation event with option = 'replaceTemporaryContent' to get a dehydrated entity
8747
8756
  * @param editor The editor to get content from
8748
- * @param mode Specify HTML to get HTML. This is the default option
8757
+ * @param mode Specify HTML to get HTML.
8749
8758
  * @param options @optional Options for Model to DOM conversion
8750
8759
  */
8751
8760
  function exportContent(editor: IEditor, mode?: 'HTML', options?: ModelToDomOption): string;
@@ -8754,9 +8763,9 @@ function exportContent(editor: IEditor, mode?: 'HTML', options?: ModelToDomOptio
8754
8763
  * Export HTML content. If there are entities, this will cause EntityOperation event with option = 'replaceTemporaryContent' to get a dehydrated entity.
8755
8764
  * This is a fast version, it retrieve HTML content directly from editor without going through content model conversion.
8756
8765
  * @param editor The editor to get content from
8757
- * @param mode Specify HTMLFast to get HTML result.
8766
+ * @param mode Specify HTMLFast to get HTML result. This is the default option
8758
8767
  */
8759
- function exportContent(editor: IEditor, mode: 'HTMLFast'): string;
8768
+ function exportContent(editor: IEditor, mode?: 'HTMLFast'): string;
8760
8769
 
8761
8770
  /**
8762
8771
  * Export plain text content
@@ -9473,15 +9482,12 @@ class EditPlugin implements EditorPlugin {
9473
9482
  private disposer;
9474
9483
  private shouldHandleNextInputEvent;
9475
9484
  private selectionAfterDelete;
9476
- private handleNormalEnter;
9477
9485
  private options;
9478
9486
  /**
9479
9487
  * @param options An optional parameter that takes in an object of type EditOptions, which includes the following properties:
9480
9488
  * handleTabKey: A boolean or HandleTabOptions object that controls Tab key handling. When a boolean, true enables all features and false disables all. When an object, individual features can be controlled. Defaults to all enabled.
9481
9489
  */
9482
9490
  constructor(options?: EditOptions);
9483
- private createNormalEnterChecker;
9484
- private getHandleNormalEnter;
9485
9491
  /**
9486
9492
  * Get name of this plugin
9487
9493
  */
@@ -9537,6 +9543,7 @@ type EditOptions = {
9537
9543
  */
9538
9544
  handleExpandedSelectionOnDelete?: boolean;
9539
9545
  /**
9546
+ * @deprecated This is always treated as true now
9540
9547
  * Callback function to determine whether the Rooster should handle the Enter key press.
9541
9548
  * If the function returns true, the Rooster will handle the Enter key press instead of the browser.
9542
9549
  * @param editor - The editor instance.
package/dist/rooster.js CHANGED
@@ -9102,7 +9102,7 @@ var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-mo
9102
9102
  // Here I didn't add 'HTMLFast' to ExportContentMode type because it will make this a breaking change and EditorAdapter will see build time error without bumping version
9103
9103
  // Once we are confident that 'HTMLFast' is stable, we can fully switch 'HTML' to use the 'HTMLFast' approach
9104
9104
  function exportContent(editor, mode, optionsOrCallbacks) {
9105
- if (mode === void 0) { mode = 'HTML'; }
9105
+ if (mode === void 0) { mode = 'HTMLFast'; }
9106
9106
  var model;
9107
9107
  switch (mode) {
9108
9108
  case 'PlainTextFast':
@@ -9111,6 +9111,7 @@ function exportContent(editor, mode, optionsOrCallbacks) {
9111
9111
  model = editor.getContentModelCopy('clean');
9112
9112
  return (0, roosterjs_content_model_dom_1.contentModelToText)(model, undefined /*separator*/, optionsOrCallbacks);
9113
9113
  case 'HTMLFast':
9114
+ default:
9114
9115
  var clonedRoot = editor.getDOMHelper().getClonedRoot();
9115
9116
  if (editor.isDarkMode()) {
9116
9117
  (0, roosterjs_content_model_dom_1.transformColor)(clonedRoot, false /*includeSelf*/, 'darkToLight', editor.getColorManager(), {
@@ -9119,7 +9120,6 @@ function exportContent(editor, mode, optionsOrCallbacks) {
9119
9120
  }
9120
9121
  return getHTMLFromDOM(editor, clonedRoot);
9121
9122
  case 'HTML':
9122
- default:
9123
9123
  model = editor.getContentModelCopy('clean');
9124
9124
  var doc = editor.getDocument();
9125
9125
  var div = doc.createElement('div');
@@ -10130,10 +10130,10 @@ var getRootComputedStyleForContext_1 = __webpack_require__(/*! ./getRootComputed
10130
10130
  * Create a EditorContext object used by ContentModel API
10131
10131
  */
10132
10132
  var createEditorContext = function (core, saveIndex) {
10133
- var _a, _b, _c;
10133
+ var _a, _b;
10134
10134
  var lifecycle = core.lifecycle, format = core.format, darkColorHandler = core.darkColorHandler, logicalRoot = core.logicalRoot, cache = core.cache, domHelper = core.domHelper;
10135
10135
  saveIndex = saveIndex && !core.lifecycle.shadowEditFragment;
10136
- var context = (0, tslib_1.__assign)({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, allowCacheListItem: !!((_b = core.experimentalFeatures) === null || _b === void 0 ? void 0 : _b.includes('CacheList')), domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale(), experimentalFeatures: (_c = core.experimentalFeatures) !== null && _c !== void 0 ? _c : [], paragraphMap: core.cache.paragraphMap, editorViewWidth: domHelper.getClientWidth() }, (0, getRootComputedStyleForContext_1.getRootComputedStyleForContext)(logicalRoot.ownerDocument));
10136
+ var context = (0, tslib_1.__assign)({ isDarkMode: lifecycle.isDarkMode, defaultFormat: format.defaultFormat, pendingFormat: (_a = format.pendingFormat) !== null && _a !== void 0 ? _a : undefined, darkColorHandler: darkColorHandler, addDelimiterForEntity: true, allowCacheElement: true, domIndexer: saveIndex ? cache.domIndexer : undefined, zoomScale: domHelper.calculateZoomScale(), experimentalFeatures: (_b = core.experimentalFeatures) !== null && _b !== void 0 ? _b : [], paragraphMap: core.cache.paragraphMap, editorViewWidth: domHelper.getClientWidth() }, (0, getRootComputedStyleForContext_1.getRootComputedStyleForContext)(logicalRoot.ownerDocument));
10137
10137
  if (core.domHelper.isRightToLeft()) {
10138
10138
  context.isRootRtl = true;
10139
10139
  }
@@ -15954,7 +15954,6 @@ var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-mo
15954
15954
  var DOMHelperImpl = /** @class */ (function () {
15955
15955
  function DOMHelperImpl(contentDiv, options) {
15956
15956
  this.contentDiv = contentDiv;
15957
- this.options = options;
15958
15957
  }
15959
15958
  DOMHelperImpl.prototype.queryElements = function (selector) {
15960
15959
  return (0, roosterjs_content_model_dom_1.toArray)(this.contentDiv.querySelectorAll(selector));
@@ -16043,14 +16042,9 @@ var DOMHelperImpl = /** @class */ (function () {
16043
16042
  * Get a deep cloned root element
16044
16043
  */
16045
16044
  DOMHelperImpl.prototype.getClonedRoot = function () {
16046
- if (this.options.cloneIndependentRoot) {
16047
- var doc = this.contentDiv.ownerDocument.implementation.createHTMLDocument();
16048
- var clone = doc.importNode(this.contentDiv, true /*deep*/);
16049
- return clone;
16050
- }
16051
- else {
16052
- return this.contentDiv.cloneNode(true /*deep*/);
16053
- }
16045
+ var doc = this.contentDiv.ownerDocument.implementation.createHTMLDocument();
16046
+ var clone = doc.importNode(this.contentDiv, true /*deep*/);
16047
+ return clone;
16054
16048
  };
16055
16049
  /**
16056
16050
  * Get format of the container element
@@ -16188,7 +16182,7 @@ var createEditorCorePlugins_1 = __webpack_require__(/*! ../../corePlugin/createE
16188
16182
  * @param options Editor options
16189
16183
  */
16190
16184
  function createEditorCore(contentDiv, options) {
16191
- var _a, _b, _c;
16185
+ var _a, _b;
16192
16186
  var corePlugins = (0, createEditorCorePlugins_1.createEditorCorePlugins)(options, contentDiv);
16193
16187
  var domCreator = (0, domCreator_1.createDOMCreator)(options.trustedHTMLHandler);
16194
16188
  return (0, tslib_1.__assign)((0, tslib_1.__assign)({ physicalRoot: contentDiv, logicalRoot: contentDiv, api: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, coreApiMap_1.coreApiMap), options.coreApiOverride), originalApi: (0, tslib_1.__assign)({}, coreApiMap_1.coreApiMap), plugins: (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([
@@ -16204,9 +16198,7 @@ function createEditorCore(contentDiv, options) {
16204
16198
  corePlugins.lifecycle,
16205
16199
  ], false), environment: createEditorEnvironment(contentDiv, options), darkColorHandler: (0, DarkColorHandlerImpl_1.createDarkColorHandler)(contentDiv, (_b = options.getDarkColor) !== null && _b !== void 0 ? _b : getDarkColorFallback, options.knownColors, options.generateColorKey), trustedHTMLHandler: options.trustedHTMLHandler && !(0, domCreator_1.isDOMCreator)(options.trustedHTMLHandler)
16206
16200
  ? options.trustedHTMLHandler
16207
- : (0, domCreator_1.createTrustedHTMLHandler)(domCreator), domCreator: domCreator, domHelper: (0, DOMHelperImpl_1.createDOMHelper)(contentDiv, {
16208
- cloneIndependentRoot: (_c = options.experimentalFeatures) === null || _c === void 0 ? void 0 : _c.includes('CloneIndependentRoot'),
16209
- }) }, getPluginState(corePlugins)), { disposeErrorHandler: options.disposeErrorHandler, onFixUpModel: options.onFixUpModel, experimentalFeatures: options.experimentalFeatures ? (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(options.experimentalFeatures), false) : [] });
16201
+ : (0, domCreator_1.createTrustedHTMLHandler)(domCreator), domCreator: domCreator, domHelper: (0, DOMHelperImpl_1.createDOMHelper)(contentDiv) }, getPluginState(corePlugins)), { disposeErrorHandler: options.disposeErrorHandler, onFixUpModel: options.onFixUpModel, experimentalFeatures: options.experimentalFeatures ? (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(options.experimentalFeatures), false) : [] });
16210
16202
  }
16211
16203
  exports.createEditorCore = createEditorCore;
16212
16204
  function createEditorEnvironment(contentDiv, options) {
@@ -18493,6 +18485,7 @@ exports.linkProcessor = linkProcessor;
18493
18485
  Object.defineProperty(exports, "__esModule", ({ value: true }));
18494
18486
  exports.listItemProcessor = void 0;
18495
18487
  var createListItem_1 = __webpack_require__(/*! ../../modelApi/creators/createListItem */ "./packages/roosterjs-content-model-dom/lib/modelApi/creators/createListItem.ts");
18488
+ var createListLevel_1 = __webpack_require__(/*! ../../modelApi/creators/createListLevel */ "./packages/roosterjs-content-model-dom/lib/modelApi/creators/createListLevel.ts");
18496
18489
  var parseFormat_1 = __webpack_require__(/*! ../utils/parseFormat */ "./packages/roosterjs-content-model-dom/lib/domToModel/utils/parseFormat.ts");
18497
18490
  var stackFormat_1 = __webpack_require__(/*! ../utils/stackFormat */ "./packages/roosterjs-content-model-dom/lib/domToModel/utils/stackFormat.ts");
18498
18491
  /**
@@ -18501,14 +18494,22 @@ var stackFormat_1 = __webpack_require__(/*! ../utils/stackFormat */ "./packages/
18501
18494
  var listItemProcessor = function (group, element, context) {
18502
18495
  var _a;
18503
18496
  var listFormat = context.listFormat;
18504
- if (listFormat.listParent && listFormat.levels.length > 0) {
18497
+ var originalListParent = listFormat.listParent;
18498
+ var shouldPopListLevel = false;
18499
+ try {
18500
+ listFormat.listParent = (_a = listFormat.listParent) !== null && _a !== void 0 ? _a : group;
18501
+ var listParent_1 = listFormat.listParent;
18502
+ if (listFormat.levels.length == 0) {
18503
+ listFormat.levels.push((0, createListLevel_1.createListLevel)(listFormat.potentialListType || 'UL', context.blockFormat));
18504
+ shouldPopListLevel = true;
18505
+ }
18505
18506
  (0, stackFormat_1.stackFormat)(context, {
18506
18507
  segment: 'shallowCloneForBlock',
18507
18508
  }, function () {
18508
18509
  (0, parseFormat_1.parseFormat)(element, context.formatParsers.segmentOnBlock, context.segmentFormat, context);
18509
18510
  var listItem = (0, createListItem_1.createListItem)(listFormat.levels, context.segmentFormat);
18510
18511
  (0, parseFormat_1.parseFormat)(element, context.formatParsers.listItemElement, listItem.format, context);
18511
- listFormat.listParent.blocks.push(listItem);
18512
+ listParent_1.blocks.push(listItem);
18512
18513
  (0, parseFormat_1.parseFormat)(element, context.formatParsers.listItemThread, listItem.levels[listItem.levels.length - 1].format, context);
18513
18514
  context.elementProcessors.child(listItem, element, context);
18514
18515
  var firstChild = listItem.blocks[0];
@@ -18520,10 +18521,11 @@ var listItemProcessor = function (group, element, context) {
18520
18521
  }
18521
18522
  });
18522
18523
  }
18523
- else {
18524
- var currentBlocks = (_a = listFormat.listParent) === null || _a === void 0 ? void 0 : _a.blocks;
18525
- var lastItem = currentBlocks === null || currentBlocks === void 0 ? void 0 : currentBlocks[(currentBlocks === null || currentBlocks === void 0 ? void 0 : currentBlocks.length) - 1];
18526
- context.elementProcessors['*']((lastItem === null || lastItem === void 0 ? void 0 : lastItem.blockType) == 'BlockGroup' ? lastItem : group, element, context);
18524
+ finally {
18525
+ if (shouldPopListLevel) {
18526
+ listFormat.levels.pop();
18527
+ }
18528
+ listFormat.listParent = originalListParent;
18527
18529
  }
18528
18530
  };
18529
18531
  exports.listItemProcessor = listItemProcessor;
@@ -18552,13 +18554,15 @@ var listProcessor = function (group, element, context) {
18552
18554
  segment: 'shallowCloneForBlock',
18553
18555
  paragraph: 'shallowCloneForGroup',
18554
18556
  }, function () {
18555
- var level = (0, createListLevel_1.createListLevel)(element.tagName, context.blockFormat);
18557
+ var tagName = element.tagName;
18558
+ var level = (0, createListLevel_1.createListLevel)(tagName, context.blockFormat);
18556
18559
  var listFormat = context.listFormat;
18557
18560
  (0, parseFormat_1.parseFormat)(element, context.formatParsers.dataset, level.dataset, context);
18558
18561
  (0, parseFormat_1.parseFormat)(element, context.formatParsers.listLevelThread, level.format, context);
18559
18562
  (0, parseFormat_1.parseFormat)(element, context.formatParsers.listLevel, level.format, context);
18560
18563
  (0, parseFormat_1.parseFormat)(element, context.formatParsers.segment, context.segmentFormat, context);
18561
18564
  var originalListParent = listFormat.listParent;
18565
+ listFormat.potentialListType = tagName;
18562
18566
  listFormat.listParent = listFormat.listParent || group;
18563
18567
  listFormat.levels.push(level);
18564
18568
  try {
@@ -29127,7 +29131,7 @@ var handleBlockGroupChildren = function (doc, parent, group, context) {
29127
29131
  exports.handleBlockGroupChildren = handleBlockGroupChildren;
29128
29132
  function cleanUpNodeStack(nodeStack, context) {
29129
29133
  var _a, _b;
29130
- if (context.allowCacheListItem && nodeStack.length > 0) {
29134
+ if (nodeStack.length > 0) {
29131
29135
  // Clear list stack, only run to nodeStack[1] because nodeStack[0] is the parent node
29132
29136
  for (var i = nodeStack.length - 1; i > 0; i--) {
29133
29137
  var node = (_b = (_a = nodeStack.pop()) === null || _a === void 0 ? void 0 : _a.refNode) !== null && _b !== void 0 ? _b : null;
@@ -29502,20 +29506,16 @@ var handleList = function (doc, parent, listItem, context, refNode) {
29502
29506
  // Apply metadata to list level to make sure list style is correct after rendering
29503
29507
  (0, applyMetadata_1.applyMetadata)(itemLevel, context.metadataAppliers.listLevel, itemLevel.format, context);
29504
29508
  }
29505
- if (context.allowCacheListItem &&
29506
- parentLevel.refNode &&
29507
- itemLevel.cachedElement == parentLevel.refNode) {
29509
+ if (parentLevel.refNode && itemLevel.cachedElement == parentLevel.refNode) {
29508
29510
  // Move refNode to next node since we are reusing this cached element
29509
29511
  parentLevel.refNode = parentLevel.refNode.nextSibling;
29510
29512
  }
29511
29513
  }
29512
29514
  // Cut off remained list levels that we can't reuse
29513
- if (context.allowCacheListItem) {
29514
- // Clean up all rest nodes in the reused list levels
29515
- for (var i = layer + 1; i < nodeStack.length; i++) {
29516
- var stackLevel = nodeStack[i];
29517
- (0, cleanUpRestNodes_1.cleanUpRestNodes)(stackLevel.refNode, context.rewriteFromModel);
29518
- }
29515
+ // Clean up all rest nodes in the reused list levels
29516
+ for (var i = layer + 1; i < nodeStack.length; i++) {
29517
+ var stackLevel = nodeStack[i];
29518
+ (0, cleanUpRestNodes_1.cleanUpRestNodes)(stackLevel.refNode, context.rewriteFromModel);
29519
29519
  }
29520
29520
  nodeStack.splice(layer + 1);
29521
29521
  // Create new list levels that are after reused ones
@@ -29526,7 +29526,7 @@ var handleList = function (doc, parent, listItem, context, refNode) {
29526
29526
  var isNewlyCreated = false;
29527
29527
  var levelRefNode = (_c = nodeStack[layer].refNode) !== null && _c !== void 0 ? _c : null;
29528
29528
  context.listFormat.currentLevel = layer;
29529
- if (context.allowCacheListItem && level.cachedElement) {
29529
+ if (level.cachedElement) {
29530
29530
  newList = level.cachedElement;
29531
29531
  nodeStack[layer].refNode = (0, reuseCachedElement_1.reuseCachedElement)(lastParent, level.cachedElement, levelRefNode, context.rewriteFromModel);
29532
29532
  nodeStack.push({
@@ -29548,9 +29548,7 @@ var handleList = function (doc, parent, listItem, context, refNode) {
29548
29548
  format: (0, tslib_1.__assign)({}, level.format),
29549
29549
  dataset: (0, tslib_1.__assign)({}, level.dataset),
29550
29550
  });
29551
- if (context.allowCacheListItem) {
29552
- level.cachedElement = newList;
29553
- }
29551
+ level.cachedElement = newList;
29554
29552
  }
29555
29553
  (0, applyFormat_1.applyFormat)(newList, context.formatAppliers.listLevelThread, level.format, context);
29556
29554
  // Need to apply metadata after applying list level format since the list numbers value relies on the result of list thread handling
@@ -29601,7 +29599,7 @@ var handleListItem = function (doc, parent, listItem, context, refNode) {
29601
29599
  var level = listItem.levels[listItem.levels.length - 1];
29602
29600
  var li;
29603
29601
  var isNewlyCreated = false;
29604
- if (context.allowCacheListItem && listItem.cachedElement) {
29602
+ if (listItem.cachedElement) {
29605
29603
  li = listItem.cachedElement;
29606
29604
  // Check if the cached LI is used as refNode under another list level,
29607
29605
  // since we know we are going to move it under the current listParent,
@@ -29620,9 +29618,7 @@ var handleListItem = function (doc, parent, listItem, context, refNode) {
29620
29618
  // This happens when outdent a list item to cause it has no list level
29621
29619
  listParent.insertBefore(li, (itemRefNode === null || itemRefNode === void 0 ? void 0 : itemRefNode.parentNode) == listParent ? itemRefNode : null);
29622
29620
  context.rewriteFromModel.addedBlockElements.push(li);
29623
- if (context.allowCacheListItem) {
29624
- listItem.cachedElement = li;
29625
- }
29621
+ listItem.cachedElement = li;
29626
29622
  }
29627
29623
  if (level) {
29628
29624
  (0, applyFormat_1.applyFormat)(li, context.formatAppliers.segment, listItem.formatHolder.format, context);
@@ -33512,7 +33508,6 @@ var EditPlugin = /** @class */ (function () {
33512
33508
  this.disposer = null;
33513
33509
  this.shouldHandleNextInputEvent = false;
33514
33510
  this.selectionAfterDelete = null;
33515
- this.handleNormalEnter = function () { return false; };
33516
33511
  var tabOptions = options.handleTabKey === false
33517
33512
  ? DisabledHandleTabOptions
33518
33513
  : options.handleTabKey === true || !options.handleTabKey
@@ -33520,19 +33515,6 @@ var EditPlugin = /** @class */ (function () {
33520
33515
  : (0, tslib_1.__assign)((0, tslib_1.__assign)({}, DefaultHandleTabOptions), options.handleTabKey);
33521
33516
  this.options = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, DefaultOptions), options), { handleTabKey: tabOptions });
33522
33517
  }
33523
- EditPlugin.prototype.createNormalEnterChecker = function (result) {
33524
- return result ? function () { return true; } : function () { return false; };
33525
- };
33526
- EditPlugin.prototype.getHandleNormalEnter = function (editor) {
33527
- switch (typeof this.options.shouldHandleEnterKey) {
33528
- case 'function':
33529
- return this.options.shouldHandleEnterKey;
33530
- case 'boolean':
33531
- return this.createNormalEnterChecker(this.options.shouldHandleEnterKey);
33532
- default:
33533
- return this.createNormalEnterChecker(editor.isExperimentalFeatureEnabled('HandleEnterKey'));
33534
- }
33535
- };
33536
33518
  /**
33537
33519
  * Get name of this plugin
33538
33520
  */
@@ -33548,7 +33530,6 @@ var EditPlugin = /** @class */ (function () {
33548
33530
  EditPlugin.prototype.initialize = function (editor) {
33549
33531
  var _this = this;
33550
33532
  this.editor = editor;
33551
- this.handleNormalEnter = this.getHandleNormalEnter(editor);
33552
33533
  if (editor.getEnvironment().isAndroid) {
33553
33534
  this.disposer = this.editor.attachDomEvent({
33554
33535
  beforeinput: {
@@ -33652,7 +33633,7 @@ var EditPlugin = /** @class */ (function () {
33652
33633
  if (!hasCtrlOrMetaKey &&
33653
33634
  !event.rawEvent.isComposing &&
33654
33635
  event.rawEvent.keyCode !== DEAD_KEY) {
33655
- (0, keyboardEnter_1.keyboardEnter)(editor, rawEvent, this.handleNormalEnter(editor), this.options.formatsToPreserveOnMerge);
33636
+ (0, keyboardEnter_1.keyboardEnter)(editor, rawEvent, this.options.formatsToPreserveOnMerge);
33656
33637
  }
33657
33638
  break;
33658
33639
  default:
@@ -34647,11 +34628,11 @@ var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-mo
34647
34628
  /**
34648
34629
  * @internal
34649
34630
  */
34650
- function keyboardEnter(editor, rawEvent, handleNormalEnter, formatsToPreserveOnMerge) {
34631
+ function keyboardEnter(editor, rawEvent, formatsToPreserveOnMerge) {
34651
34632
  if (formatsToPreserveOnMerge === void 0) { formatsToPreserveOnMerge = []; }
34652
34633
  var selection = editor.getDOMSelection();
34653
34634
  editor.formatContentModel(function (model, context) {
34654
- var _a, _b;
34635
+ var _a;
34655
34636
  // 1. delete the expanded selection if any, then merge paragraph
34656
34637
  var result = (0, roosterjs_content_model_dom_1.deleteSelection)(model, [], context);
34657
34638
  // 2. Add line break
@@ -34662,14 +34643,12 @@ function keyboardEnter(editor, rawEvent, handleNormalEnter, formatsToPreserveOnM
34662
34643
  var steps = rawEvent.shiftKey
34663
34644
  ? []
34664
34645
  : [handleAutoLink_1.handleAutoLink, handleEnterOnList_1.handleEnterOnList, deleteEmptyQuote_1.deleteEmptyQuote];
34665
- if (handleNormalEnter || handleEnterForEntity((_a = result.insertPoint) === null || _a === void 0 ? void 0 : _a.paragraph)) {
34666
- steps.push((0, handleEnterOnParagraph_1.handleEnterOnParagraph)(formatsToPreserveOnMerge));
34667
- }
34646
+ steps.push((0, handleEnterOnParagraph_1.handleEnterOnParagraph)(formatsToPreserveOnMerge));
34668
34647
  (0, roosterjs_content_model_dom_1.runEditSteps)(steps, result);
34669
34648
  }
34670
34649
  if (result.deleteResult == 'range') {
34671
34650
  // We have deleted something, next input should inherit the segment format from deleted content, so set pending format here
34672
- context.newPendingFormat = (_b = result.insertPoint) === null || _b === void 0 ? void 0 : _b.marker.format;
34651
+ context.newPendingFormat = (_a = result.insertPoint) === null || _a === void 0 ? void 0 : _a.marker.format;
34673
34652
  (0, roosterjs_content_model_dom_1.normalizeContentModel)(model);
34674
34653
  rawEvent.preventDefault();
34675
34654
  return true;
@@ -34686,10 +34665,6 @@ function keyboardEnter(editor, rawEvent, handleNormalEnter, formatsToPreserveOnM
34686
34665
  });
34687
34666
  }
34688
34667
  exports.keyboardEnter = keyboardEnter;
34689
- function handleEnterForEntity(paragraph) {
34690
- return (paragraph &&
34691
- (paragraph.isImplicit || paragraph.segments.some(function (x) { return x.segmentType == 'Entity'; })));
34692
- }
34693
34668
 
34694
34669
 
34695
34670
  /***/ },