@mjml-agent-editor/editor 0.4.2 → 0.4.3

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/dist/canvas.js CHANGED
@@ -3446,6 +3446,24 @@ function EmailEditor({
3446
3446
  setLocked(false);
3447
3447
  };
3448
3448
  }, [turn, setLocked]);
3449
+ const wasLocked = useRef5(false);
3450
+ useEffect5(() => {
3451
+ if (readOnly) {
3452
+ wasLocked.current = true;
3453
+ return;
3454
+ }
3455
+ const root = wasLocked.current && editorRef.current?.Canvas.getDocument()?.documentElement;
3456
+ wasLocked.current = false;
3457
+ if (!root) return;
3458
+ const overflow = root.style.overflow;
3459
+ root.style.overflow = "hidden";
3460
+ void root.offsetHeight;
3461
+ const frame = requestAnimationFrame(() => root.style.overflow = overflow);
3462
+ return () => {
3463
+ cancelAnimationFrame(frame);
3464
+ root.style.overflow = overflow;
3465
+ };
3466
+ }, [readOnly]);
3449
3467
  const [crumbs, setCrumbs] = useState5([]);
3450
3468
  const [picker, setPicker] = useState5(
3451
3469
  null