devexpress-richedit 24.2.6 → 25.1.1-alpha

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 (98) 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 +11 -3
  10. package/dist/dx.richedit.js +1555 -1230
  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/_constants.d.ts +1 -0
  15. package/lib/client/_constants.js +3 -0
  16. package/lib/client/bars/ribbon.d.ts +1 -0
  17. package/lib/client/bars/ribbon.js +3 -1
  18. package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +11 -0
  19. package/lib/client/client-rich-edit.js +4 -2
  20. package/lib/client/commands/commands.js +12 -0
  21. package/lib/client/i-rich-constructor-settings.d.ts +2 -0
  22. package/lib/client/model-api/api-utils/parameter-checker.d.ts +1 -1
  23. package/lib/client/model-api/api-utils/parameter-checker.js +2 -2
  24. package/lib/client/public/commands/enum.d.ts +3 -1
  25. package/lib/client/public/commands/enum.js +2 -0
  26. package/lib/client/public/options.d.ts +2 -0
  27. package/lib/client/public/options.js +2 -0
  28. package/lib/client/public/rich-edit.d.ts +4 -0
  29. package/lib/client/public/rich-edit.js +21 -0
  30. package/lib/client/ribbon/i-toolbar-item-options.d.ts +1 -1
  31. package/lib/client/settings.js +4 -0
  32. package/lib/client/utils/focus-helper.d.ts +4 -0
  33. package/lib/client/utils/focus-helper.js +36 -0
  34. package/lib/common/canvas/canvas-manager.d.ts +2 -0
  35. package/lib/common/canvas/canvas-manager.js +11 -5
  36. package/lib/common/canvas/renderes/common/document-renderer.d.ts +1 -1
  37. package/lib/common/canvas/renderes/view-manager.d.ts +4 -0
  38. package/lib/common/canvas/renderes/view-manager.js +17 -0
  39. package/lib/common/commands/client-command.d.ts +3 -1
  40. package/lib/common/commands/client-command.js +2 -0
  41. package/lib/common/commands/command-manager.js +4 -0
  42. package/lib/common/commands/layout/apply-style-command.d.ts +12 -7
  43. package/lib/common/commands/layout/apply-style-command.js +44 -36
  44. package/lib/common/commands/layout/change-zoom-level-command.d.ts +10 -0
  45. package/lib/common/commands/layout/change-zoom-level-command.js +30 -0
  46. package/lib/common/commands/layout/toggle-allow-zoom-command.d.ts +7 -0
  47. package/lib/common/commands/layout/toggle-allow-zoom-command.js +17 -0
  48. package/lib/common/commands/ruler/ruler-table-column-separators-command.d.ts +9 -2
  49. package/lib/common/commands/ruler/ruler-table-column-separators-command.js +24 -15
  50. package/lib/common/commands/toc/set-paragraph-level-command.d.ts +2 -0
  51. package/lib/common/commands/toc/set-paragraph-level-command.js +13 -7
  52. package/lib/common/interfaces/i-zoom-level-holder.d.ts +3 -0
  53. package/lib/common/interfaces/i-zoom-level-holder.js +1 -0
  54. package/lib/common/layout/main-structures/layout-row.d.ts +2 -1
  55. package/lib/common/layout/main-structures/layout-row.js +3 -1
  56. package/lib/common/layout-formatter/formatter/base-formatter.js +2 -1
  57. package/lib/common/layout-formatter/row/result.js +2 -1
  58. package/lib/common/layout-formatter/row/tab-info.js +3 -1
  59. package/lib/common/model/json/enums/json-control-enums.d.ts +2 -1
  60. package/lib/common/model/json/enums/json-control-enums.js +1 -0
  61. package/lib/common/model/json/exporters/json-control-options-converter.js +2 -0
  62. package/lib/common/model/json/importers/json-importer.js +2 -0
  63. package/lib/common/model/options/control.d.ts +1 -0
  64. package/lib/common/model/options/control.js +1 -0
  65. package/lib/common/model/paragraph/paragraph-style.d.ts +9 -4
  66. package/lib/common/model/paragraph/paragraph-style.js +20 -13
  67. package/lib/common/model/rich-utils.d.ts +2 -0
  68. package/lib/common/model/rich-utils.js +2 -0
  69. package/lib/common/mouse-handler/resize-box-helper.js +2 -2
  70. package/lib/common/rich-edit-core.d.ts +0 -1
  71. package/lib/common/rich-edit-core.js +2 -6
  72. package/lib/common/ui/ruler/controls/base.d.ts +7 -2
  73. package/lib/common/ui/ruler/controls/base.js +11 -3
  74. package/lib/common/ui/ruler/controls/column.d.ts +17 -5
  75. package/lib/common/ui/ruler/controls/column.js +37 -21
  76. package/lib/common/ui/ruler/controls/divisions.d.ts +18 -5
  77. package/lib/common/ui/ruler/controls/divisions.js +41 -13
  78. package/lib/common/ui/ruler/controls/indent/first-line.js +2 -2
  79. package/lib/common/ui/ruler/controls/indent/left.js +2 -2
  80. package/lib/common/ui/ruler/controls/indent/right.js +2 -2
  81. package/lib/common/ui/ruler/controls/margin/base.js +3 -3
  82. package/lib/common/ui/ruler/controls/owner.d.ts +2 -0
  83. package/lib/common/ui/ruler/controls/owner.js +4 -0
  84. package/lib/common/ui/ruler/controls/ruler.js +2 -2
  85. package/lib/common/ui/ruler/controls/tab/tab-info.d.ts +15 -0
  86. package/lib/common/ui/ruler/controls/tab/tab-info.js +19 -0
  87. package/lib/common/ui/ruler/controls/tab/tab.d.ts +3 -3
  88. package/lib/common/ui/ruler/controls/tab/tab.js +10 -11
  89. package/lib/common/ui/ruler/controls/table.js +5 -4
  90. package/lib/common/ui/ruler/controls/zoomable-value.d.ts +8 -0
  91. package/lib/common/ui/ruler/controls/zoomable-value.js +15 -0
  92. package/lib/common/ui/ruler/manager.d.ts +6 -2
  93. package/lib/common/ui/ruler/manager.js +13 -4
  94. package/lib/common/ui/ruler/model-data.d.ts +1 -0
  95. package/lib/common/ui/ruler/model-data.js +1 -0
  96. package/lib/common/view-settings/views-settings.d.ts +2 -0
  97. package/lib/common/view-settings/views-settings.js +3 -0
  98. package/package.json +7 -7
@@ -76,7 +76,6 @@ export declare abstract class RichEditCore implements IRichEditControl {
76
76
  private selectionFormatter;
77
77
  private scrollFormatter;
78
78
  private boxVisualizerManager;
79
- private simpleViewCanvasSizeManager;
80
79
  private _isDisposed;
81
80
  get isReadOnlyPersistent(): boolean;
82
81
  lastSavedHistoryItemId: number;
@@ -20,7 +20,6 @@ import { afterFontsLoaded, fontWebApiAvailable } from '@devexpress/utils/lib/uti
20
20
  import { StringUtils } from '@devexpress/utils/lib/utils/string';
21
21
  import { HtmlImporter } from './formats/html/import/html-importer';
22
22
  import { AutoCorrectService } from './auto-correct/auto-correct-service';
23
- import { SimpleViewCanvasSizeManager } from './canvas/renderes/common/document-renderer';
24
23
  import { ViewManager } from './canvas/renderes/view-manager';
25
24
  import { ClientSideEvents } from './client-side-events';
26
25
  import { RichEditClientCommand } from './commands/client-command';
@@ -90,9 +89,8 @@ export class RichEditCore {
90
89
  this.searchManager.raiseSearchReset();
91
90
  this.clientSideEvents.raiseDocumentChanged();
92
91
  });
93
- this.simpleViewCanvasSizeManager = new SimpleViewCanvasSizeManager(this.viewManager.canvasManager, this);
94
92
  if (this.innerClientProperties.viewsSettings.isSimpleView)
95
- this.simpleViewCanvasSizeManager.setViewMode(true);
93
+ this.viewManager.canvasManager.simpleViewCanvasSizeManager.setViewMode(true);
96
94
  if (fontWebApiAvailable())
97
95
  afterFontsLoaded(() => {
98
96
  this.invalidateLayoutAfterFontsLoaded();
@@ -182,7 +180,6 @@ export class RichEditCore {
182
180
  this.viewManager.dispose();
183
181
  this.layoutFormatterManager.dispose();
184
182
  this.eventManager.dispose();
185
- this.simpleViewCanvasSizeManager.dispose();
186
183
  this.loadingPanelManager.dispose();
187
184
  this.commandManager.dispose();
188
185
  this.spellChecker.dispose();
@@ -215,7 +212,6 @@ export class RichEditCore {
215
212
  this.scrollFormatter = null;
216
213
  this.boxVisualizerManager = null;
217
214
  this.globalEventDispatcher = null;
218
- this.simpleViewCanvasSizeManager = null;
219
215
  this.selectionModelChangesListener = null;
220
216
  this.loadingPanelManager = null;
221
217
  this.inputPositionModelChangesListener = null;
@@ -350,7 +346,7 @@ export class RichEditCore {
350
346
  onViewTypeChanged() {
351
347
  this.viewManager.renderer.onViewTypeChanged();
352
348
  this.horizontalRulerControl.onViewTypeChanged();
353
- this.simpleViewCanvasSizeManager.setViewMode(this.innerClientProperties.viewsSettings.isSimpleView);
349
+ this.viewManager.canvasManager.simpleViewCanvasSizeManager.setViewMode(this.innerClientProperties.viewsSettings.isSimpleView);
354
350
  }
355
351
  getModifiedState() {
356
352
  if (this.lastSavedHistoryItemId != this.modelManager.history.getCurrentItemId())
@@ -1,9 +1,14 @@
1
1
  import { RulerControls } from '../manager';
2
2
  import { RulerModelData } from '../model-data';
3
+ import { IZoomLevelHolder } from '../../../interfaces/i-zoom-level-holder';
3
4
  export declare class RulerModelState {
4
- modelValue: number;
5
5
  enabled: boolean;
6
- constructor(modelValue: number, enabled: boolean);
6
+ private zoomLevelHolder;
7
+ private _modelValue;
8
+ get modelValue(): number;
9
+ get originalModelValue(): number;
10
+ set modelValue(value: number);
11
+ constructor(modelValue: number, enabled: boolean, zoomLevelHolder: IZoomLevelHolder);
7
12
  clone(): RulerModelState;
8
13
  }
9
14
  export declare abstract class RulerBase {
@@ -1,12 +1,20 @@
1
1
  import { DomUtils } from '@devexpress/utils/lib/utils/dom';
2
2
  import { DocumentRenderer } from '../../../canvas/renderes/common/document-renderer';
3
+ import { RulerValue } from './zoomable-value';
3
4
  export class RulerModelState {
4
- constructor(modelValue, enabled) {
5
- this.modelValue = modelValue;
5
+ get modelValue() { return this._modelValue.value; }
6
+ ;
7
+ get originalModelValue() { return this._modelValue.originalValue; }
8
+ ;
9
+ set modelValue(value) { this._modelValue.value = value; }
10
+ ;
11
+ constructor(modelValue, enabled, zoomLevelHolder) {
6
12
  this.enabled = enabled;
13
+ this.zoomLevelHolder = zoomLevelHolder;
14
+ this._modelValue = new RulerValue(modelValue, zoomLevelHolder);
7
15
  }
8
16
  clone() {
9
- return new RulerModelState(this.modelValue, this.enabled);
17
+ return new RulerModelState(this.originalModelValue, this.enabled, this.zoomLevelHolder);
10
18
  }
11
19
  }
12
20
  export class RulerBase {
@@ -1,5 +1,6 @@
1
1
  import { RulerControls } from '../manager';
2
2
  import { RulerMultiControl } from './owner';
3
+ import { IZoomLevelHolder } from '../../../interfaces/i-zoom-level-holder';
3
4
  export declare enum ColumnAction {
4
5
  None = 0,
5
6
  ColumnMove = 1,
@@ -7,11 +8,22 @@ export declare enum ColumnAction {
7
8
  ColumnWidth = 3
8
9
  }
9
10
  export declare class RulerColumnModelState {
10
- leftPos: number;
11
- width: number;
12
- space: number;
11
+ private zoomLevelHolder;
12
+ private zoomableLeftPos;
13
+ get leftPos(): number;
14
+ get originalLeftPos(): number;
15
+ set leftPos(value: number);
16
+ private zoomableWidth;
17
+ get width(): number;
18
+ get originalWidth(): number;
19
+ set width(value: number);
20
+ private zoomableSpace;
21
+ get space(): number;
22
+ get originalSpace(): number;
23
+ set space(value: number);
13
24
  get rightPos(): number;
14
- constructor(leftPos: number, width: number, space: number);
25
+ get originalRightPos(): number;
26
+ constructor(leftPos: number, width: number, space: number, zoomLevelHolder: IZoomLevelHolder);
15
27
  clone(): RulerColumnModelState;
16
28
  equals(obj: RulerColumnModelState): boolean;
17
29
  }
@@ -47,7 +59,7 @@ declare class RulerColumnState {
47
59
  showShadow(): void;
48
60
  hideShadow(): void;
49
61
  lineControlSetPosition(): void;
50
- setValue(viewState: RulerColumnModelState): void;
62
+ setValue(viewState: RulerColumnModelState, forceUpdate?: boolean): void;
51
63
  getAction(source: HTMLElement): ColumnAction;
52
64
  }
53
65
  export {};
@@ -7,6 +7,7 @@ import { RichEditClientCommand } from '../../../commands/client-command';
7
7
  import { RICH_EDIT_CLASS_NAME_PREFIX, RULLER_NUMBER_CORRECTION } from '../settings';
8
8
  import { RulerMultiControl } from './owner';
9
9
  import { RulerLineDisplayType, SnapTo } from './vertical-line';
10
+ import { RulerValue } from './zoomable-value';
10
11
  const MinColumnWidth = UnitConverter.centimeterToPixel(1.5);
11
12
  const MinColumnSpace = UnitConverter.centimeterToPixel(0.25);
12
13
  const COLUMN_HANDLE_CLASS_NAME = RICH_EDIT_CLASS_NAME_PREFIX + "columnHandle";
@@ -33,14 +34,25 @@ export var ColumnAction;
33
34
  ColumnAction[ColumnAction["ColumnWidth"] = 3] = "ColumnWidth";
34
35
  })(ColumnAction || (ColumnAction = {}));
35
36
  export class RulerColumnModelState {
37
+ get leftPos() { return this.zoomableLeftPos.value; }
38
+ get originalLeftPos() { return this.zoomableLeftPos.originalValue; }
39
+ set leftPos(value) { this.zoomableLeftPos.value = value; }
40
+ get width() { return this.zoomableWidth.value; }
41
+ get originalWidth() { return this.zoomableWidth.originalValue; }
42
+ set width(value) { this.zoomableWidth.value = value; }
43
+ get space() { return this.zoomableSpace.value; }
44
+ get originalSpace() { return this.zoomableSpace.originalValue; }
45
+ set space(value) { this.zoomableSpace.value = value; }
36
46
  get rightPos() { return this.leftPos + this.width; }
37
- constructor(leftPos, width, space) {
38
- this.leftPos = leftPos;
39
- this.width = width;
40
- this.space = space;
47
+ get originalRightPos() { return this.originalLeftPos + this.originalWidth; }
48
+ constructor(leftPos, width, space, zoomLevelHolder) {
49
+ this.zoomLevelHolder = zoomLevelHolder;
50
+ this.zoomableLeftPos = new RulerValue(leftPos, this.zoomLevelHolder);
51
+ this.zoomableWidth = new RulerValue(width, this.zoomLevelHolder);
52
+ this.zoomableSpace = new RulerValue(space, this.zoomLevelHolder);
41
53
  }
42
54
  clone() {
43
- return new RulerColumnModelState(this.leftPos, this.width, this.space);
55
+ return new RulerColumnModelState(this.originalLeftPos, this.originalWidth, this.originalSpace, this.zoomLevelHolder);
44
56
  }
45
57
  equals(obj) {
46
58
  return this.leftPos == obj.leftPos &&
@@ -57,7 +69,8 @@ export class RulerColumnsModelState {
57
69
  }
58
70
  get activeColumn() { return this.columns[this.columnActiveIndex]; }
59
71
  clone() {
60
- return new RulerColumnsModelState(ListUtils.deepCopy(this.columns), this.equalWidth, this.columnActiveIndex, this.enabled);
72
+ const clonedColumns = ListUtils.deepCopy(this.columns);
73
+ return new RulerColumnsModelState(clonedColumns, this.equalWidth, this.columnActiveIndex, this.enabled);
61
74
  }
62
75
  }
63
76
  export class RulerColumnsControl extends RulerMultiControl {
@@ -65,8 +78,8 @@ export class RulerColumnsControl extends RulerMultiControl {
65
78
  const state = this.modelData.commandManager.getCommand(RichEditClientCommand.RulerSectionColumnsSettings).getState();
66
79
  let prevColumnLeftPos = 0;
67
80
  const modelColumns = ListUtils.map(state.value, (column) => {
68
- const result = new RulerColumnModelState(prevColumnLeftPos, column.width, column.space);
69
- prevColumnLeftPos = result.rightPos + result.space;
81
+ const result = new RulerColumnModelState(prevColumnLeftPos, column.width, column.space, this.modelData);
82
+ prevColumnLeftPos = result.originalRightPos + result.originalSpace;
70
83
  return result;
71
84
  });
72
85
  return new RulerColumnsModelState(modelColumns, state.equalWidth, state.activeIndex, state.enabled);
@@ -84,7 +97,7 @@ export class RulerColumnsControl extends RulerMultiControl {
84
97
  return result;
85
98
  }, 0, this.currModelState.columns.length - 1);
86
99
  this.setCount(this.viewState.length);
87
- ListUtils.forEach2(this.subControls, this.viewState, (control, viewState) => control.setValue(viewState));
100
+ ListUtils.forEach2(this.subControls, this.viewState, (control, viewState) => control.setValue(viewState, this.zoomChanged));
88
101
  }
89
102
  }
90
103
  createSubControl() {
@@ -96,8 +109,8 @@ export class RulerColumnsControl extends RulerMultiControl {
96
109
  const columnWidthDiff = diff / colCount;
97
110
  let prevColumnLeftPos = 0;
98
111
  this.currModelState.columns = this.prevModelState.columns.map(oldColumn => {
99
- const result = new RulerColumnModelState(prevColumnLeftPos, oldColumn.width - columnWidthDiff, oldColumn.space);
100
- prevColumnLeftPos = result.rightPos + result.space;
112
+ const result = new RulerColumnModelState(prevColumnLeftPos, oldColumn.originalWidth - columnWidthDiff, oldColumn.originalSpace, this.modelData);
113
+ prevColumnLeftPos = result.originalRightPos + result.originalSpace;
101
114
  return result;
102
115
  });
103
116
  }
@@ -122,7 +135,7 @@ export class RulerColumnsControl extends RulerMultiControl {
122
135
  }
123
136
  onMouseUp() {
124
137
  this.modelData.commandManager.getCommand(RichEditClientCommand.RulerSectionColumnsSettings)
125
- .execute(this.modelData.commandManager.isPublicApiCall, this.currModelState.columns.map(col => new ColumnSectionProperties(col.width, col.space)));
138
+ .execute(this.modelData.commandManager.isPublicApiCall, this.currModelState.columns.map(col => new ColumnSectionProperties(col.originalWidth, col.originalSpace)));
126
139
  this.finishHandle();
127
140
  }
128
141
  calculateNewModelState(distance) {
@@ -139,10 +152,11 @@ export class RulerColumnsControl extends RulerMultiControl {
139
152
  }
140
153
  }
141
154
  calculateNewModelStateColumnMove(distance) {
155
+ const minColumnWidth = MinColumnWidth * this.modelData.zoomLevel;
142
156
  const leftMargin = this.controls.leftMargin.prevModelState.modelValue;
143
157
  const column = this.prevModelState.columns[this.handleControlIndex];
144
158
  const initialPos = leftMargin + column.rightPos;
145
- const newPos = this.controls.chooseClosestAnchorPosition(initialPos + distance, [initialPos], new MinMaxNumber(leftMargin + column.leftPos + MinColumnWidth, leftMargin + this.prevModelState.columns[this.handleControlIndex + 1].rightPos - MinColumnWidth - column.space));
159
+ const newPos = this.controls.chooseClosestAnchorPosition(initialPos + distance, [initialPos], new MinMaxNumber(leftMargin + column.leftPos + minColumnWidth, leftMargin + this.prevModelState.columns[this.handleControlIndex + 1].rightPos - minColumnWidth - column.space));
146
160
  const correctedDistance = newPos - initialPos;
147
161
  const currColumn = this.currModelState.columns[this.handleControlIndex] = this.prevModelState.columns[this.handleControlIndex].clone();
148
162
  const nextColumn = this.currModelState.columns[this.handleControlIndex + 1] = this.prevModelState.columns[this.handleControlIndex + 1].clone();
@@ -151,15 +165,17 @@ export class RulerColumnsControl extends RulerMultiControl {
151
165
  nextColumn.width -= correctedDistance;
152
166
  }
153
167
  calculateNewModelStateColumnSpace(distance, leftEdge) {
168
+ const minColumnWidth = MinColumnWidth * this.modelData.zoomLevel;
169
+ const minColumnSpace = MinColumnSpace * this.modelData.zoomLevel;
154
170
  if (this.prevModelState.equalWidth) {
155
171
  const columnCount = this.currModelState.columns.length;
156
172
  const leftMargin = this.controls.leftMargin.prevModelState.modelValue;
157
173
  const column = this.prevModelState.columns[this.handleControlIndex];
158
- const maxColumnSpace = (ListUtils.last(this.prevModelState.columns).rightPos - MinColumnWidth * columnCount) / (columnCount - 1);
159
- const maxColumnWidth = (ListUtils.last(this.prevModelState.columns).rightPos - MinColumnSpace * (columnCount - 1)) / columnCount;
174
+ const maxColumnSpace = (ListUtils.last(this.prevModelState.columns).rightPos - minColumnWidth * columnCount) / (columnCount - 1);
175
+ const maxColumnWidth = (ListUtils.last(this.prevModelState.columns).rightPos - minColumnSpace * (columnCount - 1)) / columnCount;
160
176
  const bounds = leftEdge ?
161
- new MinMaxNumber(leftMargin + MinColumnWidth * (this.handleControlIndex + 1) + maxColumnSpace * this.handleControlIndex, leftMargin + maxColumnWidth * (this.handleControlIndex + 1) + MinColumnSpace * this.handleControlIndex) :
162
- new MinMaxNumber(leftMargin + (maxColumnWidth + MinColumnSpace) * (this.handleControlIndex + 1), leftMargin + (MinColumnWidth + maxColumnSpace) * (this.handleControlIndex + 1));
177
+ new MinMaxNumber(leftMargin + minColumnWidth * (this.handleControlIndex + 1) + maxColumnSpace * this.handleControlIndex, leftMargin + maxColumnWidth * (this.handleControlIndex + 1) + minColumnSpace * this.handleControlIndex) :
178
+ new MinMaxNumber(leftMargin + (maxColumnWidth + minColumnSpace) * (this.handleControlIndex + 1), leftMargin + (minColumnWidth + maxColumnSpace) * (this.handleControlIndex + 1));
163
179
  const initialPos = leftMargin + column.rightPos + (leftEdge ? 0 : column.space);
164
180
  const newPos = this.controls.chooseClosestAnchorPosition(initialPos + distance, [initialPos], bounds);
165
181
  const correctedDistance = newPos - initialPos;
@@ -182,8 +198,8 @@ export class RulerColumnsControl extends RulerMultiControl {
182
198
  const leftMargin = this.controls.leftMargin.prevModelState.modelValue;
183
199
  const column = this.prevModelState.columns[this.handleControlIndex];
184
200
  const bounds = leftEdge ?
185
- new MinMaxNumber(leftMargin + column.leftPos + MinColumnWidth, leftMargin + this.prevModelState.columns[this.handleControlIndex + 1].leftPos - MinColumnSpace) :
186
- new MinMaxNumber(leftMargin + column.rightPos + MinColumnSpace, leftMargin + this.prevModelState.columns[this.handleControlIndex + 1].rightPos - MinColumnWidth);
201
+ new MinMaxNumber(leftMargin + column.leftPos + minColumnWidth, leftMargin + this.prevModelState.columns[this.handleControlIndex + 1].leftPos - minColumnSpace) :
202
+ new MinMaxNumber(leftMargin + column.rightPos + minColumnSpace, leftMargin + this.prevModelState.columns[this.handleControlIndex + 1].rightPos - minColumnWidth);
187
203
  const initialPos = leftMargin + column.rightPos + (leftEdge ? 0 : column.space);
188
204
  const newPos = this.controls.chooseClosestAnchorPosition(initialPos + distance, [initialPos], bounds);
189
205
  const correctedDistance = newPos - initialPos;
@@ -232,8 +248,8 @@ class RulerColumnState {
232
248
  }
233
249
  this.controls.lineControl.setPosition(pos, SnapTo.LeftSide);
234
250
  }
235
- setValue(viewState) {
236
- if (!this.viewState || !this.viewState.equals(viewState)) {
251
+ setValue(viewState, forceUpdate = false) {
252
+ if (forceUpdate || !this.viewState || !this.viewState.equals(viewState)) {
237
253
  this.viewState = viewState.clone();
238
254
  this.rootElement.style.left = RULLER_NUMBER_CORRECTION + viewState.rightPos + "px";
239
255
  this.rootElement.style.width = viewState.space + "px";
@@ -2,6 +2,8 @@ import { RichEditUnit } from '../../../utils/unit-converter';
2
2
  import { RulerControls } from '../manager';
3
3
  import { RulerModelData } from '../model-data';
4
4
  import { RulerBase } from './base';
5
+ import { ViewSettings } from '../../../view-settings/views-settings';
6
+ import { IZoomLevelHolder } from '../../../interfaces/i-zoom-level-holder';
5
7
  export declare const MINOR_TOP_AND_BOTTOM_MARGIN: number;
6
8
  export declare const MAJOR_TOP_AND_BOTTOM_MARGIN: number;
7
9
  export declare const DIVISION_CONTAINER_CLASS_NAME: string;
@@ -12,9 +14,15 @@ export declare const DIVISION_NUMBER_CLASS_NAME: string;
12
14
  export declare class RulerDivisionsControl extends RulerBase {
13
15
  viewState: number;
14
16
  private initialLeft;
15
- readonly height: number;
17
+ private divisionInfo;
18
+ private maxPageWidth;
19
+ private zoomLevel;
20
+ private zoomChanged;
21
+ private _height;
22
+ get height(): number;
16
23
  protected getRootClassName(): string;
17
24
  constructor(modelData: RulerModelData, controls: RulerControls, divisionInfo: DivisionInfo, maxPageWidth: number);
25
+ render(): void;
18
26
  update(): void;
19
27
  updateModelState(): void;
20
28
  updateView(): void;
@@ -26,9 +34,14 @@ export declare enum DivisionType {
26
34
  Major = 2
27
35
  }
28
36
  export declare class DivisionInfo {
37
+ readonly originalUnitSize: number;
38
+ private zoomLevelHolder;
29
39
  readonly unitMap: DivisionType[];
30
- readonly unitSize: number;
31
- readonly stepSize: number;
32
- constructor(map: number[], unitSize: number);
33
- static create(unitType: RichEditUnit): DivisionInfo;
40
+ get unitSize(): number;
41
+ get stepSize(): number;
42
+ private _stepSize;
43
+ private _unitSize;
44
+ constructor(map: number[], originalUnitSize: number, zoomLevelHolder: IZoomLevelHolder);
45
+ updateZoomLevel(): void;
46
+ static create(unitType: RichEditUnit, viewSettings: ViewSettings): DivisionInfo;
34
47
  }
@@ -13,25 +13,40 @@ export const DIVISION_MINOR_CLASS_NAME = RULER_CLASS_NAME + "Minor" + DIVISION_C
13
13
  export const DIVISION_MAJOR_CLASS_NAME = RULER_CLASS_NAME + "Major" + DIVISION_CLASS_NAME;
14
14
  export const DIVISION_NUMBER_CLASS_NAME = RULER_CLASS_NAME + "Number" + DIVISION_CLASS_NAME;
15
15
  export class RulerDivisionsControl extends RulerBase {
16
+ get height() { return this._height; }
16
17
  getRootClassName() { return DIVISION_CONTAINER_CLASS_NAME; }
17
18
  constructor(modelData, controls, divisionInfo, maxPageWidth) {
18
19
  super(modelData, controls);
19
- this.height = 0;
20
- const unitCount = Math.ceil(maxPageWidth / divisionInfo.unitSize);
21
- this.rootElement.style.width = divisionInfo.unitSize * (unitCount * 2 + 1) + "px";
20
+ this.zoomLevel = 1.0;
21
+ this.zoomChanged = false;
22
+ this._height = 0;
23
+ this.divisionInfo = divisionInfo;
24
+ this.maxPageWidth = maxPageWidth;
22
25
  this.controls.ruler.rootElement.appendChild(this.rootElement);
26
+ this._height = SizeUtils.getOffsetHeight(this.rootElement);
23
27
  if (Browser.IE && Browser.MajorVersion <= 9)
24
28
  this.rootElement.offsetParent;
25
- this.height = SizeUtils.getOffsetHeight(this.rootElement);
26
- createDivisionElements(this.rootElement, unitCount, divisionInfo, this.height);
27
- this.initialLeft = -(unitCount * divisionInfo.unitSize - RULLER_NUMBER_CORRECTION);
29
+ this.render();
30
+ }
31
+ render() {
32
+ const unitCount = Math.ceil(this.maxPageWidth / this.divisionInfo.unitSize);
33
+ this.rootElement.style.width = this.divisionInfo.unitSize * (unitCount * 2 + 1) + "px";
34
+ createDivisionElements(this.rootElement, unitCount, this.divisionInfo, this.height);
35
+ this.initialLeft = -(unitCount * this.divisionInfo.unitSize - RULLER_NUMBER_CORRECTION);
28
36
  }
29
37
  update() {
30
38
  this.updateModelState();
31
39
  this.updateView();
32
40
  }
33
- updateModelState() { }
41
+ updateModelState() {
42
+ this.zoomChanged = this.zoomLevel != this.modelData.zoomLevel;
43
+ this.zoomLevel = this.modelData.zoomLevel;
44
+ }
34
45
  updateView() {
46
+ if (this.zoomChanged) {
47
+ this.render();
48
+ this.zoomChanged = false;
49
+ }
35
50
  const newViewState = this.getViewValue();
36
51
  if (newViewState != this.viewState) {
37
52
  this.viewState = newViewState;
@@ -48,6 +63,9 @@ export class RulerDivisionsControl extends RulerBase {
48
63
  }
49
64
  }
50
65
  function createDivisionElements(rootElement, unitCount, divisionInfo, height) {
66
+ while (rootElement.firstChild) {
67
+ rootElement.removeChild(rootElement.lastChild);
68
+ }
51
69
  let divisionLeftPosition = 0;
52
70
  const createSimpleDivision = (className, topAndBottomMargin) => {
53
71
  const stepSize = divisionInfo.stepSize;
@@ -99,15 +117,25 @@ export var DivisionType;
99
117
  DivisionType[DivisionType["Major"] = 2] = "Major";
100
118
  })(DivisionType || (DivisionType = {}));
101
119
  export class DivisionInfo {
102
- constructor(map, unitSize) {
120
+ get unitSize() { return this._unitSize; }
121
+ ;
122
+ get stepSize() { return this._stepSize; }
123
+ ;
124
+ constructor(map, originalUnitSize, zoomLevelHolder) {
125
+ this.originalUnitSize = originalUnitSize;
126
+ this.zoomLevelHolder = zoomLevelHolder;
103
127
  this.unitMap = map;
104
- this.unitSize = unitSize;
105
- this.stepSize = this.unitSize / this.unitMap.length;
128
+ this.updateZoomLevel();
129
+ }
130
+ updateZoomLevel() {
131
+ const zoomLevel = this.zoomLevelHolder.zoomLevel;
132
+ this._unitSize = this.originalUnitSize * zoomLevel;
133
+ this._stepSize = this.unitSize / this.unitMap.length;
106
134
  }
107
- static create(unitType) {
135
+ static create(unitType, viewSettings) {
108
136
  return unitType == RichEditUnit.Inch ?
109
137
  new DivisionInfo([DivisionType.Number, DivisionType.Minor, DivisionType.Minor, DivisionType.Minor,
110
- DivisionType.Major, DivisionType.Minor, DivisionType.Minor, DivisionType.Minor], UnitConverter.inchesToPixels(1)) :
111
- new DivisionInfo([DivisionType.Number, DivisionType.Minor, DivisionType.Major, DivisionType.Minor], UnitConverter.centimeterToPixelF(1));
138
+ DivisionType.Major, DivisionType.Minor, DivisionType.Minor, DivisionType.Minor], UnitConverter.inchesToPixels(1), viewSettings) :
139
+ new DivisionInfo([DivisionType.Number, DivisionType.Minor, DivisionType.Major, DivisionType.Minor], UnitConverter.centimeterToPixelF(1), viewSettings);
112
140
  }
113
141
  }
@@ -30,7 +30,7 @@ export class RulerFirstLineIndentDragHandle extends RulerBaseIndentControl {
30
30
  }
31
31
  getModelState() {
32
32
  const state = this.modelData.commandManager.getCommand(RichEditClientCommand.RulerParagraphLeftIndents).getState();
33
- return new RulerModelState(state.value.firstLine, state.enabled);
33
+ return new RulerModelState(state.value.firstLine, state.enabled, this.modelData);
34
34
  }
35
35
  updateView() {
36
36
  const newViewState = this.controls.paragraphLeftPosition + this.currModelState.modelValue;
@@ -44,7 +44,7 @@ export class RulerFirstLineIndentDragHandle extends RulerBaseIndentControl {
44
44
  }
45
45
  canHandle(source) { return source == this.rootElement; }
46
46
  onMouseUp() {
47
- const commandValue = new RulerParagraphLeftIndentsCommandValue(null, this.controls.leftIndent.currModelState.modelValue, this.currModelState.modelValue);
47
+ const commandValue = new RulerParagraphLeftIndentsCommandValue(null, this.controls.leftIndent.currModelState.originalModelValue, this.currModelState.originalModelValue);
48
48
  commandValue.setIntervalsInfo(this.modelData.selection.intervalsInfo);
49
49
  this.modelData.commandManager.getCommand(RichEditClientCommand.RulerParagraphLeftIndents)
50
50
  .execute(this.modelData.commandManager.isPublicApiCall, commandValue);
@@ -44,7 +44,7 @@ export class RulerLeftIndentDragHandle extends RulerBaseIndentControl {
44
44
  }
45
45
  getModelState() {
46
46
  const state = this.modelData.commandManager.getCommand(RichEditClientCommand.RulerParagraphLeftIndents).getState();
47
- return new RulerModelState(state.value.hanging, state.enabled);
47
+ return new RulerModelState(state.value.hanging, state.enabled, this.modelData);
48
48
  }
49
49
  updateView() {
50
50
  const newViewState = this.controls.paragraphLeftPosition + this.currModelState.modelValue;
@@ -68,7 +68,7 @@ export class RulerLeftIndentDragHandle extends RulerBaseIndentControl {
68
68
  return false;
69
69
  }
70
70
  onMouseUp() {
71
- const commandValue = new RulerParagraphLeftIndentsCommandValue(null, this.currModelState.modelValue, this.controls.firstLineIndent.currModelState.modelValue);
71
+ const commandValue = new RulerParagraphLeftIndentsCommandValue(null, this.currModelState.originalModelValue, this.controls.firstLineIndent.currModelState.originalModelValue);
72
72
  commandValue.setIntervalsInfo(this.modelData.selection.intervalsInfo);
73
73
  this.modelData.commandManager.getCommand(RichEditClientCommand.RulerParagraphLeftIndents)
74
74
  .execute(this.modelData.commandManager.isPublicApiCall, commandValue);
@@ -29,7 +29,7 @@ export class RulerRightIndentDragHandle extends RulerBaseIndentControl {
29
29
  getModelState() {
30
30
  const state = this.modelData.commandManager
31
31
  .getCommand(RichEditClientCommand.RulerParagraphRightIndent).getState();
32
- return new RulerModelState(state.value.hanging, state.enabled);
32
+ return new RulerModelState(state.value.hanging, state.enabled, this.modelData);
33
33
  }
34
34
  updateView() {
35
35
  const newViewState = this.correctRelativeLeftIndents(this.controls.ruler.pageWidth - this.controls.paragraphRightPosition + this.currModelState.modelValue);
@@ -48,7 +48,7 @@ export class RulerRightIndentDragHandle extends RulerBaseIndentControl {
48
48
  canHandle(source) { return source == this.rootElement; }
49
49
  onMouseUp() {
50
50
  this.modelData.commandManager.getCommand(RichEditClientCommand.RulerParagraphRightIndent)
51
- .execute(this.modelData.commandManager.isPublicApiCall, this.currModelState.modelValue);
51
+ .execute(this.modelData.commandManager.isPublicApiCall, this.currModelState.originalModelValue);
52
52
  this.finishHandle();
53
53
  }
54
54
  lineControlSetPosition() {
@@ -31,12 +31,12 @@ export class RulerBaseMarginControl extends RulerBase {
31
31
  }
32
32
  onMouseMove(distance, _source) {
33
33
  this.calculateNewModelState(distance);
34
- this.controls.columns.marginsChanged(this.currModelState.modelValue - this.prevModelState.modelValue);
34
+ this.controls.columns.marginsChanged(this.currModelState.originalModelValue - this.prevModelState.originalModelValue);
35
35
  this.updateView();
36
36
  this.lineControlSetPosition();
37
37
  }
38
38
  onMouseUp() {
39
- this.modelData.commandManager.getCommand(this.commandType).execute(this.modelData.commandManager.isPublicApiCall, this.currModelState.modelValue);
39
+ this.modelData.commandManager.getCommand(this.commandType).execute(this.modelData.commandManager.isPublicApiCall, this.currModelState.originalModelValue);
40
40
  this.finishHandle();
41
41
  }
42
42
  onEscPress() {
@@ -45,7 +45,7 @@ export class RulerBaseMarginControl extends RulerBase {
45
45
  }
46
46
  getModelState() {
47
47
  const state = this.modelData.commandManager.getCommand(this.commandType).getState();
48
- return new RulerModelState(state.value, state.enabled);
48
+ return new RulerModelState(state.value, state.enabled, this.modelData);
49
49
  }
50
50
  finishHandle() {
51
51
  this.controls.lineControl.hide();
@@ -16,6 +16,8 @@ export declare abstract class RulerMultiControl<TSubControl extends IRulerSubCon
16
16
  protected handleControlIndex: number;
17
17
  protected get activeSubControl(): TSubControl;
18
18
  protected viewState: TVisualState[];
19
+ protected zoomLevel: number;
20
+ protected zoomChanged: boolean;
19
21
  protected abstract getModelState(): TModelState;
20
22
  abstract updateView(): void;
21
23
  protected abstract createSubControl(): TSubControl;
@@ -4,6 +4,8 @@ export class RulerMultiControl {
4
4
  this.subControls = [];
5
5
  this.handleControlIndex = -1;
6
6
  this.viewState = [];
7
+ this.zoomLevel = 1.0;
8
+ this.zoomChanged = false;
7
9
  this.modelData = modelData;
8
10
  this.controls = controls;
9
11
  }
@@ -19,6 +21,8 @@ export class RulerMultiControl {
19
21
  updateModelState() {
20
22
  this.currModelState = this.getModelState();
21
23
  this.prevModelState = this.currModelState.clone();
24
+ this.zoomChanged = this.zoomLevel != this.modelData.zoomLevel;
25
+ this.zoomLevel = this.modelData.zoomLevel;
22
26
  }
23
27
  onMouseMove(distance, _source) {
24
28
  this.calculateNewModelState(distance);
@@ -30,7 +30,7 @@ export class RulerControl extends RulerBase {
30
30
  this.rootElement.style.paddingTop = this.controls.firstLineIndent.heightOfProtrudingPart + "px";
31
31
  }
32
32
  updateModelState() {
33
- this.currPageWidth = UnitConverter.twipsToPixelsF(this.modelData.inputPosition.getMergedSectionPropertiesRaw().pageSize.width);
33
+ this.currPageWidth = UnitConverter.twipsToPixelsF(this.modelData.inputPosition.getMergedSectionPropertiesRaw().pageSize.width) * this.modelData.zoomLevel;
34
34
  }
35
35
  updateView() {
36
36
  if (this.prevPageWidth != this.currPageWidth) {
@@ -41,7 +41,7 @@ export class RulerControl extends RulerBase {
41
41
  }
42
42
  adjust() {
43
43
  const viewWidth = this.controls.canvas.clientWidth;
44
- if (viewWidth > this.controls.ruler.pageWidth)
44
+ if (viewWidth > this.pageWidth)
45
45
  this.initialMarginLeftElement = (viewWidth - this.pageWidth - RULLER_NUMBER_CORRECTION * 2) / 2;
46
46
  else {
47
47
  const paddingLeft = DomUtils.pxToInt(DomUtils.getCurrentStyle(this.controls.canvas).paddingLeft);
@@ -0,0 +1,15 @@
1
+ import { TabAlign } from '../../../../model/paragraph/paragraph';
2
+ import { TabLeaderType } from '../../../../layout/main-structures/layout-boxes/layout-tab-space-box';
3
+ import { IZoomLevelHolder } from '../../../../interfaces/i-zoom-level-holder';
4
+ import { TabInfoBase } from '../../../../model/paragraph/paragraph-style';
5
+ export declare class RulerTabInfo extends TabInfoBase<RulerTabInfo> {
6
+ zoomLevelHolder: IZoomLevelHolder;
7
+ private zoomablePosition;
8
+ get position(): number;
9
+ set position(value: number);
10
+ get originalPosition(): number;
11
+ set originalPosition(value: number);
12
+ constructor(position: number, alignment: TabAlign, leader: TabLeaderType, deleted: boolean, isDefault: boolean, zoomLevelHolder: IZoomLevelHolder);
13
+ clone(): RulerTabInfo;
14
+ equals(obj: RulerTabInfo): boolean;
15
+ }
@@ -0,0 +1,19 @@
1
+ import { RulerValue } from '../zoomable-value';
2
+ import { TabInfoBase } from '../../../../model/paragraph/paragraph-style';
3
+ export class RulerTabInfo extends TabInfoBase {
4
+ get position() { return this.zoomablePosition.value; }
5
+ set position(value) { this.zoomablePosition.value = value; }
6
+ get originalPosition() { return this.zoomablePosition.originalValue; }
7
+ set originalPosition(value) { this.zoomablePosition.originalValue = value; }
8
+ constructor(position, alignment, leader, deleted, isDefault, zoomLevelHolder) {
9
+ super(alignment, leader, deleted, isDefault);
10
+ this.zoomLevelHolder = zoomLevelHolder;
11
+ this.zoomablePosition = new RulerValue(position, zoomLevelHolder);
12
+ }
13
+ clone() {
14
+ return new RulerTabInfo(this.originalPosition, this.alignment, this.leader, this.deleted, this.isDefault, this.zoomLevelHolder);
15
+ }
16
+ equals(obj) {
17
+ return super.equals(obj) && this.originalPosition == obj.originalPosition;
18
+ }
19
+ }
@@ -1,13 +1,13 @@
1
1
  import { TabAlign } from '../../../../model/paragraph/paragraph';
2
- import { TabInfo } from '../../../../model/paragraph/paragraph-style';
3
2
  import { RulerControls } from '../../manager';
4
3
  import { RulerModelData } from '../../model-data';
5
4
  import { RulerMultiControl } from '../owner';
6
5
  import { RulerShadow } from '../shadow';
6
+ import { RulerTabInfo } from './tab-info';
7
7
  export declare class RulerTabsControlState {
8
- tabs: TabInfo[];
8
+ tabs: RulerTabInfo[];
9
9
  enabled: boolean;
10
- constructor(tabs: TabInfo[], enabled: boolean);
10
+ constructor(tabs: RulerTabInfo[], enabled: boolean);
11
11
  clone(): RulerTabsControlState;
12
12
  }
13
13
  export declare class RulerTabViewState {