devexpress-richedit 24.2.8-build-25135-0103 → 24.2.8-build-25142-0115

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.
@@ -1,3 +1,4 @@
1
+ var _a;
1
2
  export class FocusHelper {
2
3
  static preventFocusOnClick(element) {
3
4
  return new FocusBlocker(element);
@@ -10,23 +11,24 @@ class FocusBlocker {
10
11
  this.addEventListeners(target);
11
12
  }
12
13
  addEventListeners(element) {
13
- element.addEventListener("pointerdown", this.onPointerDownBinded);
14
+ element.addEventListener("mousedown", this.onPointerDownBinded);
14
15
  }
15
16
  removeEventListeners(element) {
16
- element.removeEventListener("pointerdown", this.onPointerDownBinded);
17
+ element.removeEventListener("mousedown", this.onPointerDownBinded);
17
18
  }
18
19
  onPointerDown(event) {
19
20
  for (const element of event.composedPath()) {
20
- if (!(element instanceof HTMLElement))
21
- continue;
22
21
  if (element === this.target) {
23
22
  event.preventDefault();
24
23
  break;
25
24
  }
26
- if (!this.target.contains(element) || element.tabIndex > -1)
25
+ if (element instanceof Element && this.isFocusableElement(element))
27
26
  break;
28
27
  }
29
28
  }
29
+ isFocusableElement(element) {
30
+ return element.matches(FocusBlocker.focusableSelector);
31
+ }
30
32
  dispose() {
31
33
  if (this.target) {
32
34
  this.removeEventListeners(this.target);
@@ -34,3 +36,18 @@ class FocusBlocker {
34
36
  }
35
37
  }
36
38
  }
39
+ _a = FocusBlocker;
40
+ FocusBlocker.focusableSelectors = [
41
+ 'a[href]',
42
+ 'area[href]',
43
+ 'input',
44
+ 'select',
45
+ 'textarea',
46
+ 'button',
47
+ 'iframe',
48
+ 'object',
49
+ 'embed',
50
+ '[tabindex]:not([tabindex="-1"])',
51
+ '[contenteditable]:not([contenteditable="false"])'
52
+ ];
53
+ FocusBlocker.focusableSelector = _a.focusableSelectors.join(',');
@@ -6,7 +6,7 @@ import { CommandBase, CommandSimpleOptions } from '../command-base';
6
6
  import { ApplyStyleCommandState } from '../command-states';
7
7
  export interface IApplyStyleCommandParams {
8
8
  styleName: string;
9
- keepDirectFormatting?: boolean;
9
+ keepCustomFormatting?: boolean;
10
10
  }
11
11
  export declare class ApplyStyleCommand extends CommandBase<ApplyStyleCommandState> {
12
12
  getState(): ApplyStyleCommandState;
@@ -14,7 +14,7 @@ export declare class ApplyStyleCommand extends CommandBase<ApplyStyleCommandStat
14
14
  DEPRECATEDConvertOptionsParameter(parameter: string | IApplyStyleCommandParams): IApplyStyleCommandParams;
15
15
  executeCore(state: ApplyStyleCommandState, options: CommandSimpleOptions<IApplyStyleCommandParams>): boolean;
16
16
  applyCharacterStyle(subDocumentInterval: SubDocumentInterval, style: CharacterStyle, isPresetStyle: boolean): void;
17
- applyParagraphStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean, keepDirectFormatting?: boolean): void;
17
+ applyParagraphStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean, keepCustomFormatting?: boolean): void;
18
18
  applyParagraphLinkedStyle(subDocumentInterval: SubDocumentInterval, style: ParagraphStyle, isPresetStyle: boolean): void;
19
19
  private addLinkedCharacterStyle;
20
20
  calculateAffectedParagraphCount(subDocumentInterval: SubDocumentInterval): number;
@@ -70,7 +70,7 @@ export class ApplyStyleCommand extends CommandBase {
70
70
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName).clone();
71
71
  isPresetStyle = true;
72
72
  }
73
- this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.keepDirectFormatting);
73
+ this.applyParagraphStyle(subDocumentInterval, paragraphStyle, isPresetStyle, parameter.keepCustomFormatting);
74
74
  }
