devexpress-richedit 24.1.11 → 24.1.12-build-25107-0103

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.
Files changed (36) hide show
  1. package/bin/gulpfile.js +1 -1
  2. package/bin/index-custom.js +1 -1
  3. package/bin/localization-builder.js +1 -1
  4. package/bin/nspell-index.js +1 -1
  5. package/bin/nspell.webpack.config.js +1 -1
  6. package/bin/webpack-externals.js +1 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.d.ts +1 -1
  9. package/dist/dx.richedit.js +210 -125
  10. package/dist/dx.richedit.min.js +2 -2
  11. package/index.d.ts +1 -1
  12. package/index.js +1 -1
  13. package/lib/client/bars/ribbon.d.ts +1 -0
  14. package/lib/client/bars/ribbon.js +3 -1
  15. package/lib/client/public/rich-edit.js +2 -2
  16. package/lib/client/utils/focus-helper.d.ts +4 -0
  17. package/lib/client/utils/focus-helper.js +36 -0
  18. package/lib/common/canvas/canvas-manager.js +10 -4
  19. package/lib/common/canvas/renderes/common/document-renderer.js +10 -12
  20. package/lib/common/commands/layout/apply-style-command.d.ts +12 -7
  21. package/lib/common/commands/layout/apply-style-command.js +44 -36
  22. package/lib/common/commands/toc/set-paragraph-level-command.d.ts +2 -0
  23. package/lib/common/commands/toc/set-paragraph-level-command.js +13 -7
  24. package/lib/common/input-controller.d.ts +5 -5
  25. package/lib/common/input-controller.js +12 -12
  26. package/lib/common/layout/main-structures/layout-row.d.ts +2 -1
  27. package/lib/common/layout/main-structures/layout-row.js +3 -1
  28. package/lib/common/layout-formatter/row/result.js +2 -1
  29. package/lib/common/layout-formatter/row/tab-info.js +4 -2
  30. package/lib/common/model/paragraph/paragraph-style.js +1 -1
  31. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.d.ts +1 -1
  32. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.js +22 -25
  33. package/lib/common/rich-edit-core.js +2 -2
  34. package/lib/common/utils/size-utils.d.ts +14 -7
  35. package/lib/common/utils/size-utils.js +43 -18
  36. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * DevExpress WebRichEdit (dx.richedit.js)
3
- * Version: 24.1.11
3
+ * Version: 24.1.12
4
4
  * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
5
5
  * License: https://www.devexpress.com/Support/EULAs
6
6
  */
@@ -19609,7 +19609,7 @@ class ParagraphStyle extends StyleBase {
19609
19609
  }
19610
19610
  }
19611
19611
  ParagraphStyle.normalStyleName = "Normal";
19612
- ParagraphStyle.headingStyleName = "heading";
19612
+ ParagraphStyle.headingStyleName = "Heading";
19613
19613
  ParagraphStyle.tocStyleName = "toc";
