@vaadin/rich-text-editor 24.1.13 → 24.1.15

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.1.13",
3
+ "version": "24.1.15",
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.13",
44
- "@vaadin/component-base": "~24.1.13",
45
- "@vaadin/confirm-dialog": "~24.1.13",
46
- "@vaadin/text-field": "~24.1.13",
47
- "@vaadin/tooltip": "~24.1.13",
48
- "@vaadin/vaadin-lumo-styles": "~24.1.13",
49
- "@vaadin/vaadin-material-styles": "~24.1.13",
50
- "@vaadin/vaadin-themable-mixin": "~24.1.13"
43
+ "@vaadin/button": "~24.1.15",
44
+ "@vaadin/component-base": "~24.1.15",
45
+ "@vaadin/confirm-dialog": "~24.1.15",
46
+ "@vaadin/text-field": "~24.1.15",
47
+ "@vaadin/tooltip": "~24.1.15",
48
+ "@vaadin/vaadin-lumo-styles": "~24.1.15",
49
+ "@vaadin/vaadin-material-styles": "~24.1.15",
50
+ "@vaadin/vaadin-themable-mixin": "~24.1.15"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@esm-bundle/chai": "^4.3.4",
54
- "@vaadin/a11y-base": "~24.1.13",
54
+ "@vaadin/a11y-base": "~24.1.15",
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": "cc297ef7458e98e210db17bfb18eec7ad2932f42"
66
+ "gitHead": "9cf98ac30128388bee2710410afe01a6b725b0aa"
67
67
  }
@@ -665,6 +665,9 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
665
665
  });
666
666
 
667
667
  this._editor.on('selection-change', this.__announceFormatting.bind(this));
668
+
669
+ // Flush pending htmlValue only once the editor is fully initialized
670
+ this.__flushPendingHtmlValue();
668
671
  }
669
672
 
670
673
  /** @protected */
@@ -1011,6 +1014,14 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
1011
1014
  * @param {string} htmlValue
1012
1015
  */
1013
1016
  dangerouslySetHtmlValue(htmlValue) {
1017
+ if (!this._editor) {
1018
+ // The editor isn't ready yet, store the value for later
1019
+ this.__pendingHtmlValue = htmlValue;
1020
+ // Clear a possible value to prevent it from clearing the pending htmlValue once the editor property is set
1021
+ this.value = '';
1022
+ return;
1023
+ }
1024
+
1014
1025
  const whitespaceCharacters = {
1015
1026
  '\t': '__VAADIN_RICH_TEXT_EDITOR_TAB',
1016
1027
  ' ': '__VAADIN_RICH_TEXT_EDITOR_DOUBLE_SPACE',
@@ -1034,6 +1045,13 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
1034
1045
  this._editor.setContents(deltaFromHtml, SOURCE.API);
1035
1046
  }
1036
1047
 
1048
+ /** @private */
1049
+ __flushPendingHtmlValue() {
1050
+ if (this.__pendingHtmlValue) {
1051
+ this.dangerouslySetHtmlValue(this.__pendingHtmlValue);
1052
+ }
1053
+ }
1054
+
1037
1055
  /** @private */
1038
1056
  __announceFormatting() {
1039
1057
  const timeout = 200;
@@ -1146,6 +1164,11 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
1146
1164
 
1147
1165
  /** @private */
1148
1166
  _valueChanged(value, editor) {
1167
+ if (value && this.__pendingHtmlValue) {
1168
+ // A non-empty value is set explicitly. Clear pending htmlValue to prevent it from overriding the value.
1169
+ this.__pendingHtmlValue = undefined;
1170
+ }
1171
+
1149
1172
  if (editor === undefined) {
1150
1173
  return;
1151
1174
  }
@@ -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.1.13",
4
+ "version": "24.1.15",
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.1.13",
4
+ "version": "24.1.15",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {