tiptap/packages/core/src/helpers/isAtEndOfNode.ts

12 lines
261 B
TypeScript
Raw Normal View History

2023-03-28 20:21:16 +08:00
import { EditorState } from '@tiptap/pm/state'
export const istAtEndOfNode = (state: EditorState) => {
const { $from, $to } = state.selection
if ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) {
return false
}
return true
}