Skip to content

Commit

Permalink
fix: consistent table click handlers
Browse files Browse the repository at this point in the history
Fixes #230
  • Loading branch information
petyosi committed Dec 11, 2023
1 parent d695747 commit edfc236
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/plugins/table/TableEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ export const TableEditor: React.FC<TableEditorProps> = ({ mdastNode, parentEdito
const [activeCell, setActiveCell] = React.useState<[number, number] | null>(null)
const [iconComponentFor, readOnly] = corePluginHooks.useEmitterValues('iconComponentFor', 'readOnly')
const getCellKey = React.useMemo(() => {
const cellKeyMap = new WeakMap<Mdast.TableCell, string>()
return (cell: Mdast.TableCell) => {
if (!cellKeyMap.has(cell)) {
cellKeyMap.set(cell, uuidv4())
return (cell: Mdast.TableCell & { __cacheKey?: string }) => {
if (!cell.__cacheKey) {
cell.__cacheKey = uuidv4()
}
return cellKeyMap.get(cell)!
return cell.__cacheKey
}
}, [])

Expand Down

0 comments on commit edfc236

Please sign in to comment.