import type { Editor } from '@tiptap/core' import { getClosestTableCell } from '@admin/utils/editor/get-closest-table-cell' import { getEditorElement } from '@admin/utils/editor/get-editor-element' export function getSelectionTableCell(editor: Editor) { const selection = getEditorElement(editor)?.ownerDocument.getSelection() const anchorNode = selection?.anchorNode return getClosestTableCell(anchorNode ?? null) }