Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax-prosemirror
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wax
wax-prosemirror
Commits
44429d74
Commit
44429d74
authored
1 year ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
show error/correct answer
parent
bdd58841
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-services/src/FillTheGapQuestionService/components/EditorComponent.js
+11
-1
11 additions, 1 deletion
...c/FillTheGapQuestionService/components/EditorComponent.js
with
11 additions
and
1 deletion
wax-prosemirror-services/src/FillTheGapQuestionService/components/EditorComponent.js
+
11
−
1
View file @
44429d74
...
@@ -45,6 +45,7 @@ const EditorWrapper = styled.span`
...
@@ -45,6 +45,7 @@ const EditorWrapper = styled.span`
const
StudentAnswer
=
styled
.
span
`
const
StudentAnswer
=
styled
.
span
`
border-bottom: 1px solid black;
border-bottom: 1px solid black;
margin-right: 5px;
margin-right: 5px;
color:
${
props
=>
(
props
.
isCorrect
?
'
#008000
'
:
'
red
'
)}
;
`
;
`
;
const
CorrectAnswers
=
styled
.
span
`
const
CorrectAnswers
=
styled
.
span
`
...
@@ -168,6 +169,15 @@ const EditorComponent = ({ node, view, getPos }) => {
...
@@ -168,6 +169,15 @@ const EditorComponent = ({ node, view, getPos }) => {
}
}
};
};
let
isCorrect
=
false
;
if
(
node
.
textContent
.
split
(
'
;
'
)
.
find
(
element
=>
element
===
node
.
attrs
.
answer
.
trim
())
)
{
isCorrect
=
true
;
}
return
(
return
(
(
isEditable
&&
!
testMode
&&
!
showFeedBack
&&
(
(
isEditable
&&
!
testMode
&&
!
showFeedBack
&&
(
<
EditorWrapper
>
<
EditorWrapper
>
...
@@ -181,7 +191,7 @@ const EditorComponent = ({ node, view, getPos }) => {
...
@@ -181,7 +191,7 @@ const EditorComponent = ({ node, view, getPos }) => {
))
||
))
||
(
showFeedBack
&&
!
testMode
&&
(
(
showFeedBack
&&
!
testMode
&&
(
<>
<>
<
StudentAnswer
>
{
node
.
attrs
.
answer
}
<
/StudentAnswer
>
<
StudentAnswer
isCorrect
=
{
isCorrect
}
>
{
node
.
attrs
.
answer
}
<
/StudentAnswer
>
<
CorrectAnswers
>
{
`(Aceepted Answers :
${
node
.
textContent
.
replaceAll
(
'
;
'
,
'
-
'
)}
)`
}
<
/CorrectAnswers
>
<
CorrectAnswers
>
{
`(Aceepted Answers :
${
node
.
textContent
.
replaceAll
(
'
;
'
,
'
-
'
)}
)`
}
<
/CorrectAnswers
>
<
/
>
<
/
>
))
||
<
InputComponent
getPos
=
{
getPos
}
node
=
{
node
}
view
=
{
view
}
/
>
))
||
<
InputComponent
getPos
=
{
getPos
}
node
=
{
node
}
view
=
{
view
}
/
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment