fix(editor): support Cmd key for editor shortcuts on macOS - #8720
fix(editor): support Cmd key for editor shortcuts on macOS#8720xhon-pelushi wants to merge 2 commits into
Conversation
|
Thanks for the review — pushed a follow-up that switches the editor shortcuts to
Happy to adjust further if needed. |
There was a problem hiding this comment.
The editor mixin is already a common library between both editors, why do we now need to extract and abstract this in to a composable? useHotKey is already a composable, so we are wrapping a @nextcloud composable in a local composable?
There was a problem hiding this comment.
Agreed — the local wrapper is gone. EditFull / EditSimple now call @nextcloud/vue useHotKey directly from setup(); useEditorHotKeys.js was removed.
e3ac8a5 to
da86e8c
Compare
Register Escape / Ctrl-or-Cmd+Enter / Delete / d via @nextcloud/vue useHotKey so macOS uses Cmd and other platforms use Ctrl (not both). Call useHotKey directly from EditFull and EditSimple setup() instead of wrapping it in a local composable. Fixes nextcloud#8715 Signed-off-by: xhon-pelushi <xhon@pelushi.com>
da86e8c to
795ed24
Compare
|
Thanks @odzhychko and @SebastianKrupinski — updated to call |
getCurrentInstance() returned null when called inside the hotkey callbacks themselves, since they fire later on keydown, outside Vue's active-instance context during setup(). Resolve proxy once, synchronously, and close over it instead. Also set allowInModal: true - useHotKey ignores keystrokes inside a modal by default, and the event editor is rendered as one, so none of the shortcuts fired at all. Signed-off-by: xhon-pelushi <xhon@pelushi.com>
58f4089 to
e98f9fb
Compare
odzhychko
left a comment
There was a problem hiding this comment.
@xhon-pelushi #8720 (comment) is still open.
Just inline the logic into setup in EditorMixin (or is there a reason why it doesn't work?). Also no need for the new code comments.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
@nextcloud/vueuseHotKeyso macOS uses Cmd and other platforms use Ctrl (not both).useHotKeydirectly fromEditFullandEditSimplesetup().Fixes #8715
Test plan