@ohhwells/bridge 0.1.6 → 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.js CHANGED
@@ -3882,6 +3882,18 @@ function OhhwellsBridge() {
3882
3882
  const deactivate = useCallback(() => {
3883
3883
  const el = activeElRef.current;
3884
3884
  if (!el) return;
3885
+ const key = el.dataset.ohwKey;
3886
+ if (key) {
3887
+ const timer = autoSaveTimers.current.get(key);
3888
+ if (timer !== void 0) {
3889
+ clearTimeout(timer);
3890
+ autoSaveTimers.current.delete(key);
3891
+ const html = sanitizeHtml(el.innerHTML);
3892
+ postToParentRef.current({ type: "ow:change", nodes: [{ key, text: html }] });
3893
+ const h = document.documentElement.scrollHeight;
3894
+ if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
3895
+ }
3896
+ }
3885
3897
  el.removeAttribute("contenteditable");
3886
3898
  activeElRef.current = null;
3887
3899
  setToolbarRect(null);