@vaadin/rich-text-editor 24.2.0 → 24.2.2
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.2.
|
|
3
|
+
"version": "24.2.2",
|
|
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.2.
|
|
44
|
-
"@vaadin/component-base": "~24.2.
|
|
45
|
-
"@vaadin/confirm-dialog": "~24.2.
|
|
46
|
-
"@vaadin/text-field": "~24.2.
|
|
47
|
-
"@vaadin/tooltip": "~24.2.
|
|
48
|
-
"@vaadin/vaadin-lumo-styles": "~24.2.
|
|
49
|
-
"@vaadin/vaadin-material-styles": "~24.2.
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "~24.2.
|
|
43
|
+
"@vaadin/button": "~24.2.2",
|
|
44
|
+
"@vaadin/component-base": "~24.2.2",
|
|
45
|
+
"@vaadin/confirm-dialog": "~24.2.2",
|
|
46
|
+
"@vaadin/text-field": "~24.2.2",
|
|
47
|
+
"@vaadin/tooltip": "~24.2.2",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "~24.2.2",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "~24.2.2",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "~24.2.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
54
|
-
"@vaadin/a11y-base": "~24.2.
|
|
54
|
+
"@vaadin/a11y-base": "~24.2.2",
|
|
55
55
|
"@vaadin/testing-helpers": "^0.5.0",
|
|
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": "ed5edf42bd39119a7ab29b41000e7017af1579bc"
|
|
67
67
|
}
|
|
@@ -1013,7 +1013,26 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
1013
1013
|
* @param {string} htmlValue
|
|
1014
1014
|
*/
|
|
1015
1015
|
dangerouslySetHtmlValue(htmlValue) {
|
|
1016
|
+
const whitespaceCharacters = {
|
|
1017
|
+
'\t': '__VAADIN_RICH_TEXT_EDITOR_TAB',
|
|
1018
|
+
' ': '__VAADIN_RICH_TEXT_EDITOR_DOUBLE_SPACE',
|
|
1019
|
+
};
|
|
1020
|
+
// Replace whitespace characters with placeholders before the Delta conversion to prevent Quill from trimming them
|
|
1021
|
+
Object.entries(whitespaceCharacters).forEach(([character, replacement]) => {
|
|
1022
|
+
htmlValue = htmlValue.replaceAll(/>[^<]*</gu, (match) => match.replaceAll(character, replacement)); // NOSONAR
|
|
1023
|
+
});
|
|
1024
|
+
|
|
1016
1025
|
const deltaFromHtml = this._editor.clipboard.convert(htmlValue);
|
|
1026
|
+
|
|
1027
|
+
// Restore whitespace characters after the conversion
|
|
1028
|
+
Object.entries(whitespaceCharacters).forEach(([character, replacement]) => {
|
|
1029
|
+
deltaFromHtml.ops.forEach((op) => {
|
|
1030
|
+
if (typeof op.insert === 'string') {
|
|
1031
|
+
op.insert = op.insert.replaceAll(replacement, character);
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1017
1036
|
this._editor.setContents(deltaFromHtml, SOURCE.API);
|
|
1018
1037
|
}
|
|
1019
1038
|
|
package/web-types.json
CHANGED