Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
advu committed Nov 8, 2024
1 parent 9e5ac20 commit a563e52
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions client/components/GecView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const Word = ({ word, isError, edit, index, onEditChange, errorAction, errorFeed

return isError && edit.o_start === edit.o_end && edit.o_str === "" ? (
<span
class={"word" + index}
key={index}
style={{ position: 'relative', display: 'inline-block' }}
onMouseEnter={() => setHovered(true)}
Expand Down Expand Up @@ -55,7 +54,6 @@ const Word = ({ word, isError, edit, index, onEditChange, errorAction, errorFeed
</span>
) : isError ? (
<span
class={"word" + index}
key={index}
style={{ position: 'relative', display: 'inline-block' }}
onMouseEnter={() => setHovered(true)}
Expand Down Expand Up @@ -94,7 +92,7 @@ const Word = ({ word, isError, edit, index, onEditChange, errorAction, errorFeed
)}
</span>
) : (
<span class={"word" + index} key={index} style={{ marginRight: '5px' }}>
<span key={index} style={{ marginRight: '5px' }}>
{word}{' '}
</span>
)
Expand Down Expand Up @@ -158,6 +156,14 @@ const GrammarCheck = () => {
const words = text.split(' ')
const sentenceEdits = edits[index] || []
const modifiedSentence = []

// Loop through the sentence edits to adjust the words array with placeholders
sentenceEdits.forEach(edit => {
if (edit.o_start === edit.o_end && edit.o_str === "") {
// Insert an empty string at the insertion index
words.splice(edit.c_start, 0, "");
}
});

let currentEditIndex = 0
let currentWordIndex = 0
Expand Down

0 comments on commit a563e52

Please sign in to comment.