@vaadin/rich-text-editor 24.1.10 → 24.1.12
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/package.json +11 -11
- package/src/vaadin-rich-text-editor.js +19 -0
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/rich-text-editor",
|
|
3
|
-
"version": "24.1.
|
|
3
|
+
"version": "24.1.12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@polymer/polymer": "^3.0.0",
|
|
43
|
-
"@vaadin/button": "~24.1.
|
|
44
|
-
"@vaadin/component-base": "~24.1.
|
|
45
|
-
"@vaadin/confirm-dialog": "~24.1.
|
|
46
|
-
"@vaadin/text-field": "~24.1.
|
|
47
|
-
"@vaadin/tooltip": "~24.1.
|
|
48
|
-
"@vaadin/vaadin-lumo-styles": "~24.1.
|
|
49
|
-
"@vaadin/vaadin-material-styles": "~24.1.
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "~24.1.
|
|
43
|
+
"@vaadin/button": "~24.1.12",
|
|
44
|
+
"@vaadin/component-base": "~24.1.12",
|
|
45
|
+
"@vaadin/confirm-dialog": "~24.1.12",
|
|
46
|
+
"@vaadin/text-field": "~24.1.12",
|
|
47
|
+
"@vaadin/tooltip": "~24.1.12",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "~24.1.12",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "~24.1.12",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "~24.1.12"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
54
|
-
"@vaadin/a11y-base": "~24.1.
|
|
54
|
+
"@vaadin/a11y-base": "~24.1.12",
|
|
55
55
|
"@vaadin/testing-helpers": "^0.4.2",
|
|
56
56
|
"gulp": "^4.0.2",
|
|
57
57
|
"gulp-cli": "^2.3.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"web-types.json",
|
|
64
64
|
"web-types.lit.json"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "49b0dcd22759bc5da2d43766c9b82d6ca581456e"
|
|
67
67
|
}
|
|
@@ -1011,7 +1011,26 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
1011
1011
|
* @param {string} htmlValue
|
|
1012
1012
|
*/
|
|
1013
1013
|
dangerouslySetHtmlValue(htmlValue) {
|
|
1014
|
+
const whitespaceCharacters = {
|
|
1015
|
+
'\t': '__VAADIN_RICH_TEXT_EDITOR_TAB',
|
|
1016
|
+
' ': '__VAADIN_RICH_TEXT_EDITOR_DOUBLE_SPACE',
|
|
1017
|
+
};
|
|
1018
|
+
// Replace whitespace characters with placeholders before the Delta conversion to prevent Quill from trimming them
|
|
1019
|
+
Object.entries(whitespaceCharacters).forEach(([character, replacement]) => {
|
|
1020
|
+
htmlValue = htmlValue.replaceAll(/>[^<]*</gu, (match) => match.replaceAll(character, replacement)); // NOSONAR
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1014
1023
|
const deltaFromHtml = this._editor.clipboard.convert(htmlValue);
|
|
1024
|
+
|
|
1025
|
+
// Restore whitespace characters after the conversion
|
|
1026
|
+
Object.entries(whitespaceCharacters).forEach(([character, replacement]) => {
|
|
1027
|
+
deltaFromHtml.ops.forEach((op) => {
|
|
1028
|
+
if (typeof op.insert === 'string') {
|
|
1029
|
+
op.insert = op.insert.replaceAll(replacement, character);
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1015
1034
|
this._editor.setContents(deltaFromHtml, SOURCE.API);
|
|
1016
1035
|
}
|
|
1017
1036
|
|
package/web-types.json
CHANGED