@pie-element/inline-dropdown 3.8.2 → 3.8.3-next.1008
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +149 -0
- package/configure/CHANGELOG.md +125 -0
- package/configure/lib/defaults.js +28 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/lib/inline-dropdown-toolbar.js +26 -8
- package/configure/lib/inline-dropdown-toolbar.js.map +1 -1
- package/configure/lib/main.js +175 -18
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/markupUtils.js +9 -2
- package/configure/lib/markupUtils.js.map +1 -1
- package/configure/lib/utils.js +16 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +27 -0
- package/controller/lib/index.js +39 -6
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +100 -0
- package/docs/config-schema.json.md +77 -1
- package/docs/demo/generate.js +21 -10
- package/docs/pie-schema.json +59 -0
- package/docs/pie-schema.json.md +44 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/inline-dropdown.js +65 -18
- package/lib/inline-dropdown.js.map +1 -1
- package/package.json +6 -6
- package/module/configure.js +0 -1338
- package/module/controller.js +0 -20998
- package/module/demo.js +0 -93
- package/module/element.js +0 -225
- package/module/index.html +0 -16
- package/module/manifest.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,155 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.10.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.10.5...@pie-element/inline-dropdown@3.10.6) (2022-03-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.10.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.10.4...@pie-element/inline-dropdown@3.10.5) (2022-03-22)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.10.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.10.3...@pie-element/inline-dropdown@3.10.4) (2022-03-08)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [3.10.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.10.2...@pie-element/inline-dropdown@3.10.3) (2022-03-08)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [3.10.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.10.1...@pie-element/inline-dropdown@3.10.2) (2022-02-21)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [3.10.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.10.0...@pie-element/inline-dropdown@3.10.1) (2022-02-04)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# [3.10.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.9.9...@pie-element/inline-dropdown@3.10.0) (2022-01-24)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* use preview prompt for prompt, rationale and teacher instructions to fix table rendering PD-1456 ([f330601](https://github.com/pie-framework/pie-elements/commit/f3306019a2d1c8ce3e2783823dfe9ef0a0394e4f))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* **drag-in-the-blank, inline-dropdown:** move rationale after the item content PD-1379 ([fd71c58](https://github.com/pie-framework/pie-elements/commit/fd71c5853bdd63b31a746241dd5649e5de051300))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## [3.9.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.9.8...@pie-element/inline-dropdown@3.9.9) (2022-01-10)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## [3.9.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.9.7...@pie-element/inline-dropdown@3.9.8) (2021-12-23)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## [3.9.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.9.5...@pie-element/inline-dropdown@3.9.6) (2021-12-13)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## [3.9.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.9.2...@pie-element/inline-dropdown@3.9.3) (2021-11-29)
|
|
95
|
+
|
|
96
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## [3.9.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.9.1...@pie-element/inline-dropdown@3.9.2) (2021-10-18)
|
|
103
|
+
|
|
104
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## [3.9.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.9.0...@pie-element/inline-dropdown@3.9.1) (2021-10-04)
|
|
111
|
+
|
|
112
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# [3.9.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.8.4...@pie-element/inline-dropdown@3.9.0) (2021-09-20)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Bug Fixes
|
|
122
|
+
|
|
123
|
+
* pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
|
|
124
|
+
* Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
|
|
125
|
+
* Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
### Features
|
|
129
|
+
|
|
130
|
+
* **inline-dropdown:** add rationale at choice level PD-488 ([1d88366](https://github.com/pie-framework/pie-elements/commit/1d88366f857b90e4ffc5735fe3af78432aa8844c))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## [3.8.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.8.3...@pie-element/inline-dropdown@3.8.4) (2021-09-01)
|
|
137
|
+
|
|
138
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## [3.8.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.8.2...@pie-element/inline-dropdown@3.8.3) (2021-08-05)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Bug Fixes
|
|
148
|
+
|
|
149
|
+
* **inline-dropdown:** add math input when author clicks + without pressing the green checkmark PD-1230 ([7cfdc3f](https://github.com/pie-framework/pie-elements/commit/7cfdc3f6763fe5b56921824aae3a75e0536e7344))
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
6
155
|
## [3.8.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown@3.8.0...@pie-element/inline-dropdown@3.8.2) (2021-08-05)
|
|
7
156
|
|
|
8
157
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,131 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.6.15](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.14...@pie-element/inline-dropdown-configure@3.6.15) (2022-03-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.6.14](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.13...@pie-element/inline-dropdown-configure@3.6.14) (2022-03-22)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.6.13](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.12...@pie-element/inline-dropdown-configure@3.6.13) (2022-03-08)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [3.6.12](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.11...@pie-element/inline-dropdown-configure@3.6.12) (2022-03-08)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [3.6.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.10...@pie-element/inline-dropdown-configure@3.6.11) (2022-02-21)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [3.6.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.9...@pie-element/inline-dropdown-configure@3.6.10) (2022-02-04)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [3.6.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.8...@pie-element/inline-dropdown-configure@3.6.9) (2022-01-24)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## [3.6.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.7...@pie-element/inline-dropdown-configure@3.6.8) (2022-01-10)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## [3.6.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.6...@pie-element/inline-dropdown-configure@3.6.7) (2021-12-23)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## [3.6.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.4...@pie-element/inline-dropdown-configure@3.6.5) (2021-12-13)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## [3.6.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.1...@pie-element/inline-dropdown-configure@3.6.2) (2021-11-29)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## [3.6.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.0...@pie-element/inline-dropdown-configure@3.6.1) (2021-10-04)
|
|
95
|
+
|
|
96
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [3.6.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.5.3...@pie-element/inline-dropdown-configure@3.6.0) (2021-09-20)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Bug Fixes
|
|
106
|
+
|
|
107
|
+
* pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
|
|
108
|
+
* Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
|
|
109
|
+
* Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Features
|
|
113
|
+
|
|
114
|
+
* **inline-dropdown:** add rationale at choice level PD-488 ([1d88366](https://github.com/pie-framework/pie-elements/commit/1d88366f857b90e4ffc5735fe3af78432aa8844c))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## [3.5.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.5.2...@pie-element/inline-dropdown-configure@3.5.3) (2021-08-05)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Bug Fixes
|
|
124
|
+
|
|
125
|
+
* **inline-dropdown:** add math input when author clicks + without pressing the green checkmark PD-1230 ([7cfdc3f](https://github.com/pie-framework/pie-elements/commit/7cfdc3f6763fe5b56921824aae3a75e0536e7344))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
6
131
|
## [3.5.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.5.0...@pie-element/inline-dropdown-configure@3.5.2) (2021-08-05)
|
|
7
132
|
|
|
8
133
|
|
|
@@ -15,14 +15,22 @@ var _default = {
|
|
|
15
15
|
alternateResponse: {},
|
|
16
16
|
promptEnabled: true,
|
|
17
17
|
rationaleEnabled: true,
|
|
18
|
+
choiceRationaleEnabled: true,
|
|
18
19
|
teacherInstructionsEnabled: true,
|
|
19
|
-
studentInstructionsEnabled: true
|
|
20
|
+
studentInstructionsEnabled: true,
|
|
21
|
+
toolbarEditorPosition: 'bottom',
|
|
22
|
+
displayType: 'block'
|
|
20
23
|
},
|
|
21
24
|
configuration: {
|
|
22
25
|
prompt: {
|
|
23
26
|
settings: true,
|
|
24
27
|
label: 'Prompt'
|
|
25
28
|
},
|
|
29
|
+
spellCheck: {
|
|
30
|
+
label: 'Spellcheck',
|
|
31
|
+
settings: false,
|
|
32
|
+
enabled: true
|
|
33
|
+
},
|
|
26
34
|
lockChoiceOrder: {
|
|
27
35
|
settings: true,
|
|
28
36
|
label: 'Lock Choice Order'
|
|
@@ -38,6 +46,25 @@ var _default = {
|
|
|
38
46
|
teacherInstructions: {
|
|
39
47
|
settings: true,
|
|
40
48
|
label: 'Teacher Instructions'
|
|
49
|
+
},
|
|
50
|
+
choiceRationale: {
|
|
51
|
+
settings: true,
|
|
52
|
+
label: 'Choice Rationale'
|
|
53
|
+
},
|
|
54
|
+
toolbarEditorPosition: {
|
|
55
|
+
settings: false,
|
|
56
|
+
label: 'Toolbar Editor Position'
|
|
57
|
+
},
|
|
58
|
+
maxResponseAreas: 10,
|
|
59
|
+
maxImageWidth: {
|
|
60
|
+
teacherInstructions: 300,
|
|
61
|
+
prompt: 300,
|
|
62
|
+
rationale: 300
|
|
63
|
+
},
|
|
64
|
+
maxImageHeight: {
|
|
65
|
+
teacherInstructions: 300,
|
|
66
|
+
prompt: 300,
|
|
67
|
+
rationale: 300
|
|
41
68
|
}
|
|
42
69
|
}
|
|
43
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","disabled","mode","prompt","shuffle","markup","choices","alternateResponse","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","configuration","settings","label","lockChoiceOrder","partialScoring","rationale","teacherInstructions"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,KADL;AAELC,IAAAA,IAAI,EAAE,QAFD;AAGLC,IAAAA,MAAM,EAAE,4CAHH;AAILC,IAAAA,OAAO,EAAE,IAJJ;AAKLC,IAAAA,MAAM,EAAE,EALH;AAMLC,IAAAA,OAAO,EAAE,EANJ;AAOLC,IAAAA,iBAAiB,EAAE,EAPd;AAQLC,IAAAA,aAAa,EAAE,IARV;AASLC,IAAAA,gBAAgB,EAAE,IATb;AAULC,IAAAA,
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","disabled","mode","prompt","shuffle","markup","choices","alternateResponse","promptEnabled","rationaleEnabled","choiceRationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","displayType","configuration","settings","label","spellCheck","enabled","lockChoiceOrder","partialScoring","rationale","teacherInstructions","choiceRationale","maxResponseAreas","maxImageWidth","maxImageHeight"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,KADL;AAELC,IAAAA,IAAI,EAAE,QAFD;AAGLC,IAAAA,MAAM,EAAE,4CAHH;AAILC,IAAAA,OAAO,EAAE,IAJJ;AAKLC,IAAAA,MAAM,EAAE,EALH;AAMLC,IAAAA,OAAO,EAAE,EANJ;AAOLC,IAAAA,iBAAiB,EAAE,EAPd;AAQLC,IAAAA,aAAa,EAAE,IARV;AASLC,IAAAA,gBAAgB,EAAE,IATb;AAULC,IAAAA,sBAAsB,EAAE,IAVnB;AAWLC,IAAAA,0BAA0B,EAAE,IAXvB;AAYLC,IAAAA,0BAA0B,EAAE,IAZvB;AAaLC,IAAAA,qBAAqB,EAAE,QAblB;AAcLC,IAAAA,WAAW,EAAE;AAdR,GADM;AAiBbC,EAAAA,aAAa,EAAE;AACbZ,IAAAA,MAAM,EAAE;AACNa,MAAAA,QAAQ,EAAE,IADJ;AAENC,MAAAA,KAAK,EAAE;AAFD,KADK;AAKbC,IAAAA,UAAU,EAAE;AACVD,MAAAA,KAAK,EAAE,YADG;AAEVD,MAAAA,QAAQ,EAAC,KAFC;AAGVG,MAAAA,OAAO,EAAC;AAHE,KALC;AAUbC,IAAAA,eAAe,EAAE;AACfJ,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KAVJ;AAcbI,IAAAA,cAAc,EAAE;AACdL,MAAAA,QAAQ,EAAE,KADI;AAEdC,MAAAA,KAAK,EAAE;AAFO,KAdH;AAkBbK,IAAAA,SAAS,EAAE;AACTN,MAAAA,QAAQ,EAAE,IADD;AAETC,MAAAA,KAAK,EAAE;AAFE,KAlBE;AAsBbM,IAAAA,mBAAmB,EAAE;AACnBP,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KAtBR;AA0BbO,IAAAA,eAAe,EAAE;AACfR,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KA1BJ;AA8BbJ,IAAAA,qBAAqB,EAAC;AACpBG,MAAAA,QAAQ,EAAE,KADU;AAEpBC,MAAAA,KAAK,EAAE;AAFa,KA9BT;AAkCbQ,IAAAA,gBAAgB,EAAE,EAlCL;AAmCbC,IAAAA,aAAa,EAAE;AACbH,MAAAA,mBAAmB,EAAE,GADR;AAEbpB,MAAAA,MAAM,EAAE,GAFK;AAGbmB,MAAAA,SAAS,EAAE;AAHE,KAnCF;AAwCbK,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEdpB,MAAAA,MAAM,EAAE,GAFM;AAGdmB,MAAAA,SAAS,EAAE;AAHG;AAxCH;AAjBF,C","sourcesContent":["export default {\n model: {\n disabled: false,\n mode: 'gather',\n prompt: 'Use the dropdowns to complete the sentence',\n shuffle: true,\n markup: '',\n choices: {},\n alternateResponse: {},\n promptEnabled: true,\n rationaleEnabled: true,\n choiceRationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n displayType: 'block'\n },\n configuration: {\n prompt: {\n settings: true,\n label: 'Prompt'\n },\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order'\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n choiceRationale: {\n settings: true,\n label: 'Choice Rationale'\n },\n toolbarEditorPosition:{\n settings: false,\n label: 'Toolbar Editor Position'\n },\n maxResponseAreas: 10,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n }\n }\n};\n"],"file":"defaults.js"}
|
package/configure/lib/index.js
CHANGED
|
@@ -39,13 +39,13 @@ var _defaults2 = _interopRequireDefault(require("./defaults"));
|
|
|
39
39
|
|
|
40
40
|
var _markupUtils = require("./markupUtils");
|
|
41
41
|
|
|
42
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
42
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
43
43
|
|
|
44
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
45
45
|
|
|
46
46
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
47
47
|
|
|
48
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
48
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
49
49
|
|
|
50
50
|
var log = (0, _debug["default"])('multiple-choice:configure');
|
|
51
51
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -41,13 +41,17 @@ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
|
41
41
|
|
|
42
42
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
43
43
|
|
|
44
|
-
function
|
|
44
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
45
|
+
|
|
46
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
+
|
|
48
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
45
49
|
|
|
46
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
50
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
51
|
|
|
48
52
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
49
53
|
|
|
50
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
54
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
51
55
|
|
|
52
56
|
var MenuItemComp = /*#__PURE__*/function (_React$Component) {
|
|
53
57
|
(0, _inherits2["default"])(MenuItemComp, _React$Component);
|
|
@@ -176,7 +180,7 @@ var RespAreaToolbar = /*#__PURE__*/function (_React$Component2) {
|
|
|
176
180
|
var _this2$props = _this2.props,
|
|
177
181
|
node = _this2$props.node,
|
|
178
182
|
onAddChoice = _this2$props.onAddChoice;
|
|
179
|
-
var onlyText = createElementFromHTML(val).textContent;
|
|
183
|
+
var onlyText = createElementFromHTML(val).textContent.trim();
|
|
180
184
|
|
|
181
185
|
if (!(0, _isEmpty["default"])(onlyText)) {
|
|
182
186
|
onAddChoice(node.data.get('index'), val);
|
|
@@ -258,6 +262,15 @@ var RespAreaToolbar = /*#__PURE__*/function (_React$Component2) {
|
|
|
258
262
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onClickInside", function () {
|
|
259
263
|
_this2.clickedInside = true;
|
|
260
264
|
});
|
|
265
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "focusInput", function () {
|
|
266
|
+
// we need to focus the input so that math is saved even without pressing the green checkmark
|
|
267
|
+
var slateEditorRef = _this2.editorRef && _this2.editorRef.rootRef && _this2.editorRef.rootRef.slateEditor;
|
|
268
|
+
var inputRef = slateEditorRef && slateEditorRef.editorRef && slateEditorRef.editorRef.element;
|
|
269
|
+
|
|
270
|
+
if (inputRef) {
|
|
271
|
+
inputRef.focus();
|
|
272
|
+
}
|
|
273
|
+
});
|
|
261
274
|
return _this2;
|
|
262
275
|
}
|
|
263
276
|
|
|
@@ -299,7 +312,8 @@ var RespAreaToolbar = /*#__PURE__*/function (_React$Component2) {
|
|
|
299
312
|
|
|
300
313
|
var _this$props2 = this.props,
|
|
301
314
|
classes = _this$props2.classes,
|
|
302
|
-
choices = _this$props2.choices
|
|
315
|
+
choices = _this$props2.choices,
|
|
316
|
+
spellCheck = _this$props2.spellCheck;
|
|
303
317
|
var _this$state = this.state,
|
|
304
318
|
respAreaMarkup = _this$state.respAreaMarkup,
|
|
305
319
|
toolbarStyle = _this$state.toolbarStyle;
|
|
@@ -348,7 +362,8 @@ var RespAreaToolbar = /*#__PURE__*/function (_React$Component2) {
|
|
|
348
362
|
placeholder: "Add Choice",
|
|
349
363
|
activePlugins: filteredDefaultPlugins,
|
|
350
364
|
pluginProps: labelPlugins,
|
|
351
|
-
onBlur: this.onBlur
|
|
365
|
+
onBlur: this.onBlur,
|
|
366
|
+
spellCheck: spellCheck
|
|
352
367
|
}), /*#__PURE__*/_react["default"].createElement("i", {
|
|
353
368
|
style: {
|
|
354
369
|
cursor: 'pointer',
|
|
@@ -361,6 +376,9 @@ var RespAreaToolbar = /*#__PURE__*/function (_React$Component2) {
|
|
|
361
376
|
},
|
|
362
377
|
contentEditable: false,
|
|
363
378
|
onMouseDown: function onMouseDown() {
|
|
379
|
+
return _this3.focusInput();
|
|
380
|
+
},
|
|
381
|
+
onClick: function onClick() {
|
|
364
382
|
return _this3.onAddChoice();
|
|
365
383
|
}
|
|
366
384
|
}, "+")), choices && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/inline-dropdown-toolbar.jsx"],"names":["MenuItemComp","e","onRemoveChoice","props","preventDefault","stopPropagation","classes","correct","onClick","value","wrapper","valueHolder","__html","removeIcon","onRemoveClick","React","Component","PropTypes","object","isRequired","bool","func","string","MenuItem","background","borderBottom","boxSizing","display","cursor","lineHeight","padding","position","fontSize","fontStyle","transform","top","right","zIndex","wordBreak","findSlateNode","key","window","document","querySelector","createElementFromHTML","htmlString","div","createElement","innerHTML","trim","RespAreaToolbar","respAreaMarkup","setState","editorRef","finishEditing","val","node","onAddChoice","onlyText","textContent","data","get","newValue","index","onToolbarDone","onSelectChoice","update","toJSON","change","setNodeByKey","nextText","getNextText","moveFocusTo","moveAnchorTo","event","clickedInside","choices","onCheck","correctResponse","find","choice","length","removeNodeByKey","domNode","domNodeRect","getBoundingClientRect","editor","closest","editorRect","left","toolbarStyle","height","width","ReactDOM","findDOMNode","state","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","labelPlugins","audio","disabled","video","backgroundColor","onClickInside","itemBuilder","ref","respArea","alwaysVisible","showDone","doneOn","onKeyDown","onRespAreaChange","onDone","onBlur","choicesHolder","map","label","array","shape","StyledRespAreaToolbar","minHeight","flexDirection","border"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAGMA,Y;;;;;;;;;;;;;;;sGASY,UAAAC,CAAC,EAAI;AAAA,UACXC,cADW,GACQ,MAAKC,KADb,CACXD,cADW;AAGnBD,MAAAA,CAAC,CAACG,cAAF;AACAH,MAAAA,CAAC,CAACI,eAAF;AAEAH,MAAAA,cAAc;AACf,K;;;;;;WAED,kBAAS;AAAA,wBACsC,KAAKC,KAD3C;AAAA,UACCG,OADD,eACCA,OADD;AAAA,UACUC,OADV,eACUA,OADV;AAAA,UACmBC,OADnB,eACmBA,OADnB;AAAA,UAC4BC,KAD5B,eAC4BA,KAD5B;AAGP,0BACE;AAAK,QAAA,SAAS,EAAE,6BAAWH,OAAO,CAACI,OAAnB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AV,CAAeF,UAPd;AAQjB6C,EAAAA,aAAa,EAAE/C,sBAAUI,IAAV,CAAeF,UARb;AASjBV,EAAAA,KAAK,EAAEQ,sBAAUuG,KAAV,CAAgB;AACrBpD,IAAAA,MAAM,EAAEnD,sBAAUI,IAAV,CAAeF,UADF;AAErBuB,IAAAA,QAAQ,EAAEzB,sBAAUuG,KAAV,CAAgB;AACxBjD,MAAAA,WAAW,EAAEtD,sBAAUI,IAAV,CAAeF;AADJ,KAAhB;AAFW,GAAhB;AATU,C;AAmNrB,IAAMsG,qBAAqB,GAAG,wBAAW;AACvCb,EAAAA,QAAQ,EAAE;AACRJ,IAAAA,eAAe,EAAE,MADT;AAER,oCAAgC;AAC9BkB,MAAAA,SAAS,EAAE;AADmB;AAFxB,GAD6B;AAOvCN,EAAAA,aAAa,EAAE;AACbzF,IAAAA,OAAO,EAAE,MADI;AAEbgG,IAAAA,aAAa,EAAE,QAFF;AAGb,0BAAsB;AACpBC,MAAAA,MAAM,EAAE;AADY;AAHT,GAPwB;AAcvClB,EAAAA,WAAW,EAAE;AACX5E,IAAAA,OAAO,EAAE,KADE;AAEXC,IAAAA,QAAQ,EAAE;AAFC;AAd0B,CAAX,EAkB3BmB,eAlB2B,CAA9B;eAoBeuE,qB","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { withStyles } from '@material-ui/core/styles';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport classnames from 'classnames';\nimport { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\n\nclass MenuItemComp extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correct: PropTypes.bool.isRequired,\n onClick: PropTypes.func.isRequired,\n onRemoveChoice: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired\n };\n\n onRemoveClick = e => {\n const { onRemoveChoice } = this.props;\n\n e.preventDefault();\n e.stopPropagation();\n\n onRemoveChoice();\n };\n\n render() {\n const { classes, correct, onClick, value } = this.props;\n\n return (\n <div className={classnames(classes.wrapper, { [classes.correct]: correct })} onClick={onClick}>\n <div\n className={classes.valueHolder}\n dangerouslySetInnerHTML={{\n __html: value\n }}\n />\n <i className={classes.removeIcon} onClick={this.onRemoveClick}>\n x\n </i>\n </div>\n );\n }\n}\n\nconst MenuItem = withStyles({\n wrapper: {\n background: '#fff',\n borderBottom: '1px solid black',\n boxSizing: 'border-box',\n display: 'block',\n cursor: 'pointer',\n lineHeight: '30px',\n padding: '10px 25px 10px 10px',\n position: 'relative'\n },\n correct: {\n background: '#C4DCFA'\n },\n removeIcon: {\n cursor: 'pointer',\n fontSize: '20px',\n fontStyle: 'normal',\n position: 'absolute',\n transform: 'translate(0, -50%)',\n top: '50%',\n right: '5px',\n zIndex: 3\n },\n valueHolder: {\n wordBreak: 'break-all'\n }\n})(MenuItemComp);\n\nconst findSlateNode = key => {\n return window.document.querySelector('[data-key=\"' + key + '\"]');\n};\n\nconst createElementFromHTML = htmlString => {\n const div = document.createElement('div');\n\n div.innerHTML = (htmlString || '').trim();\n\n return div;\n};\n\nexport class RespAreaToolbar extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n node: PropTypes.object,\n onDone: PropTypes.func,\n choices: PropTypes.array,\n onAddChoice: PropTypes.func.isRequired,\n onRemoveChoice: PropTypes.func.isRequired,\n onSelectChoice: PropTypes.func.isRequired,\n onToolbarDone: PropTypes.func.isRequired,\n value: PropTypes.shape({\n change: PropTypes.func.isRequired,\n document: PropTypes.shape({\n getNextText: PropTypes.func.isRequired\n })\n })\n };\n\n state = {\n respAreaMarkup: ''\n };\n\n componentDidMount() {\n const { node } = this.props;\n\n const domNode = findSlateNode(node.key);\n\n if (domNode) {\n //eslint-disable-next-line\n const domNodeRect = domNode.getBoundingClientRect();\n const editor = domNode.closest('[data-slate-editor]');\n const editorRect = editor.getBoundingClientRect();\n const top = domNodeRect.top - editorRect.top;\n const left = domNodeRect.left - editorRect.left;\n\n this.setState({\n toolbarStyle: {\n position: 'absolute',\n top: `${top + domNodeRect.height + 60}px`,\n left: `${left + 25}px`,\n width: domNodeRect.width\n }\n });\n }\n }\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n onRespAreaChange = respAreaMarkup => {\n this.setState({ respAreaMarkup });\n };\n\n onAddChoice = () => {\n if (this.editorRef) {\n this.editorRef.finishEditing();\n }\n };\n\n onDone = (val) => {\n const { node, onAddChoice } = this.props;\n const onlyText = createElementFromHTML(val).textContent;\n\n if (!isEmpty(onlyText)) {\n onAddChoice(node.data.get('index'), val);\n }\n };\n\n onSelectChoice = (newValue, index) => {\n const { node, value, onToolbarDone, onSelectChoice } = this.props;\n const update = { ...node.data.toJSON(), value: newValue };\n const change = value.change().setNodeByKey(node.key, { data: update });\n\n const nextText = value.document.getNextText(node.key);\n\n change.moveFocusTo(nextText.key, 0).moveAnchorTo(nextText.key, 0);\n\n onToolbarDone(change, false);\n\n onSelectChoice(index);\n };\n\n onRemoveChoice = (val, index) => {\n const { node, value, onToolbarDone, onRemoveChoice } = this.props;\n\n if (isEqual(val, node.data.get('value'))) {\n const update = { ...node.data.toJSON(), value: null };\n const change = value.change().setNodeByKey(node.key, { data: update });\n\n onToolbarDone(change, false);\n }\n\n onRemoveChoice(index);\n };\n\n onKeyDown = event => {\n if (event.key === 'Enter') {\n this.onAddChoice();\n // Cancelling event\n return false;\n }\n };\n\n onBlur = () => {\n if (this.clickedInside) {\n this.clickedInside = false;\n return;\n }\n\n const { node, choices, onCheck, onToolbarDone, value } = this.props;\n const correctResponse = (choices || []).find(choice => choice.correct);\n\n this.onAddChoice();\n if (!choices || (choices && choices.length < 2) || !correctResponse) {\n onCheck(() => {\n const change = value.change();\n\n change.removeNodeByKey(node.get('key'));\n onToolbarDone(change, false);\n });\n }\n };\n\n onClickInside = () => {\n this.clickedInside = true;\n };\n\n render() {\n const { classes, choices } = this.props;\n const { respAreaMarkup, toolbarStyle } = this.state;\n\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(p => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list');\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true }\n };\n\n if (!toolbarStyle) {\n return null;\n }\n\n return (\n <div\n style={{\n ...toolbarStyle,\n backgroundColor: '#E0E1E6'\n }}\n onMouseDown={this.onClickInside}\n >\n <div className={classes.itemBuilder}>\n <EditableHtml\n ref={ref => {\n if (ref) {\n this.editorRef = ref;\n }\n }}\n autoFocus={true}\n autoSave\n className={classes.respArea}\n toolbarOpts={{\n position: 'top',\n alwaysVisible: false,\n showDone: false,\n doneOn: 'blur'\n }}\n markup={respAreaMarkup}\n onKeyDown={this.onKeyDown}\n onChange={this.onRespAreaChange}\n onDone={this.onDone}\n placeholder=\"Add Choice\"\n activePlugins={filteredDefaultPlugins}\n pluginProps={labelPlugins}\n onBlur={this.onBlur}\n />\n <i\n style={{\n cursor: 'pointer',\n fontSize: '20px',\n fontStyle: 'normal',\n position: 'absolute',\n top: '50%',\n right: '15px',\n transform: 'translate(0, -50%)'\n }}\n contentEditable={false}\n onMouseDown={() => this.onAddChoice()}\n >\n +\n </i>\n </div>\n {choices && (\n <div className={classes.choicesHolder}>\n {choices.map(({ label, correct }, index) => (\n <MenuItem\n key={index}\n onClick={() => this.onSelectChoice(label, index)}\n onRemoveChoice={() => this.onRemoveChoice(label, index)}\n value={label}\n correct={correct}\n />\n ))}\n </div>\n )}\n </div>\n );\n }\n}\n\nconst StyledRespAreaToolbar = withStyles({\n respArea: {\n backgroundColor: '#fff',\n '& [data-slate-editor=\"true\"]': {\n minHeight: 'initial !important'\n }\n },\n choicesHolder: {\n display: 'flex',\n flexDirection: 'column',\n '& > div:last-child': {\n border: 'none'\n }\n },\n itemBuilder: {\n padding: '8px',\n position: 'relative'\n }\n})(RespAreaToolbar);\n\nexport default StyledRespAreaToolbar;\n"],"file":"inline-dropdown-toolbar.js"}
|
|
1
|
+
{"version":3,"sources":["../src/inline-dropdown-toolbar.jsx"],"names":["MenuItemComp","e","onRemoveChoice","props","preventDefault","stopPropagation","classes","correct","onClick","value","wrapper","valueHolder","__html","removeIcon","onRemoveClick","React","Component","PropTypes","object","isRequired","bool","func","string","MenuItem","background","borderBottom","boxSizing","display","cursor","lineHeight","padding","position","fontSize","fontStyle","transform","top","right","zIndex","wordBreak","findSlateNode","key","window","document","querySelector","createElementFromHTML","htmlString","div","createElement","innerHTML","trim","RespAreaToolbar","respAreaMarkup","setState","editorRef","finishEditing","val","node","onAddChoice","onlyText","textContent","data","get","newValue","index","onToolbarDone","onSelectChoice","update","toJSON","change","setNodeByKey","nextText","getNextText","moveFocusTo","moveAnchorTo","event","clickedInside","choices","onCheck","correctResponse","find","choice","length","removeNodeByKey","slateEditorRef","rootRef","slateEditor","inputRef","element","focus","domNode","domNodeRect","getBoundingClientRect","editor","closest","editorRect","left","toolbarStyle","height","width","ReactDOM","findDOMNode","spellCheck","state","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","labelPlugins","audio","disabled","video","backgroundColor","onClickInside","itemBuilder","ref","respArea","alwaysVisible","showDone","doneOn","onKeyDown","onRespAreaChange","onDone","onBlur","focusInput","choicesHolder","map","label","array","shape","StyledRespAreaToolbar","minHeight","flexDirection","border"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;IAGMA,Y;;;;;;;;;;;;;;;sGASY,UAAAC,CAAC,EAAI;AACnB,UAAQC,cAAR,GAA2B,MAAKC,KAAhC,CAAQD,cAAR;AAEAD,MAAAA,CAAC,CAACG,cAAF;AACAH,MAAAA,CAAC,CAACI,eAAF;AAEAH,MAAAA,cAAc;AACf,K;;;;;;WAED,kBAAS;AACP,wBAA6C,KAAKC,KAAlD;AAAA,UAAQG,OAAR,eAAQA,OAAR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N,EAAAA,aAAa,EAAE;AACbjG,IAAAA,OAAO,EAAE,MADI;AAEbwG,IAAAA,aAAa,EAAE,QAFF;AAGb,0BAAsB;AACpBC,MAAAA,MAAM,EAAE;AADY;AAHT,GAPwB;AAcvCnB,EAAAA,WAAW,EAAE;AACXnF,IAAAA,OAAO,EAAE,KADE;AAEXC,IAAAA,QAAQ,EAAE;AAFC;AAd0B,CAAX,EAkB3BmB,eAlB2B,CAA9B;eAoBe+E,qB","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { withStyles } from '@material-ui/core/styles';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport classnames from 'classnames';\nimport { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\n\nclass MenuItemComp extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correct: PropTypes.bool.isRequired,\n onClick: PropTypes.func.isRequired,\n onRemoveChoice: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired\n };\n\n onRemoveClick = e => {\n const { onRemoveChoice } = this.props;\n\n e.preventDefault();\n e.stopPropagation();\n\n onRemoveChoice();\n };\n\n render() {\n const { classes, correct, onClick, value } = this.props;\n\n return (\n <div className={classnames(classes.wrapper, { [classes.correct]: correct })} onClick={onClick}>\n <div\n className={classes.valueHolder}\n dangerouslySetInnerHTML={{\n __html: value\n }}\n />\n <i className={classes.removeIcon} onClick={this.onRemoveClick}>\n x\n </i>\n </div>\n );\n }\n}\n\nconst MenuItem = withStyles({\n wrapper: {\n background: '#fff',\n borderBottom: '1px solid black',\n boxSizing: 'border-box',\n display: 'block',\n cursor: 'pointer',\n lineHeight: '30px',\n padding: '10px 25px 10px 10px',\n position: 'relative'\n },\n correct: {\n background: '#C4DCFA'\n },\n removeIcon: {\n cursor: 'pointer',\n fontSize: '20px',\n fontStyle: 'normal',\n position: 'absolute',\n transform: 'translate(0, -50%)',\n top: '50%',\n right: '5px',\n zIndex: 3\n },\n valueHolder: {\n wordBreak: 'break-all'\n }\n})(MenuItemComp);\n\nconst findSlateNode = key => {\n return window.document.querySelector('[data-key=\"' + key + '\"]');\n};\n\nconst createElementFromHTML = htmlString => {\n const div = document.createElement('div');\n\n div.innerHTML = (htmlString || '').trim();\n\n return div;\n};\n\nexport class RespAreaToolbar extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n node: PropTypes.object,\n onDone: PropTypes.func,\n choices: PropTypes.array,\n onAddChoice: PropTypes.func.isRequired,\n onRemoveChoice: PropTypes.func.isRequired,\n onSelectChoice: PropTypes.func.isRequired,\n onToolbarDone: PropTypes.func.isRequired,\n value: PropTypes.shape({\n change: PropTypes.func.isRequired,\n document: PropTypes.shape({\n getNextText: PropTypes.func.isRequired\n })\n })\n };\n\n state = {\n respAreaMarkup: ''\n };\n\n componentDidMount() {\n const { node } = this.props;\n\n const domNode = findSlateNode(node.key);\n\n if (domNode) {\n //eslint-disable-next-line\n const domNodeRect = domNode.getBoundingClientRect();\n const editor = domNode.closest('[data-slate-editor]');\n const editorRect = editor.getBoundingClientRect();\n const top = domNodeRect.top - editorRect.top;\n const left = domNodeRect.left - editorRect.left;\n\n this.setState({\n toolbarStyle: {\n position: 'absolute',\n top: `${top + domNodeRect.height + 60}px`,\n left: `${left + 25}px`,\n width: domNodeRect.width\n }\n });\n }\n }\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n onRespAreaChange = respAreaMarkup => {\n this.setState({ respAreaMarkup });\n };\n\n onAddChoice = () => {\n if (this.editorRef) {\n this.editorRef.finishEditing();\n }\n };\n\n onDone = (val) => {\n const { node, onAddChoice } = this.props;\n const onlyText = createElementFromHTML(val).textContent.trim();\n\n if (!isEmpty(onlyText)) {\n onAddChoice(node.data.get('index'), val);\n }\n };\n\n onSelectChoice = (newValue, index) => {\n const { node, value, onToolbarDone, onSelectChoice } = this.props;\n const update = { ...node.data.toJSON(), value: newValue };\n const change = value.change().setNodeByKey(node.key, { data: update });\n\n const nextText = value.document.getNextText(node.key);\n\n change.moveFocusTo(nextText.key, 0).moveAnchorTo(nextText.key, 0);\n\n onToolbarDone(change, false);\n\n onSelectChoice(index);\n };\n\n onRemoveChoice = (val, index) => {\n const { node, value, onToolbarDone, onRemoveChoice } = this.props;\n\n if (isEqual(val, node.data.get('value'))) {\n const update = { ...node.data.toJSON(), value: null };\n const change = value.change().setNodeByKey(node.key, { data: update });\n\n onToolbarDone(change, false);\n }\n\n onRemoveChoice(index);\n };\n\n onKeyDown = event => {\n if (event.key === 'Enter') {\n this.onAddChoice();\n // Cancelling event\n return false;\n }\n };\n\n onBlur = () => {\n if (this.clickedInside) {\n this.clickedInside = false;\n return;\n }\n\n const { node, choices, onCheck, onToolbarDone, value } = this.props;\n const correctResponse = (choices || []).find(choice => choice.correct);\n\n this.onAddChoice();\n if (!choices || (choices && choices.length < 2) || !correctResponse) {\n onCheck(() => {\n const change = value.change();\n\n change.removeNodeByKey(node.get('key'));\n onToolbarDone(change, false);\n });\n }\n };\n\n onClickInside = () => {\n this.clickedInside = true;\n };\n\n focusInput = () => {\n // we need to focus the input so that math is saved even without pressing the green checkmark\n const slateEditorRef = this.editorRef && this.editorRef.rootRef && this.editorRef.rootRef.slateEditor;\n const inputRef = slateEditorRef && slateEditorRef.editorRef && slateEditorRef.editorRef.element;\n\n if (inputRef) {\n inputRef.focus();\n }\n };\n\n render() {\n const { classes, choices, spellCheck } = this.props;\n const { respAreaMarkup, toolbarStyle } = this.state;\n\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(p => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list');\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true }\n };\n\n if (!toolbarStyle) {\n return null;\n }\n\n return (\n <div\n style={{\n ...toolbarStyle,\n backgroundColor: '#E0E1E6'\n }}\n onMouseDown={this.onClickInside}\n >\n <div className={classes.itemBuilder}>\n <EditableHtml\n ref={ref => {\n if (ref) {\n this.editorRef = ref;\n }\n }}\n autoFocus={true}\n autoSave\n className={classes.respArea}\n toolbarOpts={{\n position: 'top',\n alwaysVisible: false,\n showDone: false,\n doneOn: 'blur'\n }}\n markup={respAreaMarkup}\n onKeyDown={this.onKeyDown}\n onChange={this.onRespAreaChange}\n onDone={this.onDone}\n placeholder=\"Add Choice\"\n activePlugins={filteredDefaultPlugins}\n pluginProps={labelPlugins}\n onBlur={this.onBlur}\n spellCheck={spellCheck}\n />\n <i\n style={{\n cursor: 'pointer',\n fontSize: '20px',\n fontStyle: 'normal',\n position: 'absolute',\n top: '50%',\n right: '15px',\n transform: 'translate(0, -50%)'\n }}\n contentEditable={false}\n onMouseDown={() => this.focusInput()}\n onClick={() => this.onAddChoice()}\n >\n +\n </i>\n </div>\n {choices && (\n <div className={classes.choicesHolder}>\n {choices.map(({ label, correct }, index) => (\n <MenuItem\n key={index}\n onClick={() => this.onSelectChoice(label, index)}\n onRemoveChoice={() => this.onRemoveChoice(label, index)}\n value={label}\n correct={correct}\n />\n ))}\n </div>\n )}\n </div>\n );\n }\n}\n\nconst StyledRespAreaToolbar = withStyles({\n respArea: {\n backgroundColor: '#fff',\n '& [data-slate-editor=\"true\"]': {\n minHeight: 'initial !important'\n }\n },\n choicesHolder: {\n display: 'flex',\n flexDirection: 'column',\n '& > div:last-child': {\n border: 'none'\n }\n },\n itemBuilder: {\n padding: '8px',\n position: 'relative'\n }\n})(RespAreaToolbar);\n\nexport default StyledRespAreaToolbar;\n"],"file":"inline-dropdown-toolbar.js"}
|