Commit 63be5ca

Nick Faro committed on
Keep file tree scrolling local
commit 63be5ca3fbc8e0a79d9e110b2178808064bb6ac8 parent dd796a6
2 changed files +2−2
Modifiedinternal/site/style.go +1−1
@@ -166,7 +166,7 @@ button, input { font: inherit; }
166 .file-tree-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9,105,218,.15); } 166 .file-tree-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9,105,218,.15); }
167 .file-tree-search .icon { color: var(--muted); } 167 .file-tree-search .icon { color: var(--muted); }
168 .file-tree-search input { width: 100%; min-width: 0; height: 30px; border: 0; outline: 0; background: transparent; font-size: 13px; } 168 .file-tree-search input { width: 100%; min-width: 0; height: 30px; border: 0; outline: 0; background: transparent; font-size: 13px; }
169 .file-tree { min-height: 0; flex: 1; padding: 2px 8px 12px; overflow: auto; } 169 .file-tree { position: relative; min-height: 0; flex: 1; padding: 2px 8px 12px; overflow: auto; }
170 .file-tree-node { min-width: max-content; } 170 .file-tree-node { min-width: max-content; }
171 .file-tree-children { padding-left: 16px; } 171 .file-tree-children { padding-left: 16px; }
172 .file-tree-folder, .file-tree-file { width: 100%; min-height: 30px; padding: 4px 6px; display: flex; align-items: center; gap: 7px; border: 0; border-radius: 5px; color: var(--text); background: transparent; text-align: left; white-space: nowrap; } 172 .file-tree-folder, .file-tree-file { width: 100%; min-height: 30px; padding: 4px 6px; display: flex; align-items: center; gap: 7px; border: 0; border-radius: 5px; color: var(--text); background: transparent; text-align: left; white-space: nowrap; }
Modifiedinternal/site/template.go +1−1
@@ -417,7 +417,7 @@ const pageTemplate = `<!doctype html>
417 }); 417 });
418 renderTreeNode(root, fileTree, ''); 418 renderTreeNode(root, fileTree, '');
419 var selected = one('.file-tree-file.selected', fileTree); 419 var selected = one('.file-tree-file.selected', fileTree);
420 if (selected) selected.scrollIntoView({block: 'center'}); 420 if (selected) fileTree.scrollTop = Math.max(0, selected.offsetTop - (fileTree.clientHeight - selected.offsetHeight) / 2);
421 } 421 }
422 if (fileTree) { 422 if (fileTree) {
423 loadFiles().then(renderFileTree).catch(function () { fileTree.innerHTML = '<p class="menu-status">Could not load files.</p>'; }); 423 loadFiles().then(renderFileTree).catch(function () { fileTree.innerHTML = '<p class="menu-status">Could not load files.</p>'; });