changed shortcut handling
This commit is contained in:
parent
21b6092502
commit
ddfdd2b87a
|
|
@ -267,12 +267,14 @@ date: {{date}}
|
|||
| `Ctrl+Alt+N` | `Cmd+Option+N` | New note |
|
||||
| `Ctrl+Alt+F` | `Cmd+Option+F` | New folder |
|
||||
| `Ctrl+Z` | `Cmd+Z` | Undo |
|
||||
| `Ctrl+Y` | `Cmd+Y` | Redo |
|
||||
| `Ctrl+Shift+Z` | `Cmd+Shift+Z` | Toggle Zen Mode |
|
||||
| `Ctrl+Y` or `Ctrl+Shift+Z` | `Cmd+Y` or `Cmd+Shift+Z` | Redo |
|
||||
| `Ctrl+Alt+Z` | `Cmd+Option+Z` | Toggle Zen Mode |
|
||||
| `Esc` | `Esc` | Exit Zen Mode |
|
||||
| `F3` | `F3` | Next search match |
|
||||
| `Shift+F3` | `Shift+F3` | Previous search match |
|
||||
|
||||
> **Note for Mac users:** Some Option-based shortcuts (`Cmd+Option+N/F/T`) may conflict with browser shortcuts in Chrome/Brave. Safari has better compatibility. If shortcuts don't work, try using `Ctrl` instead of `Cmd`, or use the UI buttons.
|
||||
|
||||
### Markdown Formatting
|
||||
|
||||
| Windows/Linux | Mac | Action | Result |
|
||||
|
|
@ -290,7 +292,7 @@ Full immersive distraction-free writing experience:
|
|||
- **Hidden UI** - Sidebar, toolbar, and stats bar disappear
|
||||
- **Centered editor** - Comfortable width for optimal reading
|
||||
- **Larger text** - 18px font size with relaxed line spacing
|
||||
- **Quick access** - Button in toolbar or `Ctrl+Shift+Z` shortcut
|
||||
- **Quick access** - Button in toolbar or `Ctrl+Alt+Z` / `Cmd+Option+Z` shortcut
|
||||
- **Easy exit** - Press `Esc`, click exit button, or use shortcut again
|
||||
- **State preserved** - Returns to your previous view mode on exit
|
||||
|
||||
|
|
|
|||
|
|
@ -428,44 +428,50 @@ function noteApp() {
|
|||
if (!window.__noteapp_shortcuts_initialized) {
|
||||
window.__noteapp_shortcuts_initialized = true;
|
||||
window.addEventListener('keydown', (e) => {
|
||||
// Use e.code for all letter keys for consistency across keyboard layouts
|
||||
|
||||
// Ctrl/Cmd + S to save
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
|
||||
if ((e.ctrlKey || e.metaKey) && e.code === 'KeyS') {
|
||||
e.preventDefault();
|
||||
this.saveNote();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + Alt + N for new note
|
||||
if ((e.ctrlKey || e.metaKey) && e.altKey && e.key === 'n') {
|
||||
// Ctrl/Cmd + Alt/Option + N for new note
|
||||
if ((e.ctrlKey || e.metaKey) && e.altKey && e.code === 'KeyN') {
|
||||
e.preventDefault();
|
||||
this.createNote();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + Alt + F for new folder
|
||||
if ((e.ctrlKey || e.metaKey) && e.altKey && e.key === 'f') {
|
||||
// Ctrl/Cmd + Alt/Option + F for new folder
|
||||
if ((e.ctrlKey || e.metaKey) && e.altKey && e.code === 'KeyF') {
|
||||
e.preventDefault();
|
||||
this.createFolder();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + Z for undo
|
||||
if ((e.ctrlKey || e.metaKey) && !e.shiftKey && e.key === 'z') {
|
||||
// Ctrl/Cmd + Z for undo (without shift or alt)
|
||||
if ((e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey && e.code === 'KeyZ') {
|
||||
e.preventDefault();
|
||||
this.undo();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + Y for redo (Ctrl+Shift+Z now opens Zen mode)
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'y') {
|
||||
// Ctrl/Cmd + Y OR Ctrl/Cmd+Shift+Z for redo
|
||||
if ((e.ctrlKey || e.metaKey) && e.code === 'KeyY') {
|
||||
e.preventDefault();
|
||||
this.redo();
|
||||
}
|
||||
if ((e.ctrlKey || e.metaKey) && e.shiftKey && !e.altKey && e.code === 'KeyZ') {
|
||||
e.preventDefault();
|
||||
this.redo();
|
||||
}
|
||||
|
||||
// F3 for next search match
|
||||
if (e.key === 'F3' && !e.shiftKey) {
|
||||
if (e.code === 'F3' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
this.nextMatch();
|
||||
}
|
||||
|
||||
// Shift + F3 for previous search match
|
||||
if (e.key === 'F3' && e.shiftKey) {
|
||||
if (e.code === 'F3' && e.shiftKey) {
|
||||
e.preventDefault();
|
||||
this.previousMatch();
|
||||
}
|
||||
|
|
@ -474,31 +480,31 @@ function noteApp() {
|
|||
const isEditorFocused = document.activeElement?.id === 'note-editor';
|
||||
if (isEditorFocused && this.currentNote) {
|
||||
// Ctrl/Cmd + B for bold
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'b') {
|
||||
if ((e.ctrlKey || e.metaKey) && e.code === 'KeyB') {
|
||||
e.preventDefault();
|
||||
this.wrapSelection('**', '**', 'bold text');
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + I for italic
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'i') {
|
||||
if ((e.ctrlKey || e.metaKey) && e.code === 'KeyI') {
|
||||
e.preventDefault();
|
||||
this.wrapSelection('*', '*', 'italic text');
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + K for link
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
|
||||
if ((e.ctrlKey || e.metaKey) && e.code === 'KeyK') {
|
||||
e.preventDefault();
|
||||
this.insertLink();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + Alt + T for table
|
||||
if ((e.ctrlKey || e.metaKey) && e.altKey && e.key === 't') {
|
||||
// Ctrl/Cmd + Alt/Option + T for table
|
||||
if ((e.ctrlKey || e.metaKey) && e.altKey && e.code === 'KeyT') {
|
||||
e.preventDefault();
|
||||
this.insertTable();
|
||||
}
|
||||
|
||||
// Ctrl/Cmd + Shift + Z for Zen mode (only when note is open)
|
||||
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === 'Z') {
|
||||
// Ctrl/Cmd + Alt/Option + Z for Zen mode
|
||||
if ((e.ctrlKey || e.metaKey) && e.altKey && e.code === 'KeyZ') {
|
||||
e.preventDefault();
|
||||
this.toggleZenMode();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2063,7 +2063,7 @@
|
|||
@click="toggleZenMode()"
|
||||
class="p-2 transition"
|
||||
style="color: var(--text-secondary);"
|
||||
title="Zen Mode (Ctrl+Shift+Z)"
|
||||
title="Zen Mode (Ctrl+Alt+Z)"
|
||||
@mouseenter="$el.style.backgroundColor = 'var(--bg-secondary)'"
|
||||
@mouseleave="$el.style.backgroundColor = 'transparent'"
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in New Issue