75
75
  else if (!StylesManager.isParagraphStyle(parameter.styleName) && state.characterStyleChangeEnabled) {
76
76
  const styleName = StylesManager.getStyleNameWithoutPrefix(parameter.styleName);
@@ -105,7 +105,7 @@ export class ApplyStyleCommand extends CommandBase {
105
105
  this.modelManipulator.style.applyCharacterStyle(subDocumentInterval, characterStyle, false);
106
106
  }
107
107
  }
108
- applyParagraphStyle(subDocumentInterval, style, isPresetStyle, keepDirectFormatting = false) {
108
+ applyParagraphStyle(subDocumentInterval, style, isPresetStyle, keepCustomFormatting = false) {
109
109
  const count = this.calculateAffectedParagraphCount(subDocumentInterval);
110
110
  if (count > 0 && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paragraphStyle)) {
111
111
  const { interval, subDocument } = subDocumentInterval;
@@ -118,8 +118,7 @@ export class ApplyStyleCommand extends CommandBase {
118
118
  style = isPresetStyle ? modelManipulator.model.stylesManager.addParagraphStyle(style) : style;
119
119
  this.history.addAndRedo(new ApplyParagraphStyleHistoryItem(modelManipulator, paragraphSubDocumentInterval, style));
120
120
  this.history.addAndRedo(new ParagraphUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
121
- if (!keepDirectFormatting)
122
- this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0));
121
+ this.history.addAndRedo(new FontUseValueHistoryItem(modelManipulator, paragraphSubDocumentInterval, 0, keepCustomFormatting));
123
122
  this.history.addAndRedo(new AddParagraphToListHistoryItem(modelManipulator, subDocument, paragraphIndex, NumberingList.NumberingListNotSettedIndex, -1));
124
123
  }
125
124
  }
@@ -22,7 +22,7 @@ export class SetParagraphLevelCommandBase extends CommandBase {
22
22
  if (!paragraphStyle)
23
23
  paragraphStyle = StylesManager.getPresetParagraphStyleByName(styleName);
24
24
  if (paragraphStyle) {
25
- const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName, keepDirectFormatting: true });
25
+ const commandOptions = new CommandSimpleOptions(this.control, { styleName: StylesManager.paragraphPrefix + styleName, keepCustomFormatting: true });
26
26
  this.commandManager.getCommand(RichEditClientCommand.ChangeStyle).execute(this.commandManager.isPublicApiCall, commandOptions);
27
27
  }
