Closed1
Tiptap

リストアイテム内にいる時にTabを押したらエディタからフォーカスが消えるので、止まるようにする
const editor = useTiptapEditor({
editorProps: {
handleKeyDown: (editor, event) => {
// リストアイテム内にいる場合はTabでエディタからフォーカスを失わないようにする
if (event.key === 'Tab' && !event.ctrlKey && !event.metaKey) {
const { $from } = editor.state.selection
const node = $from.node(-1)
if (node && node.type.name === 'listItem') {
event.stopPropagation()
}
}
},
})
このスクラップは2ヶ月前にクローズされました