feat: wire font-size buttons

This commit is contained in:
Fabio Montefuscolo 2026-08-03 22:14:25 +02:00
parent 41b8480f23
commit 840aba8754
2 changed files with 9 additions and 1 deletions

View file

@ -21,7 +21,7 @@
- [x] 4.1 Add `A-` and `A+` buttons to the header in `sidepanel/sidepanel.html` before the `☰` button; style them like `#open-list` in `sidepanel/sidepanel.css`
- [x] 4.2 In `sidepanel/sidepanel.js`, implement font-size state: default 16px, range 10–24px, step 1px; apply via `editor.style.fontSize`; load from `localStorage` (`side-notes:fontSize`) at init and persist on every change
- [ ] 4.3 Wire the two buttons to decrease/increase with clamping
- [x] 4.3 Wire the two buttons to decrease/increase with clamping
- [ ] 4.4 Add keyboard shortcuts in the existing keydown handler: `Ctrl/Cmd+=` (and `+` variant) increase, `Ctrl/Cmd+-` decrease, `Ctrl/Cmd+0` reset to 16px, all with `preventDefault()`
- [ ] 4.5 Verify the find match scrolling (`selectMatch`) still scrolls correctly at min and max font sizes

View file

@ -457,6 +457,14 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo) => {
}
});
document.getElementById('font-decrease').addEventListener('click', () => {
fontSize = applyFontSize(fontSize - FONT_SIZE_STEP);
});
document.getElementById('font-increase').addEventListener('click', () => {
fontSize = applyFontSize(fontSize + FONT_SIZE_STEP);
});
// ---------------------------------------------------------------------------
// Open notes list page
// ---------------------------------------------------------------------------