28
28
  else {
@@ -5,7 +5,7 @@ import { BorderLineStyle } from './enums';
5
5
  import { LayoutBorder } from './layout-border';
6
6
  export class BorderInfo {
7
7
  constructor() {
8
- this.style = BorderLineStyle.None;
8
+ this.style = BorderLineStyle.Nil;
9
9
  this.color = ColorModelInfoCache.defaultItem;
10
10
  this.width = 0;
11
11
  this.offset = 0;
@@ -54,7 +54,7 @@ export declare class MaskedCharacterProperties extends CharacterProperties imple
54
54
  protected calculateHash(): number;
55
55
  getUseValue(value: CharacterPropertiesMask): boolean;
56
56
  setUseValue(mask: CharacterPropertiesMask, value: boolean): void;
57
- setUseValueFull(value: number): void;
57
+ setUseValueFull(value: number, onlyForDefault?: boolean): void;
58
58
  getLowPartUseValue(value: number): number;
59
59
  getHighPartUseValue(value: number): number;
60
60
  getUseValueFull(): number;
@@ -5,6 +5,7 @@ import { ColorHelper } from '../color/color';
5
5
  import { ColorModelInfo } from '../color/color-model-info';
6
6
  import { ShadingInfo } from '../shadings/shading-info';
7
7
  import { ShadingPattern } from '../shadings/shading-pattern';
8
+ import { CharacterPropertyDescriptor } from './character-property-descriptor';
8
9
  import { CompositeFontInfo } from './composite-font-info';
9
10
  import { CharacterFormattingScript, CharacterPropertiesMask, StrikeoutType, UnderlineType } from './enums';
10
11
  import { LangInfo } from './lang-info';
@@ -143,8 +144,19 @@ export class MaskedCharacterProperties extends CharacterProperties {
143
144
  this.useValueExt &= ~this.getHighPartUseValue(mask);
144
145
  }
145
146
  }
146
- setUseValueFull(value) {
147
- this.useValue = this.getLowPartUseValue(value);
147
+ setUseValueFull(value, onlyForDefault = false) {
148
+ const lowPartUseValue = this.getLowPartUseValue(value);
149
+ if (onlyForDefault) {
150
+ CharacterPropertyDescriptor.ALL_FIELDS.forEach((desc) => {
151
+ const prop = desc.getProp(this);
152
+ const mask = desc.maskValue();
153
+ if (desc.binaryEquals(prop, desc.defaultValue))
154
+ this.setUseValue(mask, !!(mask & lowPartUseValue));
155
+ });
156
+ }
157
+ else {
158
+ this.useValue = lowPartUseValue;
159
+ }
148
160
  this.useValueExt = this.getHighPartUseValue(value);
149
161
  }
150
162
  getLowPartUseValue(value) {
@@ -14,7 +14,8 @@ import { HistoryItemIntervalStateObject, HistoryItemIntervalUseStateObject } fro
14
14
  export declare class FontUseValueHistoryItem extends IntervalBasedHistoryItem {
15
15
  oldState: HistoryItemIntervalState<HistoryItemIntervalStateObject>;
16
16
  newValue: number;
17
- constructor(modelManipulator: ModelManipulator, subDocInterval: SubDocumentInterval, newValue: number);
17
+ keepCustomFormatting: boolean;
18
+ constructor(modelManipulator: ModelManipulator, subDocInterval: SubDocumentInterval, newValue: number, keepCustomFormatting?: boolean);
18
19
  redo(): void;
19
20
  undo(): void;
20
21
  }
@@ -1,12 +1,13 @@
1
1
  import { Errors } from '@devexpress/utils/lib/errors';
2
2
  import { IntervalBasedHistoryItem } from '../base/interval-based-history-item';
3
3
  export class FontUseValueHistoryItem extends IntervalBasedHistoryItem {
4
- constructor(modelManipulator, subDocInterval, newValue) {
4
+ constructor(modelManipulator, subDocInterval, newValue, keepCustomFormatting = false) {
5
5
  super(modelManipulator, subDocInterval);
6
6
  this.newValue = newValue;
7
+ this.keepCustomFormatting = keepCustomFormatting;
7
8
  }
8
9
  redo() {
9
- this.oldState = this.modelManipulator.characterProperties.useValue.setValue(this.boundSubDocument, this.interval, this.newValue);
10
+ this.oldState = this.modelManipulator.characterProperties.useValue.setValue(this.boundSubDocument, this.interval, this.newValue, this.keepCustomFormatting);
10
11
  }
11
12
  undo() {
12
13
  this.modelManipulator.characterProperties.useValue.restoreValue(this.boundSubDocument, this.oldState);
@@ -74,7 +74,7 @@ class CharacterPropertiesUseValueManipulator {
74
74
  constructor(manipulator) {
75
75
  this.manipulator = manipulator;
76
76
  }
77
- setValue(subDocument, interval, newValue) {
77
+ setValue(subDocument, interval, newValue, keepCustomFormatting = false) {
78
78
  var oldState = new HistoryItemIntervalState();
79
79
  if (!ControlOptions.isEnabled(subDocument.documentModel.options.characterFormatting))
80
80
  return oldState;
@@ -84,7 +84,7 @@ class CharacterPropertiesUseValueManipulator {
84
84
  var run = iterator.currentRun;
85
85
  oldState.register(new HistoryItemIntervalStateObject(iterator.currentInterval(), run.maskedCharacterProperties.getUseValueFull()));
86
86
  var properties = run.maskedCharacterProperties.clone();
87
- properties.setUseValueFull(newValue);
87
+ properties.setUseValueFull(newValue, keepCustomFormatting);
88
88
  run.setCharacterProperties(properties);
89
89
  run.onCharacterPropertiesChanged();
90
90
  }
@@ -8,7 +8,7 @@ export interface IIntervalPropertyWithUseValueManipulator<T> {
8
8
  restoreValue(subDocument: SubDocument, state: HistoryItemIntervalState<HistoryItemIntervalUseStateObject>): any;
9
9
  }
10
10
  export interface IIntervalPropertyManipulator<T> {
11
- setValue(subDocument: SubDocument, interval: FixedInterval, newValue: T): HistoryItemIntervalState<HistoryItemIntervalStateObject>;
11
+ setValue(subDocument: SubDocument, interval: FixedInterval, newValue: T, keepCustomFormatting?: boolean): HistoryItemIntervalState<HistoryItemIntervalStateObject>;
12
12
  restoreValue(subDocument: SubDocument, state: HistoryItemIntervalState<HistoryItemIntervalStateObject>): any;
13
13
  }
14
14
  export interface IListLevelPropertyManipulator<T> {
@@ -41,13 +41,9 @@ export class RulerControl extends RulerBase {
41
41
  }
42
42
  adjust() {
43
43
  const viewWidth = this.controls.canvas.clientWidth;
44
- if (viewWidth > this.controls.ruler.pageWidth)
45
- this.initialMarginLeftElement = (viewWidth - this.pageWidth - RULLER_NUMBER_CORRECTION * 2) / 2;
46
- else {
47
- const paddingLeft = DomUtils.pxToInt(DomUtils.getCurrentStyle(this.controls.canvas).paddingLeft);
48
- const pageAreaBorderWidth = (this.controls.canvas.scrollWidth - paddingLeft - this.pageWidth) / 2;
49
- this.initialMarginLeftElement = paddingLeft + pageAreaBorderWidth - RULLER_NUMBER_CORRECTION;
50
- }
44
+ const paddingLeft = DomUtils.pxToInt(DomUtils.getCurrentStyle(this.controls.canvas).paddingLeft);
45
+ const minValue = paddingLeft - RULLER_NUMBER_CORRECTION;
46
+ this.initialMarginLeftElement = Math.max((viewWidth - this.pageWidth - RULLER_NUMBER_CORRECTION * 2) / 2, minValue);
51
47
  this.rootElement.style.left = this.calculateLeftOffset();
52
48
  this.setPaddings();
53
49
  this.canHandleScroll = this.controls.canvas.scrollWidth > this.controls.canvas.offsetWidth;
@@ -1,6 +1,7 @@
1
1
  import { DomUtils } from '@devexpress/utils/lib/utils/dom';
2
2
  import { DocumentRenderer } from '../../../canvas/renderes/common/document-renderer';
3
3
  import { RULLER_NUMBER_CORRECTION } from '../settings';
4
+ import { SizeUtils } from '../../../../common/utils/size-utils';
4
5
  export const TABLE_COLUMN_SEPARATOR_RULER_LINE_CLASS_NAME = " table";
5
6
  export var SnapTo;
6
7
  (function (SnapTo) {
@@ -33,7 +34,7 @@ export class RulerVerticalLineControl {
33
34
  DomUtils.addClassName(this.rootElement, TABLE_COLUMN_SEPARATOR_RULER_LINE_CLASS_NAME);
34
35
  else
35
36
  DomUtils.removeClassName(this.rootElement, TABLE_COLUMN_SEPARATOR_RULER_LINE_CLASS_NAME);
36
- this.rootElement.style.height = this.canvas.clientHeight + "px";
37
+ this.rootElement.style.height = SizeUtils.getClientHeight(this.canvas) + "px";
37
38
  this.rootElement.style.top = this.canvas.offsetTop + "px";
38
39
  this.rulerControlLeft = this.rulerControlElement.offsetLeft;
39
40
  this.rulerControlWidth = this.rulerControlElement.offsetWidth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devexpress-richedit",
3
- "version": "24.2.8-build-25135-0103",
3
+ "version": "24.2.8-build-25142-0115",
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.2.8-build-25133-1935",
18
- "devextreme-dist": "24.2.8-build-25133-1935"
17
+ "devextreme": "24.2.8-build-25141-1935",
18
+ "devextreme-dist": "24.2.8-build-25141-1935"
19
19
  },
20
20
  "dependencies": {
21
21
  "jszip": "~3.10.1",