mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-01 05:48:18 +00:00
Measure the visible CouchDB action bounds
This commit is contained in:
1 parent
5e9531743f
commit
4bdb411d29
1 file changed
+8
-3
@@ -528,6 +528,11 @@ async function assertCouchDBKeyboardFormSpace(page: Page, modal: Locator): Promi
|
|||||||
throw new Error("CouchDB form layout is unavailable.");
|
throw new Error("CouchDB form layout is unavailable.");
|
||||||
const footer = footerElement.getBoundingClientRect();
|
const footer = footerElement.getBoundingClientRect();
|
||||||
const row = rowElement.getBoundingClientRect();
|
const row = rowElement.getBoundingClientRect();
|
||||||
|
const actions = Array.from(footerElement.querySelectorAll("button"), (button) =>
|
||||||
|
button.getBoundingClientRect()
|
||||||
|
);
|
||||||
|
const footerTop = Math.min(footer.top, ...actions.map((action) => action.top));
|
||||||
|
const footerBottom = Math.max(footer.bottom, ...actions.map((action) => action.bottom));
|
||||||
const modalElement = element.querySelector(".modal");
|
const modalElement = element.querySelector(".modal");
|
||||||
if (!modalElement) throw new Error("The CouchDB modal is unavailable.");
|
if (!modalElement) throw new Error("The CouchDB modal is unavailable.");
|
||||||
const modalRect = modalElement.getBoundingClientRect();
|
const modalRect = modalElement.getBoundingClientRect();
|
||||||
@@ -539,10 +544,10 @@ async function assertCouchDBKeyboardFormSpace(page: Page, modal: Locator): Promi
|
|||||||
width: innerWidth,
|
width: innerWidth,
|
||||||
height: innerHeight,
|
height: innerHeight,
|
||||||
formTop,
|
formTop,
|
||||||
footerTop: footer.top,
|
footerTop,
|
||||||
formHeight: Math.min(footer.top, contentRect.bottom, modalRect.bottom) - formTop,
|
formHeight: Math.min(footerTop, contentRect.bottom, modalRect.bottom) - formTop,
|
||||||
rowHeight: row.height + (parseFloat(getComputedStyle(host).rowGap) || 0),
|
rowHeight: row.height + (parseFloat(getComputedStyle(host).rowGap) || 0),
|
||||||
footerBottom: footer.bottom,
|
footerBottom,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log(JSON.stringify({ event: "couchdb-keyboard-form-space", keyboardHeight, bounds }));
|
console.log(JSON.stringify({ event: "couchdb-keyboard-form-space", keyboardHeight, bounds }));
|
||||||
|
|||||||
Reference in new issue
Block a user