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
@@ -9,7 +9,6 @@ import { ControlOptions } from '../../model/options/control';
9
9
  import { RichUtils } from '../../model/rich-utils';
10
10
  import { StylesManager } from '../../model/styles-manager';
11
11
  import { SubDocumentInterval } from '../../model/sub-document';
12
- import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
13
12
  import { SearchUtils } from '@devexpress/utils/lib/utils/search';
14
13
  import { CommandBase } from '../command-base';
15
14
  import { StringUtils } from '@devexpress/utils/lib/utils/string';
@@ -50,16 +49,19 @@ export class ApplyStyleCommand extends CommandBase {
50
49
  getStyleName(style) {
51
50
  return style.styleName;
52
51
  }
52
+ DEPRECATEDConvertOptionsParameter(parameter) {
53
+ return typeof parameter === 'string' ? { styleName: parameter } : parameter;
54
+ }
53
55
  executeCore(state, options) {
54
56
  const parameter = options.param;
55
- if (StringUtils.isNullOrEmpty(parameter))
57
+ if (StringUtils.isNullOrEmpty(parameter.styleName))
56
58
  return false;
57
- let interval = state.interval.clone();
59
+ const subDocumentInterval = new SubDocumentInterval(options.subDocument, state.interval.clone());
58
60
  let executed = true;
59
61
  let isPresetStyle = false;
60
62
  this.history.beginTransaction();
61
- if (StylesManager.isParagraphStyle(parameter) && state.paragraphStyleChangeEnabled) {
62
- const styleName = StylesManager.getStyleNameWithoutPrefix(parameter);
63
+ if (StylesManager.isParagraphStyle(parameter.styleName) && state.paragraphStyleChangeEnabled) {
64
+ const styleName = StylesManager.getStyleNameWithoutPrefix(parameter.styleName);
63
65
  let paragraphStyle = this.control.modelManager.model.getParagraphStyleByName(styleName);
64
66
  if (!paragraphStyle) {
65
67
  const presetStyle = StylesManager.getPresetParagraphStyleByName(styleName);
@@ -68,12 +70,12 @@ export class ApplyStyleCommand extends CommandBase {
68
70
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName).clone();
69
71
  isPresetStyle = true;
70
72
  }
71
- this.applyParagraphStyle(interval, paragraphStyle, isPresetStyle, options.subDocument);
73
+ this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.keepDirectFormatting);
72
74
  }
73
- else if (!StylesManager.isParagraphStyle(parameter) && state.characterStyleChangeEnabled) {
74
- const styleName = StylesManager.getStyleNameWithoutPrefix(parameter);
75
- if (interval.length == 0)
76
- interval = options.subDocument.getWholeWordInterval(interval.start);
75
+ else if (!StylesManager.isParagraphStyle(parameter.styleName) && state.characterStyleChangeEnabled) {
76
+ const styleName = StylesManager.getStyleNameWithoutPrefix(parameter.styleName);
77
+ if (subDocumentInterval.interval.length == 0)
78
+ subDocumentInterval.interval = options.subDocument.getWholeWordInterval(subDocumentInterval.interval.start);
77
79
  let characterStyle = this.control.modelManager.model.getCharacterStyleByName(styleName);
78
80
  if (!characterStyle) {
79
81
  const presetStyle = StylesManager.getPresetCharacterStyleByName(styleName);
@@ -82,9 +84,9 @@ export class ApplyStyleCommand extends CommandBase {
82
84
  characterStyle = presetStyle.clone();
83
85
  isPresetStyle = true;
84
86
  }
85
- if (interval.length == 0) {
87
+ if (subDocumentInterval.interval.length == 0) {
86
88
  if (isPresetStyle) {
87
- let fontInfo = characterStyle.maskedCharacterProperties.fontInfo;
89
+ const fontInfo = characterStyle.maskedCharacterProperties.fontInfo;
88
90
  if (fontInfo && fontInfo.measurer === undefined)
89
91
  characterStyle.maskedCharacterProperties.fontInfo = this.control.modelManager.model.cache.fontInfoCache.getItemByName(fontInfo.name);
90
92
  }
@@ -92,50 +94,56 @@ export class ApplyStyleCommand extends CommandBase {
92
94
  executed = false;
93
95
  }
94
96
  else
95
- this.applyCharacterStyle(interval, characterStyle, isPresetStyle, options.subDocument);
97
+ this.applyCharacterStyle(subDocumentInterval, characterStyle, isPresetStyle);
96
98
  }
97
99
  this.history.endTransaction();
98
100
  return executed;
99
101
  }
100
- applyCharacterStyle(interval, style, isPresetStyle, subDocument) {
102
+ applyCharacterStyle(subDocumentInterval, style, isPresetStyle) {
101
103
  if (ControlOptions.isEnabled(this.control.modelManager.richOptions.control.characterStyle)) {
102
- this.modelManipulator.style.applyCharacterStyle(new SubDocumentInterval(subDocument, interval), isPresetStyle ? this.control.modelManager.model.stylesManager.addCharacterStyle(style) : style, false);
104
+ const characterStyle = isPresetStyle ? this.control.modelManager.model.stylesManager.addCharacterStyle(style) : style;
105
+ this.modelManipulator.style.applyCharacterStyle(subDocumentInterval, characterStyle, false);
103
106
  }
104
107
  }
105
- applyParagraphStyle(interval, style, isPresetStyle, subDocument) {
106
- var count = this.calculateAffectedParagraphCount(interval, subDocument);
108
+ applyParagraphStyle(subDocumentInterval, style, isPresetStyle, keepDirectFormatting = false) {
109
+ const count = this.calculateAffectedParagraphCount(subDocumentInterval);
107
110
  if (count > 0 && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paragraphStyle)) {
108
- var paragraphIndex = SearchUtils.normedInterpolationIndexOf(subDocument.paragraphs, p => p.startLogPosition.value, interval.start);
109
- for (var i = 0; i < count; i++) {
110
- var paragraph = subDocument.paragraphs[paragraphIndex + i];
111
- var paragraphInterval = new FixedInterval(paragraph.startLogPosition.value, paragraph.length);
112
- var modelManipulator = this.modelManipulator;
113
- this.history.addAndRedo(new ApplyParagraphStyleHistoryItem(modelManipulator, new SubDocumentInterval(subDocument, paragraphInterval), isPresetStyle ? modelManipulator.model.stylesManager.addParagraphStyle(style) : style));
114
- this.history.addAndRedo(new ParagraphUseValueHistoryItem(modelManipulator, new SubDocumentInterval(subDocument, paragraphInterval), 0));
115
- this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, new SubDocumentInterval(subDocument, paragraphInterval), 0));
116
- this.history.addAndRedo(new AddParagraphToListHistoryItem(this.modelManipulator, subDocument, paragraphIndex, NumberingList.NumberingListNotSettedIndex, -1));
111
+ const { interval, subDocument } = subDocumentInterval;
112
+ const paragraphs = subDocument.paragraphs;
113
+ const paragraphIndex = SearchUtils.normedInterpolationIndexOf(paragraphs, p => p.startLogPosition.value, interval.start);
114
+ for (let i = 0; i < count; i++) {
115
+ const paragraph = paragraphs[paragraphIndex + i];
116
+ const modelManipulator = this.modelManipulator;
117
+ const paragraphSubDocumentInterval = new SubDocumentInterval(subDocument, paragraph.interval);
118
+ style = isPresetStyle ? modelManipulator.model.stylesManager.addParagraphStyle(style) : style;
119
+ this.history.addAndRedo(new ApplyParagraphStyleHistoryItem(modelManipulator, paragraphSubDocumentInterval, style));
120
+ this.history.addAndRedo(new ParagraphUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
121
+ if (!keepDirectFormatting)
122
+ this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
123
+ this.history.addAndRedo(new AddParagraphToListHistoryItem(modelManipulator, subDocument, paragraphIndex, NumberingList.NumberingListNotSettedIndex, -1));
117
124
  }
118
125
  }
119
126
  else
120
- this.applyParagraphLinkedStyle(interval, style, isPresetStyle, subDocument);
127
+ this.applyParagraphLinkedStyle(subDocumentInterval, style, isPresetStyle);
121
128
  }
122
- applyParagraphLinkedStyle(interval, style, isPresetStyle, subDocument) {
129
+ applyParagraphLinkedStyle(subDocumentInterval, style, isPresetStyle) {
123
130
  if (ControlOptions.isEnabled(this.control.modelManager.richOptions.control.characterStyle)) {
124
131
  if (!style.linkedStyle)
125
- this.createCharacterStyle(style);
126
- this.applyCharacterStyle(interval, style.linkedStyle, isPresetStyle, subDocument);
132
+ this.addLinkedCharacterStyle(style);
133
+ this.applyCharacterStyle(subDocumentInterval, style.linkedStyle, isPresetStyle);
127
134
  }
128
135
  }
129
- createCharacterStyle(paragraphStyle) {
130
- var style = new CharacterStyle(paragraphStyle.styleName + " Char", paragraphStyle.localizedName + " Char", false, false, false, false, paragraphStyle.maskedCharacterProperties);
136
+ addLinkedCharacterStyle(paragraphStyle) {
137
+ const style = new CharacterStyle(paragraphStyle.styleName + " Char", paragraphStyle.localizedName + " Char", false, false, false, false, paragraphStyle.maskedCharacterProperties);
131
138
  this.history.addAndRedo(new CreateStyleLinkHistoryItem(this.modelManipulator, style, paragraphStyle));
132
139
  }
133
- calculateAffectedParagraphCount(interval, subDocument) {
134
- var paragraphs = subDocument.getParagraphsByInterval(interval);
140
+ calculateAffectedParagraphCount(subDocumentInterval) {
141
+ const { interval, subDocument } = subDocumentInterval;
142
+ const paragraphs = subDocument.getParagraphsByInterval(interval);
135
143
  if (paragraphs.length > 1)
136
144
  return paragraphs.length;
137
- var paragraph = paragraphs[0];
138
- var lastParagraphCharSelected = interval.length >= paragraph.length - 1;
145
+ const paragraph = paragraphs[0];
146
+ const lastParagraphCharSelected = interval.length >= paragraph.length - 1;
139
147
  if (interval.start === paragraph.startLogPosition.value && lastParagraphCharSelected || interval.length === 0)
140
148
  return 1;
141
149
  return 0;
@@ -0,0 +1,10 @@
1
+ import { CommandBase, CommandSimpleOptions } from '../command-base';
2
+ import { SimpleCommandState } from '../command-states';
3
+ export declare class ChangeZoomLevelCommand extends CommandBase<SimpleCommandState> {
4
+ getState(): SimpleCommandState;
5
+ executeCore(_state: SimpleCommandState, options: CommandSimpleOptions<number>): boolean;
6
+ isEnabledInReadOnlyMode(): boolean;
7
+ isEnabled(): boolean;
8
+ DEPRECATEDConvertOptionsParameter(parameter: any): number;
9
+ private isZoomLevelValueCorrect;
10
+ }
@@ -0,0 +1,30 @@
1
+ import { isNumber } from '@devexpress/utils/lib/utils/common';
2
+ import { CommandBase } from '../command-base';
3
+ import { SimpleCommandState } from '../command-states';
4
+ import { RichUtils } from '../../model/rich-utils';
5
+ export class ChangeZoomLevelCommand extends CommandBase {
6
+ getState() {
7
+ const state = new SimpleCommandState(this.isEnabled(), this.control.viewManager.zoomLevel);
8
+ state.visible = this.control.viewManager.allowZoom;
9
+ return state;
10
+ }
11
+ executeCore(_state, options) {
12
+ if (options.param == this.control.viewManager.zoomLevel)
13
+ return false;
14
+ this.control.viewManager.zoomLevel = options.param;
15
+ return true;
16
+ }
17
+ isEnabledInReadOnlyMode() {
18
+ return true;
19
+ }
20
+ isEnabled() {
21
+ return this.control.viewManager.allowZoom;
22
+ }
23
+ DEPRECATEDConvertOptionsParameter(parameter) {
24
+ const res = typeof parameter == "string" ? parseFloat(parameter) : parameter;
25
+ return this.isZoomLevelValueCorrect(res) ? res : this.control.viewManager.zoomLevel;
26
+ }
27
+ isZoomLevelValueCorrect(size) {
28
+ return isNumber(size) && !isNaN(size) && size >= RichUtils.minZoomLevel && size <= RichUtils.maxZoomLevel;
29
+ }
30
+ }
@@ -0,0 +1,7 @@
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
+ }
@@ -0,0 +1,17 @@
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
+ }
@@ -1,6 +1,8 @@
1
1
  import { CommandBase, CommandOptions, ICommandOptions } from '../command-base';
2
2
  import { SimpleCommandState } from '../command-states';
3
+ import { IZoomLevelHolder } from '../../interfaces/i-zoom-level-holder';
3
4
  export declare class TableColumnSeparatorStruct {
5
+ zoomLevelHolder: IZoomLevelHolder;
4
6
  index: number;
5
7
  tableIndex: number;
6
8
  cellSpacing: number;
@@ -9,14 +11,19 @@ export declare class TableColumnSeparatorStruct {
9
11
  items: TableColumnSeparatorItem[];
10
12
  get currItem(): TableColumnSeparatorItem;
11
13
  get hasItems(): boolean;
14
+ constructor(zoomLevelHolder: IZoomLevelHolder);
12
15
  createItem(position: number, marginLeft: number, marginRight: number): void;
13
16
  clone(): TableColumnSeparatorStruct;
14
17
  }
15
18
  export declare class TableColumnSeparatorItem {
16
- position: number;
19
+ zoomLevelHolder: IZoomLevelHolder;
20
+ private zoomablePosition;
21
+ get position(): number;
22
+ get originalPosition(): number;
23
+ set position(value: number);
17
24
  leftMargin: number;
18
25
  rightMargin: number;
19
- constructor(position: number, leftMargin: number, rightMargin: number);
26
+ constructor(position: number, leftMargin: number, rightMargin: number, zoomLevelHolder: IZoomLevelHolder);
20
27
  clone(): TableColumnSeparatorItem;
21
28
  }
22
29
  export declare class RulerTableColumnSeparatorsCommand extends CommandBase<SimpleCommandState> {
@@ -8,8 +8,16 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
8
8
  import { SearchUtils } from '@devexpress/utils/lib/utils/search';
9
9
  import { CommandBase } from '../command-base';
10
10
  import { SimpleCommandState } from '../command-states';
11
+ import { RulerValue } from '../../ui/ruler/controls/zoomable-value';
11
12
  export class TableColumnSeparatorStruct {
12
- constructor() {
13
+ get currItem() {
14
+ return this.items[this.index];
15
+ }
16
+ get hasItems() {
17
+ return this.items.length > 0;
18
+ }
19
+ constructor(zoomLevelHolder) {
20
+ this.zoomLevelHolder = zoomLevelHolder;
13
21
  this.index = 0;
14
22
  this.tableIndex = 0;
15
23
  this.cellSpacing = 0;
@@ -17,17 +25,11 @@ export class TableColumnSeparatorStruct {
17
25
  this.maxValue = -1;
18
26
  this.items = [];
19
27
  }
20
- get currItem() {
21
- return this.items[this.index];
22
- }
23
- get hasItems() {
24
- return this.items.length > 0;
25
- }
26
28
  createItem(position, marginLeft, marginRight) {
27
- this.items.push(new TableColumnSeparatorItem(position, marginLeft, marginRight));
29
+ this.items.push(new TableColumnSeparatorItem(position, marginLeft, marginRight, this.zoomLevelHolder));
28
30
  }
29
31
  clone() {
30
- const result = new TableColumnSeparatorStruct();
32
+ const result = new TableColumnSeparatorStruct(this.zoomLevelHolder);
31
33
  result.index = this.index;
32
34
  result.tableIndex = this.tableIndex;
33
35
  result.minValue = this.minValue;
@@ -37,13 +39,20 @@ export class TableColumnSeparatorStruct {
37
39
  }
38
40
  }
39
41
  export class TableColumnSeparatorItem {
40
- constructor(position, leftMargin, rightMargin) {
41
- this.position = position;
42
+ get position() { return this.zoomablePosition.value; }
43
+ ;
44
+ get originalPosition() { return this.zoomablePosition.originalValue; }
45
+ ;
46
+ set position(value) { this.zoomablePosition.value = value; }
47
+ ;
48
+ constructor(position, leftMargin, rightMargin, zoomLevelHolder) {
49
+ this.zoomLevelHolder = zoomLevelHolder;
50
+ this.zoomablePosition = new RulerValue(position, this.zoomLevelHolder);
42
51
  this.leftMargin = leftMargin;
43
52
  this.rightMargin = rightMargin;
44
53
  }
45
54
  clone() {
46
- return new TableColumnSeparatorItem(this.position, this.leftMargin, this.rightMargin);
55
+ return new TableColumnSeparatorItem(this.originalPosition, this.leftMargin, this.rightMargin, this.zoomLevelHolder);
47
56
  }
48
57
  }
49
58
  export class RulerTableColumnSeparatorsCommand extends CommandBase {
@@ -83,7 +92,7 @@ export class RulerTableColumnSeparatorsCommand extends CommandBase {
83
92
  }
84
93
  return sellSpacing;
85
94
  };
86
- let struct = new TableColumnSeparatorStruct();
95
+ let struct = new TableColumnSeparatorStruct(this.control.viewManager);
87
96
  if (this.selection.tableInfo.extendedData.numRows) {
88
97
  let layoutPosition = (subDocument.isMain()
89
98
  ? new LayoutPositionMainSubDocumentCreator(this.control.layout, subDocument, position, DocumentLayoutDetailsLevel.Character)
@@ -126,8 +135,8 @@ export class RulerTableColumnSeparatorsCommand extends CommandBase {
126
135
  struct.createItem(lastLayoutCell.right, 0, 0);
127
136
  }
128
137
  struct.tableIndex = currLogicGrid.table.index;
129
- struct.items = struct.items.sort((a, b) => a.position - b.position);
130
- struct.index = SearchUtils.normedInterpolationIndexOf(struct.items, (item) => item.position, layoutCell.x);
138
+ struct.items = struct.items.sort((a, b) => a.originalPosition - b.originalPosition);
139
+ struct.index = SearchUtils.normedInterpolationIndexOf(struct.items, (item) => item.originalPosition, layoutCell.x);
131
140
  if (currLayoutGrid.parentCell) {
132
141
  struct.minValue = currLayoutGrid.parentCell.x;
133
142
  struct.maxValue = currLayoutGrid.parentCell.right;
@@ -1,6 +1,8 @@
1
1
  import { CommandBase, CommandSimpleOptions } from '../command-base';
2
2
  import { SimpleCommandState } from '../command-states';
3
3
  export declare abstract class SetParagraphLevelCommandBase extends CommandBase<SimpleCommandState> {
4
+ private get commandManager();
5
+ private get modelManager();
4
6
  isEnabled(): boolean;
5
7
  getState(): SimpleCommandState;
6
8
  executeCore(_state: SimpleCommandState, options: CommandSimpleOptions<number>): boolean;
@@ -5,24 +5,30 @@ import { RichEditClientCommand } from '../client-command';
5
5
  import { CommandBase, CommandSimpleOptions } from '../command-base';
6
6
  import { SimpleCommandState } from '../command-states';
7
7
  export class SetParagraphLevelCommandBase extends CommandBase {
8
+ get commandManager() { return this.control.commandManager; }
9
+ get modelManager() { return this.control.modelManager; }
8
10
  isEnabled() {
9
- return super.isEnabled() && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paragraphFormatting);
11
+ return super.isEnabled() && ControlOptions.isEnabled(this.modelManager.richOptions.control.paragraphFormatting);
10
12
  }
11
13
  getState() {
12
14
  const state = new SimpleCommandState(this.isEnabled());
13
- state.value = this.control.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).getState().value == this.getLevel(null);
15
+ state.value = this.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).getState().value == this.getLevel(null);
14
16
  return state;
15
17
  }
16
18
  executeCore(_state, options) {
17
19
  const level = this.getLevel(options.param);
18
20
  const styleName = level > 0 ? `${ParagraphStyle.headingStyleName} ${level}` : ParagraphStyle.normalStyleName;
19
- let paragraphStyle = this.control.modelManager.model.getParagraphStyleByName(styleName);
21
+ let paragraphStyle = this.modelManager.model.getParagraphStyleByName(styleName);
20
22
  if (!paragraphStyle)
21
23
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName);
22
- if (paragraphStyle)
23
- this.control.commandManager.getCommand(RichEditClientCommand.ChangeStyle).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, StylesManager.paragraphPrefix + styleName));
24
- else
25
- this.control.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).execute(this.control.commandManager.isPublicApiCall, new CommandSimpleOptions(this.control, level));
24
+ if (paragraphStyle) {
25
+ const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName, keepDirectFormatting: true });
26
+ this.commandManager.getCommand(RichEditClientCommand.ChangeStyle).execute(this.commandManager.isPublicApiCall, commandOptions);
27
+ }
28
+ else {
29
+ const commandOptions = new CommandSimpleOptions(this.control, level);
30
+ this.commandManager.getCommand(RichEditClientCommand.ChangeHeadingLevel).execute(this.commandManager.isPublicApiCall, commandOptions);
31
+ }
26
32
  return true;
27
33
  }
28
34
  getRelatedCommands() {
@@ -0,0 +1,3 @@
1
+ export interface IZoomLevelHolder {
2
+ zoomLevel: number;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -13,7 +13,8 @@ export declare enum LayoutRowStateFlags {
13
13
  SectionEnd = 8,
14
14
  DocumentEnd = 16,
15
15
  CellTableEnd = 64,
16
- PageBreakBefore = 128
16
+ PageBreakBefore = 128,
17
+ InfinityWidth = 256
17
18
  }
18
19
  export declare class LayoutRow extends Rectangle {
19
20
  boxes: LayoutBox[];
@@ -2,6 +2,7 @@ import { Flag } from '@devexpress/utils/lib/class/flag';
2
2
  import { UnitConverter } from '@devexpress/utils/lib/class/unit-converter';
3
3
  import { Rectangle } from '@devexpress/utils/lib/geometry/rectangle';
4
4
  import { ListUtils } from '@devexpress/utils/lib/utils/list';
5
+ import { LayoutBoxType } from './layout-boxes/layout-box';
5
6
  export var LayoutRowStateFlags;
6
7
  (function (LayoutRowStateFlags) {
7
8
  LayoutRowStateFlags[LayoutRowStateFlags["NormallyEnd"] = 0] = "NormallyEnd";
@@ -12,6 +13,7 @@ export var LayoutRowStateFlags;
12
13
  LayoutRowStateFlags[LayoutRowStateFlags["DocumentEnd"] = 16] = "DocumentEnd";
13
14
  LayoutRowStateFlags[LayoutRowStateFlags["CellTableEnd"] = 64] = "CellTableEnd";
14
15
  LayoutRowStateFlags[LayoutRowStateFlags["PageBreakBefore"] = 128] = "PageBreakBefore";
16
+ LayoutRowStateFlags[LayoutRowStateFlags["InfinityWidth"] = 256] = "InfinityWidth";
15
17
  })(LayoutRowStateFlags || (LayoutRowStateFlags = {}));
16
18
  export class LayoutRow extends Rectangle {
17
19
  get hasEffectToPageHeight() { return this.boxes.length != 1 || !this.boxes[0].isSectionBreakBox; }
@@ -127,7 +129,7 @@ export class LayoutRow extends Rectangle {
127
129
  return lastBoxIndexWhatCanStrikeoutAndUnderline;
128
130
  }
129
131
  containsSpacesOnly() {
130
- return this.boxes.length > 0 && ListUtils.allOf(this.boxes, val => val.isWhitespace());
132
+ return this.boxes.length > 0 && ListUtils.allOf(this.boxes, val => val.isWhitespace() || val.getType() === LayoutBoxType.ParagraphMark);
131
133
  }
132
134
  }
133
135
  export class LayoutRowWithIndex extends LayoutRow {
@@ -233,7 +233,8 @@ export class BaseFormatter {
233
233
  const minPageContentHeight = bottomPosition + margins.bottom;
234
234
  const minVisibleAreaHeight = minPageContentHeight +
235
235
  pageInfo.topMargin + pageInfo.topPageBorderWidth + pageInfo.bottomPageBorderWidth + pageInfo.bottomMargin;
236
- const diff = Math.floor(Math.max(0, this.manager.controlHeightProvider.getVisibleAreaHeight(false) - minVisibleAreaHeight));
236
+ const zoomLevel = this.manager.innerClientProperties.viewsSettings.zoomLevel;
237
+ const diff = Math.floor(Math.max(0, this.manager.controlHeightProvider.getVisibleAreaHeight(false) / zoomLevel - minVisibleAreaHeight));
237
238
  const finalPageHeight = minPageContentHeight + diff;
238
239
  const columnHeight = finalPageHeight - margins.vertical;
239
240
  this.layoutPosition.column.height = columnHeight;
@@ -42,7 +42,8 @@ export class RowFormatterResult {
42
42
  return;
43
43
  this.rowFormatter.tabInfo.shiftBoxesAfterLastTab();
44
44
  const dontJustifyLinesEndingInSoftLineBreak = this.rowFormatter.manager.model.compatibilitySettings.dontJustifyLinesEndingInSoftLineBreak;
45
- BoxAligner.align(this.row, this.rowFormatter.paragraphProps.alignment, currLogicRowEndPos, this.rowBoxIndexStart, dontJustifyLinesEndingInSoftLineBreak);
45
+ if (!this.row.flags.get(LayoutRowStateFlags.InfinityWidth))
46
+ BoxAligner.align(this.row, this.rowFormatter.paragraphProps.alignment, currLogicRowEndPos, this.rowBoxIndexStart, dontJustifyLinesEndingInSoftLineBreak);
46
47
  this.rowBoxIndexStart = this.row.boxes.length;
47
48
  }
48
49
  deleteSomeAnchorObjects(index, posToRestart) {
@@ -7,6 +7,7 @@ import { SearchUtils } from '@devexpress/utils/lib/utils/search';
7
7
  import { StringUtils } from '@devexpress/utils/lib/utils/string';
8
8
  import { LayoutBoxType } from '../../layout/main-structures/layout-boxes/layout-box';
9
9
  import { TabLeaderType } from '../../layout/main-structures/layout-boxes/layout-tab-space-box';
10
+ import { LayoutRowStateFlags } from '../../layout/main-structures/layout-row';
10
11
  import { TabAlign } from '../../model/paragraph/paragraph';
11
12
  import { ParagraphFirstLineIndent } from '../../model/paragraph/paragraph-properties';
12
13
  import { TabInfo } from '../../model/paragraph/paragraph-style';
@@ -85,9 +86,10 @@ export class RowTabInfo {
85
86
  if (tabXPosRelativePage > lastInterval.end) {
86
87
  if (lastInterval.end < this.rowFormatter.paragraphHorizontalBounds.end) {
87
88
  if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013) {
89
+ this.currInterval.avaliableWidth = Number.MAX_SAFE_INTEGER - this.currInterval.busyWidth;
88
90
  this.currInterval.length = Number.MAX_SAFE_INTEGER;
89
- this.currInterval.avaliableWidth = Number.MAX_SAFE_INTEGER;
90
91
  this.row.width = Number.MAX_SAFE_INTEGER;
92
+ this.row.flags.set(LayoutRowStateFlags.InfinityWidth, true);
91
93
  return this.addTabBox();
92
94
  }
93
95
  else if (tabBox.right < this.rowFormatter.paragraphHorizontalBounds.end) {
@@ -65,5 +65,6 @@ export declare enum JSONControlOptionsProperty {
65
65
  PageBreakInsertMode = 31,
66
66
  AcceptsTab = 32,
67
67
  Download = 33,
68
- RaiseClientEventsOnModificationsViaAPI = 34
68
+ RaiseClientEventsOnModificationsViaAPI = 34,
69
+ AllowZoom = 35
69
70
  }
@@ -68,4 +68,5 @@ export var JSONControlOptionsProperty;
68
68
  JSONControlOptionsProperty[JSONControlOptionsProperty["AcceptsTab"] = 32] = "AcceptsTab";
69
69
  JSONControlOptionsProperty[JSONControlOptionsProperty["Download"] = 33] = "Download";
70
70
  JSONControlOptionsProperty[JSONControlOptionsProperty["RaiseClientEventsOnModificationsViaAPI"] = 34] = "RaiseClientEventsOnModificationsViaAPI";
71
+ JSONControlOptionsProperty[JSONControlOptionsProperty["AllowZoom"] = 35] = "AllowZoom";
71
72
  })(JSONControlOptionsProperty || (JSONControlOptionsProperty = {}));
@@ -74,6 +74,8 @@ export class JSONControlOptionsConverter {
74
74
  result.acceptsTab = obj[JSONControlOptionsProperty.AcceptsTab];
75
75
  if (obj[JSONControlOptionsProperty.Download] !== undefined)
76
76
  result.download = obj[JSONControlOptionsProperty.Download];
77
+ if (obj[JSONControlOptionsProperty.AllowZoom] !== undefined)
78
+ result.allowZoom = obj[JSONControlOptionsProperty.AllowZoom];
77
79
  result.raiseClientEventsOnModificationsViaAPI = !!obj[JSONControlOptionsProperty.RaiseClientEventsOnModificationsViaAPI];
78
80
  return result;
79
81
  }
@@ -124,6 +124,8 @@ export class JSONImporter {
124
124
  controlOptions.acceptsTab = !!json[JSONControlOptionsProperty.AcceptsTab];
125
125
  if (json[JSONControlOptionsProperty.Download] !== undefined)
126
126
  controlOptions.download = json[JSONControlOptionsProperty.Download];
127
+ if (json[JSONControlOptionsProperty.AllowZoom] !== undefined)
128
+ controlOptions.allowZoom = json[JSONControlOptionsProperty.AllowZoom];
127
129
  controlOptions.raiseClientEventsOnModificationsViaAPI = !!json[JSONControlOptionsProperty.RaiseClientEventsOnModificationsViaAPI];
128
130
  }
129
131
  }
@@ -33,6 +33,7 @@ export declare class ControlOptions {
33
33
  tables: DocumentCapability;
34
34
  tableStyle: DocumentCapability;
35
35
  floatingObjects: DocumentCapability;
36
+ allowZoom: DocumentCapability;
36
37
  acceptsTab: boolean;
37
38
  raiseClientEventsOnModificationsViaAPI: boolean;
38
39
  static isEnabled(capability: DocumentCapability): boolean;
@@ -35,6 +35,7 @@ export class ControlOptions {
35
35
  this.tables = DocumentCapability.Default;
36
36
  this.tableStyle = DocumentCapability.Default;
37
37
  this.floatingObjects = DocumentCapability.Default;
38
+ this.allowZoom = DocumentCapability.Default;
38
39
  this.acceptsTab = true;
39
40
  this.raiseClientEventsOnModificationsViaAPI = true;
40
41
  }
@@ -42,13 +42,18 @@ export declare class TabProperties implements IEquatable<TabProperties>, IClonea
42
42
  setTabs(tabProp: TabProperties): void;
43
43
  merge(tabProperties: TabProperties): void;
44
44
  }
45
- export declare class TabInfo implements IEquatable<TabInfo>, ICloneable<TabInfo> {
45
+ export declare abstract class TabInfoBase<T extends TabInfoBase<T>> implements IEquatable<T>, ICloneable<T> {
46
46
  alignment: TabAlign;
47
47
  leader: TabLeaderType;
48
- position: number;
49
- isDefault: boolean;
50
48
  deleted: boolean;
49
+ isDefault: boolean;
50
+ constructor(alignment: TabAlign, leader: TabLeaderType, deleted: boolean, isDefault: boolean);
51
+ equals(obj: T): boolean;
52
+ abstract clone(): T;
53
+ }
54
+ export declare class TabInfo extends TabInfoBase<TabInfo> {
55
+ position: number;
51
56
  constructor(position: number, alignment: TabAlign, leader: TabLeaderType, deleted: boolean, isDefault: boolean);
52
- clone(): TabInfo;
53
57
  equals(obj: TabInfo): boolean;
58
+ clone(): TabInfo;
54
59
  }
@@ -61,7 +61,7 @@ export class ParagraphStyle extends StyleBase {
61
61
  }
62
62
  }
63
63
  ParagraphStyle.normalStyleName = "Normal";
64
- ParagraphStyle.headingStyleName = "heading";
64
+ ParagraphStyle.headingStyleName = "Heading";
65
65
  ParagraphStyle.tocStyleName = "toc";
66
66
  export class TabProperties {
67
67
  constructor() {
@@ -106,24 +106,31 @@ export class TabProperties {
106
106
  this.sort();
107
107
  }
108
108
  }
109
- export class TabInfo {
110
- constructor(position, alignment, leader, deleted, isDefault) {
111
- this.position = position;
109
+ export class TabInfoBase {
110
+ constructor(alignment, leader, deleted, isDefault) {
112
111
  this.alignment = alignment;
113
112
  this.leader = leader;
114
- this.isDefault = isDefault;
115
113
  this.deleted = deleted;
116
- }
117
- clone() {
118
- return new TabInfo(this.position, this.alignment, this.leader, this.deleted, this.isDefault);
114
+ this.isDefault = isDefault;
119
115
  }
120
116
  equals(obj) {
121
117
  if (!obj)
122
118
  return false;
123
- return this.alignment == obj.alignment &&
124
- this.leader == obj.leader &&
125
- this.position == obj.position &&
126
- this.deleted == obj.deleted &&
127
- this.isDefault == obj.isDefault;
119
+ return this.alignment === obj.alignment &&
120
+ this.leader === obj.leader &&
121
+ this.deleted === obj.deleted &&
122
+ this.isDefault === obj.isDefault;
123
+ }
124
+ }
125
+ export class TabInfo extends TabInfoBase {
126
+ constructor(position, alignment, leader, deleted, isDefault) {
127
+ super(alignment, leader, deleted, isDefault);
128
+ this.position = position;
129
+ }
130
+ equals(obj) {
131
+ return super.equals(obj) && this.position == obj.position;
132
+ }
133
+ clone() {
134
+ return new TabInfo(this.position, this.alignment, this.leader, this.deleted, this.isDefault);
128
135
  }
129
136
  }
@@ -9,6 +9,8 @@ export declare class RichUtils {
9
9
  static predefinedFontSizes: number[];
10
10
  static minFontSize: number;
11
11
  static maxFontSize: number;
12
+ static minZoomLevel: number;
13
+ static maxZoomLevel: number;
12
14
  static specialCharacters: SpecialCharacters;
13
15
  static getSelectedParagraphs(intervals: FixedInterval[], subDocument: SubDocument): {
14
16
  paragraphs: Paragraph[];
@@ -63,4 +63,6 @@ RichUtils.isAlphanumeric = /^[\u00C0-\u1FFF\u2C00-\uD7FF\w]+$/;
63
63
  RichUtils.predefinedFontSizes = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72];
64
64
  RichUtils.minFontSize = 1;
65
65
  RichUtils.maxFontSize = 600;
66
+ RichUtils.minZoomLevel = 0.5;
67
+ RichUtils.maxZoomLevel = 2.0;
66
68
  RichUtils.specialCharacters = new SpecialCharacters();
@@ -64,8 +64,8 @@ export class ResizeBoxHelper {
64
64
  }
65
65
  }
66
66
  getSize(evt) {
67
- var absDeltaX = evt.absolutePoint.x - (this.startScrollLeft - evt.scroll.x) - this.startX;
68
- var absDeltaY = evt.absolutePoint.y - (this.startScrollTop - evt.scroll.y) - this.startY;
67
+ var absDeltaX = (evt.absolutePoint.x - (this.startScrollLeft - evt.scroll.x) - this.startX) / this.control.viewManager.zoomLevel;
68
+ var absDeltaY = (evt.absolutePoint.y - (this.startScrollTop - evt.scroll.y) - this.startY) / this.control.viewManager.zoomLevel;
69
69
  var deltaX = absDeltaX * Math.cos(this.rotation) - (-absDeltaY) * Math.sin(this.rotation);
70
70
  var deltaY = -(absDeltaX * Math.sin(this.rotation) + (-absDeltaY) * Math.cos(this.rotation));
71
71
  var newWidth, newHeight;