devexpress-richedit 24.1.5-build-24211-0105 → 24.1.5

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.
@@ -53,8 +53,8 @@ export class ClientRichEdit {
53
53
  this.rawDataSource = settings.rawDataSource;
54
54
  this.contextMenuSettings = settings.contextMenuSettings;
55
55
  this.fullScreenHelper = new FullScreenHelper(element);
56
- if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=")
57
- config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFYWkdXQzFTVkdFeU1IbFVPRGh0YzAxNmRsQTJaeUlLZlE9PS5GYjZ4U0JwU3BSVHBWajZ0dWtlQTJZaU1WVW5tb0ZoSDJKV3Ryak5iN3p6VlNrNzhKa294RVFKOW9rVlErYnh0SzM1WWlFZkpEWGJnNktrYVA1ZEljcnp0ZHlsOFlGL2ltc3BIWkY5aWlaeGtVK0FXbFVrV1RUb2c0ZnZDbWlxMTl2MWhIdz09In0=")));
56
+ if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWExcHBaR1pSWjA1WGEyVkxaVmx6U2tJNFdHcFhaeUlLZlE9PS5mL01XY3Z5bDUyTFJMRWlMaEVyYnF1eW5yQ3FEQjdvZ0U1QVgxcGdpMXduSW9sT1MySFluNjBWeDBTb0VJVVpEUGhIRlBSQkdpSzg2cFA1K0xjMG56dUd6RFpEZkVUUS9CeklldjJoNTYzdWc2SzlKMCswMER0eTlvVW1GU2xvRTl6WTdQZz09In0=")
57
+ config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWExcHBaR1pSWjA1WGEyVkxaVmx6U2tJNFdHcFhaeUlLZlE9PS5mL01XY3Z5bDUyTFJMRWlMaEVyYnF1eW5yQ3FEQjdvZ0U1QVgxcGdpMXduSW9sT1MySFluNjBWeDBTb0VJVVpEUGhIRlBSQkdpSzg2cFA1K0xjMG56dUd6RFpEZkVUUS9CeklldjJoNTYzdWc2SzlKMCswMER0eTlvVW1GU2xvRTl6WTdQZz09In0=")));
58
58
  this.prepareElement(element, settings);
59
59
  this.initDefaultFontsAndStyles();
60
60
  this.initBars(settings.ribbon, settings.fonts);
@@ -7,7 +7,6 @@ import { LogListHelper } from '../../rich-utils/debug/logger/base-logger/log-lis
7
7
  import { LogSource } from '../../rich-utils/debug/logger/base-logger/log-source';
8
8
  import { LogObjToStrLayout } from '../../rich-utils/debug/logger/layout-logger/log-obj-to-str-layout';
9
9
  import { ViewType } from '../../view-settings/views-settings';
10
- import { Browser } from '@devexpress/utils/lib/browser';
11
10
  import { DomUtils } from '@devexpress/utils/lib/utils/dom';
12
11
  import { ListUtils } from '@devexpress/utils/lib/utils/list';
13
12
  import { NumberMapUtils } from '@devexpress/utils/lib/utils/map/number';
@@ -102,14 +101,12 @@ export class ViewManager {
102
101
  this.selection.renderAllPageSelection(this.layout, 0, true);
103
102
  else
104
103
  this.selection.applySelectionChanges(this.layout);
105
- if (Browser.WebKitTouchUI || (Browser.MacOSPlatform && Browser.MajorVersion >= 13) || Browser.Chrome) {
106
- const pageIndex = ListUtils.reverseIndexBy(layoutSelection.selectionInfo.pageInfos, pageInfo => pageInfo.oldItems.length > 0);
107
- if (pageIndex > -1) {
108
- const pageInfo = layoutSelection.selectionInfo.pageInfos[pageIndex];
109
- const item = pageInfo.oldItems[0];
110
- const layoutPage = this.layout.pages[pageIndex];
111
- this.inputController.setPosition(layoutPage.x + this.cache[pageIndex].page.offsetLeft + item.x, this.sizes.getPageOffsetY(layoutPage) + item.y);
112
- }
104
+ const pageIndex = ListUtils.reverseIndexBy(layoutSelection.selectionInfo.pageInfos, pageInfo => pageInfo.oldItems.length > 0);
105
+ if (pageIndex > -1) {
106
+ const pageInfo = layoutSelection.selectionInfo.pageInfos[pageIndex];
107
+ const item = pageInfo.oldItems[0];
108
+ const layoutPage = this.layout.pages[pageIndex];
109
+ this.inputController.setPosition(layoutPage.x + this.cache[pageIndex].page.offsetLeft + item.x, this.sizes.getPageOffsetY(layoutPage) + item.y);
113
110
  }
114
111
  }
115
112
  NotifySearchSelectionLayoutChanged() {
@@ -1,6 +1,7 @@
1
1
  import { LayoutPoint } from './layout/layout-point';
2
2
  import { Offset, Point } from '@devexpress/utils/lib/geometry/point';
3
3
  import { ModifierKey } from '@devexpress/utils/lib/utils/key';
4
+ import { RichEditClientCommand } from './commands/client-command';
4
5
  import { IEventManager } from './interfaces/i-event-manager';
5
6
  import { IRichEditControl } from './interfaces/i-rich-edit-core';
6
7
  import { BoxVisualizerManager } from './layout-engine/visualizers/box-visualizer-manager';
@@ -17,6 +18,7 @@ export declare class EventManager implements IEventManager {
17
18
  control: IRichEditControl;
18
19
  mouseHandler: MouseHandler;
19
20
  touchHandler: TouchHandler;
21
+ inputTypeHandlers: Record<string, RichEditClientCommand>;
20
22
  moveLocked: boolean;
21
23
  shouldPreventContextMenuEvent: boolean;
22
24
  set mouseWheelEvent(val: boolean);
@@ -48,6 +50,8 @@ export declare class EventManager implements IEventManager {
48
50
  onFocusOut(): void;
49
51
  isFocused(): boolean;
50
52
  private lockMouseMove;
53
+ onInput(inputType: string): boolean;
54
+ private createInputTypeHandlers;
51
55
  }
52
56
  export declare class RichMouseEvent {
53
57
  layoutPoint: LayoutPoint;
@@ -40,6 +40,7 @@ export class EventManager {
40
40
  this.control = control;
41
41
  this.mouseHandler = new MouseHandler(control, boxVisualizerManager);
42
42
  this.touchHandler = new TouchHandler(control, boxVisualizerManager);
43
+ this.inputTypeHandlers = this.createInputTypeHandlers();
43
44
  }
44
45
  set mouseWheelEvent(val) {
45
46
  this.mouseHandler.mouseWheelEvent = val;
@@ -212,6 +213,19 @@ export class EventManager {
212
213
  this.moveLocked = true;
213
214
  this.lockMouseMoveTimerId = setTimeout(() => this.moveLocked = false, 0);
214
215
  }
216
+ onInput(inputType) {
217
+ const commandId = this.inputTypeHandlers[inputType];
218
+ if (!commandId)
219
+ return false;
220
+ const command = this.control.commandManager.getCommand(commandId);
221
+ command.execute(false);
222
+ return true;
223
+ }
224
+ createInputTypeHandlers() {
225
+ const result = {};
226
+ result["insertParagraph"] = RichEditClientCommand.InsertParagraph;
227
+ return result;
228
+ }
215
229
  }
216
230
  export class RichMouseEvent {
217
231
  constructor(evt, layoutPoint, source, scrollTop, scrollLeft) {
@@ -5,6 +5,7 @@ import { IRichEditControl } from './interfaces/i-rich-edit-core';
5
5
  import { HtmlBuilder } from './formats/html/export/html-builder';
6
6
  export declare const INPUT_CLASS_NAME = "dxreInputTarget";
7
7
  export declare abstract class InputEditorBase<TInpElement extends HTMLElement> {
8
+ private newLineRegexp;
8
9
  eventManager: IEventManager;
9
10
  control: IRichEditControl;
10
11
  inputElement: TInpElement;
@@ -31,7 +32,7 @@ export declare abstract class InputEditorBase<TInpElement extends HTMLElement> {
31
32
  createHierarchy(parent: HTMLElement): void;
32
33
  createHierarchyCore(): void;
33
34
  createInputElement(): TInpElement;
34
- onInput(evt: KeyboardEvent): void;
35
+ onInput(evt: InputEvent): void;
35
36
  onBlur(_evt: FocusEvent): void;
36
37
  onFocus(): void;
37
38
  onKeyDown(evt: KeyboardEvent): void;
@@ -47,7 +48,7 @@ export declare abstract class InputEditorBase<TInpElement extends HTMLElement> {
47
48
  tryObtainCodeFromChar(char: string): number;
48
49
  captureFocus(): void;
49
50
  canUseInputEvent(): boolean;
50
- getEditableDocumentText(): string;
51
+ getEditableDocumentText(keepLineBreakes?: boolean): string;
51
52
  getEditableTextOwner(): HTMLElement;
52
53
  setPosition(left: number, top: number): void;
53
54
  clearInputElement(): void;
@@ -74,7 +75,7 @@ export declare class DivInputEditor extends InputEditorBase<HTMLElement> {
74
75
  createInputElement(): HTMLElement;
75
76
  onKeyDown(evt: KeyboardEvent): void;
76
77
  onKeyUp(evt: KeyboardEvent): void;
77
- onInput(evt: KeyboardEvent): void;
78
+ onInput(evt: InputEvent): void;
78
79
  onFocus(): void;
79
80
  onBlur(evt: FocusEvent): void;
80
81
  onShortcutCore(evt: KeyboardEvent, shortcutCode: number): void;
@@ -25,6 +25,7 @@ const TAB_KEYCODE = 9;
25
25
  const IDEOGRAPHIC_SPACE_CHARCODE = 12288;
26
26
  export class InputEditorBase {
27
27
  constructor(control, eventManager, parent) {
28
+ this.newLineRegexp = /(\r\n|\n|\r)/gm;
28
29
  this.processTextOnKeyPress = false;
29
30
  this.evtHandlersHolder = new DomEventHandlersHolder();
30
31
  this.control = control;
@@ -63,8 +64,7 @@ export class InputEditorBase {
63
64
  this.evtHandlersHolder.addListener(this.getEditableDocument(), "focus", this.onFocus.bind(this));
64
65
  this.evtHandlersHolder.addListener(this.getEditableDocument(), "blur", (evt) => this.onBlurTimerId = setTimeout(() => this.onBlur(evt), 10));
65
66
  this.evtHandlersHolder.addListener(this.getEditableDocument(), "contextmenu", this.onContextMenu.bind(this));
66
- if (this.canInsertTextOnInputEvent)
67
- this.evtHandlersHolder.addListener(this.getEditableDocument(), "input", (evt) => this.onInput(evt));
67
+ this.evtHandlersHolder.addListener(this.getEditableDocument(), "input", (evt) => this.onInput(evt));
68
68
  }
69
69
  createHierarchy(parent) {
70
70
  this.inputElement = this.createInputElement();
@@ -78,8 +78,21 @@ export class InputEditorBase {
78
78
  return null;
79
79
  }
80
80
  onInput(evt) {
81
- if (this.canInsertTextOnInputEvent)
82
- this.onInputTimerId = setTimeout(() => this.onTextInput(evt.data), 0);
81
+ if (!this.processTextOnKeyPress) {
82
+ if (evt.inputType === "insertText") {
83
+ const text = this.getEditableTextOwner().innerText;
84
+ if (StringUtils.isNullOrEmpty(text))
85
+ return;
86
+ if (this.newLineRegexp.test(text)) {
87
+ this.eventManager.onInput("insertParagraph");
88
+ this.clearInputElement();
89
+ }
90
+ else
91
+ this.onInputTimerId = setTimeout(() => this.onTextInput(evt.data), 0);
92
+ }
93
+ else if (this.eventManager.onInput(evt.inputType))
94
+ this.clearInputElement();
95
+ }
83
96
  }
84
97
  onBlur(_evt) {
85
98
  const targetElement = document.activeElement;
@@ -135,11 +148,10 @@ export class InputEditorBase {
135
148
  this.keyPressTimerId = setTimeout(() => this.onTextInput(undefined), 0);
136
149
  else if (this.processTextOnKeyPress) {
137
150
  this.imeTimerId = setTimeout(() => {
138
- if (!this.isIME)
139
- this.onTextInput(undefined);
151
+ this.onTextInput(undefined);
152
+ this.processTextOnKeyPress = false;
140
153
  }, 0);
141
154
  }
142
- this.processTextOnKeyPress = false;
143
155
  this.inputWithAlt = false;
144
156
  }
145
157
  }
@@ -200,8 +212,9 @@ export class InputEditorBase {
200
212
  canUseInputEvent() {
201
213
  return Browser.Firefox && Browser.MajorVersion >= 14 || Browser.WebKitTouchUI;
202
214
  }
203
- getEditableDocumentText() {
204
- return DomUtils.getInnerText(this.getEditableTextOwner()).replace(/(\r\n|\n|\r)/gm, "");
215
+ getEditableDocumentText(keepLineBreakes = false) {
216
+ const text = DomUtils.getInnerText(this.getEditableTextOwner());
217
+ return keepLineBreakes ? text : text.replace(this.newLineRegexp, "");
205
218
  }
206
219
  getEditableTextOwner() {
207
220
  return null;
@@ -13,6 +13,7 @@ export interface IEventManager {
13
13
  onText(text: string, isUpdated: boolean): any;
14
14
  onTextReplace(text: string, length?: number): any;
15
15
  onShortcut(shortcutCode: number): any;
16
+ onInput(inputType: string): boolean;
16
17
  isFocused(): boolean;
17
18
  onFocusIn(): any;
18
19
  onFocusOut(): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devexpress-richedit",
3
- "version": "24.1.5-build-24211-0105",
3
+ "version": "24.1.5",
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.5-build-24209-1937",
18
- "devextreme-dist": "24.1.5-build-24209-1937"
17
+ "devextreme": "24.1.5",
18
+ "devextreme-dist": "24.1.5"
19
19
  },
20
20
  "dependencies": {
21
21
  "jszip": "~3.10.1",