Skip to content

Commit 98a6486

Browse files
fix(reply): Avoid crash due to negative range start value in reply (#528)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 2ae80dd commit 98a6486

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/ReplyField/ReplyField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class ReplyField extends React.Component<Props, State> {
8181

8282
const { mentionString, mentionTrigger } = activeMention;
8383
const offset = mentionString.length + mentionTrigger.length;
84-
const mentionStart = currentCursor - offset;
84+
const mentionStart = Math.max(0, currentCursor - offset);
8585

8686
range.setStart(textNode, mentionStart);
8787
range.setEnd(textNode, mentionStart);

0 commit comments

Comments
 (0)