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
8926bf27
Commit
8926bf27
authored
2 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
container tool
parent
77f8fd16
No related branches found
No related tags found
1 merge request
!396
add inputs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-services/src/MultipleDropDownService/MultipleDropDownQuestion.js
+36
-2
36 additions, 2 deletions
...s/src/MultipleDropDownService/MultipleDropDownQuestion.js
with
36 additions
and
2 deletions
wax-prosemirror-services/src/MultipleDropDownService/MultipleDropDownQuestion.js
+
36
−
2
View file @
8926bf27
import
{
injectable
}
from
'
inversify
'
;
import
{
findWrapping
}
from
'
prosemirror-transform
'
;
import
{
v4
as
uuidv4
}
from
'
uuid
'
;
import
Tools
from
'
../lib/Tools
'
;
import
helpers
from
'
../MultipleChoiceQuestionService/helpers/helpers
'
;
@
injectable
()
class
FillTheGapQuestion
extends
Tools
{
...
...
@@ -8,14 +11,45 @@ class FillTheGapQuestion extends Tools {
name
=
'
Multiple Drop Down
'
;
get
run
()
{
return
(
state
,
dispatch
,
view
)
=>
{};
return
(
state
,
dispatch
,
view
)
=>
{
helpers
.
checkifEmpty
(
view
);
const
{
$from
,
$to
}
=
view
.
state
.
selection
;
const
range
=
$from
.
blockRange
(
$to
);
const
{
tr
}
=
view
.
state
;
const
wrapping
=
range
&&
findWrapping
(
range
,
state
.
config
.
schema
.
nodes
.
multiple_drop_down_container
,
{
id
:
uuidv4
(),
},
);
if
(
!
wrapping
)
return
false
;
tr
.
wrap
(
range
,
wrapping
);
dispatch
(
tr
);
};
}
get
active
()
{
return
state
=>
{};
}
select
=
(
state
,
activeViewId
,
activeView
)
=>
{};
select
=
(
state
,
activeViewId
,
activeView
)
=>
{
const
{
disallowedTools
}
=
activeView
.
props
;
let
status
=
true
;
const
{
from
,
to
}
=
state
.
selection
;
if
(
from
===
null
||
disallowedTools
.
includes
(
'
MultipleDropDown
'
))
return
false
;
state
.
doc
.
nodesBetween
(
from
,
to
,
(
node
,
pos
)
=>
{
if
(
node
.
type
.
groups
.
includes
(
'
questions
'
))
{
status
=
false
;
}
});
return
status
;
};
get
enable
()
{
return
state
=>
{};
...
...
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