mirror of
https://github.com/PrimalHQ/primal-web-app.git
synced 2024-10-03 02:10:55 +00:00
Scroll to the top of a note if it is too long to fit the screen
This commit is contained in:
parent
925e927528
commit
b0c2b394e0
@ -108,7 +108,14 @@ const Thread: Component = () => {
|
||||
if (!pn) return;
|
||||
|
||||
setTimeout(() => {
|
||||
pn.scrollIntoView({ block: 'end' });
|
||||
const rect = pn.getBoundingClientRect();
|
||||
const wh = window.innerHeight - 72;
|
||||
|
||||
const block = rect.height < wh && parentNotes().length > 0 ?
|
||||
'end' : 'start';
|
||||
|
||||
pn.scrollIntoView({ block });
|
||||
block === 'start' && window.scrollBy({ top: -72 });
|
||||
}, 100);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user