devexpress-richedit 24.1.11-build-25044-1420 → 24.1.11-build-25051-0101

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.
@@ -66,12 +66,11 @@ export declare class ClipboardHelper {
66
66
  private control;
67
67
  private useWithBuildInClipboard;
68
68
  private static browserDoesNotSupportReadingFromClipboard;
69
- private static browserDoesNotSupportWritingToClipboard;
70
69
  private static noDataInClipboardMessage;
71
70
  private static clipboardItemCannotBeInsertedMessage;
72
- private static lastWritenTextHash;
71
+ private static lastWrittenTextHash;
73
72
  constructor(control: IRichEditControl, useWithBuildInClipboard?: boolean);
74
- protected get clipboard(): any;
73
+ protected get clipboard(): Clipboard;
75
74
  canReadFromClipboard(): boolean;
76
75
  readFromClipboard(): Promise<void>;
77
76
  clearAfterImport(): void;
@@ -79,9 +78,10 @@ export declare class ClipboardHelper {
79
78
  private insertClipboardItem;
80
79
  private insertPlainText;
81
80
  private insertHtml;
82
- canWriteToClipboard(): boolean;
83
- writeToClipboard(clipboardData: RangeCopy): Promise<void>;
84
81
  tryWriteToClipboard(clipboardData: RangeCopy): Promise<void>;
82
+ private canWriteToClipboard;
83
+ private writeToClipboard;
84
+ protected createClipboardItem(blob: Blob): ClipboardItem;
85
85
  private calculateHash;
86
86
  protected readAsText(blob: Blob): Promise<string>;
87
87
  private createModelManager;
@@ -115,7 +115,14 @@ export class ClipboardCommand extends CommandBase {
115
115
  this.control.endUpdate();
116
116
  }
117
117
  tryWriteToClipboard() {
118
- this.clipboardHelper.tryWriteToClipboard(ClipboardCommand.builtInClipboard.clipboardData).catch(reason => console.log(reason));
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ try {
120
+ yield this.clipboardHelper.tryWriteToClipboard(ClipboardCommand.builtInClipboard.clipboardData);
121
+ }
122
+ catch (error) {
123
+ console.log(error);
124
+ }
125
+ });
119
126
  }
120
127
  isVisible() {
121
128
  return true;
@@ -312,15 +319,17 @@ export class ClipboardHelper {
312
319
  return Promise.reject(ClipboardHelper.noDataInClipboardMessage);
313
320
  }
314
321
  insertClipboardItem(item, type, insert) {
315
- return item.getType(type)
316
- .then(blob => this.readAsText(blob))
317
- .then(text => insert(text));
322
+ return __awaiter(this, void 0, void 0, function* () {
323
+ const blob = yield item.getType(type);
324
+ const text = yield this.readAsText(blob);
325
+ return yield insert(text);
326
+ });
318
327
  }
319
328
  insertPlainText(text) {
320
329
  return new Promise((resolve, reject) => {
321
- if (ClipboardHelper.lastWritenTextHash === this.calculateHash(text))
330
+ if (ClipboardHelper.lastWrittenTextHash === this.calculateHash(text))
322
331
  reject();
323
- ClipboardHelper.lastWritenTextHash = -1;
332
+ ClipboardHelper.lastWrittenTextHash = -1;
324
333
  const command = new InsertPlainTextCommand(this.control);
325
334
  if (command.execute(false, new CommandSimpleOptions(this.control, text)))
326
335
  resolve();
@@ -342,30 +351,43 @@ export class ClipboardHelper {
342
351
  }
343
352
  });
344
353
  }
354
+ tryWriteToClipboard(clipboardData) {
355
+ return __awaiter(this, void 0, void 0, function* () {
356
+ if (this.canWriteToClipboard())
357
+ yield this.writeToClipboard(clipboardData);
358
+ });
359
+ }
345
360
  canWriteToClipboard() {
346
361
  var _a;
347
- return !!((_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.writeText);
362
+ return !!((_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.write);
348
363
  }
349
364
  writeToClipboard(clipboardData) {
350
- ClipboardHelper.lastWritenTextHash = -1;
365
+ ClipboardHelper.lastWrittenTextHash = -1;
351
366
  return new Promise((resolve, reject) => {
352
367
  const modelManager = this.createModelManager(clipboardData.model);
353
368
  const exporter = new TxtExporter(modelManager.modelManipulator, new DocumentExporterOptions());
354
369
  exporter.exportToBlob((blob) => __awaiter(this, void 0, void 0, function* () {
355
- const text = yield this.readAsText(blob);
356
- if (this.useWithBuildInClipboard)
357
- ClipboardHelper.lastWritenTextHash = this.calculateHash(text);
358
- if (this.canWriteToClipboard())
359
- this.clipboard.writeText(text).then(() => resolve()).catch(reason => reject(reason));
370
+ let error = null;
371
+ try {
372
+ const item = this.createClipboardItem(blob);
373
+ yield this.clipboard.write([item]);
374
+ }
375
+ catch (err) {
376
+ error = err;
377
+ }
378
+ if (this.useWithBuildInClipboard) {
379
+ const text = yield this.readAsText(blob);
380
+ ClipboardHelper.lastWrittenTextHash = this.calculateHash(text);
381
+ }
382
+ if (error)
383
+ reject(error);
360
384
  else
361
- return Promise.reject(ClipboardHelper.browserDoesNotSupportWritingToClipboard);
385
+ resolve();
362
386
  }));
363
387
  });
364
388
  }
365
- tryWriteToClipboard(clipboardData) {
366
- if (this.canWriteToClipboard())
367
- return this.writeToClipboard(clipboardData);
368
- return Promise.resolve();
389
+ createClipboardItem(blob) {
390
+ return new ClipboardItem({ 'text/plain': blob });
369
391
  }
370
392
  calculateHash(text) {
371
393
  let hash = 0;
@@ -385,10 +407,9 @@ export class ClipboardHelper {
385
407
  }
386
408
  }
387
409
  ClipboardHelper.browserDoesNotSupportReadingFromClipboard = 'The browser does not support reading from the clipboard.';
388
- ClipboardHelper.browserDoesNotSupportWritingToClipboard = 'The browser does not support writing to the clipboard.';
389
410
  ClipboardHelper.noDataInClipboardMessage = 'There is no any supported data in the clipboard.';
390
411
  ClipboardHelper.clipboardItemCannotBeInsertedMessage = 'The clipboard item cannot be inserted.';
391
- ClipboardHelper.lastWritenTextHash = -1;
412
+ ClipboardHelper.lastWrittenTextHash = -1;
392
413
  export class InsertHtmlCommand extends CommandBase {
393
414
  getState() {
394
415
  return new SimpleCommandState(this.isEnabled());
@@ -7,6 +7,7 @@ import { FieldName } from '../names';
7
7
  import { FieldCodeParserState, FieldSwitchType } from './field-code-parser';
8
8
  import { FieldCodeParserClientUpdatingBase } from './field-code-parser-client-updating-base';
9
9
  import { UrlUtils } from '../../../utils/utils';
10
+ import { StringUtils } from '@devexpress/utils/lib/utils/string';
10
11
  export class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase {
11
12
  get name() { return FieldName.Hyperlink; }
12
13
  parseCodeCurrentFieldInternal(_responce) {
@@ -23,15 +24,14 @@ export class FieldCodeParserHyperlink extends FieldCodeParserClientUpdatingBase
23
24
  const text = (_b = (_a = this.parameterInfoList[0]) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
24
25
  const newHyperlinkInfo = this.updateHyperlinkInfo(text);
25
26
  if (!newHyperlinkInfo) {
26
- if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference) {
27
+ if (!this.modelManager.richOptions.fields.keepHyperlinkResultForInvalidReference)
27
28
  this.removeInterval(this.getTopField().getResultInterval());
28
- }
29
29
  return true;
30
30
  }
31
31
  const modelManipulator = this.modelManager.modelManipulator;
32
32
  const resultInterval = field.getResultInterval();
33
33
  if (resultInterval.length === 0) {
34
- const resultText = text !== null && text !== void 0 ? text : "#" + newHyperlinkInfo.anchor;
34
+ const resultText = StringUtils.isNullOrEmpty(text) ? `#${newHyperlinkInfo.anchor}` : text;
35
35
  const newResultInterval = new FixedInterval(resultInterval.start, resultText.length);
36
36
  this.setInputPositionState();
37
37
  this.replaceTextByInterval(resultInterval, resultText);
@@ -35,12 +35,11 @@ export class TouchHandlerPopupMenuState extends TouchHandlerStateBase {
35
35
  return new TouchHandlerBeginTapProcessingState(this.handler, evt);
36
36
  }
37
37
  canExtendSelection(mousePoint, lpStart) {
38
- return this.handler.control.focusManager.isInFocus &&
39
- this.handler.control.selection.isCollapsed() &&
38
+ return this.handler.control.selection.isCollapsed() &&
40
39
  this.isHitPoints(mousePoint, lpStart.getPositionRelativePage(this.handler.control.measurer), lpStart.row.height);
41
40
  }
42
41
  canExtendSelectionOnOneSide(mousePoint, selectionInterval) {
43
- return this.handler.control.focusManager.isInFocus && this.isLeftOrRightEdge(mousePoint, selectionInterval);
42
+ return this.isLeftOrRightEdge(mousePoint, selectionInterval);
44
43
  }
45
44
  getLayoutPosition(logPosition) {
46
45
  var subDocument = this.handler.control.selection.activeSubDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devexpress-richedit",
3
- "version": "24.1.11-build-25044-1420",
3
+ "version": "24.1.11-build-25051-0101",
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-build-25043-1937",
18
- "devextreme-dist": "24.1.11-build-25043-1937"
17
+ "devextreme": "24.1.11-build-25049-1936",
18
+ "devextreme-dist": "24.1.11-build-25049-1936"
19
19
  },
20
20
  "dependencies": {
21
21
  "jszip": "~3.10.1",