@vaadin/rich-text-editor 24.5.0-beta1 → 24.5.0-rc2

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.5.0-beta1",
3
+ "version": "24.5.0-rc2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -41,20 +41,20 @@
41
41
  "dependencies": {
42
42
  "@open-wc/dedupe-mixin": "^1.3.0",
43
43
  "@polymer/polymer": "^3.0.0",
44
- "@vaadin/button": "24.5.0-beta1",
45
- "@vaadin/component-base": "24.5.0-beta1",
46
- "@vaadin/confirm-dialog": "24.5.0-beta1",
47
- "@vaadin/overlay": "24.5.0-beta1",
48
- "@vaadin/text-field": "24.5.0-beta1",
49
- "@vaadin/tooltip": "24.5.0-beta1",
50
- "@vaadin/vaadin-lumo-styles": "24.5.0-beta1",
51
- "@vaadin/vaadin-material-styles": "24.5.0-beta1",
52
- "@vaadin/vaadin-themable-mixin": "24.5.0-beta1",
44
+ "@vaadin/button": "24.5.0-rc2",
45
+ "@vaadin/component-base": "24.5.0-rc2",
46
+ "@vaadin/confirm-dialog": "24.5.0-rc2",
47
+ "@vaadin/overlay": "24.5.0-rc2",
48
+ "@vaadin/text-field": "24.5.0-rc2",
49
+ "@vaadin/tooltip": "24.5.0-rc2",
50
+ "@vaadin/vaadin-lumo-styles": "24.5.0-rc2",
51
+ "@vaadin/vaadin-material-styles": "24.5.0-rc2",
52
+ "@vaadin/vaadin-themable-mixin": "24.5.0-rc2",
53
53
  "lit": "^3.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@vaadin/a11y-base": "24.5.0-beta1",
57
- "@vaadin/chai-plugins": "24.5.0-beta1",
56
+ "@vaadin/a11y-base": "24.5.0-rc2",
57
+ "@vaadin/chai-plugins": "24.5.0-rc2",
58
58
  "@vaadin/testing-helpers": "^1.0.0",
59
59
  "gulp": "^4.0.2",
60
60
  "gulp-cli": "^2.3.0",
@@ -66,5 +66,5 @@
66
66
  "web-types.json",
67
67
  "web-types.lit.json"
68
68
  ],
69
- "gitHead": "da4b57724d7089e3766d59d01068159322adb2b8"
69
+ "gitHead": "be5bf40aec33761c6defdb5b3093c7b6dd5d97fd"
70
70
  }
@@ -793,10 +793,26 @@ export const RichTextEditorMixin = (superClass) =>
793
793
  */
794
794
  dangerouslySetHtmlValue(htmlValue) {
795
795
  if (!this._editor) {
796
- // The editor isn't ready yet, store the value for later
797
- this.__pendingHtmlValue = htmlValue;
798
- // Clear a possible value to prevent it from clearing the pending htmlValue once the editor property is set
799
- this.value = '';
796
+ this.__savePendingHtmlValue(htmlValue);
797
+
798
+ return;
799
+ }
800
+
801
+ // In Firefox, the styles are not properly computed when the element is placed
802
+ // in a Lit component, as the element is first attached to the DOM and then
803
+ // the shadowRoot is initialized. This causes the `hmlValue` to not be correctly
804
+ // parsed into the delta format used by Quill. To work around this, we check
805
+ // if the display property is set and if not, we wait for the element to intersect
806
+ // with the viewport before trying to set the value again.
807
+ if (!getComputedStyle(this).display) {
808
+ this.__savePendingHtmlValue(htmlValue);
809
+ const observer = new IntersectionObserver(() => {
810
+ if (getComputedStyle(this).display) {
811
+ this.__flushPendingHtmlValue();
812
+ observer.disconnect();
813
+ }
814
+ });
815
+ observer.observe(this);
800
816
  return;
801
817
  }
802
818
 
@@ -823,6 +839,14 @@ export const RichTextEditorMixin = (superClass) =>
823
839
  this._editor.setContents(deltaFromHtml, SOURCE.API);
824
840
  }
825
841
 
842
+ /** @private */
843
+ __savePendingHtmlValue(htmlValue) {
844
+ // The editor isn't ready yet, store the value for later
845
+ this.__pendingHtmlValue = htmlValue;
846
+ // Clear a possible value to prevent it from clearing the pending htmlValue once the editor property is set
847
+ this.value = '';
848
+ }
849
+
826
850
  /** @private */
827
851
  __flushPendingHtmlValue() {
828
852
  if (this.__pendingHtmlValue) {