diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue
index c8a51a9b1d..7c785e32d6 100644
--- a/packages/nc-gui/components/cell/attachment/index.vue
+++ b/packages/nc-gui/components/cell/attachment/index.vue
@@ -2,9 +2,8 @@
import { onKeyDown } from '@vueuse/core'
import { useProvideAttachmentCell } from './utils'
import { useSortable } from './sort'
-import { useSelectedCellKeyupListener } from '~/composables/useSelectedCellKeyupListener'
-import { ActiveCellInj } from '~/context'
import {
+ ActiveCellInj,
DropZoneRef,
IsGalleryInj,
IsKanbanInj,
@@ -14,6 +13,7 @@ import {
openLink,
ref,
useDropZone,
+ useSelectedCellKeyupListener,
useSmartsheetRowStoreOrThrow,
useSmartsheetStoreOrThrow,
watch,
diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue
index 3e3d163c9c..7b2c7808d3 100644
--- a/packages/nc-gui/components/smartsheet/Grid.vue
+++ b/packages/nc-gui/components/smartsheet/Grid.vue
@@ -363,7 +363,7 @@ useEventListener(document, 'keyup', async (e: KeyboardEvent) => {
/** On clicking outside of table reset active cell */
const smartTable = ref(null)
-onClickOutside(smartTable, (e: PointerEvent) => {
+onClickOutside(smartTable, (e) => {
clearRangeRows()
if (selected.col === null) return
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
index 80fd0dc135..c6e921385e 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
@@ -16,7 +16,7 @@ watch(
// todo: replace setTimeout
setTimeout(() => {
if (commentsWrapperEl.value) commentsWrapperEl.value.scrollTop = commentsWrapperEl.value?.scrollHeight
- }, 200
+ }, 200)
},
{ immediate: true },
)
diff --git a/packages/nc-gui/components/virtual-cell/Formula.vue b/packages/nc-gui/components/virtual-cell/Formula.vue
index 35a9b43c9b..7d25764c04 100644
--- a/packages/nc-gui/components/virtual-cell/Formula.vue
+++ b/packages/nc-gui/components/virtual-cell/Formula.vue
@@ -1,7 +1,7 @@
diff --git a/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts b/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts
index f26e584353..b9565b68e5 100644
--- a/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts
+++ b/packages/nc-gui/composables/useSelectedCellKeyupListener/index.ts
@@ -1,20 +1,21 @@
+import { isClient } from '@vueuse/core'
import type { Ref } from 'vue'
-import { onUnmounted, useEventListener } from '#imports'
export function useSelectedCellKeyupListener(selected: Ref, handler: (e: KeyboardEvent) => void) {
- const cleanup: Ref | null> = ref(null)
+ if (isClient) {
+ watch(selected, (nextVal, _, cleanup) => {
+ // bind listener when `selected` is truthy
+ if (nextVal) {
+ document.addEventListener('keyup', handler)
+ // if `selected` is falsy then remove the event handler
+ } else {
+ document.removeEventListener('keyup', handler)
+ }
- watch(selected, (value) => {
- if (value) {
- cleanup.value = useEventListener('keydown', handler, true)
- } else {
- cleanup.value?.()
- }
- })
-
- onUnmounted(() => cleanup.value?.())
-
- return {
- cleanup,
+ // cleanup is called whenever the watcher is re-evaluated or stopped
+ cleanup(() => {
+ document.removeEventListener('keyup', handler)
+ })
+ })
}
}
diff --git a/packages/nc-gui/utils/columnUtils.ts b/packages/nc-gui/utils/columnUtils.ts
index f75d778afa..318f0ffe08 100644
--- a/packages/nc-gui/utils/columnUtils.ts
+++ b/packages/nc-gui/utils/columnUtils.ts
@@ -24,7 +24,6 @@ import TimerOutline from '~icons/mdi/timer-outline'
import Star from '~icons/mdi/star'
import MathIntegral from '~icons/mdi/math-integral'
import MovieRoll from '~icons/mdi/movie-roll'
-import Counter from '~icons/mdi/counter'
import CalendarClock from '~icons/mdi/calendar-clock'
import ID from '~icons/mdi/identifier'
import RulerSquareCompass from '~icons/mdi/ruler-square-compass'