@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.cjs CHANGED
@@ -4335,6 +4335,24 @@ function EmailEditor({
4335
4335
  setLocked(false);
4336
4336
  };
4337
4337
  }, [turn, setLocked]);
4338
+ const wasLocked = (0, import_react10.useRef)(false);
4339
+ (0, import_react10.useEffect)(() => {
4340
+ if (readOnly) {
4341
+ wasLocked.current = true;
4342
+ return;
4343
+ }
4344
+ const root = wasLocked.current && editorRef.current?.Canvas.getDocument()?.documentElement;
4345
+ wasLocked.current = false;
4346
+ if (!root) return;
4347
+ const overflow = root.style.overflow;
4348
+ root.style.overflow = "hidden";
4349
+ void root.offsetHeight;
4350
+ const frame = requestAnimationFrame(() => root.style.overflow = overflow);
4351
+ return () => {
4352
+ cancelAnimationFrame(frame);
4353
+ root.style.overflow = overflow;
4354
+ };
4355
+ }, [readOnly]);
4338
4356
  const [crumbs, setCrumbs] = (0, import_react10.useState)([]);
4339
4357
  const [picker, setPicker] = (0, import_react10.useState)(
4340
4358
  null