Skip to content

fix(editor): support Cmd key for editor shortcuts on macOS - #8720

Merged
SebastianKrupinski merged 1 commit into
nextcloud:mainfrom
xhon-pelushi:fix/mac-editor-shortcuts
Sep 5, 2026
Merged

fix(editor): support Cmd key for editor shortcuts on macOS#8720
SebastianKrupinski merged 1 commit into
nextcloud:mainfrom
xhon-pelushi:fix/mac-editor-shortcuts

Conversation

@xhon-pelushi

@xhon-pelushi xhon-pelushi commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Register calendar editor shortcuts via @nextcloud/vue useHotKey so macOS uses Cmd and other platforms use Ctrl (not both).
  • Call useHotKey directly from EditFull and EditSimple setup().

Fixes #8715

Test plan

  • On macOS: open an event editor and confirm Cmd+Enter / Cmd+Delete / Cmd+D behave as expected; Escape still cancels
  • On Windows/Linux: confirm Ctrl shortcuts still work; plain Ctrl must not also fire the Cmd bindings on macOS

Comment thread src/mixins/EditorMixin.js Outdated
@odzhychko odzhychko self-assigned this Aug 12, 2026
@xhon-pelushi

Copy link
Copy Markdown
Contributor Author

Thanks for the review — pushed a follow-up that switches the editor shortcuts to useHotKey (via a small useEditorHotKeys composable used from both EditSimple and EditFull).

  • Escape / Ctrl|Cmd+Enter / Ctrl|Cmd+Delete / Ctrl|Cmd+D are registered through @nextcloud/vue/composables/useHotKey
  • On macOS that means Cmd only (not Ctrl||Meta)
  • The mixin window keydown listeners and handlers are removed

Happy to adjust further if needed.

Comment thread src/composables/useEditorHotKeys.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — the local wrapper is gone. EditFull / EditSimple now call @nextcloud/vue useHotKey directly from setup(); useEditorHotKeys.js was removed.

@xhon-pelushi
xhon-pelushi force-pushed the fix/mac-editor-shortcuts branch 2 times, most recently from da86e8c to 795ed24 Compare August 14, 2026 03:41
@xhon-pelushi

Copy link
Copy Markdown
Contributor Author

Thanks @odzhychko and @SebastianKrupinski — updated to call useHotKey directly from EditFull / EditSimple setup() (no local wrapper composable). macOS gets Cmd via useHotKey; Ctrl is not also accepted for those bindings.

Comment thread src/views/EditFull.vue Outdated
Comment thread src/views/EditFull.vue Outdated
@xhon-pelushi
xhon-pelushi force-pushed the fix/mac-editor-shortcuts branch from 58f4089 to e98f9fb Compare August 15, 2026 20:42

@odzhychko odzhychko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/mixins/EditorMixin.js 82.35% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@SebastianKrupinski
SebastianKrupinski force-pushed the fix/mac-editor-shortcuts branch 3 times, most recently from a7336a1 to 5c6cf32 Compare September 5, 2026 17:53
@SebastianKrupinski

Copy link
Copy Markdown
Contributor

@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.

I made the changes.

@SebastianKrupinski

Copy link
Copy Markdown
Contributor

Note:

Shortcut keys work, but not so well for recurring events

@SebastianKrupinski

Copy link
Copy Markdown
Contributor

/backport to stable6.6

@backportbot backportbot Bot added the backport-request A backport was requested for this pull request label Sep 5, 2026
@SebastianKrupinski

Copy link
Copy Markdown
Contributor

/backport to stable6.5

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski
SebastianKrupinski merged commit 534f9f9 into nextcloud:main Sep 5, 2026
32 checks passed
@backportbot backportbot Bot removed the backport-request A backport was requested for this pull request label Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ctrl is used instead of Cmd in editor shortcuts under MacOS

3 participants