@ohhwells/bridge 0.1.6 → 0.1.8
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 +15 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3921,6 +3921,21 @@ function OhhwellsBridge() {
|
|
|
3921
3921
|
const deactivate = (0, import_react.useCallback)(() => {
|
|
3922
3922
|
const el = activeElRef.current;
|
|
3923
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
|
+
}
|
|
3931
|
+
const html = sanitizeHtml(el.innerHTML);
|
|
3932
|
+
const original = originalContentRef.current ?? "";
|
|
3933
|
+
if (html !== sanitizeHtml(original)) {
|
|
3934
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key, text: html }] });
|
|
3935
|
+
const h = document.documentElement.scrollHeight;
|
|
3936
|
+
if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3924
3939
|
el.removeAttribute("contenteditable");
|
|
3925
3940
|
activeElRef.current = null;
|
|
3926
3941
|
setToolbarRect(null);
|