clear table cell content #1122
Closed
SunnyCheung-cp
started this conversation in
Ideas
Replies: 1 comment
-
It worked. here's my code. @Saul-Mirone would it be all right?
export const selectCell = (state) => {
const { tr } = state
const table = findTable(tr.selection)
if (table) {
const cell = selectionCell(state)
return cloneTr(tr.setSelection(new CellSelection(cell)))
}
return state.tr
}
export const selectCellCommand = $command('SelectCell', () => () => (state, dispatch) => {
const result = dispatch?.(selectCell(state))
return Boolean(result)
})
onClick={() => {
call(selectCellCommand.key);
view.dispatch(view.state.tr.deleteSelection());
}} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions