devexpress-richedit 25.1.13 → 25.1.14
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 +177 -140
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/client-rich-edit.js +2 -2
- package/lib/common/commands/text/clipboard-commands.js +11 -8
- package/lib/common/rich-utils/html-utils.d.ts +5 -2
- package/lib/common/rich-utils/html-utils.js +42 -8
- package/package.json +3 -3
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -62,8 +62,8 @@ export class ClientRichEdit {
|
|
|
62
62
|
this.rawDataSource = settings.rawDataSource;
|
|
63
63
|
this.contextMenuSettings = settings.contextMenuSettings;
|
|
64
64
|
this.fullScreenHelper = new FullScreenHelper(element);
|
|
65
|
-
if ("
|
|
66
|
-
config(JSON.parse(atob("
|
|
65
|
+
if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWRubDViekJaZUhseGRHWjVUakJGYjNsR2RWZDRjaUlLZlE9PS5vcDA0VmtJbFI3VnUvbit4WVVPZENPOGhNUmJvaE1TZGJqVXBIdDR1TWk1T2V5NHB1b0ZJcmhjTkdUWk5RcmJyeHRMSXd6Wk9ZckJ1UTU2aEdkc05QaWZTcnQ2R3YvL0xjMXE4VFNrLzNDMjFVTHJ2REVSWVZiYnRhMUZkRmczSXFIeVdmdz09In0=")
|
|
66
|
+
config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWRubDViekJaZUhseGRHWjVUakJGYjNsR2RWZDRjaUlLZlE9PS5vcDA0VmtJbFI3VnUvbit4WVVPZENPOGhNUmJvaE1TZGJqVXBIdDR1TWk1T2V5NHB1b0ZJcmhjTkdUWk5RcmJyeHRMSXd6Wk9ZckJ1UTU2aEdkc05QaWZTcnQ2R3YvL0xjMXE4VFNrLzNDMjFVTHJ2REVSWVZiYnRhMUZkRmczSXFIeVdmdz09In0=")));
|
|
67
67
|
this.prepareElement(element, settings);
|
|
68
68
|
this.initDefaultFontsAndStyles();
|
|
69
69
|
this.initBars(settings.ribbon, settings.fonts);
|
|
@@ -215,9 +215,11 @@ export class PasteSelectionCommand extends ClipboardCommand {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
changeModel() {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
this.control.importHtml(elements);
|
|
218
|
+
if (!this.control.isLoadingPictureFromClipboard) {
|
|
219
|
+
const result = getHTMLElementsFromHtml(this.control.inputController.getEditableDocumentContent());
|
|
220
|
+
this.control.importHtml(result.elements);
|
|
221
|
+
result.dispose();
|
|
222
|
+
}
|
|
221
223
|
}
|
|
222
224
|
isEnabled() {
|
|
223
225
|
return super.isEnabled() && ControlOptions.isEnabled(this.control.modelManager.richOptions.control.paste);
|
|
@@ -337,8 +339,9 @@ export class ClipboardHelper {
|
|
|
337
339
|
return new Promise((resolve, reject) => {
|
|
338
340
|
try {
|
|
339
341
|
this.control.beginUpdate();
|
|
340
|
-
const
|
|
341
|
-
this.control.importHtml(elements);
|
|
342
|
+
const result = getHTMLElementsFromHtml(html);
|
|
343
|
+
this.control.importHtml(result.elements);
|
|
344
|
+
result.dispose();
|
|
342
345
|
this.control.endUpdate();
|
|
343
346
|
resolve();
|
|
344
347
|
}
|
|
@@ -411,13 +414,13 @@ export class InsertHtmlCommand extends CommandBase {
|
|
|
411
414
|
return new SimpleCommandState(this.isEnabled());
|
|
412
415
|
}
|
|
413
416
|
executeCore(_state, options) {
|
|
414
|
-
const
|
|
417
|
+
const result = getHTMLElementsFromHtml(options.param);
|
|
415
418
|
this.history.addTransaction(() => {
|
|
416
419
|
const charPropsBundle = this.inputPosition.charPropsBundle;
|
|
417
420
|
this.modelManipulator.range.removeInterval(this.selection.subDocumentInterval, true, false);
|
|
418
|
-
new HtmlImporter(this.control.modelManager, this.control.measurer, this.selection.intervalsInfo.subDocPosition, elements, charPropsBundle).import();
|
|
421
|
+
new HtmlImporter(this.control.modelManager, this.control.measurer, this.selection.intervalsInfo.subDocPosition, result.elements, charPropsBundle).import();
|
|
419
422
|
});
|
|
420
|
-
|
|
423
|
+
result.dispose();
|
|
421
424
|
return true;
|
|
422
425
|
}
|
|
423
426
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getHTMLElementsFromHtml(
|
|
1
|
+
import { IDisposable } from "@devexpress/utils/lib/types";
|
|
2
|
+
export declare function getHTMLElementsFromHtml(html: string | NodeListOf<ChildNode>): IHtmlResult;
|
|
3
|
+
export interface IHtmlResult extends IDisposable {
|
|
4
|
+
readonly elements: HTMLElement[];
|
|
5
|
+
}
|
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
import { HtmlImporter } from "../formats/html/import/html-importer";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
2
|
+
let shadowRoot;
|
|
3
|
+
if (document.readyState === 'loading')
|
|
4
|
+
document.addEventListener('DOMContentLoaded', createShadowRoot);
|
|
5
|
+
else
|
|
6
|
+
createShadowRoot();
|
|
7
|
+
export function getHTMLElementsFromHtml(html) {
|
|
8
|
+
const fragment = document.createDocumentFragment();
|
|
9
|
+
if (typeof html === "string") {
|
|
10
|
+
if (html !== '') {
|
|
11
|
+
const resultHtml = HtmlImporter.convertHtml(html);
|
|
12
|
+
const doc = new DOMParser().parseFromString(resultHtml, 'text/html');
|
|
13
|
+
for (const node of Array.from(doc.body.childNodes))
|
|
14
|
+
fragment.appendChild(document.importNode(node, true));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
for (const node of Array.from(html))
|
|
19
|
+
fragment.appendChild(node);
|
|
20
|
+
}
|
|
21
|
+
shadowRoot.textContent = '';
|
|
22
|
+
shadowRoot.appendChild(fragment);
|
|
23
|
+
return new HTMLResult(shadowRoot);
|
|
24
|
+
}
|
|
25
|
+
function createShadowRoot() {
|
|
26
|
+
const host = document.createElement('div');
|
|
27
|
+
host.style.overflow = 'hidden';
|
|
28
|
+
host.style.position = 'absolute';
|
|
29
|
+
host.style.top = '-9999px';
|
|
30
|
+
host.style.left = '-9999px';
|
|
31
|
+
shadowRoot = host.attachShadow({ mode: 'open' });
|
|
32
|
+
document.body.appendChild(host);
|
|
33
|
+
}
|
|
34
|
+
class HTMLResult {
|
|
35
|
+
constructor(shadowRoot) {
|
|
36
|
+
this.shadowRoot = shadowRoot;
|
|
37
|
+
}
|
|
38
|
+
get elements() {
|
|
39
|
+
return Array.from(this.shadowRoot.childNodes);
|
|
40
|
+
}
|
|
41
|
+
dispose() {
|
|
42
|
+
this.shadowRoot.textContent = '';
|
|
43
|
+
}
|
|
10
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devexpress-richedit",
|
|
3
|
-
"version": "25.1.
|
|
3
|
+
"version": "25.1.14",
|
|
4
4
|
"homepage": "https://www.devexpress.com/",
|
|
5
5
|
"bugs": "https://www.devexpress.com/support/",
|
|
6
6
|
"author": "Developer Express Inc.",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"build-nspell": "webpack --mode production --config=bin/nspell.webpack.config.js"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"devextreme": "25.1.
|
|
15
|
-
"devextreme-dist": "25.1.
|
|
14
|
+
"devextreme": "25.1.14",
|
|
15
|
+
"devextreme-dist": "25.1.14"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"dictionary-en": "3.2.0",
|