@pie-element/inline-dropdown 3.9.9 → 3.10.1-beta.1443
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 +371 -0
- package/configure/CHANGELOG.md +336 -0
- package/configure/lib/defaults.js +24 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/inline-dropdown-toolbar.js +9 -4
- package/configure/lib/inline-dropdown-toolbar.js.map +1 -1
- package/configure/lib/main.js +219 -124
- 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 +17 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +5 -5
- package/controller/CHANGELOG.md +74 -0
- package/controller/lib/index.js +32 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/config-schema.json +110 -0
- package/docs/config-schema.json.md +85 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +19 -18
- package/docs/pie-schema.json +39 -0
- package/docs/pie-schema.json.md +28 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/inline-dropdown.js +7 -2
- package/lib/inline-dropdown.js.map +1 -1
- package/package.json +6 -6
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,342 @@
|
|
|
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
|
+
# [4.5.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.4.0...@pie-element/inline-dropdown-configure@4.5.0) (2023-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update pie-libs ([6423903](https://github.com/pie-framework/pie-elements/commit/6423903898b041f56db2111de2e4aac4ee9f1fd3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [4.4.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.3.6...@pie-element/inline-dropdown-configure@4.4.0) (2023-01-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* update pie-libs ([b174476](https://github.com/pie-framework/pie-elements/commit/b174476729119a0689f1f8adfc8c235246676cab))
|
|
23
|
+
* update pie-libs ([f72c3c8](https://github.com/pie-framework/pie-elements/commit/f72c3c8d8bc9bbf061bb81502317157a63c22972))
|
|
24
|
+
* update pie-libs ([8490729](https://github.com/pie-framework/pie-elements/commit/8490729a2389d36fd3968f0806119fde96577842))
|
|
25
|
+
* **inline-dropdown:** added configuration prop to hide the settings panel PD-1999 + replaced the warning message component ([3ea0366](https://github.com/pie-framework/pie-elements/commit/3ea0366e2149f59aaa592f2c35a776bf145e7a32))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [4.3.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.3.5...@pie-element/inline-dropdown-configure@4.3.6) (2022-12-21)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* updated pie-libs ([8cb5b90](https://github.com/pie-framework/pie-elements/commit/8cb5b90d501ccbdf5ffd764e6555faa48b8f54d6))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [4.3.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.3.4...@pie-element/inline-dropdown-configure@4.3.5) (2022-12-20)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* updated pie-libs ([6549302](https://github.com/pie-framework/pie-elements/commit/65493026fbf356c5ab752ae6a14d961d4b256368))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [4.3.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.3.3...@pie-element/inline-dropdown-configure@4.3.4) (2022-12-07)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* update libs ([441f403](https://github.com/pie-framework/pie-elements/commit/441f403870b7bec0d61fab58b8d93dbe0ead4c32))
|
|
59
|
+
* update libs for PD-2030 PD-2031 ([3174022](https://github.com/pie-framework/pie-elements/commit/3174022d45603ed217bbe8804a142b07084636a5))
|
|
60
|
+
* updated lib PD-1715 ([42e788d](https://github.com/pie-framework/pie-elements/commit/42e788db0c792838994e55001952da7701251a8e))
|
|
61
|
+
* updated libs ([c20de3a](https://github.com/pie-framework/pie-elements/commit/c20de3a6ba4499a090c809e18e52588d2a585fa0))
|
|
62
|
+
* updated libs ([0eed79a](https://github.com/pie-framework/pie-elements/commit/0eed79a32c3b777c16c8cabf201513fc1d2726a0))
|
|
63
|
+
* updated libs ([343c9ec](https://github.com/pie-framework/pie-elements/commit/343c9ec3dccba7f781e90ae2bd195cac6f78f467))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## [4.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.3.2...@pie-element/inline-dropdown-configure@4.3.3) (2022-11-15)
|
|
70
|
+
|
|
71
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## [4.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.3.1...@pie-element/inline-dropdown-configure@4.3.2) (2022-11-11)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Bug Fixes
|
|
81
|
+
|
|
82
|
+
* **inline-dropdown:** add sanity checks for withRubric ([25e5403](https://github.com/pie-framework/pie-elements/commit/25e540323dd33c43f67e2f8ade736a4fc98c96f2))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## [4.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.3.0...@pie-element/inline-dropdown-configure@4.3.1) (2022-10-31)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* **inline-dropdown:** fix count in choice rationale PD-2056 ([37bebe1](https://github.com/pie-framework/pie-elements/commit/37bebe168eb4ee4f1f7aad4330e548344d46f308))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# [4.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.2.5...@pie-element/inline-dropdown-configure@4.3.0) (2022-10-17)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
### Bug Fixes
|
|
103
|
+
|
|
104
|
+
* update snapshots ([9781596](https://github.com/pie-framework/pie-elements/commit/978159686bbbd6b727dff4b88ce4ab9606504586))
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
### Features
|
|
108
|
+
|
|
109
|
+
* enable spanish and special characters in author PD-2120 ([85fd3dd](https://github.com/pie-framework/pie-elements/commit/85fd3dd0fc10da1a2dfd5a842809c625790f8ba9))
|
|
110
|
+
* set withRubric to false in item default configurations. Set rubricEnabled to true if it's enabled for drawing-response and extended-text-entry ([a209057](https://github.com/pie-framework/pie-elements/commit/a209057f5a3fa5438efc8595453c89c11959a8f5))
|
|
111
|
+
* update libs ([7e174fb](https://github.com/pie-framework/pie-elements/commit/7e174fba75e7ea668900ad5c103751cefe33e2af))
|
|
112
|
+
* **inline-dropdown:** add pie-api config PD-23 ([456c14a](https://github.com/pie-framework/pie-elements/commit/456c14aa3b5e0c2769d957b072a32c3298b9cb11))
|
|
113
|
+
* **inline-dropdown:** add settings to enable rubric. Add withRubric prop to configuration and rubricEnabled prop to model PD-2092 ([1e3b2e6](https://github.com/pie-framework/pie-elements/commit/1e3b2e6348a76264145c118bdee709f8e61f189e))
|
|
114
|
+
* **inline-dropdown:** updated snapshot PD-2092 ([672a168](https://github.com/pie-framework/pie-elements/commit/672a16869c1c2ffbd7fced12b513de38f4d61669))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## [4.2.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.2.4...@pie-element/inline-dropdown-configure@4.2.5) (2022-09-29)
|
|
121
|
+
|
|
122
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## [4.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.2.3...@pie-element/inline-dropdown-configure@4.2.4) (2022-09-14)
|
|
129
|
+
|
|
130
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## [4.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.2.2...@pie-element/inline-dropdown-configure@4.2.3) (2022-08-31)
|
|
137
|
+
|
|
138
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## [4.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.2.1...@pie-element/inline-dropdown-configure@4.2.2) (2022-08-16)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Bug Fixes
|
|
148
|
+
|
|
149
|
+
* **inline-dropdown:** update validation message ([a87ae23](https://github.com/pie-framework/pie-elements/commit/a87ae2369f438e4fd6902680c2a1fb4b3ef8ef3a))
|
|
150
|
+
* **inline-dropdown:** update validation message ([99afc72](https://github.com/pie-framework/pie-elements/commit/99afc7208b5d9db307d6a0174c3945ddb77baaca))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
## [4.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.2.0...@pie-element/inline-dropdown-configure@4.2.1) (2022-08-08)
|
|
157
|
+
|
|
158
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# [4.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.1.3...@pie-element/inline-dropdown-configure@4.2.0) (2022-08-02)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Features
|
|
168
|
+
|
|
169
|
+
* PD-1896 remove unused import and console log ([de1090e](https://github.com/pie-framework/pie-elements/commit/de1090e3ee64b70a1120066b2281bb7c66837df3))
|
|
170
|
+
* **inline-dropdown:** add missing configurable validation. Added maxResponseAreaChoices property to configuration ([5cfff17](https://github.com/pie-framework/pie-elements/commit/5cfff17c5df2c149c1b6e29a4109f3ff6b850110))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
## [4.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.1.2...@pie-element/inline-dropdown-configure@4.1.3) (2022-07-22)
|
|
177
|
+
|
|
178
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
## [4.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.1.1...@pie-element/inline-dropdown-configure@4.1.2) (2022-07-20)
|
|
185
|
+
|
|
186
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
## [4.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.1.0...@pie-element/inline-dropdown-configure@4.1.1) (2022-07-19)
|
|
193
|
+
|
|
194
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
# [4.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@4.0.0...@pie-element/inline-dropdown-configure@4.1.0) (2022-06-28)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
### Features
|
|
204
|
+
|
|
205
|
+
* **inline-dropdown:** add maxImageWidth and maxImageHeight props PD-1801 ([a2ad5d5](https://github.com/pie-framework/pie-elements/commit/a2ad5d5298e5696541f45ab8ca9e5675f5bb1a57))
|
|
206
|
+
* **inline-dropdown, drag-in-the-blank, explicit-constructed-response:** set config default for maxRespponseAreas ([a9e9dc5](https://github.com/pie-framework/pie-elements/commit/a9e9dc5ff43199c946f4226790d924ab5d8674ed))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.7.4...@pie-element/inline-dropdown-configure@4.0.0) (2022-06-28)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
### chore
|
|
216
|
+
|
|
217
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### BREAKING CHANGES
|
|
221
|
+
|
|
222
|
+
* Image percent buttons were removed from toolbar.
|
|
223
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
## [3.7.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.7.3...@pie-element/inline-dropdown-configure@3.7.4) (2022-06-13)
|
|
230
|
+
|
|
231
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
## [3.7.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.7.2...@pie-element/inline-dropdown-configure@3.7.3) (2022-05-30)
|
|
238
|
+
|
|
239
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
## [3.7.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.7.1...@pie-element/inline-dropdown-configure@3.7.2) (2022-05-16)
|
|
246
|
+
|
|
247
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
## [3.7.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.7.0...@pie-element/inline-dropdown-configure@3.7.1) (2022-05-09)
|
|
254
|
+
|
|
255
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
# [3.7.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.16...@pie-element/inline-dropdown-configure@3.7.0) (2022-05-03)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
### Bug Fixes
|
|
265
|
+
|
|
266
|
+
* **explcit-constructed-response, inline-dropdown, drag-in-the-blank:** Fixed some math symbols rendering PD-1535 ([98b99ff](https://github.com/pie-framework/pie-elements/commit/98b99ff26742c15563b365c7fbb7fab981f057d8))
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
### Features
|
|
270
|
+
|
|
271
|
+
* **inline-dropdown:** added validation UI improvements PD-1698 ([477066b](https://github.com/pie-framework/pie-elements/commit/477066b51d746d37ba8ba81ece42c95972466fc3))
|
|
272
|
+
* **inline-dropdown:** ui/ux for validation PD-1699 ([d277f49](https://github.com/pie-framework/pie-elements/commit/d277f4958284cfc8dc8b16df49de924f1810c159))
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## [3.6.16](https://github.com/pie-framework/pie-elements/compare/@pie-element/inline-dropdown-configure@3.6.15...@pie-element/inline-dropdown-configure@3.6.16) (2022-04-12)
|
|
279
|
+
|
|
280
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## [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)
|
|
287
|
+
|
|
288
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## [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)
|
|
295
|
+
|
|
296
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## [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)
|
|
303
|
+
|
|
304
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## [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)
|
|
311
|
+
|
|
312
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
## [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)
|
|
319
|
+
|
|
320
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
## [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)
|
|
327
|
+
|
|
328
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
## [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)
|
|
335
|
+
|
|
336
|
+
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
6
342
|
## [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)
|
|
7
343
|
|
|
8
344
|
**Note:** Version bump only for package @pie-element/inline-dropdown-configure
|
|
@@ -18,13 +18,20 @@ var _default = {
|
|
|
18
18
|
choiceRationaleEnabled: true,
|
|
19
19
|
teacherInstructionsEnabled: true,
|
|
20
20
|
studentInstructionsEnabled: true,
|
|
21
|
-
toolbarEditorPosition: 'bottom'
|
|
21
|
+
toolbarEditorPosition: 'bottom',
|
|
22
|
+
displayType: 'block'
|
|
22
23
|
},
|
|
23
24
|
configuration: {
|
|
24
25
|
prompt: {
|
|
25
26
|
settings: true,
|
|
26
27
|
label: 'Prompt'
|
|
27
28
|
},
|
|
29
|
+
settingsPanelDisabled: false,
|
|
30
|
+
spellCheck: {
|
|
31
|
+
label: 'Spellcheck',
|
|
32
|
+
settings: false,
|
|
33
|
+
enabled: true
|
|
34
|
+
},
|
|
28
35
|
lockChoiceOrder: {
|
|
29
36
|
settings: true,
|
|
30
37
|
label: 'Lock Choice Order'
|
|
@@ -48,6 +55,22 @@ var _default = {
|
|
|
48
55
|
toolbarEditorPosition: {
|
|
49
56
|
settings: false,
|
|
50
57
|
label: 'Toolbar Editor Position'
|
|
58
|
+
},
|
|
59
|
+
maxResponseAreas: 10,
|
|
60
|
+
maxResponseAreaChoices: 10,
|
|
61
|
+
maxImageWidth: {
|
|
62
|
+
teacherInstructions: 300,
|
|
63
|
+
prompt: 300,
|
|
64
|
+
rationale: 300
|
|
65
|
+
},
|
|
66
|
+
maxImageHeight: {
|
|
67
|
+
teacherInstructions: 300,
|
|
68
|
+
prompt: 300,
|
|
69
|
+
rationale: 300
|
|
70
|
+
},
|
|
71
|
+
withRubric: {
|
|
72
|
+
settings: false,
|
|
73
|
+
label: 'Add Rubric'
|
|
51
74
|
}
|
|
52
75
|
}
|
|
53
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","disabled","mode","prompt","shuffle","markup","choices","alternateResponse","promptEnabled","rationaleEnabled","choiceRationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","settings","label","lockChoiceOrder","partialScoring","rationale","teacherInstructions","choiceRationale"],"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;
|
|
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","settingsPanelDisabled","spellCheck","enabled","lockChoiceOrder","partialScoring","rationale","teacherInstructions","choiceRationale","maxResponseAreas","maxResponseAreaChoices","maxImageWidth","maxImageHeight","withRubric"],"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,I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;AACdL,MAAAA,mBAAmB,EAAE,GADP;AAEdrB,MAAAA,MAAM,EAAE,GAFM;AAGdoB,MAAAA,SAAS,EAAE;AAHG,KA1CH;AA+CbO,IAAAA,UAAU,EAAE;AACVd,MAAAA,QAAQ,EAAE,KADA;AAEVC,MAAAA,KAAK,EAAE;AAFG;AA/CC;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 settingsPanelDisabled: false,\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 maxResponseAreaChoices: 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 withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n },\n};\n"],"file":"defaults.js"}
|
package/configure/lib/index.js
CHANGED
|
@@ -39,9 +39,9 @@ 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
|
|
|
@@ -121,6 +121,16 @@ var InlineDropdown = /*#__PURE__*/function (_HTMLElement) {
|
|
|
121
121
|
value: function onDeleteImage(src, done) {
|
|
122
122
|
this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
|
|
123
123
|
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "insertSound",
|
|
126
|
+
value: function insertSound(handler) {
|
|
127
|
+
this.dispatchEvent(new _pieConfigureEvents.InsertSoundEvent(handler));
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "onDeleteSound",
|
|
131
|
+
value: function onDeleteSound(src, done) {
|
|
132
|
+
this.dispatchEvent(new _pieConfigureEvents.DeleteSoundEvent(src, done));
|
|
133
|
+
}
|
|
124
134
|
}, {
|
|
125
135
|
key: "_render",
|
|
126
136
|
value: function _render() {
|
|
@@ -135,6 +145,10 @@ var InlineDropdown = /*#__PURE__*/function (_HTMLElement) {
|
|
|
135
145
|
imageSupport: {
|
|
136
146
|
add: this.insertImage.bind(this),
|
|
137
147
|
"delete": this.onDeleteImage.bind(this)
|
|
148
|
+
},
|
|
149
|
+
uploadSoundSupport: {
|
|
150
|
+
add: this.insertSound.bind(this),
|
|
151
|
+
"delete": this.onDeleteSound.bind(this)
|
|
138
152
|
}
|
|
139
153
|
});
|
|
140
154
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","InlineDropdown","_model","prepareModel","_configuration","sensibleDefaults","configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","handler","InsertImageEvent","src","done","DeleteImageEvent","element","React","createElement","Main","model","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","ReactDOM","render","HTMLElement","currModal","slateMarkup","markup","choices"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","InlineDropdown","_model","prepareModel","_configuration","sensibleDefaults","configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","model","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","currModal","slateMarkup","markup","choices"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAC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KAFU,CAAf;;AAIA,MAAMa,WAAW,GAAGb,KAAK,CAACa,WAAN,IAAqB,oCAAkBD,SAAS,CAACE,MAA5B,EAAoCF,SAAS,CAACG,OAA9C,CAAzC;AACA,MAAMD,MAAM,GAAG,gCAAcD,WAAd,CAAf;AAEA,yCACKD,SADL;AAEEC,IAAAA,WAAW,EAAXA,WAFF;AAGEC,IAAAA,MAAM,EAANA;AACA;;AAJF;AAMD,C","sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport debug from 'debug';\nimport defaults from 'lodash/defaults';\n\nimport sensibleDefaults from './defaults';\nimport { processMarkup, createSlateMarkup } from './markupUtils';\n\nconst log = debug('multiple-choice:configure');\n\nexport default class InlineDropdown extends HTMLElement {\n static prepareModel = (model = {}) => {\n const currModal = {\n ...sensibleDefaults.model,\n ...model,\n };\n const slateMarkup = model.slateMarkup || createSlateMarkup(currModal.markup, currModal.choices);\n const markup = processMarkup(slateMarkup);\n\n return {\n ...currModal,\n slateMarkup,\n markup,\n /*...processedMarkup,*/\n };\n };\n\n constructor() {\n super();\n this._model = InlineDropdown.prepareModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = InlineDropdown.prepareModel(s);\n this._render();\n }\n\n set configuration(c) {\n this._configuration = defaults(c, sensibleDefaults.configuration);\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = InlineDropdown.prepareModel(m);\n this._render();\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = c;\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n log('_render');\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
|
@@ -45,9 +45,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
45
45
|
|
|
46
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
47
|
|
|
48
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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; }
|
|
49
49
|
|
|
50
|
-
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; }
|
|
51
51
|
|
|
52
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); }; }
|
|
53
53
|
|
|
@@ -312,7 +312,9 @@ var RespAreaToolbar = /*#__PURE__*/function (_React$Component2) {
|
|
|
312
312
|
|
|
313
313
|
var _this$props2 = this.props,
|
|
314
314
|
classes = _this$props2.classes,
|
|
315
|
-
choices = _this$props2.choices
|
|
315
|
+
choices = _this$props2.choices,
|
|
316
|
+
spellCheck = _this$props2.spellCheck,
|
|
317
|
+
uploadSoundSupport = _this$props2.uploadSoundSupport;
|
|
316
318
|
var _this$state = this.state,
|
|
317
319
|
respAreaMarkup = _this$state.respAreaMarkup,
|
|
318
320
|
toolbarStyle = _this$state.toolbarStyle;
|
|
@@ -361,7 +363,9 @@ var RespAreaToolbar = /*#__PURE__*/function (_React$Component2) {
|
|
|
361
363
|
placeholder: "Add Choice",
|
|
362
364
|
activePlugins: filteredDefaultPlugins,
|
|
363
365
|
pluginProps: labelPlugins,
|
|
364
|
-
onBlur: this.onBlur
|
|
366
|
+
onBlur: this.onBlur,
|
|
367
|
+
spellCheck: spellCheck,
|
|
368
|
+
uploadSoundSupport: uploadSoundSupport
|
|
365
369
|
}), /*#__PURE__*/_react["default"].createElement("i", {
|
|
366
370
|
style: {
|
|
367
371
|
cursor: 'pointer',
|
|
@@ -405,6 +409,7 @@ exports.RespAreaToolbar = RespAreaToolbar;
|
|
|
405
409
|
(0, _defineProperty2["default"])(RespAreaToolbar, "propTypes", {
|
|
406
410
|
classes: _propTypes["default"].object,
|
|
407
411
|
node: _propTypes["default"].object,
|
|
412
|
+
uploadSoundSupport: _propTypes["default"].object,
|
|
408
413
|
onDone: _propTypes["default"].func,
|
|
409
414
|
choices: _propTypes["default"].array,
|
|
410
415
|
onAddChoice: _propTypes["default"].func.isRequired,
|
|
@@ -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","slateEditorRef","rootRef","slateEditor","inputRef","element","focus","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","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;AAAA,UAAiBC,OAAjB,eAAiBA,OAAjB;AAAA,UAA0BC,OAA1B,eAA0BA,OAA1B;AAAA,UAAmCC,KAAnC,eAAmCA,KAAnC;AAEA,0BACE;AAAK,QAAA,SAAS,EAAE,6BAAWH,OAAO,CAACI,OAAnB,uCAA+BJ,OAAO,CAACC,OAAvC,EAAiDA,OAAjD,EAAhB;AAA6E,QAAA,OAAO,EAAEC;AAAtF,sBACE;AACE,QAAA,SAAS,EAAEF,OAAO,CAACK,WADrB;AAEE,QAAA,uBAAuB,EAAE;AACvBC,UAAAA,MAAM,EAAEH;AADe;AAF3B,QADF,eAOE;AAAG,QAAA,SAAS,EAAEH,OAAO,CAACO,UAAtB;AAAkC,QAAA,OAAO,EAAE,KAAKC;AAAhD,aAPF,CADF;AAaD;;;EAlCwBC,kBAAMC,S;;iCAA3BhB,Y,eACe;AACjBM,EAAAA,OAAO,EAAEW,sBAAUC,MAAV,CAAiBC,UADT;AAEjBZ,EAAAA,OAAO,EAAEU,sBAAUG,IAAV,CAAeD,UAFP;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,cAAc,EAAEhD,sBAAUI,IAAV,CAAeF,UAPd;AAQjB6C,EAAAA,aAAa,EAAE/C,sBAAUI,IAAV,CAAeF,UARb;AASjBV,EAAAA,KAAK,EAAEQ,sBAAU8G,KAAV,CAAgB;AACrB3D,IAAAA,MAAM,EAAEnD,sBAAUI,IAAV,CAAeF,UADF;AAErBuB,IAAAA,QAAQ,EAAEzB,sBAAU8G,KAAV,CAAgB;AACxBxD,MAAAA,WAAW,EAAEtD,sBAAUI,IAAV,CAAeF;AADJ,KAAhB;AAFW,GAAhB;AATU,C;AA8NrB,IAAM6G,qBAAqB,GAAG,wBAAW;AACvCd,EAAAA,QAAQ,EAAE;AACRJ,IAAAA,eAAe,EAAE,MADT;AAER,oCAAgC;AAC9BmB,MAAAA,SAAS,EAAE;AADmB;AAFxB,GAD6B;AAOvCN,EAAAA,aAAa,EAAE;AACbhG,IAAAA,OAAO,EAAE,MADI;AAEbuG,IAAAA,aAAa,EAAE,QAFF;AAGb,0BAAsB;AACpBC,MAAAA,MAAM,EAAE;AADY;AAHT,GAPwB;AAcvCnB,EAAAA,WAAW,EAAE;AACXlF,IAAAA,OAAO,EAAE,KADE;AAEXC,IAAAA,QAAQ,EAAE;AAFC;AAd0B,CAAX,EAkB3BmB,eAlB2B,CAA9B;eAoBe8E,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 } = 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.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"}
|
|
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","uploadSoundSupport","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;;;;;;;;;;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H,KAAV,CAAgB;AACrB7D,IAAAA,MAAM,EAAEnD,sBAAUI,IAAV,CAAeF,UADF;AAErBuB,IAAAA,QAAQ,EAAEzB,sBAAUgH,KAAV,CAAgB;AACxB1D,MAAAA,WAAW,EAAEtD,sBAAUI,IAAV,CAAeF;AADJ,KAAhB;AAFW,GAAhB;AAVU,C;AAmOrB,IAAM+G,qBAAqB,GAAG,wBAAW;AACvCd,EAAAA,QAAQ,EAAE;AACRJ,IAAAA,eAAe,EAAE,MADT;AAER,oCAAgC;AAC9BmB,MAAAA,SAAS,EAAE;AADmB;AAFxB,GAD6B;AAOvCN,EAAAA,aAAa,EAAE;AACblG,IAAAA,OAAO,EAAE,MADI;AAEbyG,IAAAA,aAAa,EAAE,QAFF;AAGb,0BAAsB;AACpBC,MAAAA,MAAM,EAAE;AADY;AAHT,GAPwB;AAcvCnB,EAAAA,WAAW,EAAE;AACXpF,IAAAA,OAAO,EAAE,KADE;AAEXC,IAAAA,QAAQ,EAAE;AAFC;AAd0B,CAAX,EAkB3BmB,eAlB2B,CAA9B;eAoBegF,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 uploadSoundSupport: 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, uploadSoundSupport } = this.props;\n const { respAreaMarkup, toolbarStyle } = this.state;\n\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list',\n );\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 uploadSoundSupport={uploadSoundSupport}\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"}
|