@ohhwells/bridge 0.1.5 → 0.1.7

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/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -3920,6 +3921,18 @@ function OhhwellsBridge() {
3920
3921
  const deactivate = (0, import_react.useCallback)(() => {
3921
3922
  const el = activeElRef.current;
3922
3923
  if (!el) return;
3924
+ const key = el.dataset.ohwKey;
3925
+ if (key) {
3926
+ const timer = autoSaveTimers.current.get(key);
3927
+ if (timer !== void 0) {
3928
+ clearTimeout(timer);
3929
+ autoSaveTimers.current.delete(key);
3930
+ const html = sanitizeHtml(el.innerHTML);
3931
+ postToParentRef.current({ type: "ow:change", nodes: [{ key, text: html }] });
3932
+ const h = document.documentElement.scrollHeight;
3933
+ if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
3934
+ }
3935
+ }
3923
3936
  el.removeAttribute("contenteditable");
3924
3937
  activeElRef.current = null;
3925
3938
  setToolbarRect(null);