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