Skip to content

Commit b5209c7

Browse files
committed
fix: setWordSelection if no word selected
1 parent 6ab4515 commit b5209c7

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

packages/super-editor/src/core/helpers/setWordSelection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TextSelection } from 'prosemirror-state';
44
export const setWordSelection = (view, pos) => {
55
const { state, dispatch } = view;
66
const word = findWordBounds(state.doc, pos);
7+
if (!word) return;
78
const tr = state.tr.setSelection(TextSelection.create(state.doc, word.from, word.to));
89
dispatch(tr);
910
};

0 commit comments

Comments
 (0)