roosterjs 9.18.0 → 9.19.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.18.0)
1
+ // Type definitions for roosterjs (Version 9.19.0)
2
2
  // Generated by dts tool from roosterjs
3
3
  // Project: https://github.com/Microsoft/roosterjs
4
4
 
@@ -80,7 +80,7 @@ export type ContentModelBlockFormat = BackgroundColorFormat & DirectionFormat &
80
80
  /**
81
81
  * Format of table cell
82
82
  */
83
- export type ContentModelTableCellFormat = ContentModelBlockFormat & BorderBoxFormat & VerticalAlignFormat & WordBreakFormat & TextColorFormat & SizeFormat;
83
+ export type ContentModelTableCellFormat = ContentModelBlockFormat & BorderBoxFormat & VerticalAlignFormat & WordBreakFormat & TextColorFormat & SizeFormat & BoldFormat;
84
84
 
85
85
  /**
86
86
  * The format object for a list item in Content Model
@@ -3552,6 +3552,7 @@ export type ExperimentalFeature = /**
3552
3552
  */
3553
3553
  'PersistCache'
3554
3554
  /**
3555
+ * @deprecated
3555
3556
  * Workaround for the Legacy Image Edit
3556
3557
  */
3557
3558
  | 'LegacyImageSelection'
@@ -4595,8 +4596,13 @@ export interface FormatContentModelContext {
4595
4596
  * @optional
4596
4597
  * When pass true, skip adding undo snapshot when write Content Model back to DOM.
4597
4598
  * Need to be set by the formatter function
4599
+ * Default value is false, which means add undo snapshot
4600
+ * When set to true, it will skip adding undo snapshot but mark "hasNewContent" so that next undo snapshot will be added, this is same with "MarkNewContent"
4601
+ * When set to 'DoNotSkip', it will add undo snapshot (default behavior)
4602
+ * When set to 'MarkNewContent', it will skip adding undo snapshot but mark "hasNewContent" so that next undo snapshot will be added
4603
+ * When set to 'SkipAll', it will skip adding undo snapshot and not mark "hasNewContent", as if no change is made
4598
4604
  */
4599
- skipUndoSnapshot?: boolean;
4605
+ skipUndoSnapshot?: boolean | 'DoNotSkip' | 'MarkNewContent' | 'SkipAll';
4600
4606
  /**
4601
4607
  * @optional
4602
4608
  * When set to true, formatWithContentModel API will not keep cached Content Model. Next time when we need a Content Model, a new one will be created
@@ -8703,6 +8709,7 @@ export class AutoFormatPlugin implements EditorPlugin {
8703
8709
  * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
8704
8710
  * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.
8705
8711
  * - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to false.
8712
+ * - removeListMargins: A boolean to remove list margins when it is automatically triggered. Defaults to false.
8706
8713
  * - autoHyphen: A boolean that enables or disables automatic hyphen transformation. Defaults to false.
8707
8714
  * - autoFraction: A boolean that enables or disables automatic fraction transformation. Defaults to false.
8708
8715
  * - autoOrdinals: A boolean that enables or disables automatic ordinal number transformation. Defaults to false.
@@ -8765,6 +8772,10 @@ export interface AutoFormatOptions extends AutoLinkOptions {
8765
8772
  * Transform ordinal numbers into superscript
8766
8773
  */
8767
8774
  autoOrdinals?: boolean;
8775
+ /**
8776
+ * Remove the margins of auto triggered list
8777
+ */
8778
+ removeListMargins?: boolean;
8768
8779
  }
8769
8780
 
8770
8781
  /**
@@ -9503,6 +9514,9 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
9503
9514
  private mouseDownHandler;
9504
9515
  private onDropHandler;
9505
9516
  private keyDownHandler;
9517
+ private setContentHandler;
9518
+ private formatEventHandler;
9519
+ private contentChangedHandler;
9506
9520
  /**
9507
9521
  * EXPOSED FOR TESTING PURPOSE ONLY
9508
9522
  */
