Skip to content

Commit

Permalink
fix(reply): Avoid crash due to negative range start value in reply (#528
Browse files Browse the repository at this point in the history
)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
jstoffan and mergify[bot] authored Jun 23, 2020
1 parent 2ae80dd commit 98a6486
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/ReplyField/ReplyField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class ReplyField extends React.Component<Props, State> {

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

range.setStart(textNode, mentionStart);
range.setEnd(textNode, mentionStart);
Expand Down

0 comments on commit 98a6486

Please sign in to comment.