feat(sidebar): Notion-style collapse/peek, desktop reopen button, Ctrl+\\ toggle
Stop collapsing the sidebar on navigation (was hiding the nav when opening Shared pages). Show the hamburger in the top-left on desktop when collapsed, add a left-edge hover zone that floats the sidebar in and auto-collapses on mouse leave, and bind Ctrl/Cmd+\\ to toggle it.
This commit is contained in:
+9
-1
@@ -325,6 +325,14 @@
|
||||
fdLoad(window.location.href, false);
|
||||
});
|
||||
|
||||
// Ctrl/Cmd + \ : toggle the sidebar (Notion-style).
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === '\\' || e.code === 'Backslash')) {
|
||||
e.preventDefault();
|
||||
document.dispatchEvent(new CustomEvent('fd-toggle-sidebar'));
|
||||
}
|
||||
});
|
||||
|
||||
// Programmatic navigation used by Alpine helpers.
|
||||
window.fdNavigate = function(url, opts) {
|
||||
opts = opts || {};
|
||||
@@ -379,7 +387,7 @@
|
||||
var doc = new DOMParser().parseFromString(d.serverResponse, 'text/html');
|
||||
var mw = doc.querySelector('.main-wrapper');
|
||||
if (mw) d.serverResponse = mw.outerHTML;
|
||||
} catch (e) { /* keep original response on parse failure */ }
|
||||
} catch { /* keep original response on parse failure */ }
|
||||
});
|
||||
|
||||
document.body.addEventListener('htmx:afterSwap', function(evt) {
|
||||
|
||||
Reference in New Issue
Block a user