diff --git a/packages/nc-gui/components/cell/Currency.vue b/packages/nc-gui/components/cell/Currency.vue index 1b5d363969..3bf10c83e5 100644 --- a/packages/nc-gui/components/cell/Currency.vue +++ b/packages/nc-gui/components/cell/Currency.vue @@ -86,8 +86,6 @@ onMounted(() => { @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop @contextmenu.stop diff --git a/packages/nc-gui/components/cell/Decimal.vue b/packages/nc-gui/components/cell/Decimal.vue index 80a7e9fc01..72398a3ff6 100644 --- a/packages/nc-gui/components/cell/Decimal.vue +++ b/packages/nc-gui/components/cell/Decimal.vue @@ -105,8 +105,6 @@ watch(isExpandedFormOpen, () => { @keydown.right.stop @keydown.up.stop="onKeyDown" @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Duration.vue b/packages/nc-gui/components/cell/Duration.vue index c3bc7bb3ea..83566923ad 100644 --- a/packages/nc-gui/components/cell/Duration.vue +++ b/packages/nc-gui/components/cell/Duration.vue @@ -103,8 +103,6 @@ const focus: VNodeRef = (el) => !isExpandedFormOpen.value && !isEditColumn.value @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Email.vue b/packages/nc-gui/components/cell/Email.vue index 385fecb852..8be8584132 100644 --- a/packages/nc-gui/components/cell/Email.vue +++ b/packages/nc-gui/components/cell/Email.vue @@ -78,8 +78,6 @@ watch( @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Float.vue b/packages/nc-gui/components/cell/Float.vue index 8a91b05ebb..b40a33f701 100644 --- a/packages/nc-gui/components/cell/Float.vue +++ b/packages/nc-gui/components/cell/Float.vue @@ -58,8 +58,6 @@ const focus: VNodeRef = (el) => !isExpandedFormOpen.value && !isEditColumn.value @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Percent.vue b/packages/nc-gui/components/cell/Percent.vue index 55b6188e56..29c2efe3f9 100644 --- a/packages/nc-gui/components/cell/Percent.vue +++ b/packages/nc-gui/components/cell/Percent.vue @@ -49,8 +49,6 @@ const focus: VNodeRef = (el) => !isExpandedFormOpen.value && !isEditColumn.value @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/PhoneNumber.vue b/packages/nc-gui/components/cell/PhoneNumber.vue index 24c3c8ef36..3e9b425c51 100644 --- a/packages/nc-gui/components/cell/PhoneNumber.vue +++ b/packages/nc-gui/components/cell/PhoneNumber.vue @@ -70,8 +70,6 @@ watch( @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Text.vue b/packages/nc-gui/components/cell/Text.vue index e3ec8698a6..2e4f6f2cde 100644 --- a/packages/nc-gui/components/cell/Text.vue +++ b/packages/nc-gui/components/cell/Text.vue @@ -43,8 +43,6 @@ const focus: VNodeRef = (el) => !isExpandedFormOpen.value && !isEditColumn.value @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/TextArea.vue b/packages/nc-gui/components/cell/TextArea.vue index 6cf430bd22..36dc1a4797 100644 --- a/packages/nc-gui/components/cell/TextArea.vue +++ b/packages/nc-gui/components/cell/TextArea.vue @@ -100,8 +100,6 @@ onClickOutside(inputWrapperRef, (e) => { @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Url.vue b/packages/nc-gui/components/cell/Url.vue index cd6d15077e..71f7c57563 100644 --- a/packages/nc-gui/components/cell/Url.vue +++ b/packages/nc-gui/components/cell/Url.vue @@ -99,8 +99,6 @@ watch( @keydown.right.stop @keydown.up.stop @keydown.delete.stop - @keydown.ctrl.z.stop - @keydown.meta.z.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/composables/useUndoRedo.ts b/packages/nc-gui/composables/useUndoRedo.ts index 502ed672ee..9e94080b46 100644 --- a/packages/nc-gui/composables/useUndoRedo.ts +++ b/packages/nc-gui/composables/useUndoRedo.ts @@ -26,6 +26,16 @@ export const useUndoRedo = createSharedComposable(() => { }) const isSameScope = (sc: { key: string; param: string | string[] }[]) => { + // TODO - improve this logic + // for now we disable undo/redo for webhook, field, api, relation + const slugs = scope.value.find((s) => s.key === 'slugs') + if (slugs) { + const params = Array.isArray(slugs.param) ? slugs.param : slugs.param.split(',') + if (params.some((el) => ['webhook', 'field', 'api', 'relation'].includes(el))) { + return false + } + } + return sc.every((s) => { return scope.value.some( // viewTitle is optional for default view @@ -158,6 +168,9 @@ export const useUndoRedo = createSharedComposable(() => { useEventListener(document, 'keydown', async (e: KeyboardEvent) => { const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey + + if (e && (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement)) return + if (cmdOrCtrl && !e.altKey) { switch (e.keyCode) { case 90: {