feat: font-size keyboard shortcuts (Ctrl+=/-/0)
This commit is contained in:
parent
840aba8754
commit
fe12a15a43
2 changed files with 14 additions and 1 deletions
|
|
@ -22,7 +22,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
|
||||
- [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()`
|
||||
- [x] 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
|
||||
|
||||
## 5. Validation
|
||||
|
|
|
|||
|
|
@ -414,6 +414,19 @@ document.addEventListener('keydown', (e) => {
|
|||
e.stopPropagation();
|
||||
openFind();
|
||||
}
|
||||
// Font size: Ctrl/Cmd+= (or +) increase, Ctrl/Cmd+- decrease, Ctrl/Cmd+0 reset
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === '=' || e.key === '+')) {
|
||||
e.preventDefault();
|
||||
fontSize = applyFontSize(fontSize + FONT_SIZE_STEP);
|
||||
}
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === '-') {
|
||||
e.preventDefault();
|
||||
fontSize = applyFontSize(fontSize - FONT_SIZE_STEP);
|
||||
}
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === '0') {
|
||||
e.preventDefault();
|
||||
fontSize = applyFontSize(FONT_SIZE_DEFAULT);
|
||||
}
|
||||
// Escape → close find bar
|
||||
if (e.key === 'Escape' && !findBar.hidden) {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue