mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
scroll code viewer
This commit is contained in:
parent
fa58493f49
commit
b1d881247c
@ -172,6 +172,14 @@
|
||||
$: rows = highlight.length > 0 ? padHighlighted(renderedRows) : renderedRows;
|
||||
$: originalLineNumberDigits = String(rows.at(-1)?.originalLineNumber || '0').length;
|
||||
$: currentLineNumberDigits = String(rows.at(-1)?.currentLineNumber || '0').length;
|
||||
|
||||
const scrollToChangedLine = () => {
|
||||
const changedLines = document.getElementsByClassName('line-changed');
|
||||
if (changedLines.length > 0) {
|
||||
changedLines[0].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
};
|
||||
$: deltas.length && scrollToChangedLine();
|
||||
</script>
|
||||
|
||||
<table class="w-full whitespace-pre font-mono">
|
||||
@ -198,6 +206,7 @@
|
||||
class="px-1.5 before:content-[attr(data-marker)]"
|
||||
class:diff-line-addition={row.type === RowType.Addition}
|
||||
class:diff-line-deletion={row.type === RowType.Deletion}
|
||||
class:line-changed={row.type === RowType.Addition || row.type === RowType.Deletion}
|
||||
data-marker={row.type === RowType.Addition
|
||||
? '+'
|
||||
: row.type === RowType.Deletion
|
||||
|
Loading…
Reference in New Issue
Block a user