diff --git a/README.md b/README.md index 713f42f..cc71082 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ umbenennen, löschen, per Drag sortieren). Zoom 40–200 % pro Blatt | `Bild↑` / `Bild↓` | seitenweise (bei festen Tabellen nach Viewport-Höhe) | | **`Strg`/`Cmd`+`C`/`X`/`V`** | Kopieren / Ausschneiden / Einfügen (Zellen + Formatierung, bezugsangepasst) | | **`F4`** (im Editor/in der Formelleiste) | Bezug am Cursor sperren/zyklisch umschalten: `A1` → `$A$1` → `A$1` → `$A1` → `A1`; bei markiertem Text werden **alle** darin gefundenen Bezüge auf einmal umgeschaltet, jeder ausgehend vom eigenen Zustand | -| **`Alt`+`Enter`** (im Editor) | Zeilenumbruch in der Zelle einfügen, statt zu committen | +| **`Alt`+`Enter`** bzw. **`Cmd`+`Enter`** (im Editor) | Zeilenumbruch in der Zelle einfügen, statt zu committen — `Cmd`+`Enter` als Mac-Fallback, da `⌥` (Option) dort eine Compose-Taste ist und nicht überall zuverlässig als reines Modifier ankommt | Bei **festen (scrollbaren) Tabellen** wird die aktive Zelle bei jeder Navigation automatisch in den sichtbaren Bereich gescrollt (unter Beachtung fixierter diff --git a/src/components/TableGrid.vue b/src/components/TableGrid.vue index e7254d0..edec5a6 100644 --- a/src/components/TableGrid.vue +++ b/src/components/TableGrid.vue @@ -650,10 +650,16 @@ function cancelEdit() { focusRoot(); } function onEditKeydown(e: KeyboardEvent) { - if (e.key === 'Enter' && e.altKey) { + // Alt+Enter (Windows/Excel-365-Mac) or Cmd+Enter (a macOS-safe fallback -- + // Option is a compose key there, e.g. for Control+Option+Return, the + // traditional Mac Excel shortcut, or some layouts/browsers, so `altKey` + // alone isn't fully reliable; `e.code` sidesteps `key` being altered by + // that composition, since Enter itself never composes into another char). + const isEnter = e.key === 'Enter' || e.code === 'Enter' || e.code === 'NumpadEnter'; + if (isEnter && (e.altKey || e.metaKey)) { // insert a literal newline at the caret ourselves rather than relying on // the textarea's native Enter handling, which some browsers/OSes divert - // Alt+Enter away from (e.g. as a window/fullscreen shortcut) + // this combination away from (e.g. as a window/fullscreen shortcut) e.preventDefault(); e.stopPropagation(); const el = editInput.value;