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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/bin/gulpfile.js +1 -1
  2. package/bin/index-custom.js +1 -1
  3. package/bin/localization-builder.js +1 -1
  4. package/bin/nspell-index.js +1 -1
  5. package/bin/nspell.webpack.config.js +1 -1
  6. package/bin/webpack-externals.js +1 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.d.ts +1 -1
  9. package/dist/dx.richedit.js +210 -125
  10. package/dist/dx.richedit.min.js +2 -2
  11. package/index.d.ts +1 -1
  12. package/index.js +1 -1
  13. package/lib/client/bars/ribbon.d.ts +1 -0
  14. package/lib/client/bars/ribbon.js +3 -1
  15. package/lib/client/public/rich-edit.js +2 -2
  16. package/lib/client/utils/focus-helper.d.ts +4 -0
  17. package/lib/client/utils/focus-helper.js +36 -0
  18. package/lib/common/canvas/canvas-manager.js +10 -4
  19. package/lib/common/canvas/renderes/common/document-renderer.js +10 -12
  20. package/lib/common/commands/layout/apply-style-command.d.ts +12 -7
  21. package/lib/common/commands/layout/apply-style-command.js +44 -36
  22. package/lib/common/commands/toc/set-paragraph-level-command.d.ts +2 -0
  23. package/lib/common/commands/toc/set-paragraph-level-command.js +13 -7
  24. package/lib/common/input-controller.d.ts +5 -5
  25. package/lib/common/input-controller.js +12 -12
  26. package/lib/common/layout/main-structures/layout-row.d.ts +2 -1
  27. package/lib/common/layout/main-structures/layout-row.js +3 -1
  28. package/lib/common/layout-formatter/row/result.js +2 -1
  29. package/lib/common/layout-formatter/row/tab-info.js +4 -2
  30. package/lib/common/model/paragraph/paragraph-style.js +1 -1
  31. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.d.ts +1 -1
  32. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.js +22 -25
  33. package/lib/common/rich-edit-core.js +2 -2
  34. package/lib/common/utils/size-utils.d.ts +14 -7
  35. package/lib/common/utils/size-utils.js +43 -18
  36. package/package.json +3 -3
@@ -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 {
@@ -93,7 +93,7 @@ export class RichEditCore {
93
93
  this.invalidateLayoutAfterFontsLoaded();
94
94
  });
95
95
  }
96
- get isReadOnlyPersistent() { return this.readOnly == ReadOnlyMode.Persistent; }
96
+ get isReadOnlyPersistent() { return this.readOnly === ReadOnlyMode.Persistent; }
97
97
  get model() { return this.modelManager.model; }
98
98
  get isDisposed() {
99
99
  return this._isDisposed;
@@ -257,8 +257,8 @@ export class RichEditCore {
257
257
  this.readOnly = ReadOnlyMode.Persistent;
258
258
  else if (!readOnly && this.readOnly === ReadOnlyMode.Persistent) {
259
259
  this.readOnly = ReadOnlyMode.None;
260
- this.inputController.inputEditor.initializeIfNotReadOnly();
261
260
  }
261
+ this.inputController.inputEditor.initializeEditableStateCore();
262
262
  }
263
263
  setWorkSession(sessionGuid, documentInfo) {
264
264
  this.sessionGuid = sessionGuid;
@@ -1,11 +1,17 @@
1
+ declare 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": "24.1.11",
3
+ "version": "24.1.12-build-25107-0103",
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": "24.1.11",
18
- "devextreme-dist": "24.1.11"
17
+ "devextreme": "24.1.12-build-25105-1937",
18
+ "devextreme-dist": "24.1.12-build-25105-1937"
19
19
  },
20
20
  "dependencies": {
21
21
  "jszip": "~3.10.1",