@vaadin/rich-text-editor 24.2.3 → 24.2.5

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.3",
3
+ "version": "24.2.5",
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.3",
44
- "@vaadin/component-base": "~24.2.3",
45
- "@vaadin/confirm-dialog": "~24.2.3",
46
- "@vaadin/text-field": "~24.2.3",
47
- "@vaadin/tooltip": "~24.2.3",
48
- "@vaadin/vaadin-lumo-styles": "~24.2.3",
49
- "@vaadin/vaadin-material-styles": "~24.2.3",
50
- "@vaadin/vaadin-themable-mixin": "~24.2.3"
43
+ "@vaadin/button": "~24.2.5",
44
+ "@vaadin/component-base": "~24.2.5",
45
+ "@vaadin/confirm-dialog": "~24.2.5",
46
+ "@vaadin/text-field": "~24.2.5",
47
+ "@vaadin/tooltip": "~24.2.5",
48
+ "@vaadin/vaadin-lumo-styles": "~24.2.5",
49
+ "@vaadin/vaadin-material-styles": "~24.2.5",
50
+ "@vaadin/vaadin-themable-mixin": "~24.2.5"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@esm-bundle/chai": "^4.3.4",
54
- "@vaadin/a11y-base": "~24.2.3",
54
+ "@vaadin/a11y-base": "~24.2.5",
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": "72e557e765e72559e9c6a525e257d185ad186dc5"
66
+ "gitHead": "f1c916061f1b117fa9c597d3067e7b96563f99a7"
67
67
  }
@@ -667,6 +667,9 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
667
667
  });
668
668
 
669
669
  this._editor.on('selection-change', this.__announceFormatting.bind(this));
670
+
671
+ // Flush pending htmlValue only once the editor is fully initialized
672
+ this.__flushPendingHtmlValue();
670
673
  }
671
674
 
672
675
  /** @protected */
@@ -1013,6 +1016,14 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
1013
1016
  * @param {string} htmlValue
1014
1017
  */
1015
1018
  dangerouslySetHtmlValue(htmlValue) {
1019
+ if (!this._editor) {
1020
+ // The editor isn't ready yet, store the value for later
1021
+ this.__pendingHtmlValue = htmlValue;
1022
+ // Clear a possible value to prevent it from clearing the pending htmlValue once the editor property is set
1023
+ this.value = '';
1024
+ return;
1025
+ }
1026
+
1016
1027
  const whitespaceCharacters = {
1017
1028
  '\t': '__VAADIN_RICH_TEXT_EDITOR_TAB',
1018
1029
  ' ': '__VAADIN_RICH_TEXT_EDITOR_DOUBLE_SPACE',
@@ -1036,6 +1047,13 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
1036
1047
  this._editor.setContents(deltaFromHtml, SOURCE.API);
1037
1048
  }
1038
1049
 
1050
+ /** @private */
1051
+ __flushPendingHtmlValue() {
1052
+ if (this.__pendingHtmlValue) {
1053
+ this.dangerouslySetHtmlValue(this.__pendingHtmlValue);
1054
+ }
1055
+ }
1056
+
1039
1057
  /** @private */
1040
1058
  __announceFormatting() {
1041
1059
  const timeout = 200;
@@ -1148,6 +1166,11 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
1148
1166
 
1149
1167
  /** @private */
1150
1168
  _valueChanged(value, editor) {
1169
+ if (value && this.__pendingHtmlValue) {
1170
+ // A non-empty value is set explicitly. Clear pending htmlValue to prevent it from overriding the value.
1171
+ this.__pendingHtmlValue = undefined;
1172
+ }
1173
+
1151
1174
  if (editor === undefined) {
1152
1175
  return;
1153
1176
  }
@@ -91,6 +91,11 @@ const richTextEditor = css`
91
91
  strong {
92
92
  font-weight: 600;
93
93
  }
94
+
95
+ code,
96
+ pre {
97
+ background-color: var(--material-secondary-background-color);
98
+ }
94
99
  `;
95
100
 
96
101
  registerStyles('vaadin-rich-text-editor', [typography, richTextEditor], {
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.3",
4
+ "version": "24.2.5",
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.3",
4
+ "version": "24.2.5",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {