diff --git a/changelog/unreleased/enhancement-app-templates b/changelog/unreleased/enhancement-app-templates index 09a16999683..0c17a11a25c 100644 --- a/changelog/unreleased/enhancement-app-templates +++ b/changelog/unreleased/enhancement-app-templates @@ -6,4 +6,6 @@ This enables developers to more easily create custom apps, and brings unified be https://github.com/owncloud/web/issues/9302 https://github.com/owncloud/web/issues/9303 https://github.com/owncloud/web/issues/9617 +https://github.com/owncloud/web/issues/9695 https://github.com/owncloud/web/pull/9485 +https://github.com/owncloud/web/pull/9699 diff --git a/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue b/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue index 63a1fed7005..4bc036b96cc 100644 --- a/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue +++ b/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue @@ -317,7 +317,7 @@ export default defineComponent({ autosaveIntervalId = null }) - const { bindKeyAction } = useKeyboardActions() + const { bindKeyAction } = useKeyboardActions({ skipDisabledKeyBindingsCheck: true }) bindKeyAction({ modifier: ModifierKey.Ctrl, primary: Key.S }, () => { if (!unref(isDirty)) { return diff --git a/packages/web-pkg/src/composables/keyboardActions/useKeyboardActions.ts b/packages/web-pkg/src/composables/keyboardActions/useKeyboardActions.ts index d3eb87180be..304713f6798 100644 --- a/packages/web-pkg/src/composables/keyboardActions/useKeyboardActions.ts +++ b/packages/web-pkg/src/composables/keyboardActions/useKeyboardActions.ts @@ -2,6 +2,10 @@ import { useEventListener } from '@vueuse/core' import { Ref, ref, unref } from 'vue' import * as uuid from 'uuid' +interface KeyboardActionsOptions { + skipDisabledKeyBindingsCheck?: boolean +} + export enum Key { C = 'c', V = 'v', @@ -65,12 +69,12 @@ const areCustomKeyBindingsDisabled = () => { return isTextSelected } -export const useKeyboardActions = (): KeyboardActions => { +export const useKeyboardActions = (options?: KeyboardActionsOptions): KeyboardActions => { const actions = ref>([]) const selectionCursor = ref(0) const listener = (event: KeyboardEvent): void => { - if (areCustomKeyBindingsDisabled()) { + if (!options?.skipDisabledKeyBindingsCheck && areCustomKeyBindingsDisabled()) { return } @@ -81,6 +85,7 @@ export const useKeyboardActions = (): KeyboardActions => { } else if (shiftKey) { modifier = ModifierKey.Shift } + unref(actions) .filter((action) => { return action.primary === key && action.modifier === modifier