@@ -8943,8 +8943,8 @@ var scrollCaretIntoView_1 = __webpack_require__(/*! ./scrollCaretIntoView */ "./
8943
8943
  * @param options More options, see FormatContentModelOptions
8944
8944
  */
8945
8945
  var formatContentModel = function (core, formatter, options, domToModelOptions) {
8946
- var _a;
8947
- var _b = options || {}, onNodeCreated = _b.onNodeCreated, getChangeData = _b.getChangeData, rawEvent = _b.rawEvent, selectionOverride = _b.selectionOverride, scroll = _b.scrollCaretIntoView;
8946
+ var _a, _b;
8947
+ var _c = options || {}, onNodeCreated = _c.onNodeCreated, rawEvent = _c.rawEvent, selectionOverride = _c.selectionOverride, scroll = _c.scrollCaretIntoView;
8948
8948
  var model = core.api.createContentModel(core, domToModelOptions, selectionOverride);
8949
8949
  var context = {
8950
8950
  newEntities: [],
@@ -8957,7 +8957,8 @@ var formatContentModel = function (core, formatter, options, domToModelOptions)
8957
8957
  var skipUndoSnapshot = context.skipUndoSnapshot, clearModelCache = context.clearModelCache, entityStates = context.entityStates, canUndoByBackspace = context.canUndoByBackspace;
8958
8958
  if (changed) {
8959
8959
  var isNested = core.undo.isNested;
8960
- var shouldAddSnapshot = !skipUndoSnapshot && !isNested;
8960
+ var shouldAddSnapshot = (!skipUndoSnapshot || skipUndoSnapshot == 'DoNotSkip') && !isNested;
8961
+ var shouldMarkNewContent = (skipUndoSnapshot === true || skipUndoSnapshot == 'MarkNewContent') && !isNested;
8961
8962
  var selection = void 0;
8962
8963
  if (shouldAddSnapshot) {
8963
8964
  core.undo.isNested = true;
@@ -8977,7 +8978,7 @@ var formatContentModel = function (core, formatter, options, domToModelOptions)
8977
8978
  contentModel: clearModelCache ? undefined : model,
8978
8979
  selection: clearModelCache ? undefined : selection,
8979
8980
  source: (options === null || options === void 0 ? void 0 : options.changeSource) || roosterjs_content_model_dom_1.ChangeSource.Format,
8980
- data: getChangeData === null || getChangeData === void 0 ? void 0 : getChangeData(),
8981
+ data: (_b = options === null || options === void 0 ? void 0 : options.getChangeData) === null || _b === void 0 ? void 0 : _b.call(options),
8981
8982
  formatApiName: options === null || options === void 0 ? void 0 : options.apiName,
8982
8983
  changedEntities: getChangedEntities(context, rawEvent),
8983
8984
  };
@@ -8991,7 +8992,7 @@ var formatContentModel = function (core, formatter, options, domToModelOptions)
8991
8992
  if (shouldAddSnapshot) {
8992
8993
  core.api.addUndoSnapshot(core, false /*canUndoByBackspace*/, entityStates);
8993
8994
  }
8994
- else {
8995
+ if (shouldMarkNewContent) {
8995
8996
  core.undo.snapshotsManager.hasNewContent = true;
8996
8997
  }
8997
8998
  }
@@ -13025,7 +13026,6 @@ var isSingleImageInSelection_1 = __webpack_require__(/*! ./isSingleImageInSelect
13025
13026
  var normalizePos_1 = __webpack_require__(/*! ./normalizePos */ "./packages/roosterjs-content-model-core/lib/corePlugin/selection/normalizePos.ts");
13026
13027
  var roosterjs_content_model_dom_1 = __webpack_require__(/*! roosterjs-content-model-dom */ "./packages/roosterjs-content-model-dom/lib/index.ts");
13027
13028
  var MouseLeftButton = 0;
13028
- var MouseMiddleButton = 1;
13029
13029
  var MouseRightButton = 2;
13030
13030
  var Up = 'ArrowUp';
13031
13031
  var Down = 'ArrowDown';
@@ -13231,7 +13231,7 @@ var SelectionPlugin = /** @class */ (function () {
13231
13231
  this.onMouseDown(this.editor, event.rawEvent);
13232
13232
  break;
13233
13233
  case 'mouseUp':
13234
- this.onMouseUp(this.editor, event);
13234
+ this.onMouseUp();
13235
13235
  break;
13236
13236
  case 'keyDown':
13237
13237
  this.onKeyDown(this.editor, event.rawEvent);
@@ -13247,40 +13247,25 @@ var SelectionPlugin = /** @class */ (function () {
13247
13247
  }
13248
13248
  };
13249
13249
  SelectionPlugin.prototype.onMouseDown = function (editor, rawEvent) {
13250
- var _a, _b;
13250
+ var _a;
13251
13251
  var selection = editor.getDOMSelection();
13252
13252
  var image;
13253
13253
  // Image selection
13254
- if (editor.isExperimentalFeatureEnabled('LegacyImageSelection')) {
13255
- if (rawEvent.button === MouseRightButton &&
13256
- (image =
13257
- (_a = this.getClickingImage(rawEvent)) !== null && _a !== void 0 ? _a : this.getContainedTargetImage(rawEvent, selection)) &&
13258
- image.isContentEditable) {
13259
- this.selectImageWithRange(image, rawEvent);
13260
- return;
13261
- }
13262
- else if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'image' && selection.image !== rawEvent.target) {
13263
- this.selectBeforeOrAfterElement(editor, selection.image);
13264
- return;
13265
- }
13254
+ if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'image' &&
13255
+ (rawEvent.button == MouseLeftButton ||
13256
+ (rawEvent.button == MouseRightButton &&
13257
+ !this.getClickingImage(rawEvent) &&
13258
+ !this.getContainedTargetImage(rawEvent, selection)))) {
13259
+ this.setDOMSelection(null /*domSelection*/, null /*tableSelection*/);
13266
13260
  }
13267
- else {
13268
- if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'image' &&
13269
- (rawEvent.button == MouseLeftButton ||
13270
- (rawEvent.button == MouseRightButton &&
13271
- !this.getClickingImage(rawEvent) &&
13272
- !this.getContainedTargetImage(rawEvent, selection)))) {
13273
- this.setDOMSelection(null /*domSelection*/, null /*tableSelection*/);
13274
- }
13275
- if ((image =
13276
- (_b = this.getClickingImage(rawEvent)) !== null && _b !== void 0 ? _b : this.getContainedTargetImage(rawEvent, selection)) &&
13277
- image.isContentEditable) {
13278
- this.setDOMSelection({
13279
- type: 'image',
13280
- image: image,
13281
- }, null);
13282
- return;
13283
- }
13261
+ if ((image =
13262
+ (_a = this.getClickingImage(rawEvent)) !== null && _a !== void 0 ? _a : this.getContainedTargetImage(rawEvent, selection)) &&
13263
+ image.isContentEditable) {
13264
+ this.setDOMSelection({
13265
+ type: 'image',
13266
+ image: image,
13267
+ }, null);
13268
+ return;
13284
13269
  }
13285
13270
  // Table selection
13286
13271
  if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'table' && rawEvent.button == MouseLeftButton) {
@@ -13308,33 +13293,7 @@ var SelectionPlugin = /** @class */ (function () {
13308
13293
  });
13309
13294
  }
13310
13295
  };
13311
- SelectionPlugin.prototype.selectImageWithRange = function (image, event) {
13312
- var _a;
13313
- var range = image.ownerDocument.createRange();
13314
- range.selectNode(image);
13315
- var domSelection = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getDOMSelection();
13316
- if ((domSelection === null || domSelection === void 0 ? void 0 : domSelection.type) == 'image' && image == domSelection.image) {
13317
- event.preventDefault();
13318
- }
13319
- else {
13320
- this.setDOMSelection({
13321
- type: 'range',
13322
- isReverted: false,
13323
- range: range,
13324
- }, null);
13325
- }
13326
- };
13327
- SelectionPlugin.prototype.onMouseUp = function (editor, event) {
13328
- var image;
13329
- if (editor.isExperimentalFeatureEnabled('LegacyImageSelection') &&
13330
- (image = this.getClickingImage(event.rawEvent)) &&
13331
- image.isContentEditable &&
13332
- event.rawEvent.button != MouseMiddleButton &&
13333
- (event.rawEvent.button ==
13334
- MouseRightButton /* it's not possible to drag using right click */ ||
13335
- event.isClicking)) {
13336
- this.selectImageWithRange(image, event.rawEvent);
13337
- }
13296
+ SelectionPlugin.prototype.onMouseUp = function () {
13338
13297
  this.detachMouseEvent();
13339
13298
  };
13340
13299
  SelectionPlugin.prototype.onKeyDown = function (editor, rawEvent) {
@@ -15278,6 +15237,9 @@ exports.defaultContentModelFormatMap = {
15278
15237
  marginTop: '1em',
15279
15238
  marginBottom: '1em',
15280
15239
  },
15240
+ th: {
15241
+ fontWeight: 'bold',
15242
+ },
15281
15243
  };
15282
15244
 
15283
15245
 
@@ -15410,6 +15372,7 @@ exports.defaultHTMLStyleMap = {
15410
15372
  },
15411
15373
  th: {
15412
15374
  display: 'table-cell',
15375
+ fontWeight: 'bold',
15413
15376
  },
15414
15377
  u: {
15415
15378
  textDecoration: 'underline',
@@ -22707,6 +22670,9 @@ function setFirstColumnFormatBorders(rows, format) {
22707
22670
  switch (rowIndex) {
22708
22671
  case 0:
22709
22672
  cell.isHeader = !!format.hasHeaderRow;
22673
+ if (cell.isHeader) {
22674
+ cell.format.fontWeight = 'bold';
22675
+ }
22710
22676
  break;
22711
22677
  case rows.length - 1:
22712
22678
  setBorderColor(cell.format, 'borderTop');
@@ -22734,6 +22700,7 @@ function setHeaderRowFormat(rows, format, metaOverrides) {
22734
22700
  (_a = rows[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.forEach(function (readonlyCell, cellIndex) {
22735
22701
  var cell = (0, mutate_1.mutateBlock)(readonlyCell);
22736
22702
  cell.isHeader = true;
22703
+ cell.format.fontWeight = 'bold';
22737
22704
  if (format.headerRowColor) {
22738
22705
  if (!metaOverrides.bgColorOverrides[rowIndex][cellIndex]) {
22739
22706
  (0, setTableCellBackgroundColor_1.setTableCellBackgroundColor)(cell, format.headerRowColor, false /*isColorOverride*/, true /*applyToSegments*/);
@@ -26642,6 +26609,7 @@ var updateMetadata_1 = __webpack_require__(/*! ../../modelApi/metadata/updateMet
26642
26609
  var isEmpty_1 = __webpack_require__(/*! ../../modelApi/common/isEmpty */ "./packages/roosterjs-content-model-dom/lib/modelApi/common/isEmpty.ts");
26643
26610
  var moveChildNodes_1 = __webpack_require__(/*! ../../domUtils/moveChildNodes */ "./packages/roosterjs-content-model-dom/lib/domUtils/moveChildNodes.ts");
26644
26611
  var reuseCachedElement_1 = __webpack_require__(/*! ../../domUtils/reuseCachedElement */ "./packages/roosterjs-content-model-dom/lib/domUtils/reuseCachedElement.ts");
26612
+ var stackFormat_1 = __webpack_require__(/*! ../utils/stackFormat */ "./packages/roosterjs-content-model-dom/lib/modelToDom/utils/stackFormat.ts");
26645
26613
  /**
26646
26614
  * @internal
26647
26615
  */
@@ -26687,7 +26655,7 @@ var handleTable = function (doc, parent, table, context, refNode) {
26687
26655
  (0, applyFormat_1.applyFormat)(tr, context.formatAppliers.tableRow, tableRow.format, context);
26688
26656
  }
26689
26657
  (_b = context.onNodeCreated) === null || _b === void 0 ? void 0 : _b.call(context, tableRow, tr);
26690
- for (var col = 0; col < tableRow.cells.length; col++) {
26658
+ var _loop_1 = function (col) {
26691
26659
  var cell = tableRow.cells[col];
26692
26660
  if (cell.isSelected) {
26693
26661
  var tableSelection = context.tableSelection || {
@@ -26705,9 +26673,9 @@ var handleTable = function (doc, parent, table, context, refNode) {
26705
26673
  context.tableSelection = tableSelection;
26706
26674
  }
26707
26675
  if (!cell.spanAbove && !cell.spanLeft) {
26708
- var td = (context.allowCacheElement && cell.cachedElement) ||
26709
- doc.createElement(cell.isHeader ? 'th' : 'td');
26710
- tr.appendChild(td);
26676
+ var tag = cell.isHeader ? 'th' : 'td';
26677
+ var td_1 = (context.allowCacheElement && cell.cachedElement) || doc.createElement(tag);
26678
+ tr.appendChild(td_1);
26711
26679
  var rowSpan = 1;
26712
26680
  var colSpan = 1;
26713
26681
  var width = table.widths[col];
@@ -26719,31 +26687,36 @@ var handleTable = function (doc, parent, table, context, refNode) {
26719
26687
  width += table.widths[col + colSpan];
26720
26688
  }
26721
26689
  if (rowSpan > 1) {
26722
- td.rowSpan = rowSpan;
26690
+ td_1.rowSpan = rowSpan;
26723
26691
  }
26724
26692
  if (colSpan > 1) {
26725
- td.colSpan = colSpan;
26693
+ td_1.colSpan = colSpan;
26726
26694
  }
26727
26695
  if (!cell.cachedElement || (cell.format.useBorderBox && (0, updateMetadata_1.hasMetadata)(table))) {
26728
- if (width > 0 && !td.style.width) {
26729
- td.style.width = width + 'px';
26696
+ if (width > 0 && !td_1.style.width) {
26697
+ td_1.style.width = width + 'px';
26730
26698
  }
26731
- if (height > 0 && !td.style.height) {
26732
- td.style.height = height + 'px';
26699
+ if (height > 0 && !td_1.style.height) {
26700
+ td_1.style.height = height + 'px';
26733
26701
  }
26734
26702
  }
26735
- if (!cell.cachedElement) {
26736
- if (context.allowCacheElement) {
26737
- cell.cachedElement = td;
26703
+ (0, stackFormat_1.stackFormat)(context, tag, function () {
26704
+ if (!cell.cachedElement) {
26705
+ if (context.allowCacheElement) {
26706
+ cell.cachedElement = td_1;
26707
+ }
26708
+ (0, applyFormat_1.applyFormat)(td_1, context.formatAppliers.block, cell.format, context);
26709
+ (0, applyFormat_1.applyFormat)(td_1, context.formatAppliers.tableCell, cell.format, context);
26710
+ (0, applyFormat_1.applyFormat)(td_1, context.formatAppliers.tableCellBorder, cell.format, context);
26711
+ (0, applyFormat_1.applyFormat)(td_1, context.formatAppliers.dataset, cell.dataset, context);
26738
26712
  }
26739
- (0, applyFormat_1.applyFormat)(td, context.formatAppliers.block, cell.format, context);
26740
- (0, applyFormat_1.applyFormat)(td, context.formatAppliers.tableCell, cell.format, context);
26741
- (0, applyFormat_1.applyFormat)(td, context.formatAppliers.tableCellBorder, cell.format, context);
26742
- (0, applyFormat_1.applyFormat)(td, context.formatAppliers.dataset, cell.dataset, context);
26743
- }
26744
- context.modelHandlers.blockGroupChildren(doc, td, cell, context);
26745
- (_f = context.onNodeCreated) === null || _f === void 0 ? void 0 : _f.call(context, cell, td);
26713
+ context.modelHandlers.blockGroupChildren(doc, td_1, cell, context);
26714
+ });
26715
+ (_f = context.onNodeCreated) === null || _f === void 0 ? void 0 : _f.call(context, cell, td_1);
26746
26716
  }
26717
+ };
26718
+ for (var col = 0; col < tableRow.cells.length; col++) {
26719
+ _loop_1(col);
26747
26720
  }
26748
26721
  }
26749
26722
  (_g = context.domIndexer) === null || _g === void 0 ? void 0 : _g.onTable(tableNode, table);
@@ -27191,6 +27164,7 @@ var DefaultOptions = {
27191
27164
  autoHyphen: false,
27192
27165
  autoFraction: false,
27193
27166
  autoOrdinals: false,
27167
+ removeListMargins: false,
27194
27168
  };
27195
27169
  /**
27196
27170
  * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
@@ -27201,6 +27175,7 @@ var AutoFormatPlugin = /** @class */ (function () {
27201
27175
  * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
27202
27176
  * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.
27203
27177
  * - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to false.
27178
+ * - removeListMargins: A boolean to remove list margins when it is automatically triggered. Defaults to false.
27204
27179
  * - autoHyphen: A boolean that enables or disables automatic hyphen transformation. Defaults to false.
27205
27180
  * - autoFraction: A boolean that enables or disables automatic fraction transformation. Defaults to false.
27206
27181
  * - autoOrdinals: A boolean that enables or disables automatic ordinal number transformation. Defaults to false.
@@ -27271,24 +27246,29 @@ var AutoFormatPlugin = /** @class */ (function () {
27271
27246
  var formatOptions_1 = {
27272
27247
  changeSource: '',
27273
27248
  apiName: '',
27249
+ getChangeData: undefined,
27274
27250
  };
27275
27251
  (0, roosterjs_content_model_api_1.formatTextSegmentBeforeSelectionMarker)(editor, function (model, previousSegment, paragraph, _markerFormat, context) {
27276
- var _a = _this.options, autoBullet = _a.autoBullet, autoNumbering = _a.autoNumbering, autoLink = _a.autoLink, autoHyphen = _a.autoHyphen, autoFraction = _a.autoFraction, autoOrdinals = _a.autoOrdinals, autoMailto = _a.autoMailto, autoTel = _a.autoTel;
27252
+ var _a;
27253
+ var _b = _this.options, autoBullet = _b.autoBullet, autoNumbering = _b.autoNumbering, autoLink = _b.autoLink, autoHyphen = _b.autoHyphen, autoFraction = _b.autoFraction, autoOrdinals = _b.autoOrdinals, autoMailto = _b.autoMailto, autoTel = _b.autoTel, removeListMargins = _b.removeListMargins;
27277
27254
  var shouldHyphen = false;
27278
27255
  var shouldLink = false;
27279
27256
  var shouldList = false;
27280
27257
  var shouldFraction = false;
27281
27258
  var shouldOrdinals = false;
27282
27259
  if (autoBullet || autoNumbering) {
27283
- shouldList = (0, keyboardListTrigger_1.keyboardListTrigger)(model, paragraph, context, autoBullet, autoNumbering);
27260
+ shouldList = (0, keyboardListTrigger_1.keyboardListTrigger)(model, paragraph, context, autoBullet, autoNumbering, removeListMargins);
27284
27261
  }
27285
27262
  if (autoLink || autoTel || autoMailto) {
27286
- shouldLink = !!(0, roosterjs_content_model_api_1.promoteLink)(previousSegment, paragraph, {
27263
+ var linkSegment = (0, roosterjs_content_model_api_1.promoteLink)(previousSegment, paragraph, {
27287
27264
  autoLink: autoLink,
27288
27265
  autoTel: autoTel,
27289
27266
  autoMailto: autoMailto,
27290
27267
  });
27291
- if (shouldLink) {
27268
+ if (linkSegment) {
27269
+ var anchor_1 = createAnchor(((_a = linkSegment.link) === null || _a === void 0 ? void 0 : _a.format.href) || '', linkSegment.text);
27270
+ formatOptions_1.getChangeData = function () { return anchor_1; };
27271
+ shouldLink = true;
27292
27272
  context.canUndoByBackspace = true;
27293
27273
  }
27294
27274
  }
@@ -27326,10 +27306,10 @@ var AutoFormatPlugin = /** @class */ (function () {
27326
27306
  case 'Tab':
27327
27307
  if (!rawEvent.shiftKey) {
27328
27308
  (0, roosterjs_content_model_api_1.formatTextSegmentBeforeSelectionMarker)(editor, function (model, _previousSegment, paragraph, _markerFormat, context) {
27329
- var _a = _this.options, autoBullet = _a.autoBullet, autoNumbering = _a.autoNumbering;
27309
+ var _a = _this.options, autoBullet = _a.autoBullet, autoNumbering = _a.autoNumbering, removeListMargins = _a.removeListMargins;
27330
27310
  var shouldList = false;
27331
27311
  if (autoBullet || autoNumbering) {
27332
- shouldList = (0, keyboardListTrigger_1.keyboardListTrigger)(model, paragraph, context, autoBullet, autoNumbering);
27312
+ shouldList = (0, keyboardListTrigger_1.keyboardListTrigger)(model, paragraph, context, autoBullet, autoNumbering, removeListMargins);
27333
27313
  context.canUndoByBackspace = shouldList;
27334
27314
  }
27335
27315
  if (shouldList) {
@@ -27367,6 +27347,12 @@ var getChangeSource = function (shouldList, shouldHyphen, shouldLink) {
27367
27347
  ? roosterjs_content_model_dom_1.ChangeSource.AutoLink
27368
27348
  : '';
27369
27349
  };
27350
+ var createAnchor = function (url, text) {
27351
+ var anchor = document.createElement('a');
27352
+ anchor.href = url;
27353
+ anchor.textContent = text;
27354
+ return anchor;
27355
+ };
27370
27356
 
27371
27357
 
27372
27358
  /***/ }),
@@ -27839,14 +27825,14 @@ var roosterjs_content_model_api_1 = __webpack_require__(/*! roosterjs-content-mo
27839
27825
  /**
27840
27826
  * @internal
27841
27827
  */
27842
- function keyboardListTrigger(model, paragraph, context, shouldSearchForBullet, shouldSearchForNumbering) {
27828
+ function keyboardListTrigger(model, paragraph, context, shouldSearchForBullet, shouldSearchForNumbering, removeListMargins) {
27843
27829
  if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
27844
27830
  if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
27845
27831
  var listStyleType = (0, getListTypeStyle_1.getListTypeStyle)(model, shouldSearchForBullet, shouldSearchForNumbering);
27846
27832
  if (listStyleType) {
27847
27833
  paragraph.segments.splice(0, 1);
27848
27834
  var listType = listStyleType.listType, styleType = listStyleType.styleType, index = listStyleType.index;
27849
- triggerList(model, listType, styleType, index);
27835
+ triggerList(model, listType, styleType, index, removeListMargins);
27850
27836
  context.canUndoByBackspace = true;
27851
27837
  setAnnounceData(model, context);
27852
27838
  return true;
@@ -27854,8 +27840,8 @@ function keyboardListTrigger(model, paragraph, context, shouldSearchForBullet, s
27854
27840
  return false;
27855
27841
  }
27856
27842
  exports.keyboardListTrigger = keyboardListTrigger;
27857
- var triggerList = function (model, listType, styleType, index) {
27858
- (0, roosterjs_content_model_api_1.setListType)(model, listType);
27843
+ var triggerList = function (model, listType, styleType, index, removeListMargins) {
27844
+ (0, roosterjs_content_model_api_1.setListType)(model, listType, removeListMargins);
27859
27845
  var isOrderedList = listType == 'OL';
27860
27846
  if (index && index > 0 && isOrderedList) {
27861
27847
  (0, roosterjs_content_model_api_1.setModelListStartNumber)(model, index);
@@ -29005,8 +28991,8 @@ var handleEnterOnList = function (context) {
29005
28991
  }
29006
28992
  });
29007
28993
  if (listItem.levels.length == 0) {
29008
- var index_1 = findIndex(listParent.blocks, nextBlock.levels.length, listIndex);
29009
- nextBlock.levels[nextBlock.levels.length - 1].format.startNumberOverride = index_1;
28994
+ var nextBlockIndex = findIndex(listParent.blocks, nextBlock.levels.length);
28995
+ nextBlock.levels[nextBlock.levels.length - 1].format.startNumberOverride = nextBlockIndex;
29010
28996
  }
29011
28997
  }
29012
28998
  }
@@ -29050,16 +29036,16 @@ var createNewListLevel = function (listItem) {
29050
29036
  return (0, roosterjs_content_model_dom_1.createListLevel)(level.listType, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, level.format), { startNumberOverride: undefined, displayForDummyItem: undefined }), level.dataset);
29051
29037
  });
29052
29038
  };
29053
- var findIndex = function (blocks, levelLength, index) {
29039
+ var findIndex = function (blocks, levelLength) {
29054
29040
  var counter = 1;
29055
- for (var i = index; i > -1; i--) {
29041
+ for (var i = 0; i < blocks.length; i++) {
29056
29042
  var listItem = blocks[i];
29057
29043
  if ((0, roosterjs_content_model_dom_1.isBlockGroupOfType)(listItem, 'ListItem') &&
29058
29044
  listItem.levels.length === levelLength) {
29059
29045
  counter++;
29060
29046
  }
29061
- else if (!((0, roosterjs_content_model_dom_1.isBlockGroupOfType)(listItem, 'ListItem') &&
29062
- listItem.levels.length == 0)) {
29047
+ else if ((0, roosterjs_content_model_dom_1.isBlockGroupOfType)(listItem, 'ListItem') &&
29048
+ listItem.levels.length == 0) {
29063
29049
  return counter;
29064
29050
  }
29065
29051
  }
@@ -30133,6 +30119,7 @@ var MouseRightButton = 2;
30133
30119
  var DRAG_ID = '_dragging';
30134
30120
  var IMAGE_EDIT_CLASS = 'imageEdit';
30135
30121
  var IMAGE_EDIT_CLASS_CARET = 'imageEditCaretColor';
30122
+ var IMAGE_EDIT_FORMAT_EVENT = 'ImageEditEvent';
30136
30123
  /**
30137
30124
  * ImageEdit plugin handles the following image editing features:
30138
30125
  * - Resize image
@@ -30242,9 +30229,7 @@ var ImageEditPlugin = /** @class */ (function () {
30242
30229
  this.keyDownHandler(this.editor, event);
30243
30230
  break;
30244
30231
  case 'contentChanged':
30245
- if (event.source == roosterjs_content_model_dom_1.ChangeSource.Drop) {
30246
- this.onDropHandler(this.editor);
30247
- }
30232
+ this.contentChangedHandler(this.editor, event);
30248
30233
  break;
30249
30234
  case 'extractContentWithDom':
30250
30235
  this.removeImageEditing(event.clonedRoot);
@@ -30321,6 +30306,32 @@ var ImageEditPlugin = /** @class */ (function () {
30321
30306
  }
30322
30307
  }
30323
30308
  };
30309
+ ImageEditPlugin.prototype.setContentHandler = function (editor) {
30310
+ var selection = editor.getDOMSelection();
30311
+ if ((selection === null || selection === void 0 ? void 0 : selection.type) == 'image' && selection.image.dataset.isEditing && !this.isEditing) {
30312
+ delete selection.image.dataset.isEditing;
30313
+ }
30314
+ };
30315
+ ImageEditPlugin.prototype.formatEventHandler = function (event) {
30316
+ if (this.isEditing && event.formatApiName !== IMAGE_EDIT_FORMAT_EVENT) {
30317
+ this.cleanInfo();
30318
+ this.isEditing = false;
30319
+ this.isCropMode = false;
30320
+ }
30321
+ };
30322
+ ImageEditPlugin.prototype.contentChangedHandler = function (editor, event) {
30323
+ switch (event.source) {
30324
+ case roosterjs_content_model_dom_1.ChangeSource.SetContent:
30325
+ this.setContentHandler(editor);
30326
+ break;
30327
+ case roosterjs_content_model_dom_1.ChangeSource.Format:
30328
+ this.formatEventHandler(event);
30329
+ break;
30330
+ case roosterjs_content_model_dom_1.ChangeSource.Drop:
30331
+ this.onDropHandler(editor);
30332
+ break;
30333
+ }
30334
+ };
30324
30335
  /**
30325
30336
  * EXPOSED FOR TESTING PURPOSE ONLY
30326
30337
  */
@@ -30399,6 +30410,7 @@ var ImageEditPlugin = /** @class */ (function () {
30399
30410
  }
30400
30411
  }
30401
30412
  },
30413
+ apiName: IMAGE_EDIT_FORMAT_EVENT,
30402
30414
  }, {
30403
30415
  tryGetFromCache: true,
30404
30416
  });
@@ -35477,7 +35489,15 @@ function createCellResizer(editor, td, table, isRTL, isHorizontal, onStart, onEn
35477
35489
  var zoomScale = editor.getDOMHelper().calculateZoomScale();
35478
35490
  var div = (0, createElement_1.createElement)(createElementData, document);
35479
35491
  (anchorContainer || document.body).appendChild(div);
35480
- var context = { editor: editor, td: td, table: table, isRTL: isRTL, zoomScale: zoomScale, onStart: onStart };
35492
+ var context = {
35493
+ editor: editor,
35494
+ td: td,
35495
+ table: table,
35496
+ isRTL: isRTL,
35497
+ zoomScale: zoomScale,
35498
+ onStart: onStart,
35499
+ originalWidth: (0, roosterjs_content_model_dom_1.parseValueWithUnit)(table.style.width),
35500
+ };
35481
35501
  var setPosition = isHorizontal ? setHorizontalPosition : setVerticalPosition;
35482
35502
  setPosition(context, div);
35483
35503
  var handler = {
@@ -35598,6 +35618,11 @@ function onDraggingVertical(context, event, initValue, deltaX) {
35598
35618
  tableRow.cells[col].style.width = cmTable.widths[col] + 'px';
35599
35619
  }
35600
35620
  }
35621
+ if (context.originalWidth > 0) {
35622
+ var newWidth = context.originalWidth + change + 'px';
35623
+ mutableTable.format.width = newWidth;
35624
+ table.style.width = newWidth;
35625
+ }
35601
35626
  return true;
35602
35627
  }
35603
35628
  else {