From 840aba87549f909224b57298881523e039bb9c1f Mon Sep 17 00:00:00 2001 From: Fabio Montefuscolo Date: Mon, 3 Aug 2026 22:14:25 +0200 Subject: [PATCH] feat: wire font-size buttons --- openspec/changes/sidepanel-ux-improvements/tasks.md | 2 +- sidepanel/sidepanel.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/openspec/changes/sidepanel-ux-improvements/tasks.md b/openspec/changes/sidepanel-ux-improvements/tasks.md index 5b25625..f806011 100644 --- a/openspec/changes/sidepanel-ux-improvements/tasks.md +++ b/openspec/changes/sidepanel-ux-improvements/tasks.md @@ -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 diff --git a/sidepanel/sidepanel.js b/sidepanel/sidepanel.js index 0c4c2b8..662633c 100644 --- a/sidepanel/sidepanel.js +++ b/sidepanel/sidepanel.js @@ -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 // ---------------------------------------------------------------------------