import type { Editor } from '@tiptap/react' import { selectedRect } from '@tiptap/pm/tables' export function getSelectedTableColumnCellPositions(editor: Editor): number[] { if (!editor.isActive('table')) return [] try { const rect = selectedRect(editor.state) const columnIndex = rect.left const cellPositions = rect.map.cellsInRect({ bottom: rect.map.height, left: columnIndex, right: columnIndex + 1, top: 0 }) return [...new Set(cellPositions)].map((pos) => rect.tableStart + pos) } catch { return [] } }