Skip to content

Commit

Permalink
Fix formatting. npx eslint no errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBBS committed Nov 16, 2022
1 parent 8188200 commit 0a9087c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
20 changes: 9 additions & 11 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,20 +384,18 @@ class ReportActionCompose extends React.Component {
updateComment(comment, shouldDebounceSaveComment) {
const newComment = EmojiUtils.replaceEmojis(comment);
this.setState((prevState) => {
let newState = {
const newState = {
isCommentEmpty: !!newComment.match(/^(\s|`)*$/),
value: newComment
}

if(comment !== newComment) {
const remainder = prevState.value.slice(prevState.selection.end).length
newState.selection = {
value: newComment,
};
if (comment !== newComment) {
const remainder = prevState.value.slice(prevState.selection.end).length;
newState.selection = {
start: newComment.length - remainder,
end: newComment.length - remainder
}
end: newComment.length - remainder,
};
}

return newState
return newState;
});

// Indicate that draft has been created.
Expand Down
17 changes: 7 additions & 10 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,16 @@ class ReportActionItemMessageEdit extends React.Component {
*/
updateDraft(draft) {
const newDraft = EmojiUtils.replaceEmojis(draft);

this.setState((prevState) => {
let newState = {draft: newDraft}

if(draft !== newDraft) {
const remainder = prevState.draft.slice(prevState.selection.end).length
newState.selection = {
const newState = {draft: newDraft};
if (draft !== newDraft) {
const remainder = prevState.draft.slice(prevState.selection.end).length;
newState.selection = {
start: newDraft.length - remainder,
end: newDraft.length - remainder
}
end: newDraft.length - remainder,
};
}

return newState
return newState;
});

// This component is rendered only when draft is set to a non-empty string. In order to prevent component
Expand Down

0 comments on commit 0a9087c

Please sign in to comment.