mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
scroll first chagned line into view
This commit is contained in:
parent
bc9c2dd25d
commit
a03799f35b
@ -48,7 +48,7 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="diff-listing w-full font-mono whitespace-pre select-text">
|
||||
<div class="diff-listing w-full select-text whitespace-pre font-mono">
|
||||
{#each diffRows.rows as row}
|
||||
{@const baseNumber =
|
||||
row.type === RowType.Equal || row.type === RowType.Deletion
|
||||
@ -67,7 +67,11 @@
|
||||
>
|
||||
{row.type === RowType.Addition ? '+' : row.type === RowType.Deletion ? '-' : ''}
|
||||
</div>
|
||||
<div class="px-1 diff-line-{row.type}" data-line-number={curNumber}>
|
||||
<div
|
||||
class:line-changed={row.type === RowType.Addition || row.type === RowType.Deletion}
|
||||
class="px-1 diff-line-{row.type}"
|
||||
data-line-number={curNumber}
|
||||
>
|
||||
{#each renderRowContent(row) as content}
|
||||
{@html content}
|
||||
{/each}
|
||||
|
@ -242,10 +242,15 @@
|
||||
}
|
||||
|
||||
function scrollToSession() {
|
||||
let sessionEl = document.getElementById('currentSession');
|
||||
const sessionEl = document.getElementById('currentSession');
|
||||
if (sessionEl) {
|
||||
sessionEl.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
|
||||
const changedLines = document.getElementsByClassName('line-changed');
|
||||
if (changedLines.length > 0) {
|
||||
changedLines[0].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
|
||||
// player
|
||||
|
Loading…
Reference in New Issue
Block a user