@vaadin/rich-text-editor 24.2.0 → 24.2.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/rich-text-editor",
3
- "version": "24.2.0",
3
+ "version": "24.2.1",
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.0",
44
- "@vaadin/component-base": "~24.2.0",
45
- "@vaadin/confirm-dialog": "~24.2.0",
46
- "@vaadin/text-field": "~24.2.0",
47
- "@vaadin/tooltip": "~24.2.0",
48
- "@vaadin/vaadin-lumo-styles": "~24.2.0",
49
- "@vaadin/vaadin-material-styles": "~24.2.0",
50
- "@vaadin/vaadin-themable-mixin": "~24.2.0"
43
+ "@vaadin/button": "~24.2.1",
44
+ "@vaadin/component-base": "~24.2.1",
45
+ "@vaadin/confirm-dialog": "~24.2.1",
46
+ "@vaadin/text-field": "~24.2.1",
47
+ "@vaadin/tooltip": "~24.2.1",
48
+ "@vaadin/vaadin-lumo-styles": "~24.2.1",
49
+ "@vaadin/vaadin-material-styles": "~24.2.1",
50
+ "@vaadin/vaadin-themable-mixin": "~24.2.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@esm-bundle/chai": "^4.3.4",
54
- "@vaadin/a11y-base": "~24.2.0",
54
+ "@vaadin/a11y-base": "~24.2.1",
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": "8b9e860d53fc0132d05d3e8701eeded2dca74eba"
66
+ "gitHead": "2272e10119a59a95901b160f96cbbcae523aea1a"
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/rich-text-editor",
4
- "version": "24.2.0",
4
+ "version": "24.2.1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/rich-text-editor",
4
- "version": "24.2.0",
4
+ "version": "24.2.1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {