devexpress-richedit 24.2.5-build-25037-0102 → 24.2.6-build-25051-0120
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.
- package/bin/gulpfile.js +1 -1
- package/bin/index-custom.js +1 -1
- package/bin/localization-builder.js +1 -1
- package/bin/nspell-index.js +1 -1
- package/bin/nspell.webpack.config.js +1 -1
- package/bin/webpack-externals.js +1 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.d.ts +1 -1
- package/dist/dx.richedit.js +210 -165
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/common/commands/text/clipboard-commands.d.ts +5 -5
- package/lib/common/commands/text/clipboard-commands.js +41 -20
- package/lib/common/focus-manager.js +1 -4
- package/lib/common/input-controller.d.ts +1 -1
- package/lib/common/input-controller.js +11 -8
- package/lib/common/model/fields/field.js +0 -2
- package/lib/common/model/fields/parsers/field-code-parser-hyperlink.js +3 -3
- package/lib/common/mouse-handler/touch-handler/touch-handler-popup-menu-state.js +2 -3
- package/package.json +3 -3
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -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
|
71
|
+
private static lastWrittenTextHash;
|
73
72
|
constructor(control: IRichEditControl, useWithBuildInClipboard?: boolean);
|
74
|
-
protected get clipboard():
|
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
|
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
|
316
|
-
|
317
|
-
|
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.
|
330
|
+
if (ClipboardHelper.lastWrittenTextHash === this.calculateHash(text))
|
322
331
|
reject();
|
323
|
-
ClipboardHelper.
|
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.
|
362
|
+
return !!((_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.write);
|
348
363
|
}
|
349
364
|
writeToClipboard(clipboardData) {
|
350
|
-
ClipboardHelper.
|
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
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
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
|
-
|
385
|
+
resolve();
|
362
386
|
}));
|
363
387
|
});
|
364
388
|
}
|
365
|
-
|
366
|
-
|
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.
|
412
|
+
ClipboardHelper.lastWrittenTextHash = -1;
|
392
413
|
export class InsertHtmlCommand extends CommandBase {
|
393
414
|
getState() {
|
394
415
|
return new SimpleCommandState(this.isEnabled());
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Browser } from '@devexpress/utils/lib/browser';
|
2
1
|
export class FocusManager {
|
3
2
|
constructor(canvasManager, owner, inputController, eventManager) {
|
4
3
|
this.canvasManager = canvasManager;
|
@@ -18,9 +17,7 @@ export class FocusManager {
|
|
18
17
|
captureFocus() {
|
19
18
|
if (this.owner.canCaptureFocus()) {
|
20
19
|
this.owner.onCaptureFocus();
|
21
|
-
|
22
|
-
Browser.MacOSMobilePlatform && window.self !== window.top)
|
23
|
-
this.inputController.captureFocus();
|
20
|
+
this.inputController.captureFocus();
|
24
21
|
this.eventManager.onFocusIn();
|
25
22
|
}
|
26
23
|
}
|
@@ -119,7 +119,7 @@ export declare class IFrameInputEditor extends InputEditorBase<HTMLIFrameElement
|
|
119
119
|
initEvents(): void;
|
120
120
|
private isModifyEnabled;
|
121
121
|
captureFocus(): void;
|
122
|
-
setPosition(left: number, top: number): void;
|
122
|
+
setPosition(left: number, top: number, force?: boolean): void;
|
123
123
|
clearInputElement(): void;
|
124
124
|
setEditableDocumentContent(content: string | NodeListOf<ChildNode>): void;
|
125
125
|
getEditableDocumentContent(): string | NodeListOf<ChildNode>;
|
@@ -410,15 +410,16 @@ export class DivInputEditor extends InputEditorBase {
|
|
410
410
|
this.cursorWasSetOnLastPosition = true;
|
411
411
|
}
|
412
412
|
setEditableDocumentContent(content) {
|
413
|
+
if (!content) {
|
414
|
+
this.clearInputElement();
|
415
|
+
return;
|
416
|
+
}
|
413
417
|
if (typeof content === "string")
|
414
418
|
this.inputElement.innerHTML = content;
|
415
|
-
else
|
419
|
+
else {
|
416
420
|
this.inputElement.innerHTML = "";
|
417
|
-
|
418
|
-
this.inputElement.appendChild(content[i]);
|
421
|
+
content.forEach((node) => this.inputElement.appendChild(node));
|
419
422
|
}
|
420
|
-
else
|
421
|
-
this.clearInputElement();
|
422
423
|
}
|
423
424
|
setEditableDocumentCursorPosition(cursorPosition) {
|
424
425
|
let textLength = this.getEditableDocumentFullText().length;
|
@@ -587,8 +588,9 @@ export class IFrameInputEditor extends InputEditorBase {
|
|
587
588
|
else
|
588
589
|
DomUtils.setFocus(this.control.readOnly == ReadOnlyMode.Persistent ? this.inputElement : this.editableDocument.body);
|
589
590
|
}
|
590
|
-
setPosition(left, top) {
|
591
|
-
|
591
|
+
setPosition(left, top, force = false) {
|
592
|
+
if (this.IMEState === IMEState.None || force)
|
593
|
+
super.setPosition(left, top);
|
592
594
|
if (left && top)
|
593
595
|
this.selectEditableDocumentContent();
|
594
596
|
}
|
@@ -723,11 +725,12 @@ export class IFrameInputEditor extends InputEditorBase {
|
|
723
725
|
const layoutPoint = new LayoutPoint(layoutPosition.pageIndex, layoutX, layoutPosition.getLayoutY(DocumentLayoutDetailsLevel.Row));
|
724
726
|
const pageElement = this.control.viewManager.cache[layoutPoint.pageIndex].page;
|
725
727
|
layoutPoint.offset(pageElement.offsetLeft, pageElement.offsetTop);
|
726
|
-
this.setPosition(layoutPoint.x, layoutPoint.y);
|
728
|
+
this.setPosition(layoutPoint.x, layoutPoint.y, true);
|
727
729
|
this.editableDocument.body.style.textIndent = this.previousText.length ? currentTextIndent :
|
728
730
|
layoutPosition.getLayoutX(this.control.measurer, DocumentLayoutDetailsLevel.Box) +
|
729
731
|
layoutPosition.box.getCharOffsetXInPixels(this.control.measurer, layoutPosition.charOffset) - layoutX + "px";
|
730
732
|
this.inputElement.style.width = layoutPosition.row.width + "px";
|
733
|
+
this.inputElement.style.minWidth = layoutPosition.row.width + "px";
|
731
734
|
if (Browser.IE || Browser.Edge) {
|
732
735
|
this.editableDocument.body.style.width = this.inputElement.style.width;
|
733
736
|
this.editableDocument.body.style.height = this.inputElement.style.height = layoutPosition.row.height + "px";
|
@@ -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
|
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.
|
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.
|
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.2.
|
3
|
+
"version": "24.2.6-build-25051-0120",
|
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.
|
18
|
-
"devextreme-dist": "24.2.
|
17
|
+
"devextreme": "24.2.6-build-25050-1935",
|
18
|
+
"devextreme-dist": "24.2.6-build-25050-1935"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
21
|
"jszip": "~3.10.1",
|