19614
19614
  class TabProperties {
19615
19615
  constructor() {
@@ -92577,6 +92577,7 @@ class LayoutPageArea extends rectangle.Rectangle {
92577
92577
 
92578
92578
 
92579
92579
 
92580
+
92580
92581
  var LayoutRowStateFlags;
92581
92582
  (function (LayoutRowStateFlags) {
92582
92583
  LayoutRowStateFlags[LayoutRowStateFlags["NormallyEnd"] = 0] = "NormallyEnd";
@@ -92587,6 +92588,7 @@ var LayoutRowStateFlags;
92587
92588
  LayoutRowStateFlags[LayoutRowStateFlags["DocumentEnd"] = 16] = "DocumentEnd";
92588
92589
  LayoutRowStateFlags[LayoutRowStateFlags["CellTableEnd"] = 64] = "CellTableEnd";
92589
92590
  LayoutRowStateFlags[LayoutRowStateFlags["PageBreakBefore"] = 128] = "PageBreakBefore";
92591
+ LayoutRowStateFlags[LayoutRowStateFlags["InfinityWidth"] = 256] = "InfinityWidth";
92590
92592
  })(LayoutRowStateFlags || (LayoutRowStateFlags = {}));
92591
92593
  class layout_row_LayoutRow extends rectangle.Rectangle {
92592
92594
  constructor(minY = Number.MAX_SAFE_INTEGER) {
@@ -92702,7 +92704,7 @@ class layout_row_LayoutRow extends rectangle.Rectangle {
92702
92704
  return lastBoxIndexWhatCanStrikeoutAndUnderline;
92703
92705
  }
92704
92706
  containsSpacesOnly() {
92705
- return this.boxes.length > 0 && utils_list.ListUtils.allOf(this.boxes, val => val.isWhitespace());
92707
+ return this.boxes.length > 0 && utils_list.ListUtils.allOf(this.boxes, val => val.isWhitespace() || val.getType() === LayoutBoxType.ParagraphMark);
92706
92708
  }
92707
92709
  }
92708
92710
  class LayoutRowWithIndex extends (/* unused pure expression or super */ null && (layout_row_LayoutRow)) {
@@ -93806,7 +93808,8 @@ class RowFormatterResult {
93806
93808
  return;
93807
93809
  this.rowFormatter.tabInfo.shiftBoxesAfterLastTab();
93808
93810
  const dontJustifyLinesEndingInSoftLineBreak = this.rowFormatter.manager.model.compatibilitySettings.dontJustifyLinesEndingInSoftLineBreak;
93809
- BoxAligner.align(this.row, this.rowFormatter.paragraphProps.alignment, currLogicRowEndPos, this.rowBoxIndexStart, dontJustifyLinesEndingInSoftLineBreak);
93811
+ if (!this.row.flags.get(LayoutRowStateFlags.InfinityWidth))
93812
+ BoxAligner.align(this.row, this.rowFormatter.paragraphProps.alignment, currLogicRowEndPos, this.rowBoxIndexStart, dontJustifyLinesEndingInSoftLineBreak);
93810
93813
  this.rowBoxIndexStart = this.row.boxes.length;
93811
93814
  }
93812
93815
  deleteSomeAnchorObjects(index, posToRestart) {
@@ -95506,6 +95509,7 @@ class RowEndedWithPageBreakState extends RowEndedWithParagraphMarkFormatterState
95506
95509
 
95507
95510
 
95508
95511
 
95512
+
95509
95513
  class RowTabInfo {
95510
95514
  constructor(rowFormatter, paragraphHorizontalBoundsStart) {
95511
95515
  this.rowFormatter = rowFormatter;
@@ -95575,10 +95579,11 @@ class RowTabInfo {
95575
95579
  const lastInterval = utils_list.ListUtils.last(this.rowFormatter.rowSizesManager.rowFormattingInfo.intervals);
95576
95580
  if (tabXPosRelativePage > lastInterval.end) {
95577
95581
  if (lastInterval.end < this.rowFormatter.paragraphHorizontalBounds.end) {
95578
- if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013) {
95582
+ if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013 && tabPosition !== null) {
95583
+ this.currInterval.avaliableWidth = Number.MAX_SAFE_INTEGER - this.currInterval.busyWidth;
95579
95584
  this.currInterval.length = Number.MAX_SAFE_INTEGER;
95580
- this.currInterval.avaliableWidth = Number.MAX_SAFE_INTEGER;
95581
95585
  this.row.width = Number.MAX_SAFE_INTEGER;
95586
+ this.row.flags.set(LayoutRowStateFlags.InfinityWidth, true);
95582
95587
  return this.addTabBox();
95583
95588
  }
95584
95589
  else if (tabBox.right < this.rowFormatter.paragraphHorizontalBounds.end) {
@@ -102159,18 +102164,16 @@ class SimpleViewCanvasSizeManager {
102159
102164
  this.sizeUpdated = true;
102160
102165
  }
102161
102166
  changeSizeCore() {
102162
- {
102163
- utils_list.ListUtils.forEach(this.control.viewManager.cache, (_val) => this.control.viewManager.renderer.removePage(1), 1);
102164
- this.control.viewManager.ensureFirstPageIsRendered();
102165
- this.control.innerClientProperties.viewsSettings.widthOfPage = this.canvasManager.getCanvasWidth();
102166
- if (this.control.layoutFormatterManager) {
102167
- this.control.layoutFormatterManager.invalidator.onChangedAllLayout();
102168
- this.control.selection.scrollManager.setScroll(new ScrollState().byModelPosition(this.control.selection)
102169
- .setModelPosition(this.control.selection.lastSelectedInterval.start).useStdRelativePosition().useStdOffset());
102170
- }
102171
- this.control.owner.adjustControl();
102172
- this.control.horizontalRulerControl.update();
102167
+ utils_list.ListUtils.forEach(this.control.viewManager.cache, (_val) => this.control.viewManager.renderer.removePage(1), 1);
102168
+ this.control.viewManager.ensureFirstPageIsRendered();
102169
+ this.control.innerClientProperties.viewsSettings.widthOfPage = this.canvasManager.getCanvasWidth();
102170
+ if (this.control.layoutFormatterManager) {
102171
+ this.control.layoutFormatterManager.invalidator.onChangedAllLayout();
102172
+ this.control.selection.scrollManager.setScroll(new ScrollState().byModelPosition(this.control.selection)
102173
+ .setModelPosition(this.control.selection.lastSelectedInterval.start).useStdRelativePosition().useStdOffset());
102173
102174
  }
102175
+ this.control.owner.adjustControl();
102176
+ this.control.horizontalRulerControl.update();
102174
102177
  }
102175
102178
  }
102176
102179
  class DocumentRenderer {
@@ -102354,7 +102357,7 @@ class DocumentRenderer {
102354
102357
  }
102355
102358
  }
102356
102359
  updatePageSize(page, pageElement) {
102357
- if (pageElement.offsetHeight != page.height || pageElement.offsetWidth != page.width)
102360
+ if (pageElement.offsetHeight != Math.round(page.height) || pageElement.offsetWidth != Math.round(page.width))
102358
102361
  dom.DomUtils.setStyleSize(pageElement.style, page);
102359
102362
  }
102360
102363
  updatePageClasses(pageElement) {
@@ -106208,40 +106211,31 @@ class MouseHandlerDefaultState extends MouseHandlerStateBase {
106208
106211
  this.processMouseDownOnMaxDetailsLevel(evt, htr, activeSubDocument);
106209
106212
  }
106210
106213
  processMouseDownOnMaxDetailsLevel(evt, htr, activeSubDocument) {
106214
+ const selection = this.handler.control.selection;
106211
106215
  if (htr.floatingObject) {
106212
- if (htr.floatingObject.belongsToSubDocId != this.handler.control.selection.activeSubDocument.id)
106213
- MouseHandlerHelper.changeActiveSubDocumentToParent(this.handler.control);
106214
106216
  const box = htr.floatingObject;
106215
- this.selectFloatingObject(box);
106216
- const specRunInfo = this.handler.control.selection.specialRunInfo;
106217
- if (specRunInfo.isSelectedAnchorObject) {
106218
- if (box.getType() == LayoutBoxType.AnchorTextBox &&
106219
- HitTestManager.isPointInTexBoxArea(evt.layoutPoint, box, activeSubDocument.isTextBox() ? 0 : box.rotationInRadians)) {
106217
+ const rotationAngle = activeSubDocument.isTextBox() ? 0 : box.rotationInRadians;
106218
+ if (box.getType() == LayoutBoxType.AnchorTextBox && HitTestManager.isPointInTexBoxArea(evt.layoutPoint, box, rotationAngle)) {
106219
+ const textbox = box;
106220
+ if (textbox.internalSubDocId !== selection.activeSubDocument.id && this.selectFloatingObject(box)) {
106220
106221
  this.handler.control.commandManager.getCommand(RichEditClientCommand.ChangeActiveSubDocumentToTextBox).execute(this.handler.control.commandManager.isPublicApiCall);
106221
106222
  this.handler.boxVisualizerManager.resizeBoxVisualizer.show(htr.pageIndex, null, null, null, box);
106222
- htr = this.handler.control.hitTestManager.calculate(evt.layoutPoint, DocumentLayoutDetailsLevel.Max, this.handler.control.selection.activeSubDocument);
106223
- }
106224
- else {
106225
- if (this.resizeRotationChecker(() => {
106226
- const dragFloatingObjectState = new MouseHandlerDragFloatingObjectState(this.handler, evt);
106227
- this.handler.switchState(new MouseHandlerBeginDragHelperState(evt.layoutPoint, this.handler, dragFloatingObjectState));
106228
- }))
106229
- return;
106230
- else {
106231
- if (specRunInfo.isPictureSelected()) {
106232
- this.handler.control.selection.setSelection(new SetSelectionParams()
106233
- .setInterval(new fixed.FixedInterval(specRunInfo.getPicturePosition(), 1)));
106234
- return;
106235
- }
106236
- }
106223
+ htr = this.handler.control.hitTestManager.calculate(evt.layoutPoint, DocumentLayoutDetailsLevel.Max, selection.activeSubDocument);
106237
106224
  }
106238
106225
  }
106226
+ else {
106227
+ if (this.selectFloatingObject(box) && this.resizeRotationChecker(() => {
106228
+ const dragFloatingObjectState = new MouseHandlerDragFloatingObjectState(this.handler, evt);
106229
+ this.handler.switchState(new MouseHandlerBeginDragHelperState(evt.layoutPoint, this.handler, dragFloatingObjectState));
106230
+ }))
106231
+ return;
106232
+ }
106239
106233
  }
106240
106234
  if (browser.Browser.TouchUI && htr.subDocument.isMain() && htr.exactlyDetailLevel < DocumentLayoutDetailsLevel.PageArea) {
106241
106235
  if (htr.deviations[DocumentLayoutDetailsLevel.PageArea] & rectangle.HitTestDeviation.Top || htr.deviations[DocumentLayoutDetailsLevel.PageArea] & rectangle.HitTestDeviation.Bottom)
106242
106236
  this.handler.control.viewManager.canvasScrollManager.waitForDblClick();
106243
106237
  }
106244
- if (evt.button === MouseButton.Right && this.handler.control.selection.lastSelectedInterval.contains(htr.getPosition()))
106238
+ if (evt.button === MouseButton.Right && selection.lastSelectedInterval.contains(htr.getPosition()))
106245
106239
  return;
106246
106240
  if (this.shouldSelectEntireTableColumn(htr))
106247
106241
  this.beginSelectEntireTableColumn(htr, evt);
@@ -106256,7 +106250,7 @@ class MouseHandlerDefaultState extends MouseHandlerStateBase {
106256
106250
  this.beginSelectEntireTableCell(htr, evt);
106257
106251
  }
106258
106252
  else if (this.isLeftArea(htr, evt)) {
106259
- if (evt.modifiers & key/* ModifierKey */.tx.Ctrl && this.handler.control.selection.isCollapsed())
106253
+ if (evt.modifiers & key/* ModifierKey */.tx.Ctrl && selection.isCollapsed())
106260
106254
  this.handler.control.commandManager.getCommand(RichEditClientCommand.SelectAll).execute(this.handler.control.commandManager.isPublicApiCall, htr.getPosition());
106261
106255
  else if (this.isLeftAreaOffset(htr, evt))
106262
106256
  this.beginLineSelection(htr, evt);
@@ -106464,8 +106458,14 @@ class MouseHandlerDefaultState extends MouseHandlerStateBase {
106464
106458
  this.handler.switchState(state);
106465
106459
  }
106466
106460
  selectFloatingObject(box) {
106461
+ const selection = this.handler.control.selection;
106462
+ if (box.belongsToSubDocId !== selection.activeSubDocument.id)
106463
+ MouseHandlerHelper.changeActiveSubDocumentToParent(this.handler.control);
106464
+ if (box.belongsToSubDocId !== selection.activeSubDocument.id)
106465
+ return false;
106467
106466
  const pos = this.handler.control.layout.anchorObjectsPositionInfo.getPosition(box.objectId);
106468
- this.handler.control.selection.setSelection(new SetSelectionParams().setInterval(new fixed.FixedInterval(pos, 1)));
106467
+ selection.setSelection(new SetSelectionParams().setInterval(new fixed.FixedInterval(pos, 1)));
106468
+ return selection.specialRunInfo.isSelectedAnchorObject;
106469
106469
  }
106470
106470
  }
106471
106471
  class MouseHandlerHelper {
@@ -107638,31 +107638,56 @@ ResizeBoxListener.directionToSource = {
107638
107638
  };
107639
107639
 
107640
107640
  ;// CONCATENATED MODULE: ./src/common/utils/size-utils.ts
107641
+
107641
107642
  class SizeUtils {
107643
+ static getScrollbarsWidth() {
107644
+ if (!(0,common.isDefined)(this._scrollbarsWidth)) {
107645
+ const scrollDiv = document.createElement('div');
107646
+ scrollDiv.style.visibility = 'hidden';
107647
+ scrollDiv.style.overflow = 'scroll';
107648
+ scrollDiv.style.position = 'absolute';
107649
+ scrollDiv.style.top = '-9999px';
107650
+ scrollDiv.style.width = '100px';
107651
+ scrollDiv.style.height = '100px';
107652
+ document.body.appendChild(scrollDiv);
107653
+ const innerDiv = document.createElement('div');
107654
+ innerDiv.style.width = '100%';
107655
+ innerDiv.style.height = '100%';
107656
+ scrollDiv.appendChild(innerDiv);
107657
+ this._scrollbarsWidth = {
107658
+ horizontal: SizeUtils.getOffsetHeight(scrollDiv) - SizeUtils.getOffsetHeight(innerDiv),
107659
+ vertical: SizeUtils.getOffsetWidth(scrollDiv) - SizeUtils.getOffsetWidth(innerDiv)
107660
+ };
107661
+ scrollDiv.remove();
107662
+ }
107663
+ return this._scrollbarsWidth;
107664
+ }
107642
107665
  static getWidthInfo(element) {
107643
- const offsetSize = SizeUtils.getOffsetWidth(element);
107644
- const style = getComputedStyle(element);
107645
- const inset = parseCssValue(style.borderLeftWidth)
107646
- + parseCssValue(style.borderRightWidth)
107647
- + parseCssValue(style.paddingLeft)
107648
- + parseCssValue(style.paddingRight);
107649
- const sizeWithScrollBar = offsetSize - inset;
107650
- const scrollBarSize = Math.round(sizeWithScrollBar) - element.clientWidth;
107651
- return new DimensionInfo(offsetSize, sizeWithScrollBar - scrollBarSize, scrollBarSize);
107666
+ const computedStyle = getComputedStyle(element);
107667
+ const offsetWidth = this.getOffsetWidth(element);
107668
+ const offsetWidthWithoutBorder = offsetWidth
107669
+ - parseCssValue(computedStyle.borderLeftWidth)
107670
+ - parseCssValue(computedStyle.borderRightWidth);
107671
+ let scrollbarWidth = 0;
107672
+ if (Math.round(offsetWidthWithoutBorder) > element.clientWidth)
107673
+ scrollbarWidth = SizeUtils.getScrollbarsWidth().vertical;
107674
+ const clientWidth = offsetWidthWithoutBorder - scrollbarWidth;
107675
+ return new DimensionInfo(offsetWidth, clientWidth, scrollbarWidth);
107652
107676
  }
107653
107677
  static getClientWidth(element) {
107654
107678
  return this.getWidthInfo(element).clientSize;
107655
107679
  }
107656
107680
  static getHeightInfo(element) {
107657
- const offsetSize = SizeUtils.getOffsetHeight(element);
107658
- const style = getComputedStyle(element);
107659
- const inset = parseCssValue(style.borderTopWidth)
107660
- + parseCssValue(style.borderBottomWidth)
107661
- + parseCssValue(style.paddingTop)
107662
- + parseCssValue(style.paddingBottom);
107663
- const sizeWithScrollBar = offsetSize - inset;
107664
- const scrollBarSize = Math.round(sizeWithScrollBar) - element.clientHeight;
107665
- return new DimensionInfo(offsetSize, sizeWithScrollBar - scrollBarSize, scrollBarSize);
107681
+ const computedStyle = getComputedStyle(element);
107682
+ const offsetHeight = this.getOffsetHeight(element);
107683
+ const offsetHeightWithoutBorder = offsetHeight
107684
+ - parseCssValue(computedStyle.borderTopWidth)
107685
+ - parseCssValue(computedStyle.borderBottomWidth);
107686
+ let scrollbarWidth = 0;
107687
+ if (Math.round(offsetHeightWithoutBorder) > element.clientHeight)
107688
+ scrollbarWidth = SizeUtils.getScrollbarsWidth().horizontal;
107689
+ const clientHeight = offsetHeightWithoutBorder - scrollbarWidth;
107690
+ return new DimensionInfo(offsetHeight, clientHeight, scrollbarWidth);
107666
107691
  }
107667
107692
  static getClientHeight(element) {
107668
107693
  return this.getHeightInfo(element).clientSize;
@@ -108009,17 +108034,23 @@ class CanvasManager extends batch_updatable/* BatchUpdatableObject */.IS {
108009
108034
  onScrollIntervalTick() {
108010
108035
  const evtX = this.lastMousePosition.x;
108011
108036
  const evtY = this.lastMousePosition.y;
108012
- const inHorizontalArea = evtX >= this.canvasPosition.x && evtX <= this.canvasPosition.x + this.sizes.getVisibleAreaWidth(true);
108013
- const inVerticalArea = evtY >= this.canvasPosition.y && evtY <= this.canvasPosition.y + this.sizes.getVisibleAreaHeight(true);
108037
+ const inHorizontalArea = evtX >= this.canvasPosition.x && evtX <= this.canvasPosition.x + this.sizes.getVisibleAreaWidth(false);
108038
+ const inVerticalArea = evtY >= this.canvasPosition.y && evtY <= this.canvasPosition.y + this.sizes.getVisibleAreaHeight(false);
108014
108039
  if (!inHorizontalArea && !inVerticalArea)
108015
108040
  return;
108041
+ const yOffsetWithoutScrollbar = this.canvasPosition.y + this.sizes.getVisibleAreaHeight(false) - evtY;
108042
+ const yOffsetWithScrollbar = this.canvasPosition.y + this.sizes.getVisibleAreaHeight(true) - evtY;
108043
+ const outsideHorizontalScrollbar = yOffsetWithoutScrollbar > 0 || yOffsetWithScrollbar < 0;
108016
108044
  if (inHorizontalArea && evtY - this.canvasPosition.y <= AUTOSCROLL_AREA_SIZE)
108017
108045
  this.viewManager.canvas.scrollTop -= AUTOSCROLL_STEP;
108018
- else if (inHorizontalArea && this.canvasPosition.y + this.sizes.getVisibleAreaHeight(true) - evtY <= AUTOSCROLL_AREA_SIZE)
108046
+ else if (inHorizontalArea && yOffsetWithoutScrollbar <= AUTOSCROLL_AREA_SIZE && outsideHorizontalScrollbar)
108019
108047
  this.viewManager.canvas.scrollTop += AUTOSCROLL_STEP;
108048
+ const xOffsetWithoutScrollbar = this.canvasPosition.x + this.sizes.getVisibleAreaWidth(false) - evtX;
108049
+ const xOffsetWithScrollbar = this.canvasPosition.x + this.sizes.getVisibleAreaWidth(true) - evtX;
108050
+ const outsideVerticalScrollbar = xOffsetWithoutScrollbar > 0 || xOffsetWithScrollbar < 0;
108020
108051
  if (inVerticalArea && evtX - this.canvasPosition.x <= AUTOSCROLL_AREA_SIZE)
108021
108052
  this.viewManager.canvas.scrollLeft -= AUTOSCROLL_STEP;
108022
- else if (inVerticalArea && this.canvasPosition.x + this.sizes.getVisibleAreaWidth(true) - evtX <= AUTOSCROLL_AREA_SIZE)
108053
+ else if (inVerticalArea && xOffsetWithoutScrollbar <= AUTOSCROLL_AREA_SIZE && outsideVerticalScrollbar)
108023
108054
  this.viewManager.canvas.scrollLeft += AUTOSCROLL_STEP;
108024
108055
  }
108025
108056
  static getCursorClassName(pointer) {
@@ -110309,17 +110340,17 @@ class InputEditorBase {
110309
110340
  clearTimeout(this.onKeyUpTimerId);
110310
110341
  }
110311
110342
  initialize() {
110312
- this.initializeIfNotReadOnly();
110343
+ this.initializeEditableState();
110313
110344
  this.initEvents();
110314
110345
  this.prevKeyCode = EMPTY_KEYCODE;
110315
110346
  }
110316
- initializeIfNotReadOnly() {
110317
- if ((this.control.readOnly !== ReadOnlyMode.Persistent || this.control.modelManager.clientMode) && !this.initializedIfNotReadOnly) {
110318
- this.initializedIfNotReadOnly = true;
110319
- this.initializeIfNotReadOnlyCore();
110347
+ initializeEditableState() {
110348
+ if (!this.editableStateInitialized) {
110349
+ this.editableStateInitialized = true;
110350
+ this.initializeEditableStateCore();
110320
110351
  }
110321
110352
  }
110322
- initializeIfNotReadOnlyCore() {
110353
+ initializeEditableStateCore() {
110323
110354
  }
110324
110355
  initEvents() {
110325
110356
  this.evtHandlersHolder.addListener(this.getEditableDocument(), "keydown", this.onKeyDown.bind(this));
@@ -110539,8 +110570,8 @@ class DivInputEditor extends InputEditorBase {
110539
110570
  clearTimeout(this.composEndTimerId);
110540
110571
  clearTimeout(this.onTextInputTimerId);
110541
110572
  }
110542
- initializeIfNotReadOnlyCore() {
110543
- this.inputElement.contentEditable = "true";
110573
+ initializeEditableStateCore() {
110574
+ this.inputElement.contentEditable = String(!this.control.isReadOnlyPersistent);
110544
110575
  this.clearInputElement();
110545
110576
  }
110546
110577
  setPosition(left, top) {
@@ -110788,11 +110819,11 @@ class IFrameInputEditor extends InputEditorBase {
110788
110819
  body.style.margin = "0px";
110789
110820
  body.style.overflow = "hidden";
110790
110821
  }
110791
- initializeIfNotReadOnlyCore() {
110822
+ initializeEditableStateCore() {
110792
110823
  if (browser.Browser.WebKitFamily)
110793
- this.editableDocument.body.setAttribute("contenteditable", "true");
110824
+ this.editableDocument.body.setAttribute("contenteditable", String(!this.control.isReadOnlyPersistent));
110794
110825
  else
110795
- this.editableDocument.designMode = "on";
110826
+ this.editableDocument.designMode = this.control.isReadOnlyPersistent ? "off" : "on";
110796
110827
  }
110797
110828
  createInputElement() {
110798
110829
  const element = document.createElement("IFRAME");
@@ -110931,7 +110962,7 @@ class IFrameInputEditor extends InputEditorBase {
110931
110962
  recreateIfNeeded() {
110932
110963
  const iframeDocument = this.inputElement.contentDocument || this.inputElement.contentWindow.document;
110933
110964
  if (!iframeDocument.body.hasAttribute("loaded")) {
110934
- this.initializedIfNotReadOnly = false;
110965
+ this.editableStateInitialized = false;
110935
110966
  this.createHierarchyCore();
110936
110967
  this.initialize();
110937
110968
  }
@@ -115237,7 +115268,7 @@ class RichEditCore {
115237
115268
  this.invalidateLayoutAfterFontsLoaded();
115238
115269
  });
115239
115270
  }
115240
- get isReadOnlyPersistent() { return this.readOnly == ReadOnlyMode.Persistent; }
115271
+ get isReadOnlyPersistent() { return this.readOnly === ReadOnlyMode.Persistent; }
115241
115272
  get model() { return this.modelManager.model; }
115242
115273
  get isDisposed() {
115243
115274
  return this._isDisposed;
@@ -115401,8 +115432,8 @@ class RichEditCore {
115401
115432
  this.readOnly = ReadOnlyMode.Persistent;
115402
115433
  else if (!readOnly && this.readOnly === ReadOnlyMode.Persistent) {
115403
115434
  this.readOnly = ReadOnlyMode.None;
115404
- this.inputController.inputEditor.initializeIfNotReadOnly();
115405
115435
  }
115436
+ this.inputController.inputEditor.initializeEditableStateCore();
115406
115437
  }
115407
115438
  setWorkSession(sessionGuid, documentInfo) {
115408
115439
  this.sessionGuid = sessionGuid;
@@ -122271,6 +122302,44 @@ function createInnerItems(items) {
122271
122302
  }
122272
122303
  }
122273
122304
 
122305
+ ;// CONCATENATED MODULE: ./src/client/utils/focus-helper.ts
122306
+ class FocusHelper {
122307
+ static preventFocusOnClick(element) {
122308
+ return new FocusBlocker(element);
122309
+ }
122310
+ }
122311
+ class FocusBlocker {
122312
+ constructor(target) {
122313
+ this.target = target;
122314
+ this.onPointerDownBinded = this.onPointerDown.bind(this);
122315
+ this.addEventListeners(target);
122316
+ }
122317
+ addEventListeners(element) {
122318
+ element.addEventListener("pointerdown", this.onPointerDownBinded);
122319
+ }
122320
+ removeEventListeners(element) {
122321
+ element.removeEventListener("pointerdown", this.onPointerDownBinded);
122322
+ }
122323
+ onPointerDown(event) {
122324
+ for (const element of event.composedPath()) {
122325
+ if (!(element instanceof HTMLElement))
122326
+ continue;
122327
+ if (element === this.target) {
122328
+ event.preventDefault();
122329
+ break;
122330
+ }
122331
+ if (!this.target.contains(element) || element.tabIndex > -1)
122332
+ break;
122333
+ }
122334
+ }
122335
+ dispose() {
122336
+ if (this.target) {
122337
+ this.removeEventListeners(this.target);
122338
+ this.target = null;
122339
+ }
122340
+ }
122341
+ }
122342
+
122274
122343
  ;// CONCATENATED MODULE: ./src/client/bars/ribbon.ts
122275
122344
 
122276
122345
 
@@ -122280,6 +122349,7 @@ function createInnerItems(items) {
122280
122349
 
122281
122350
 
122282
122351
 
122352
+
122283
122353
  class ClientRibbonBar extends RibbonBarBase {
122284
122354
  constructor(ownerControl, ownerElement, apiRibbon, fonts) {
122285
122355
  var _a;
@@ -122288,6 +122358,7 @@ class ClientRibbonBar extends RibbonBarBase {
122288
122358
  this.ownerElement = ownerElement;
122289
122359
  this.init(apiRibbon, fonts);
122290
122360
  this.createControl((_a = apiRibbon.activeTabIndex) !== null && _a !== void 0 ? _a : 1);
122361
+ this.focusHandler = FocusHelper.preventFocusOnClick(this.ribbon.element);
122291
122362
  }
122292
122363
  updateContextItem(_commandKey) {
122293
122364
  }
@@ -122313,13 +122384,13 @@ class ClientRibbonBar extends RibbonBarBase {
122313
122384
  }
122314
122385
  dispose() {
122315
122386
  this.ribbon.dispose();
122387
+ this.focusHandler.dispose();
122316
122388
  }
122317
122389
  checkActivateHeaderFooter(_selection) {
122318
122390
  return false;
122319
122391
  }
122320
122392
  createControl(activeTabIndex) {
122321
122393
  const element = document.createElement('div');
122322
- element.tabIndex = 0;
122323
122394
  const firstChild = this.ownerElement.firstChild;
122324
122395
  if (firstChild)
122325
122396
  this.ownerElement.insertBefore(element, firstChild);
@@ -129268,7 +129339,6 @@ class LinkHeaderFooterToPreviousCommand extends HeaderFooterCommandBase {
129268
129339
 
129269
129340
 
129270
129341
 
129271
-
129272
129342
  class ApplyStyleCommand extends CommandBase {
129273
129343
  getState() {
129274
129344
  var interval = this.selection.lastSelectedInterval.clone();
@@ -129305,16 +129375,19 @@ class ApplyStyleCommand extends CommandBase {
129305
129375
  getStyleName(style) {
129306
129376
  return style.styleName;
129307
129377
  }
129378
+ DEPRECATEDConvertOptionsParameter(parameter) {
129379
+ return typeof parameter === 'string' ? { styleName: parameter } : parameter;
129380
+ }
129308
129381
  executeCore(state, options) {
129309
129382
  const parameter = options.param;
129310
- if (utils_string.StringUtils.isNullOrEmpty(parameter))
129383
+ if (utils_string.StringUtils.isNullOrEmpty(parameter.styleName))
129311
129384
  return false;
129312
- let interval = state.interval.clone();
129385
+ const subDocumentInterval = new SubDocumentInterval(options.subDocument, state.interval.clone());
129313
129386
  let executed = true;
129314
129387
  let isPresetStyle = false;
129315
129388
  this.history.beginTransaction();
129316
- if (StylesManager.isParagraphStyle(parameter) && state.paragraphStyleChangeEnabled) {
129317
- const styleName = StylesManager.getStyleNameWithoutPrefix(parameter);
129389
+ if (StylesManager.isParagraphStyle(parameter.styleName) && state.paragraphStyleChangeEnabled) {
129390
+ const styleName = StylesManager.getStyleNameWithoutPrefix(parameter.styleName);
129318
129391
  let paragraphStyle = this.control.modelManager.model.getParagraphStyleByName(styleName);
129319
129392
  if (!paragraphStyle) {
129320
129393
  const presetStyle = StylesManager.getPresetParagraphStyleByName(styleName);
@@ -129323,12 +129396,12 @@ class ApplyStyleCommand extends CommandBase {
129323
129396
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName).clone();
129324
129397
  isPresetStyle = true;
129325
129398
  }
129326
- this.applyParagraphStyle(interval, paragraphStyle, isPresetStyle, options.subDocument);
129399
+ this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.keepDirectFormatting);
129327
129400
  }
129328
- else if (!StylesManager.isParagraphStyle(parameter) && state.characterStyleChangeEnabled) {
129329
- const styleName = StylesManager.getStyleNameWithoutPrefix(parameter);
129330
- if (interval.length == 0)
129331
- interval = options.subDocument.getWholeWordInterval(interval.start);
129401
+ else if (!StylesManager.isParagraphStyle(parameter.styleName) && state.characterStyleChangeEnabled) {
129402
+ const styleName = StylesManager.getStyleNameWithoutPrefix(parameter.styleName);
129403
+ if (subDocumentInterval.interval.length == 0)
129404
+ subDocumentInterval.interval = options.subDocument.getWholeWordInterval(subDocumentInterval.interval.start);
129332
129405
  let characterStyle = this.control.modelManager.model.getCharacterStyleByName(styleName);
129333
129406
  if (!characterStyle) {
129334
129407
  const presetStyle = StylesManager.getPresetCharacterStyleByName(styleName);
@@ -129337,9 +129410,9 @@ class ApplyStyleCommand extends CommandBase {
129337
129410
  characterStyle = presetStyle.clone();
129338
129411
  isPresetStyle = true;
129339
129412
  }
129340
- if (interval.length == 0) {
129413
+ if (subDocumentInterval.interval.length == 0) {
129341
129414
  if (isPresetStyle) {
129342
- let fontInfo = characterStyle.maskedCharacterProperties.fontInfo;
129415
+ const fontInfo = characterStyle.maskedCharacterProperties.fontInfo;
129343
129416
  if (fontInfo && fontInfo.measurer === undefined)
129344
129417
  characterStyle.maskedCharacterProperties.fontInfo = this.control.modelManager.model.cache.fontInfoCache.getItemByName(fontInfo.name);
129345
129418
  }
@@ -129347,50 +129420,56 @@ class ApplyStyleCommand extends CommandBase {
129347
129420
  executed = false;
129348
129421
  }
129349
129422
  else
129350
- this.applyCharacterStyle(interval, characterStyle, isPresetStyle, options.subDocument);
129423
+ this.applyCharacterStyle(subDocumentInterval, characterStyle, isPresetStyle);
129351
129424
  }
129352
129425
  this.history.endTransaction();
129353
129426
  return executed;
129354
129427
  }
129355
- applyCharacterStyle(interval, style, isPresetStyle, subDocument) {
129428
+ applyCharacterStyle(subDocumentInterval, style, isPresetStyle) {
129356
129429
  if (ControlOptions.isEnabled(this.control.modelManager.richOptions.control.characterStyle)) {
129357
- this.modelManipulator.style.applyCharacterStyle(new SubDocumentInterval(subDocument, interval), isPresetStyle ? this.control.modelManager.model.stylesManager.addCharacterStyle(style) : style, false);
129430
+ const characterStyle = isPresetStyle ? this.control.modelManager.model.stylesManager.addCharacterStyle(style) : style;
129431
+ this.modelManipulator.style.applyCharacterStyle(subDocumentInterval, characterStyle, false);
129358
129432
  }
129359
129433
  }
129360
- applyParagraphStyle(interval, style, isPresetStyle, subDocument) {
129361
- var count = this.calculateAffectedParagraphCount(interval, subDocument);
129434
+ applyParagraphStyle(subDocumentInterval, style, isPresetStyle, keepDirectFormatting = false) {
129435
+ const count = this.calculateAffectedParagraphCount(subDocumentInterval);
129362
129436
  if (count > 0 && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paragraphStyle)) {
129363
- var paragraphIndex = search.SearchUtils.normedInterpolationIndexOf(subDocument.paragraphs, p => p.startLogPosition.value, interval.start);
129364
- for (var i = 0; i < count; i++) {
129365
- var paragraph = subDocument.paragraphs[paragraphIndex + i];
129366
- var paragraphInterval = new fixed.FixedInterval(paragraph.startLogPosition.value, paragraph.length);
129367
- var modelManipulator = this.modelManipulator;
129368
- this.history.addAndRedo(new ApplyParagraphStyleHistoryItem(modelManipulator, new SubDocumentInterval(subDocument, paragraphInterval), isPresetStyle ? modelManipulator.model.stylesManager.addParagraphStyle(style) : style));
129369
- this.history.addAndRedo(new ParagraphUseValueHistoryItem(modelManipulator, new SubDocumentInterval(subDocument, paragraphInterval), 0));
129370
- this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, new SubDocumentInterval(subDocument, paragraphInterval), 0));
129371
- this.history.addAndRedo(new AddParagraphToListHistoryItem(this.modelManipulator, subDocument, paragraphIndex, NumberingList.NumberingListNotSettedIndex, -1));
129437
+ const { interval, subDocument } = subDocumentInterval;
129438
+ const paragraphs = subDocument.paragraphs;
129439
+ const paragraphIndex = search.SearchUtils.normedInterpolationIndexOf(paragraphs, p => p.startLogPosition.value, interval.start);
129440
+ for (let i = 0; i < count; i++) {
129441
+ const paragraph = paragraphs[paragraphIndex + i];
129442
+ const modelManipulator = this.modelManipulator;
129443
+ const paragraphSubDocumentInterval = new SubDocumentInterval(subDocument, paragraph.interval);
129444
+ style = isPresetStyle ? modelManipulator.model.stylesManager.addParagraphStyle(style) : style;
129445
+ this.history.addAndRedo(new ApplyParagraphStyleHistoryItem(modelManipulator, paragraphSubDocumentInterval, style));
129446
+ this.history.addAndRedo(new ParagraphUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
129447
+ if (!keepDirectFormatting)
129448
+ this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
129449
+ this.history.addAndRedo(new AddParagraphToListHistoryItem(modelManipulator, subDocument, paragraphIndex, NumberingList.NumberingListNotSettedIndex, -1));
129372
129450
  }
129373
129451
  }
129374
129452
  else
129375
- this.applyParagraphLinkedStyle(interval, style, isPresetStyle, subDocument);
129453
+ this.applyParagraphLinkedStyle(subDocumentInterval, style, isPresetStyle);
129376
129454
  }
129377
- applyParagraphLinkedStyle(interval, style, isPresetStyle, subDocument) {
129455
+ applyParagraphLinkedStyle(subDocumentInterval, style, isPresetStyle) {
129378
129456
  if (ControlOptions.isEnabled(this.control.modelManager.richOptions.control.characterStyle)) {
129379
129457
  if (!style.linkedStyle)
129380
- this.createCharacterStyle(style);
129381
- this.applyCharacterStyle(interval, style.linkedStyle, isPresetStyle, subDocument);
129458
+ this.addLinkedCharacterStyle(style);
129459
+ this.applyCharacterStyle(subDocumentInterval, style.linkedStyle, isPresetStyle);
129382
129460
  }
129383
129461
  }
129384
- createCharacterStyle(paragraphStyle) {
129385
- var style = new CharacterStyle(paragraphStyle.styleName + " Char", paragraphStyle.localizedName + " Char", false, false, false, false, paragraphStyle.maskedCharacterProperties);
129462
+ addLinkedCharacterStyle(paragraphStyle) {
129463
+ const style = new CharacterStyle(paragraphStyle.styleName + " Char", paragraphStyle.localizedName + " Char", false, false, false, false, paragraphStyle.maskedCharacterProperties);
129386
129464
  this.history.addAndRedo(new CreateStyleLinkHistoryItem(this.modelManipulator, style, paragraphStyle));
129387
129465
  }
129388
- calculateAffectedParagraphCount(interval, subDocument) {
129389
- var paragraphs = subDocument.getParagraphsByInterval(interval);
129466
+ calculateAffectedParagraphCount(subDocumentInterval) {
129467
+ const { interval, subDocument } = subDocumentInterval;
129468
+ const paragraphs = subDocument.getParagraphsByInterval(interval);
129390
129469
  if (paragraphs.length > 1)
129391
129470
  return paragraphs.length;
129392
- var paragraph = paragraphs[0];
129393
- var lastParagraphCharSelected = interval.length >= paragraph.length - 1;
129471
+ const paragraph = paragraphs[0];
129472
+ const lastParagraphCharSelected = interval.length >= paragraph.length - 1;
129394
129473
  if (interval.start === paragraph.startLogPosition.value && lastParagraphCharSelected || interval.length === 0)
129395
129474
  return 1;
129396
129475
  return 0;
@@ -135884,24 +135963,30 @@ class RemoveNextWordCommand extends RemoveWordCommandBase {
135884
135963
 
135885
135964
 
135886
135965
  class SetParagraphLevelCommandBase extends CommandBase {
135966
+ get commandManager() { return this.control.commandManager; }
135967
+ get modelManager() { return this.control.modelManager; }
135887
135968
  isEnabled() {
135888
- return super.isEnabled() && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paragraphFormatting);
135969
+ return super.isEnabled() && ControlOptions.isEnabled(this.modelManager.richOptions.control.paragraphFormatting);
135889
135970
  }
135890
135971
  getState() {
135891
135972
  const state = new SimpleCommandState(this.isEnabled());
135892
- state.value = this.control.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).getState().value == this.getLevel(null);
135973
+ state.value = this.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).getState().value == this.getLevel(null);
135893
135974
  return state;
135894
135975
  }
135895
135976
  executeCore(_state, options) {
135896
135977
  const level = this.getLevel(options.param);
135897
135978
  const styleName = level > 0 ? `${ParagraphStyle.headingStyleName} ${level}` : ParagraphStyle.normalStyleName;
135898
- let paragraphStyle = this.control.modelManager.model.getParagraphStyleByName(styleName);
135979
+ let paragraphStyle = this.modelManager.model.getParagraphStyleByName(styleName);
135899
135980
  if (!paragraphStyle)
135900
135981
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName);
135901
- if (paragraphStyle)
135902
- this.control.commandManager.getCommand(RichEditClientCommand.ChangeStyle).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, StylesManager.paragraphPrefix + styleName));
135903
- else
135904
- this.control.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, level));
135982
+ if (paragraphStyle) {
135983
+ const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName, keepDirectFormatting: true });
135984
+ this.commandManager.getCommand(RichEditClientCommand.ChangeStyle).execute(this.commandManager.isPublicApiCall, commandOptions);
135985
+ }
135986
+ else {
135987
+ const commandOptions = new CommandSimpleOptions(this.control, level);
135988
+ this.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).execute(this.commandManager.isPublicApiCall, commandOptions);
135989
+ }
135905
135990
  return true;
135906
135991
  }
135907
135992
  getRelatedCommands() {
@@ -144035,11 +144120,11 @@ class RichEditPublic {
144035
144120
  command.execute(true, type);
144036
144121
  }
144037
144122
  get readOnly() {
144038
- return this._native.core.readOnly == ReadOnlyMode.Persistent;
144123
+ return this._native.core.readOnly === ReadOnlyMode.Persistent;
144039
144124
  }
144040
144125
  set readOnly(value) {
144041
144126
  if (this.readOnly != value) {
144042
- this._native.core.readOnly = value ? ReadOnlyMode.Persistent : ReadOnlyMode.None;
144127
+ this._native.core.setPersistentReadOnly(value);
144043
144128
  this._native.core.barHolder.updateItemsState();
144044
144129
  this._native.core.horizontalRulerControl.update();
144045
144130
  this._native.core.beginUpdate();