Skip to content

Commit

Permalink
Prevent insertion of empty text
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed May 11, 2021
1 parent b79d013 commit 82ac3eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useEditable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const useEditable = (
const end = position.position + (offset > 0 ? offset : 0);
range = makeRange(element, start, end);
range.deleteContents();
range.insertNode(document.createTextNode(append));
if (append) range.insertNode(document.createTextNode(append));
setCurrentRange(makeRange(element, start + append.length));
}
},
Expand Down

0 comments on commit 82ac3eb

Please sign in to comment.