@vaadin/rich-text-editor 23.4.0-alpha1 → 23.4.0-alpha2

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": "23.4.0-alpha1",
3
+ "version": "23.4.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,14 +40,14 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@polymer/polymer": "^3.0.0",
43
- "@vaadin/button": "23.4.0-alpha1",
44
- "@vaadin/component-base": "23.4.0-alpha1",
45
- "@vaadin/confirm-dialog": "23.4.0-alpha1",
46
- "@vaadin/text-field": "23.4.0-alpha1",
47
- "@vaadin/tooltip": "23.4.0-alpha1",
48
- "@vaadin/vaadin-lumo-styles": "23.4.0-alpha1",
49
- "@vaadin/vaadin-material-styles": "23.4.0-alpha1",
50
- "@vaadin/vaadin-themable-mixin": "23.4.0-alpha1"
43
+ "@vaadin/button": "23.4.0-alpha2",
44
+ "@vaadin/component-base": "23.4.0-alpha2",
45
+ "@vaadin/confirm-dialog": "23.4.0-alpha2",
46
+ "@vaadin/text-field": "23.4.0-alpha2",
47
+ "@vaadin/tooltip": "23.4.0-alpha2",
48
+ "@vaadin/vaadin-lumo-styles": "23.4.0-alpha2",
49
+ "@vaadin/vaadin-material-styles": "23.4.0-alpha2",
50
+ "@vaadin/vaadin-themable-mixin": "23.4.0-alpha2"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@esm-bundle/chai": "^4.3.4",
@@ -62,5 +62,5 @@
62
62
  "web-types.json",
63
63
  "web-types.lit.json"
64
64
  ],
65
- "gitHead": "a7cdbab591c62ee8dbc0e91fee877fbbf4b92bad"
65
+ "gitHead": "3fa9a5d13db6baf0307f863669ab2f3f5114c6a0"
66
66
  }
@@ -641,6 +641,9 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
641
641
  });
642
642
 
643
643
  this._editor.on('selection-change', this.__announceFormatting.bind(this));
644
+
645
+ // Flush pending htmlValue only once the editor is fully initialized
646
+ this.__flushPendingHtmlValue();
644
647
  }
645
648
 
646
649
  /** @protected */
@@ -987,10 +990,25 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
987
990
  * @param {string} htmlValue
988
991
  */
989
992
  dangerouslySetHtmlValue(htmlValue) {
993
+ if (!this._editor) {
994
+ // The editor isn't ready yet, store the value for later
995
+ this.__pendingHtmlValue = htmlValue;
996
+ // Clear a possible value to prevent it from clearing the pending htmlValue once the editor property is set
997
+ this.value = '';
998
+ return;
999
+ }
1000
+
990
1001
  const deltaFromHtml = this._editor.clipboard.convert(htmlValue);
991
1002
  this._editor.setContents(deltaFromHtml, SOURCE.API);
992
1003
  }
993
1004
 
1005
+ /** @private */
1006
+ __flushPendingHtmlValue() {
1007
+ if (this.__pendingHtmlValue) {
1008
+ this.dangerouslySetHtmlValue(this.__pendingHtmlValue);
1009
+ }
1010
+ }
1011
+
994
1012
  /** @private */
995
1013
  __announceFormatting() {
996
1014
  const timeout = 200;
@@ -1110,6 +1128,11 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
1110
1128
 
1111
1129
  /** @private */
1112
1130
  _valueChanged(value, editor) {
1131
+ if (value && this.__pendingHtmlValue) {
1132
+ // A non-empty value is set explicitly. Clear pending htmlValue to prevent it from overriding the value.
1133
+ this.__pendingHtmlValue = undefined;
1134
+ }
1135
+
1113
1136
  if (editor === undefined) {
1114
1137
  return;
1115
1138
  }
@@ -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": "23.4.0-alpha1",
4
+ "version": "23.4.0-alpha2",
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": "23.4.0-alpha1",
4
+ "version": "23.4.0-alpha2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {