devexpress-richedit 25.1.1-alpha → 25.1.3

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 (132) 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.css +1 -1
  9. package/dist/dx.richedit.d.ts +1 -2
  10. package/dist/dx.richedit.js +1732 -1362
  11. package/dist/dx.richedit.min.js +2 -2
  12. package/index.d.ts +1 -1
  13. package/index.js +1 -1
  14. package/lib/client/client-rich-edit.js +3 -3
  15. package/lib/client/commands/commands.js +0 -3
  16. package/lib/client/commands/mail-merge-command.js +2 -1
  17. package/lib/client/formats/docx/export/data.d.ts +5 -1
  18. package/lib/client/formats/docx/export/data.js +3 -2
  19. package/lib/client/formats/docx/export/exporter.d.ts +2 -3
  20. package/lib/client/formats/docx/export/exporter.js +3 -3
  21. package/lib/client/formats/docx/export/exporters/base/sections.d.ts +0 -1
  22. package/lib/client/formats/docx/export/exporters/base/sections.js +2 -10
  23. package/lib/client/formats/docx/export/exporters/base/table/table.d.ts +1 -1
  24. package/lib/client/formats/docx/export/exporters/base/table/table.js +4 -4
  25. package/lib/client/formats/docx/import/destination/paragraph-properties/properties/paragraph-spacing-destination.js +6 -4
  26. package/lib/client/model-api/character-properties.js +13 -17
  27. package/lib/client/model-api/document.js +2 -0
  28. package/lib/client/model-api/formats/exporter.js +2 -2
  29. package/lib/client/model-api/images/images.js +1 -1
  30. package/lib/client/model-api/sub-document.js +1 -1
  31. package/lib/client/public/commands/enum.d.ts +1 -2
  32. package/lib/client/public/commands/enum.js +0 -1
  33. package/lib/client/public/options.d.ts +1 -0
  34. package/lib/client/public/rich-edit.js +2 -2
  35. package/lib/client/utils/focus-helper.js +22 -5
  36. package/lib/common/canvas/canvas-manager.js +38 -24
  37. package/lib/common/canvas/canvas-scroll-info.d.ts +6 -3
  38. package/lib/common/canvas/canvas-scroll-info.js +9 -4
  39. package/lib/common/canvas/canvas-scroll-manager.d.ts +4 -1
  40. package/lib/common/canvas/canvas-scroll-manager.js +28 -20
  41. package/lib/common/canvas/canvas-size-info.d.ts +4 -2
  42. package/lib/common/canvas/canvas-size-info.js +3 -5
  43. package/lib/common/canvas/renderes/canvas-listener/print-layout-view-canvas-listener.js +2 -2
  44. package/lib/common/canvas/renderes/common/document-renderer.d.ts +4 -1
  45. package/lib/common/canvas/renderes/common/document-renderer.js +15 -12
  46. package/lib/common/canvas/renderes/view-manager.d.ts +5 -1
  47. package/lib/common/canvas/renderes/view-manager.js +16 -7
  48. package/lib/common/commands/client-command.d.ts +1 -2
  49. package/lib/common/commands/client-command.js +0 -1
  50. package/lib/common/commands/command-manager.js +0 -2
  51. package/lib/common/commands/document/print-document-on-client-command.d.ts +2 -0
  52. package/lib/common/commands/document/print-document-on-client-command.js +46 -18
  53. package/lib/common/commands/layout/apply-style-command.d.ts +2 -2
  54. package/lib/common/commands/layout/apply-style-command.js +3 -4
  55. package/lib/common/commands/toc/set-paragraph-level-command.js +1 -1
  56. package/lib/common/formats/i-document-exporter.d.ts +3 -0
  57. package/lib/common/formats/rtf/export/exporter.d.ts +2 -3
  58. package/lib/common/formats/rtf/export/exporter.js +3 -3
  59. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.d.ts +4 -2
  60. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.js +13 -9
  61. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.d.ts +3 -2
  62. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.js +4 -4
  63. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.d.ts +2 -1
  64. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.js +2 -2
  65. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.d.ts +4 -2
  66. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.js +16 -9
  67. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.d.ts +2 -1
  68. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.js +2 -2
  69. package/lib/common/formats/rtf/import/table/normalization/apply-use-values.d.ts +6 -0
  70. package/lib/common/formats/rtf/import/table/normalization/apply-use-values.js +90 -0
  71. package/lib/common/formats/rtf/import/table/table-converter.js +7 -2
  72. package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -2
  73. package/lib/common/formats/rtf/importer-in-subdocument.js +4 -3
  74. package/lib/common/input-controller.d.ts +5 -5
  75. package/lib/common/input-controller.js +16 -12
  76. package/lib/common/layout/document-layout.d.ts +5 -0
  77. package/lib/common/layout/document-layout.js +13 -0
  78. package/lib/common/layout/main-structures/layout-page-area.d.ts +3 -0
  79. package/lib/common/layout/main-structures/layout-page-area.js +6 -0
  80. package/lib/common/layout/main-structures/layout-page.d.ts +3 -0
  81. package/lib/common/layout/main-structures/layout-page.js +8 -0
  82. package/lib/common/layout/main-structures/layout-row.js +1 -2
  83. package/lib/common/layout-formatter/floating/position-calculators/horizontal.d.ts +1 -0
  84. package/lib/common/layout-formatter/floating/position-calculators/horizontal.js +16 -12
  85. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.d.ts +4 -1
  86. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.js +36 -2
  87. package/lib/common/layout-formatter/row/states.js +0 -2
  88. package/lib/common/layout-formatter/row/tab-info.js +5 -4
  89. package/lib/common/layout-formatter/row/word-holder.js +1 -1
  90. package/lib/common/layout-formatter/table/info/table-info.d.ts +0 -1
  91. package/lib/common/layout-formatter/table/info/table-info.js +2 -18
  92. package/lib/common/layout-formatter/table/size-compressor.js +9 -2
  93. package/lib/common/layout-formatter/table/table-alignment-applier.js +0 -2
  94. package/lib/common/model/borders/border-info.js +1 -1
  95. package/lib/common/model/caches/images.d.ts +4 -1
  96. package/lib/common/model/caches/images.js +6 -2
  97. package/lib/common/model/changes/change.d.ts +2 -1
  98. package/lib/common/model/changes/enums.d.ts +2 -1
  99. package/lib/common/model/changes/enums.js +1 -0
  100. package/lib/common/model/changes/model/zoom-level.d.ts +8 -0
  101. package/lib/common/model/changes/model/zoom-level.js +8 -0
  102. package/lib/common/model/character/character-properties.d.ts +1 -1
  103. package/lib/common/model/character/character-properties.js +14 -2
  104. package/lib/common/model/creator/creator.js +6 -0
  105. package/lib/common/model/fields/field.d.ts +1 -1
  106. package/lib/common/model/fields/field.js +4 -3
  107. package/lib/common/model/fields/tree-creator.js +1 -1
  108. package/lib/common/model/history/items/character-properties-history-items.d.ts +2 -1
  109. package/lib/common/model/history/items/character-properties-history-items.js +3 -2
  110. package/lib/common/model/manipulators/character-properties-manipulator.js +2 -2
  111. package/lib/common/model/manipulators/i-properties-manipulator.d.ts +1 -1
  112. package/lib/common/model/manipulators/model-manipulator.d.ts +2 -1
  113. package/lib/common/model/manipulators/model-manipulator.js +4 -0
  114. package/lib/common/model/manipulators/picture-manipulator/picture-manipulator.js +2 -2
  115. package/lib/common/model/options/fonts.d.ts +1 -1
  116. package/lib/common/model/paragraph/paragraph-style.d.ts +2 -1
  117. package/lib/common/model/paragraph/paragraph-style.js +2 -1
  118. package/lib/common/model/tables/secondary-structures/table-base-structures.d.ts +2 -1
  119. package/lib/common/model/tables/secondary-structures/table-base-structures.js +1 -0
  120. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.d.ts +1 -1
  121. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.js +22 -25
  122. package/lib/common/rich-edit-core.js +18 -18
  123. package/lib/common/ui/ruler/controls/ruler.js +3 -7
  124. package/lib/common/ui/ruler/controls/vertical-line.js +2 -1
  125. package/lib/common/ui/ruler/ruler.js +2 -0
  126. package/lib/common/utils/mixed-size.d.ts +27 -0
  127. package/lib/common/utils/mixed-size.js +91 -0
  128. package/lib/common/utils/size-utils.d.ts +14 -7
  129. package/lib/common/utils/size-utils.js +43 -18
  130. package/package.json +3 -3
  131. package/lib/common/commands/layout/toggle-allow-zoom-command.d.ts +0 -7
  132. package/lib/common/commands/layout/toggle-allow-zoom-command.js +0 -17
@@ -53,7 +53,8 @@ export declare abstract class TabInfoBase<T extends TabInfoBase<T>> implements I
53
53
  }
54
54
  export declare class TabInfo extends TabInfoBase<TabInfo> {
55
55
  position: number;
56
- constructor(position: number, alignment: TabAlign, leader: TabLeaderType, deleted: boolean, isDefault: boolean);
56
+ readonly isParagraphIndent: boolean;
57
+ constructor(position: number, alignment: TabAlign, leader: TabLeaderType, deleted: boolean, isDefault: boolean, isParagraphIndent?: boolean);
57
58
  equals(obj: TabInfo): boolean;
58
59
  clone(): TabInfo;
59
60
  }
@@ -123,9 +123,10 @@ export class TabInfoBase {
123
123
  }
124
124
  }
125
125
  export class TabInfo extends TabInfoBase {
126
- constructor(position, alignment, leader, deleted, isDefault) {
126
+ constructor(position, alignment, leader, deleted, isDefault, isParagraphIndent = false) {
127
127
  super(alignment, leader, deleted, isDefault);
128
128
  this.position = position;
129
+ this.isParagraphIndent = isParagraphIndent;
129
130
  }
130
131
  equals(obj) {
131
132
  return super.equals(obj) && this.position == obj.position;
@@ -94,5 +94,6 @@ export declare enum ConditionalTableStyleFormatting {
94
94
  TopRightCell = 8,
95
95
  TopLeftCell = 4,
96
96
  BottomRightCell = 2,
97
- BottomLeftCell = 1
97
+ BottomLeftCell = 1,
98
+ None = 0
98
99
  }
@@ -124,4 +124,5 @@ export var ConditionalTableStyleFormatting;
124
124
  ConditionalTableStyleFormatting[ConditionalTableStyleFormatting["TopLeftCell"] = 4] = "TopLeftCell";
125
125
  ConditionalTableStyleFormatting[ConditionalTableStyleFormatting["BottomRightCell"] = 2] = "BottomRightCell";
126
126
  ConditionalTableStyleFormatting[ConditionalTableStyleFormatting["BottomLeftCell"] = 1] = "BottomLeftCell";
127
+ ConditionalTableStyleFormatting[ConditionalTableStyleFormatting["None"] = 0] = "None";
127
128
  })(ConditionalTableStyleFormatting || (ConditionalTableStyleFormatting = {}));
@@ -32,7 +32,7 @@ export declare class MouseHandlerDefaultState extends MouseHandlerStateBase {
32
32
  private shouldBeginDragExistingSelection;
33
33
  private selectImage;
34
34
  private beginDragExistingSelection;
35
- selectFloatingObject(box: LayoutAnchoredObjectBox): void;
35
+ selectFloatingObject(box: LayoutAnchoredObjectBox): boolean;
36
36
  }
37
37
  export declare class MouseHandlerHelper {
38
38
  static selectParentsTextBox(control: IRichEditControl): void;
@@ -168,40 +168,31 @@ export class MouseHandlerDefaultState extends MouseHandlerStateBase {
168
168
  this.processMouseDownOnMaxDetailsLevel(evt, htr, activeSubDocument);
169
169
  }
170
170
  processMouseDownOnMaxDetailsLevel(evt, htr, activeSubDocument) {
171
+ const selection = this.handler.control.selection;
171
172
  if (htr.floatingObject) {
172
- if (htr.floatingObject.belongsToSubDocId != this.handler.control.selection.activeSubDocument.id)
173
- MouseHandlerHelper.changeActiveSubDocumentToParent(this.handler.control);
174
173
  const box = htr.floatingObject;
175
- this.selectFloatingObject(box);
176
- const specRunInfo = this.handler.control.selection.specialRunInfo;
177
- if (specRunInfo.isSelectedAnchorObject) {
178
- if (box.getType() == LayoutBoxType.AnchorTextBox &&
179
- HitTestManager.isPointInTexBoxArea(evt.layoutPoint, box, activeSubDocument.isTextBox() ? 0 : box.rotationInRadians)) {
174
+ const rotationAngle = activeSubDocument.isTextBox() ? 0 : box.rotationInRadians;
175
+ if (box.getType() == LayoutBoxType.AnchorTextBox && HitTestManager.isPointInTexBoxArea(evt.layoutPoint, box, rotationAngle)) {
176
+ const textbox = box;
177
+ if (textbox.internalSubDocId !== selection.activeSubDocument.id && this.selectFloatingObject(box)) {
180
178
  this.handler.control.commandManager.getCommand(RichEditClientCommand.ChangeActiveSubDocumentToTextBox).execute(this.handler.control.commandManager.isPublicApiCall);
181
179
  this.handler.boxVisualizerManager.resizeBoxVisualizer.show(htr.pageIndex, null, null, null, box);
182
- htr = this.handler.control.hitTestManager.calculate(evt.layoutPoint, DocumentLayoutDetailsLevel.Max, this.handler.control.selection.activeSubDocument);
183
- }
184
- else {
185
- if (this.resizeRotationChecker(() => {
186
- const dragFloatingObjectState = new MouseHandlerDragFloatingObjectState(this.handler, evt);
187
- this.handler.switchState(new MouseHandlerBeginDragHelperState(evt.layoutPoint, this.handler, dragFloatingObjectState));
188
- }))
189
- return;
190
- else {
191
- if (specRunInfo.isPictureSelected()) {
192
- this.handler.control.selection.setSelection(new SetSelectionParams()
193
- .setInterval(new FixedInterval(specRunInfo.getPicturePosition(), 1)));
194
- return;
195
- }
196
- }
180
+ htr = this.handler.control.hitTestManager.calculate(evt.layoutPoint, DocumentLayoutDetailsLevel.Max, selection.activeSubDocument);
197
181
  }
198
182
  }
183
+ else {
184
+ if (this.selectFloatingObject(box) && this.resizeRotationChecker(() => {
185
+ const dragFloatingObjectState = new MouseHandlerDragFloatingObjectState(this.handler, evt);
186
+ this.handler.switchState(new MouseHandlerBeginDragHelperState(evt.layoutPoint, this.handler, dragFloatingObjectState));
187
+ }))
188
+ return;
189
+ }
199
190
  }
200
191
  if (Browser.TouchUI && htr.subDocument.isMain() && htr.exactlyDetailLevel < DocumentLayoutDetailsLevel.PageArea) {
201
192
  if (htr.deviations[DocumentLayoutDetailsLevel.PageArea] & HitTestDeviation.Top || htr.deviations[DocumentLayoutDetailsLevel.PageArea] & HitTestDeviation.Bottom)
202
193
  this.handler.control.viewManager.canvasScrollManager.waitForDblClick();
203
194
  }
204
- if (evt.button === MouseButton.Right && this.handler.control.selection.lastSelectedInterval.contains(htr.getPosition()))
195
+ if (evt.button === MouseButton.Right && selection.lastSelectedInterval.contains(htr.getPosition()))
205
196
  return;
206
197
  if (this.shouldSelectEntireTableColumn(htr))
207
198
  this.beginSelectEntireTableColumn(htr, evt);
@@ -216,7 +207,7 @@ export class MouseHandlerDefaultState extends MouseHandlerStateBase {
216
207
  this.beginSelectEntireTableCell(htr, evt);
217
208
  }
218
209
  else if (this.isLeftArea(htr, evt)) {
219
- if (evt.modifiers & ModifierKey.Ctrl && this.handler.control.selection.isCollapsed())
210
+ if (evt.modifiers & ModifierKey.Ctrl && selection.isCollapsed())
220
211
  this.handler.control.commandManager.getCommand(RichEditClientCommand.SelectAll).execute(this.handler.control.commandManager.isPublicApiCall, htr.getPosition());
221
212
  else if (this.isLeftAreaOffset(htr, evt))
222
213
  this.beginLineSelection(htr, evt);
@@ -424,8 +415,14 @@ export class MouseHandlerDefaultState extends MouseHandlerStateBase {
424
415
  this.handler.switchState(state);
425
416
  }
426
417
  selectFloatingObject(box) {
418
+ const selection = this.handler.control.selection;
419
+ if (box.belongsToSubDocId !== selection.activeSubDocument.id)
420
+ MouseHandlerHelper.changeActiveSubDocumentToParent(this.handler.control);
421
+ if (box.belongsToSubDocId !== selection.activeSubDocument.id)
422
+ return false;
427
423
  const pos = this.handler.control.layout.anchorObjectsPositionInfo.getPosition(box.objectId);
428
- this.handler.control.selection.setSelection(new SetSelectionParams().setInterval(new FixedInterval(pos, 1)));
424
+ selection.setSelection(new SetSelectionParams().setInterval(new FixedInterval(pos, 1)));
425
+ return selection.specialRunInfo.isSelectedAnchorObject;
429
426
  }
430
427
  }
431
428
  export class MouseHandlerHelper {
@@ -44,7 +44,7 @@ import { HorizontalRulerControl } from './ui/ruler/ruler';
44
44
  import { SearchManager } from './ui/search-manager';
45
45
  import { isDefined } from '@devexpress/utils/lib/utils/common';
46
46
  export class RichEditCore {
47
- get isReadOnlyPersistent() { return this.readOnly == ReadOnlyMode.Persistent; }
47
+ get isReadOnlyPersistent() { return this.readOnly === ReadOnlyMode.Persistent; }
48
48
  get model() { return this.modelManager.model; }
49
49
  get isDisposed() {
50
50
  return this._isDisposed;
@@ -139,15 +139,19 @@ export class RichEditCore {
139
139
  ]);
140
140
  this.modelManager.modelManipulator.clearListeners();
141
141
  this.modelManager.history.clear();
142
- this.modelManager.modelManipulator.modelListeners.push(this.inputPositionModelChangesListener);
143
- this.modelManager.modelManipulator.modelListeners.push(this.layoutFormatterManager.modelChangesListener);
144
- this.modelManager.modelManipulator.modelListeners.push(this.selectionModelChangesListener);
145
- this.modelManager.modelManipulator.modelListeners.push(new SpellCheckerModelChangesListener(this.spellChecker));
142
+ this.modelManager.modelManipulator.addModelListener(this.inputPositionModelChangesListener);
143
+ this.modelManager.modelManipulator.addModelListener(this.layoutFormatterManager.modelChangesListener);
144
+ this.modelManager.modelManipulator.addModelListener(this.selectionModelChangesListener);
145
+ this.modelManager.modelManipulator.addModelListener(new SpellCheckerModelChangesListener(this.spellChecker));
146
146
  if (this.barHolder.ribbon)
147
- this.modelManager.modelManipulator.modelListeners.push(this.barHolder.ribbon);
148
- this.modelManager.modelManipulator.modelListeners.push(this.barHolder.contextMenu);
149
- this.modelManager.modelManipulator.modelListeners.push(this.horizontalRulerControl);
150
- this.modelManager.modelManipulator.modelListeners.push(this.selectionFormatter);
147
+ this.modelManager.modelManipulator.addModelListener(this.barHolder.ribbon);
148
+ this.modelManager.modelManipulator.addModelListener(this.barHolder.contextMenu);
149
+ this.modelManager.modelManipulator.addModelListener(this.horizontalRulerControl);
150
+ this.modelManager.modelManipulator.addModelListener(this.selectionFormatter);
151
+ this.modelManager.modelManipulator.addModelListener(this.viewManager);
152
+ this.modelManager.modelManipulator.addModelListener(this.viewManager.canvasManager.simpleViewCanvasSizeManager);
153
+ this.modelManager.modelManipulator.addModelListener(this.viewManager.canvasScrollManager);
154
+ this.modelManager.modelManipulator.addModelListener(this.viewManager.scroll);
151
155
  this.registerFontChangesListeners();
152
156
  this.selection.onChanged.add(this.searchManager);
153
157
  this.selection.onChanged.add(this.boxVisualizerManager.resizeBoxVisualizer);
@@ -164,8 +168,8 @@ export class RichEditCore {
164
168
  this.selection.onChanged.add(this.globalEventDispatcher);
165
169
  this.selection.onChanged.add(this.barHolder.publicUiChangesListener);
166
170
  this.registerActiveContextTabManager();
167
- this.modelManager.modelManipulator.modelListeners.push(this.globalEventDispatcher);
168
- this.modelManager.modelManipulator.modelListeners.push(this.barHolder.publicUiChangesListener);
171
+ this.modelManager.modelManipulator.addModelListener(this.globalEventDispatcher);
172
+ this.modelManager.modelManipulator.addModelListener(this.barHolder.publicUiChangesListener);
169
173
  this.inputController.initExporter();
170
174
  }
171
175
  dispose() {
@@ -253,8 +257,8 @@ export class RichEditCore {
253
257
  this.readOnly = ReadOnlyMode.Persistent;
254
258
  else if (!readOnly && this.readOnly === ReadOnlyMode.Persistent) {
255
259
  this.readOnly = ReadOnlyMode.None;
256
- this.inputController.inputEditor.initializeIfNotReadOnly();
257
260
  }
261
+ this.inputController.inputEditor.initializeEditableStateCore();
258
262
  }
259
263
  setWorkSession(sessionGuid, documentInfo) {
260
264
  this.sessionGuid = sessionGuid;
@@ -288,12 +292,7 @@ export class RichEditCore {
288
292
  }
289
293
  closeDocument() {
290
294
  this.selection.onChanged.remove(this.globalEventDispatcher);
291
- for (let ind = 0; ind < this.modelManager.modelManipulator.modelListeners.length; ind++) {
292
- if (this.modelManager.modelManipulator.modelListeners[ind] == this.globalEventDispatcher) {
293
- this.modelManager.modelManipulator.modelListeners.splice(ind, 1);
294
- break;
295
- }
296
- }
295
+ this.modelManager.modelManipulator.removeModelListener(this.globalEventDispatcher);
297
296
  this.barHolder.setEnabled(false);
298
297
  if (this.horizontalRulerControl)
299
298
  this.horizontalRulerControl.setEnable(false);
@@ -380,6 +379,7 @@ export class RichEditCore {
380
379
  pictureRenderer: this.viewManager.renderer,
381
380
  uiUnitConverter: this.uiUnitConverter,
382
381
  lastMaxNumPages: this.layout.lastMaxNumPages,
382
+ grids: this.layout.grids,
383
383
  pageIndex: this.selection.pageIndex,
384
384
  sessionGuid: this.sessionGuid,
385
385
  clientGuid: this.clientGuid,
@@ -41,13 +41,9 @@ export class RulerControl extends RulerBase {
41
41
  }
42
42
  adjust() {
43
43
  const viewWidth = this.controls.canvas.clientWidth;
44
- if (viewWidth > this.pageWidth)
45
- this.initialMarginLeftElement = (viewWidth - this.pageWidth - RULLER_NUMBER_CORRECTION * 2) / 2;
46
- else {
47
- const paddingLeft = DomUtils.pxToInt(DomUtils.getCurrentStyle(this.controls.canvas).paddingLeft);
48
- const pageAreaBorderWidth = (this.controls.canvas.scrollWidth - paddingLeft - this.pageWidth) / 2;
49
- this.initialMarginLeftElement = paddingLeft + pageAreaBorderWidth - RULLER_NUMBER_CORRECTION;
50
- }
44
+ const paddingLeft = DomUtils.pxToInt(DomUtils.getCurrentStyle(this.controls.canvas).paddingLeft);
45
+ const minValue = paddingLeft - RULLER_NUMBER_CORRECTION;
46
+ this.initialMarginLeftElement = Math.max((viewWidth - this.pageWidth - RULLER_NUMBER_CORRECTION * 2) / 2, minValue);
51
47
  this.rootElement.style.left = this.calculateLeftOffset();
52
48
  this.setPaddings();
53
49
  this.canHandleScroll = this.controls.canvas.scrollWidth > this.controls.canvas.offsetWidth;
@@ -1,6 +1,7 @@
1
1
  import { DomUtils } from '@devexpress/utils/lib/utils/dom';
2
2
  import { DocumentRenderer } from '../../../canvas/renderes/common/document-renderer';
3
3
  import { RULLER_NUMBER_CORRECTION } from '../settings';
4
+ import { SizeUtils } from '../../../../common/utils/size-utils';
4
5
  export const TABLE_COLUMN_SEPARATOR_RULER_LINE_CLASS_NAME = " table";
5
6
  export var SnapTo;
6
7
  (function (SnapTo) {
@@ -33,7 +34,7 @@ export class RulerVerticalLineControl {
33
34
  DomUtils.addClassName(this.rootElement, TABLE_COLUMN_SEPARATOR_RULER_LINE_CLASS_NAME);
34
35
  else
35
36
  DomUtils.removeClassName(this.rootElement, TABLE_COLUMN_SEPARATOR_RULER_LINE_CLASS_NAME);
36
- this.rootElement.style.height = this.canvas.clientHeight + "px";
37
+ this.rootElement.style.height = SizeUtils.getClientHeight(this.canvas) + "px";
37
38
  this.rootElement.style.top = this.canvas.offsetTop + "px";
38
39
  this.rulerControlLeft = this.rulerControlElement.offsetLeft;
39
40
  this.rulerControlWidth = this.rulerControlElement.offsetWidth;
@@ -146,6 +146,8 @@ export class HorizontalRulerControl extends BatchUpdatableObject {
146
146
  case ModelChangeType.TableCellRemoved:
147
147
  case ModelChangeType.TableCellInserted:
148
148
  return HorizontalRulerEventType.FullReset;
149
+ case ModelChangeType.ZoomLevelChanged:
150
+ return HorizontalRulerEventType.FullReset;
149
151
  default:
150
152
  return HorizontalRulerEventType.None;
151
153
  }
@@ -0,0 +1,27 @@
1
+ export declare class MixedSize {
2
+ static fromLayout(value: number): MixedSize;
3
+ static fromUI(value: number): MixedSize;
4
+ private _UISizePart;
5
+ private _UISize;
6
+ private _layoutSizePart;
7
+ private _layoutSize;
8
+ private _scale;
9
+ private _scaleIsSpecified;
10
+ get UISize(): number;
11
+ get LayoutSize(): number;
12
+ private get UISizePart();
13
+ private set UISizePart(value);
14
+ private get LayoutSizePart();
15
+ private set LayoutSizePart(value);
16
+ private onSizeChanged;
17
+ addUISize(value: number): this;
18
+ addLayoutSize(value: number): this;
19
+ addSize(value: MixedSize): this;
20
+ subtractUISize(value: number): this;
21
+ subtractLayoutSize(value: number): this;
22
+ subtractSize(value: MixedSize): this;
23
+ private checkSizeHasSameScale;
24
+ private checkScaleIsSpecified;
25
+ useScale(value: number): this;
26
+ clear(): this;
27
+ }
@@ -0,0 +1,91 @@
1
+ import { isDefined } from "@devexpress/utils/lib/utils/common";
2
+ export class MixedSize {
3
+ constructor() {
4
+ this._UISizePart = 0;
5
+ this._layoutSizePart = 0;
6
+ this._scale = 1;
7
+ this._scaleIsSpecified = false;
8
+ }
9
+ static fromLayout(value) {
10
+ return new MixedSize().addLayoutSize(value);
11
+ }
12
+ static fromUI(value) {
13
+ return new MixedSize().addUISize(value);
14
+ }
15
+ get UISize() {
16
+ this.checkScaleIsSpecified();
17
+ if (!isDefined(this._UISize))
18
+ this._UISize = this._layoutSizePart * this._scale + this._UISizePart;
19
+ return this._UISize;
20
+ }
21
+ get LayoutSize() {
22
+ this.checkScaleIsSpecified();
23
+ if (!isDefined(this._layoutSize))
24
+ this._layoutSize = this._layoutSizePart + this._UISizePart / this._scale;
25
+ return this._layoutSize;
26
+ }
27
+ get UISizePart() {
28
+ return this._UISizePart;
29
+ }
30
+ set UISizePart(value) {
31
+ this._UISizePart = value;
32
+ this.onSizeChanged();
33
+ }
34
+ get LayoutSizePart() {
35
+ return this._layoutSizePart;
36
+ }
37
+ set LayoutSizePart(value) {
38
+ this._layoutSizePart = value;
39
+ this.onSizeChanged();
40
+ }
41
+ onSizeChanged() {
42
+ this._UISize = null;
43
+ this._layoutSize = null;
44
+ }
45
+ addUISize(value) {
46
+ this.UISizePart += value;
47
+ return this;
48
+ }
49
+ addLayoutSize(value) {
50
+ this.LayoutSizePart += value;
51
+ return this;
52
+ }
53
+ addSize(value) {
54
+ this.checkSizeHasSameScale(value);
55
+ this.addLayoutSize(value._layoutSizePart);
56
+ this.addUISize(value._UISizePart);
57
+ return this;
58
+ }
59
+ subtractUISize(value) {
60
+ this.UISizePart -= value;
61
+ return this;
62
+ }
63
+ subtractLayoutSize(value) {
64
+ this.LayoutSizePart -= value;
65
+ return this;
66
+ }
67
+ subtractSize(value) {
68
+ this.checkSizeHasSameScale(value);
69
+ this.subtractLayoutSize(value._layoutSizePart);
70
+ this.subtractUISize(value._UISizePart);
71
+ return this;
72
+ }
73
+ checkSizeHasSameScale(size) {
74
+ if (size._scaleIsSpecified && size._scale !== this._scale)
75
+ throw new Error("The size has a different scale and cannot be added.");
76
+ }
77
+ checkScaleIsSpecified() {
78
+ if (!this._scaleIsSpecified)
79
+ console.warn("MixedSize is used without specifying the scale.");
80
+ }
81
+ useScale(value) {
82
+ this._scale = value;
83
+ this._scaleIsSpecified = true;
84
+ return this;
85
+ }
86
+ clear() {
87
+ this.UISizePart = 0;
88
+ this.LayoutSizePart = 0;
89
+ return this;
90
+ }
91
+ }
@@ -1,11 +1,17 @@
1
+ type ScrollbarsWidth = {
2
+ horizontal: number;
3
+ vertical: number;
4
+ };
1
5
  export declare class SizeUtils {
2
- static getWidthInfo(element: Element): DimensionInfo;
3
- static getClientWidth(element: Element): number;
4
- static getHeightInfo(element: Element): DimensionInfo;
5
- static getClientHeight(element: Element): number;
6
- static getOffsetSize(element: Element): DOMRect;
7
- static getOffsetWidth(element: Element): number;
8
- static getOffsetHeight(element: Element): number;
6
+ private static _scrollbarsWidth;
7
+ static getScrollbarsWidth(): ScrollbarsWidth;
8
+ static getWidthInfo(element: HTMLElement): DimensionInfo;
9
+ static getClientWidth(element: HTMLElement): number;
10
+ static getHeightInfo(element: HTMLElement): DimensionInfo;
11
+ static getClientHeight(element: HTMLElement): number;
12
+ static getOffsetSize(element: HTMLElement): DOMRect;
13
+ static getOffsetWidth(element: HTMLElement): number;
14
+ static getOffsetHeight(element: HTMLElement): number;
9
15
  }
10
16
  export declare class DimensionInfo {
11
17
  readonly offsetSize: number;
@@ -13,3 +19,4 @@ export declare class DimensionInfo {
13
19
  readonly scrollbarSize: number;
14
20
  constructor(offsetSize: number, clientSize: number, scrollbarSize: number);
15
21
  }
22
+ export {};
@@ -1,28 +1,53 @@
1
+ import { isDefined } from "@devexpress/utils/lib/utils/common";
1
2
  export class SizeUtils {
3
+ static getScrollbarsWidth() {
4
+ if (!isDefined(this._scrollbarsWidth)) {
5
+ const scrollDiv = document.createElement('div');
6
+ scrollDiv.style.visibility = 'hidden';
7
+ scrollDiv.style.overflow = 'scroll';
8
+ scrollDiv.style.position = 'absolute';
9
+ scrollDiv.style.top = '-9999px';
10
+ scrollDiv.style.width = '100px';
11
+ scrollDiv.style.height = '100px';
12
+ document.body.appendChild(scrollDiv);
13
+ const innerDiv = document.createElement('div');
14
+ innerDiv.style.width = '100%';
15
+ innerDiv.style.height = '100%';
16
+ scrollDiv.appendChild(innerDiv);
17
+ this._scrollbarsWidth = {
18
+ horizontal: SizeUtils.getOffsetHeight(scrollDiv) - SizeUtils.getOffsetHeight(innerDiv),
19
+ vertical: SizeUtils.getOffsetWidth(scrollDiv) - SizeUtils.getOffsetWidth(innerDiv)
20
+ };
21
+ scrollDiv.remove();
22
+ }
23
+ return this._scrollbarsWidth;
24
+ }
2
25
  static getWidthInfo(element) {
3
- const offsetSize = SizeUtils.getOffsetWidth(element);
4
- const style = getComputedStyle(element);
5
- const inset = parseCssValue(style.borderLeftWidth)
6
- + parseCssValue(style.borderRightWidth)
7
- + parseCssValue(style.paddingLeft)
8
- + parseCssValue(style.paddingRight);
9
- const sizeWithScrollBar = offsetSize - inset;
10
- const scrollBarSize = Math.round(sizeWithScrollBar) - element.clientWidth;
11
- return new DimensionInfo(offsetSize, sizeWithScrollBar - scrollBarSize, scrollBarSize);
26
+ const computedStyle = getComputedStyle(element);
27
+ const offsetWidth = this.getOffsetWidth(element);
28
+ const offsetWidthWithoutBorder = offsetWidth
29
+ - parseCssValue(computedStyle.borderLeftWidth)
30
+ - parseCssValue(computedStyle.borderRightWidth);
31
+ let scrollbarWidth = 0;
32
+ if (Math.round(offsetWidthWithoutBorder) > element.clientWidth)
33
+ scrollbarWidth = SizeUtils.getScrollbarsWidth().vertical;
34
+ const clientWidth = offsetWidthWithoutBorder - scrollbarWidth;
35
+ return new DimensionInfo(offsetWidth, clientWidth, scrollbarWidth);
12
36
  }
13
37
  static getClientWidth(element) {
14
38
  return this.getWidthInfo(element).clientSize;
15
39
  }
16
40
  static getHeightInfo(element) {
17
- const offsetSize = SizeUtils.getOffsetHeight(element);
18
- const style = getComputedStyle(element);
19
- const inset = parseCssValue(style.borderTopWidth)
20
- + parseCssValue(style.borderBottomWidth)
21
- + parseCssValue(style.paddingTop)
22
- + parseCssValue(style.paddingBottom);
23
- const sizeWithScrollBar = offsetSize - inset;
24
- const scrollBarSize = Math.round(sizeWithScrollBar) - element.clientHeight;
25
- return new DimensionInfo(offsetSize, sizeWithScrollBar - scrollBarSize, scrollBarSize);
41
+ const computedStyle = getComputedStyle(element);
42
+ const offsetHeight = this.getOffsetHeight(element);
43
+ const offsetHeightWithoutBorder = offsetHeight
44
+ - parseCssValue(computedStyle.borderTopWidth)
45
+ - parseCssValue(computedStyle.borderBottomWidth);
46
+ let scrollbarWidth = 0;
47
+ if (Math.round(offsetHeightWithoutBorder) > element.clientHeight)
48
+ scrollbarWidth = SizeUtils.getScrollbarsWidth().horizontal;
49
+ const clientHeight = offsetHeightWithoutBorder - scrollbarWidth;
50
+ return new DimensionInfo(offsetHeight, clientHeight, scrollbarWidth);
26
51
  }
27
52
  static getClientHeight(element) {
28
53
  return this.getHeightInfo(element).clientSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devexpress-richedit",
3
- "version": "25.1.1-alpha",
3
+ "version": "25.1.3",
4
4
  "homepage": "https://www.devexpress.com/",
5
5
  "bugs": "https://www.devexpress.com/support/",
6
6
  "author": "Developer Express Inc.",
@@ -14,8 +14,8 @@
14
14
  "build-nspell": "webpack --mode production --config=bin/nspell.webpack.config.js"
15
15
  },
16
16
  "peerDependencies": {
17
- "devextreme": "25.1.1-alpha",
18
- "devextreme-dist": "25.1.1-alpha"
17
+ "devextreme": "25.1.3",
18
+ "devextreme-dist": "25.1.3"
19
19
  },
20
20
  "dependencies": {
21
21
  "jszip": "~3.10.1",
@@ -1,7 +0,0 @@
1
- import { CommandBase, CommandSimpleOptions } from '../command-base';
2
- import { SimpleCommandState } from '../command-states';
3
- export declare class ToggleAllowZoomCommand extends CommandBase<SimpleCommandState> {
4
- getState(): SimpleCommandState;
5
- executeCore(_state: SimpleCommandState, options: CommandSimpleOptions<boolean>): boolean;
6
- isEnabledInReadOnlyMode(): boolean;
7
- }
@@ -1,17 +0,0 @@
1
- import { CommandBase } from '../command-base';
2
- import { SimpleCommandState } from '../command-states';
3
- export class ToggleAllowZoomCommand extends CommandBase {
4
- getState() {
5
- return new SimpleCommandState(this.isEnabled(), this.control.viewManager.allowZoom);
6
- }
7
- executeCore(_state, options) {
8
- const allowZoom = this.control.viewManager.allowZoom;
9
- if (options.param === allowZoom)
10
- return false;
11
- this.control.viewManager.allowZoom = !allowZoom;
12
- return true;
13
- }
14
- isEnabledInReadOnlyMode() {
15
- return true;
16
- }
17
- }