refactor: reuse blurTarget in inline rename

This commit is contained in:
Danila Poyarkov 2026-05-07 10:30:27 +03:00
parent a6da185e54
commit 4e702799fc

View file

@ -1,6 +1,8 @@
import { onClickOutside } from '@vueuse/core'
import { nextTick, ref, type Ref } from 'vue'
import { blurTarget } from '#vue/shared/dom-events'
export interface InlineRenameState<T extends string> {
editingId: Ref<T | null>
start: (id: T, currentName: string) => void
@ -63,7 +65,7 @@ export function useInlineRename<T extends string>(
function onKeydown(e: KeyboardEvent) {
if (e.code === 'Enter') {
if (e.target instanceof HTMLElement) e.target.blur()
blurTarget(e)
return
}