fix(ai): les clics ne font plus sauter la conversation au bas (BUG-059); tableaux markdown corrects dans create_pdf (#92)

This commit is contained in:
2026-09-17 13:55:36 -04:00
parent 6a58a59a11
commit 22e9240e4f
14 changed files with 174 additions and 32 deletions
+25 -1
View File
@@ -43,6 +43,25 @@ const PANEL_MIN_WIDTH = 320;
const PANEL_MAX_WIDTH = 1000;
const PANEL_WIDTH_KEY = 'obsigate-bookslm-width';
/**
* BUG-059 — Is this pointer press a scrollbar drag (and only that)?
*
* Only genuine scroll gestures may release the top-pinning of the latest
* question (wheel / touchmove / scrollbar drag). A scrollbar drag reports the
* scrollable container itself as the event target and lands inside the
* vertical scrollbar gutter. A plain click anywhere in the content — a link,
* a file path, the steps toggle, text selection — must NOT unpin: clearing
* the anchor padding would clamp the scroll position and jump the whole
* thread to the bottom of the conversation window.
*/
export function isScrollbarPress(target, clientX, container) {
if (!container || target !== container) return false;
const rect = container.getBoundingClientRect();
if (!rect || !Number.isFinite(rect.right)) return false;
const GUTTER = 24; // conservative vertical-scrollbar width estimate
return clientX >= rect.right - GUTTER;
}
/**
* Accent- and case-insensitive normalization used to match `/` commands and
* `@` mentions: skill ids/labels and vault paths may contain accented
@@ -985,7 +1004,12 @@ class BooksLM {
};
messagesEl.addEventListener('wheel', unpin, { passive: true });
messagesEl.addEventListener('touchmove', unpin, { passive: true });
messagesEl.addEventListener('mousedown', unpin, { passive: true });
// BUG-059: a scrollbar drag only — a plain click on the content must
// not unpin (it would clear the anchor padding and jump the thread to
// the bottom of the window).
messagesEl.addEventListener('mousedown', (e) => {
if (isScrollbarPress(e.target, e.clientX, messagesEl)) unpin();
}, { passive: true });
}
// Close the session / command menus when clicking elsewhere in the panel.