@pie-element/drawing-response 3.9.11 → 3.9.14

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/configure/CHANGELOG.md +24 -0
  3. package/configure/lib/defaults.js +7 -2
  4. package/configure/lib/defaults.js.map +1 -1
  5. package/configure/lib/image-container.js +14 -7
  6. package/configure/lib/image-container.js.map +1 -1
  7. package/configure/lib/index.js +0 -6
  8. package/configure/lib/index.js.map +1 -1
  9. package/configure/lib/root.js +15 -7
  10. package/configure/lib/root.js.map +1 -1
  11. package/configure/package.json +3 -3
  12. package/configure/src/__tests__/__snapshots__/root.test.jsx.snap +7 -14
  13. package/configure/src/defaults.js +7 -2
  14. package/configure/src/image-container.jsx +72 -44
  15. package/configure/src/index.js +0 -6
  16. package/configure/src/root.jsx +31 -24
  17. package/controller/CHANGELOG.md +8 -0
  18. package/controller/lib/index.js +6 -3
  19. package/controller/lib/index.js.map +1 -1
  20. package/controller/package.json +1 -1
  21. package/controller/src/__tests__/index.test.js +18 -9
  22. package/controller/src/index.js +4 -1
  23. package/docs/config-schema.json +16 -0
  24. package/docs/config-schema.json.md +12 -0
  25. package/docs/demo/generate.js +1 -0
  26. package/docs/pie-schema.json +12 -0
  27. package/docs/pie-schema.json.md +8 -0
  28. package/lib/drawing-response/container.js +57 -11
  29. package/lib/drawing-response/container.js.map +1 -1
  30. package/lib/drawing-response/drawable-image.js +2 -1
  31. package/lib/drawing-response/drawable-image.js.map +1 -1
  32. package/lib/drawing-response/drawable-main.js +26 -10
  33. package/lib/drawing-response/drawable-main.js.map +1 -1
  34. package/lib/drawing-response/drawable-text.js +1 -1
  35. package/lib/drawing-response/drawable-text.js.map +1 -1
  36. package/lib/drawing-response/index.js +3 -0
  37. package/lib/drawing-response/index.js.map +1 -1
  38. package/package.json +4 -4
  39. package/src/drawing-response/__tests__/__snapshots__/container.test.jsx.snap +18 -2
  40. package/src/drawing-response/__tests__/__snapshots__/drawing-main.test.jsx.snap +12 -2
  41. package/src/drawing-response/__tests__/container.test.jsx +7 -0
  42. package/src/drawing-response/__tests__/drawing-main.test.jsx +2 -1
  43. package/src/drawing-response/container.jsx +40 -2
  44. package/src/drawing-response/drawable-image.jsx +2 -1
  45. package/src/drawing-response/drawable-main.jsx +24 -10
  46. package/src/drawing-response/drawable-text.jsx +1 -1
  47. package/src/drawing-response/index.jsx +3 -1
@@ -17,7 +17,7 @@ export class ImageContainer extends Component {
17
17
  maxImageHeight: 0,
18
18
  dragEnabled: true,
19
19
  dropzoneActive: false,
20
- }
20
+ };
21
21
  }
22
22
 
23
23
  componentDidMount() {
@@ -26,7 +26,7 @@ export class ImageContainer extends Component {
26
26
  const { height, width } = positionInfo;
27
27
  this.setState({
28
28
  maxImageWidth: width,
29
- maxImageHeight: height
29
+ maxImageHeight: height,
30
30
  });
31
31
  }
32
32
  }
@@ -46,7 +46,7 @@ export class ImageContainer extends Component {
46
46
  this.handleFileRead(file);
47
47
  };
48
48
 
49
- makeDropzoneActive= () => this.setState({ dropzoneActive: true });
49
+ makeDropzoneActive = () => this.setState({ dropzoneActive: true });
50
50
 
51
51
  makeDropzoneInactive = () => this.setState({ dropzoneActive: false });
52
52
 
@@ -90,7 +90,7 @@ export class ImageContainer extends Component {
90
90
 
91
91
  const dimensions = {
92
92
  height: offsetHeight,
93
- width: offsetWidth
93
+ width: offsetWidth,
94
94
  };
95
95
 
96
96
  this.setState({ dimensions });
@@ -126,11 +126,19 @@ export class ImageContainer extends Component {
126
126
  const fitsContainer = x <= maxImageWidth + 5;
127
127
  const hasMinimumWidth = x > 150 && y > 150;
128
128
 
129
+ const keepAspectRatioWidth = x > y ? x : 'auto';
130
+ const keepAspectRatioHeight = x > y ? 'auto' : y;
131
+
129
132
  if (fitsContainer && hasMinimumWidth) {
130
- box.style.width = `${x}px`;
131
- box.style.height = `${y}px`;
133
+ box.style.width = `${keepAspectRatioWidth}px`;
134
+ box.style.height = `${keepAspectRatioHeight}px`;
132
135
 
133
- this.setState({ dimensions: { height: y, width: x }});
136
+ this.setState({
137
+ dimensions: {
138
+ height: keepAspectRatioHeight,
139
+ width: keepAspectRatioWidth,
140
+ },
141
+ });
134
142
  }
135
143
 
136
144
  this.handleDisableDrag();
@@ -141,60 +149,80 @@ export class ImageContainer extends Component {
141
149
 
142
150
  return (
143
151
  <div>
144
- <Button
145
- label={label}
146
- onClick={this.handleInputClick}
147
- />
152
+ <Button label={label} onClick={this.handleInputClick} />
148
153
  <input
149
154
  accept="image/*"
150
155
  className={classes.input}
151
156
  onChange={this.handleUploadImage}
152
- ref={ref => { this.input = ref; }}
157
+ ref={(ref) => {
158
+ this.input = ref;
159
+ }}
153
160
  type="file"
154
161
  />
155
162
  </div>
156
- )
163
+ );
157
164
  }
158
165
 
159
166
  render() {
160
- const {
161
- classes,
162
- imageUrl
163
- } = this.props;
167
+ const { classes, imageUrl } = this.props;
164
168
  const {
165
169
  dropzoneActive,
166
170
  dragEnabled,
167
171
  maxImageHeight,
168
- maxImageWidth
172
+ maxImageWidth,
173
+ dimensions,
169
174
  } = this.state;
170
175
 
171
176
  return (
172
- <div className={classes.base} >
173
- <div className={`${classes.box} ${dropzoneActive ? classes.boxActive : ''}`}
174
- {...dragEnabled ? {
175
- onDragExit: this.handleOnDragExit,
176
- onDragLeave: this.handleOnDragExit,
177
- onDragOver: this.handleOnDragOver ,
178
- onDrop: this.handleOnDrop
179
- } : {}}
177
+ <div className={classes.base}>
178
+ <div
179
+ className={`${classes.box} ${
180
+ dropzoneActive ? classes.boxActive : ''
181
+ }`}
182
+ {...(dragEnabled
183
+ ? {
184
+ onDragExit: this.handleOnDragExit,
185
+ onDragLeave: this.handleOnDragExit,
186
+ onDragOver: this.handleOnDragOver,
187
+ onDrop: this.handleOnDrop,
188
+ }
189
+ : {})}
180
190
  >
181
191
  <div className={classes.toolbar}>
182
- {this.renderUploadControl(imageUrl ? 'Replace Image' : 'Upload Image')}
192
+ {this.renderUploadControl(
193
+ imageUrl ? 'Replace Image' : 'Upload Image'
194
+ )}
183
195
  </div>
184
196
 
185
- <div ref={ref => { this.imageSection = ref; }} className={classes.drawableHeight}>
197
+ <div
198
+ ref={(ref) => {
199
+ this.imageSection = ref;
200
+ }}
201
+ className={classes.drawableHeight}
202
+ >
186
203
  {imageUrl ? (
187
204
  <div className={classes.imageContainer}>
188
205
  <img
189
206
  className={classes.image}
190
207
  height="auto"
191
208
  onLoad={this.handleOnImageLoad}
192
- ref={ref => { this.image = ref; }}
209
+ ref={(ref) => {
210
+ this.image = ref;
211
+ }}
193
212
  src={imageUrl}
194
- style={{ maxWidth: maxImageWidth, maxHeight: maxImageHeight }}
195
- alt=''
213
+ style={{
214
+ maxWidth: maxImageWidth,
215
+ maxHeight: maxImageHeight,
216
+ ...dimensions,
217
+ }}
218
+ alt=""
219
+ />
220
+ <div
221
+ ref={(ref) => {
222
+ this.resize = ref;
223
+ }}
224
+ className={classes.resize}
196
225
  />
197
- <div ref={ref => { this.resize = ref; }} className={classes.resize} />
198
226
  </div>
199
227
  ) : (
200
228
  <div className={`${classes.drawableHeight} ${classes.centered}`}>
@@ -210,25 +238,25 @@ export class ImageContainer extends Component {
210
238
  }
211
239
  }
212
240
 
213
- const styles = theme => ({
241
+ const styles = (theme) => ({
214
242
  base: {
215
- marginTop: theme.spacing.unit * 2
243
+ marginTop: theme.spacing.unit * 2,
216
244
  },
217
245
  box: {
218
246
  border: '1px solid #E0E1E6',
219
- borderRadius: '5px'
247
+ borderRadius: '5px',
220
248
  },
221
249
  boxActive: {
222
- border: '1px solid #0032C2'
250
+ border: '1px solid #0032C2',
223
251
  },
224
252
  centered: {
225
253
  alignItems: 'center',
226
254
  display: 'flex',
227
255
  flexDirection: 'column',
228
- justifyContent: 'center'
256
+ justifyContent: 'center',
229
257
  },
230
258
  drawableHeight: {
231
- minHeight: 350
259
+ minHeight: 350,
232
260
  },
233
261
  image: {
234
262
  alignItems: 'center',
@@ -237,7 +265,7 @@ const styles = theme => ({
237
265
  },
238
266
  imageContainer: {
239
267
  position: 'relative',
240
- width: 'fit-content'
268
+ width: 'fit-content',
241
269
  },
242
270
  resize: {
243
271
  borderBottom: '1px solid #727272',
@@ -247,10 +275,10 @@ const styles = theme => ({
247
275
  height: '10px',
248
276
  position: 'absolute',
249
277
  right: '-10px',
250
- width: '10px'
278
+ width: '10px',
251
279
  },
252
280
  input: {
253
- display: 'none'
281
+ display: 'none',
254
282
  },
255
283
  toolbar: {
256
284
  backgroundColor: '#ECEDF1',
@@ -258,15 +286,15 @@ const styles = theme => ({
258
286
  borderTopLeftRadius: '5px',
259
287
  borderTopRightRadius: '5px',
260
288
  display: 'flex',
261
- padding: '12px 8px'
262
- }
289
+ padding: '12px 8px',
290
+ },
263
291
  });
264
292
 
265
293
  ImageContainer.propTypes = {
266
294
  classes: PropTypes.object.isRequired,
267
295
  imageUrl: PropTypes.string.isRequired,
268
296
  onImageUpload: PropTypes.func.isRequired,
269
- onUpdateImageDimension: PropTypes.func.isRequired
297
+ onUpdateImageDimension: PropTypes.func.isRequired,
270
298
  };
271
299
 
272
300
  export default withStyles(styles)(ImageContainer);
@@ -49,12 +49,6 @@ export default class DrawableResponseConfigure extends HTMLElement {
49
49
  };
50
50
 
51
51
  onConfigurationChanged = (c) => {
52
- if (!c.backgroundImage.enabled) {
53
- this.onModelChanged({
54
- ...this._model,
55
- imageUrl: ''
56
- });
57
- }
58
52
  this._configuration = c;
59
53
  this._render();
60
54
  };
@@ -11,22 +11,22 @@ import cloneDeep from 'lodash/cloneDeep';
11
11
  const { Panel, toggle } = settings;
12
12
 
13
13
  export class Root extends React.Component {
14
- onPromptChanged = prompt => {
14
+ onPromptChanged = (prompt) => {
15
15
  const { model, onModelChanged } = this.props;
16
16
  const update = cloneDeep(model);
17
17
 
18
18
  onModelChanged({
19
19
  ...update,
20
- prompt
20
+ prompt,
21
21
  });
22
22
  };
23
23
 
24
- onTeacherInstructionsChanged = teacherInstructions => {
24
+ onTeacherInstructionsChanged = (teacherInstructions) => {
25
25
  const { model, onModelChanged } = this.props;
26
26
 
27
27
  onModelChanged({
28
28
  ...model,
29
- teacherInstructions
29
+ teacherInstructions,
30
30
  });
31
31
  };
32
32
 
@@ -35,16 +35,16 @@ export class Root extends React.Component {
35
35
 
36
36
  onModelChanged({
37
37
  ...model,
38
- imageDimensions: dimensions
38
+ imageDimensions: dimensions,
39
39
  });
40
40
  };
41
41
 
42
- onImageUpload = imageUrl => {
42
+ onImageUpload = (imageUrl) => {
43
43
  const { model, onModelChanged } = this.props;
44
44
 
45
45
  onModelChanged({
46
46
  ...model,
47
- imageUrl
47
+ imageUrl,
48
48
  });
49
49
  };
50
50
 
@@ -55,11 +55,15 @@ export class Root extends React.Component {
55
55
  model,
56
56
  imageSupport,
57
57
  onConfigurationChanged,
58
- onModelChanged
58
+ onModelChanged,
59
59
  } = this.props;
60
- const { backgroundImage = {}, prompt = {}, teacherInstructions = {} } =
61
- configuration || {};
62
- const { teacherInstructionsEnabled, promptEnabled } =
60
+ const {
61
+ backgroundImage = {},
62
+ prompt = {},
63
+ teacherInstructions = {},
64
+ spellCheck = {},
65
+ } = configuration || {};
66
+ const { teacherInstructionsEnabled, promptEnabled, spellCheckEnabled, backgroundImageEnabled } =
63
67
  model || {};
64
68
  const toolbarOpts = {};
65
69
 
@@ -83,16 +87,16 @@ export class Root extends React.Component {
83
87
  onChangeConfiguration={onConfigurationChanged}
84
88
  groups={{
85
89
  Settings: {
86
- 'backgroundImage.enabled':
87
- backgroundImage.settings &&
88
- toggle(backgroundImage.label, true),
90
+ backgroundImageEnabled: backgroundImage.settings && toggle(backgroundImage.label),
89
91
  promptEnabled: prompt.settings && toggle(prompt.label)
90
92
  },
91
93
  Properties: {
92
94
  teacherInstructionsEnabled:
93
95
  teacherInstructions.settings &&
94
- toggle(teacherInstructions.label)
95
- }
96
+ toggle(teacherInstructions.label),
97
+ spellCheckEnabled:
98
+ spellCheck.settings && toggle(spellCheck.label),
99
+ },
96
100
  }}
97
101
  />
98
102
  }
@@ -109,6 +113,7 @@ export class Root extends React.Component {
109
113
  imageSupport={imageSupport}
110
114
  nonEmpty={false}
111
115
  toolbarOpts={toolbarOpts}
116
+ spellCheck={spellCheckEnabled}
112
117
  />
113
118
  </InputContainer>
114
119
  )}
@@ -119,11 +124,13 @@ export class Root extends React.Component {
119
124
  markup={model.prompt}
120
125
  onChange={this.onPromptChanged}
121
126
  toolbarOpts={toolbarOpts}
127
+ spellCheck={spellCheckEnabled}
128
+ imageSupport={imageSupport}
122
129
  />
123
130
  </InputContainer>
124
131
  )}
125
132
 
126
- {backgroundImage.enabled && (
133
+ {backgroundImageEnabled && (
127
134
  <div>
128
135
  <Typography className={classes.label} variant="subheading">
129
136
  Define Background Image
@@ -143,20 +150,20 @@ export class Root extends React.Component {
143
150
  }
144
151
  }
145
152
 
146
- const styles = theme => ({
153
+ const styles = (theme) => ({
147
154
  base: {
148
- marginTop: theme.spacing.unit * 3
155
+ marginTop: theme.spacing.unit * 3,
149
156
  },
150
157
  label: {
151
- marginTop: theme.spacing.unit * 4
158
+ marginTop: theme.spacing.unit * 4,
152
159
  },
153
160
  prompt: {
154
161
  paddingTop: theme.spacing.unit * 2,
155
- width: '100%'
162
+ width: '100%',
156
163
  },
157
164
  regular: {
158
- marginBottom: theme.spacing.unit * 3
159
- }
165
+ marginBottom: theme.spacing.unit * 3,
166
+ },
160
167
  });
161
168
 
162
169
  Root.propTypes = {
@@ -165,7 +172,7 @@ Root.propTypes = {
165
172
  model: PropTypes.object.isRequired,
166
173
  imageSupport: PropTypes.shape({
167
174
  add: PropTypes.func,
168
- delete: PropTypes.func
175
+ delete: PropTypes.func,
169
176
  }),
170
177
  onModelChanged: PropTypes.func.isRequired,
171
178
  onConfigurationChanged: PropTypes.func.isRequired,
@@ -3,6 +3,14 @@
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.2.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/drawing-response-controller@3.2.7...@pie-element/drawing-response-controller@3.2.8) (2022-03-22)
7
+
8
+ **Note:** Version bump only for package @pie-element/drawing-response-controller
9
+
10
+
11
+
12
+
13
+
6
14
  ## [3.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/drawing-response-controller@3.2.2...@pie-element/drawing-response-controller@3.2.4) (2021-11-11)
7
15
 
8
16
  **Note:** Version bump only for package @pie-element/drawing-response-controller
@@ -25,7 +25,8 @@ var normalize = function normalize(question) {
25
25
  return _objectSpread({
26
26
  promptEnabled: true,
27
27
  teacherInstructionsEnabled: true,
28
- studentInstructionsEnabled: true
28
+ studentInstructionsEnabled: true,
29
+ backgroundImageEnabled: true
29
30
  }, question);
30
31
  };
31
32
 
@@ -36,14 +37,16 @@ function model(question, session, env) {
36
37
  var imageUrl = normalizedQuestion.imageUrl,
37
38
  imageDimensions = normalizedQuestion.imageDimensions,
38
39
  prompt = normalizedQuestion.prompt,
39
- promptEnabled = normalizedQuestion.promptEnabled;
40
+ promptEnabled = normalizedQuestion.promptEnabled,
41
+ backgroundImageEnabled = normalizedQuestion.backgroundImageEnabled;
40
42
  return new Promise(function (resolve) {
41
43
  var out = {
42
44
  disabled: env.mode !== 'gather',
43
45
  mode: env.mode,
44
46
  imageDimensions: imageDimensions,
45
47
  imageUrl: imageUrl,
46
- prompt: promptEnabled ? prompt : null
48
+ prompt: promptEnabled ? prompt : null,
49
+ backgroundImageEnabled: backgroundImageEnabled
47
50
  };
48
51
 
49
52
  if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","normalize","question","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","model","session","env","normalizedQuestion","imageUrl","imageDimensions","prompt","Promise","resolve","out","disabled","mode","role","teacherInstructions","createDefaultModel","defaults","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0CAAN,CAAZ;;AAEO,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA;AAC/BC,IAAAA,aAAa,EAAE,IADgB;AAE/BC,IAAAA,0BAA0B,EAAE,IAFG;AAG/BC,IAAAA,0BAA0B,EAAE;AAHG,KAI5BH,QAJ4B;AAAA,CAA1B;;;;AAOA,SAASI,KAAT,CAAeJ,QAAf,EAAyBK,OAAzB,EAAkCC,GAAlC,EAAuC;AAC5C,MAAMC,kBAAkB,GAAGR,SAAS,CAACC,QAAD,CAApC;AACA,MACEQ,QADF,GAKID,kBALJ,CACEC,QADF;AAAA,MAEEC,eAFF,GAKIF,kBALJ,CAEEE,eAFF;AAAA,MAGEC,MAHF,GAKIH,kBALJ,CAGEG,MAHF;AAAA,MAIET,aAJF,GAKIM,kBALJ,CAIEN,aAJF;AAOA,SAAO,IAAIU,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC5B,QAAMC,GAAG,GAAG;AACVC,MAAAA,QAAQ,EAAER,GAAG,CAACS,IAAJ,KAAa,QADb;AAEVA,MAAAA,IAAI,EAAET,GAAG,CAACS,IAFA;AAGVN,MAAAA,eAAe,EAAfA,eAHU;AAIVD,MAAAA,QAAQ,EAARA,QAJU;AAKVE,MAAAA,MAAM,EAAET,aAAa,GAAGS,MAAH,GAAY;AALvB,KAAZ;;AAQA,QAAIJ,GAAG,CAACU,IAAJ,KAAa,YAAb,KAA8BV,GAAG,CAACS,IAAJ,KAAa,MAAb,IAAuBT,GAAG,CAACS,IAAJ,KAAa,UAAlE,CAAJ,EAAmF;AACjFF,MAAAA,GAAG,CAACI,mBAAJ,GAA0BV,kBAAkB,CAACL,0BAAnB,GAAgDK,kBAAkB,CAACU,mBAAnE,GAAyF,IAAnH;AACD,KAFD,MAEO;AACLJ,MAAAA,GAAG,CAACI,mBAAJ,GAA0B,IAA1B;AACD;;AAEDL,IAAAA,OAAO,CAACC,GAAD,CAAP;AACD,GAhBM,CAAP;AAiBD;;AAEM,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,MAACd,KAAD,uEAAS,EAAT;AAAA,SAChC,IAAIO,OAAJ,CAAY,UAAAC,OAAO,EAAI;AACrBA,IAAAA,OAAO,iCACFO,oBADE,GAEFf,KAFE,EAAP;AAID,GALD,CADgC;AAAA,CAA3B;;;;AAQA,SAASgB,OAAT,GAAsC;AAC3C,SAAO,IAAIT,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC5Bd,IAAAA,GAAG,CAAC,YAAD,CAAH;AACAc,IAAAA,OAAO,CAAC;AACNS,MAAAA,KAAK,EAAE,CADD;AAENC,MAAAA,SAAS,EAAE,KAFL;AAGNC,MAAAA,IAAI,EAAE;AAHA,KAAD,CAAP;AAKD,GAPM,CAAP;AAQD","sourcesContent":["import debug from 'debug';\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:drawing-response:controller');\n\nexport const normalize = question => ({\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const {\n imageUrl,\n imageDimensions,\n prompt,\n promptEnabled\n } = normalizedQuestion;\n\n return new Promise(resolve => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n imageDimensions,\n imageUrl,\n prompt: promptEnabled ? prompt : null,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise(resolve => {\n resolve({\n ...defaults,\n ...model,\n })\n });\n\nexport function outcome(/*config, session*/) {\n return new Promise(resolve => {\n log('outcome...');\n resolve({\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring'\n });\n });\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","normalize","question","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","backgroundImageEnabled","model","session","env","normalizedQuestion","imageUrl","imageDimensions","prompt","Promise","resolve","out","disabled","mode","role","teacherInstructions","createDefaultModel","defaults","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0CAAN,CAAZ;;AAEO,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA;AAC/BC,IAAAA,aAAa,EAAE,IADgB;AAE/BC,IAAAA,0BAA0B,EAAE,IAFG;AAG/BC,IAAAA,0BAA0B,EAAE,IAHG;AAI/BC,IAAAA,sBAAsB,EAAE;AAJO,KAK5BJ,QAL4B;AAAA,CAA1B;;;;AAQA,SAASK,KAAT,CAAeL,QAAf,EAAyBM,OAAzB,EAAkCC,GAAlC,EAAuC;AAC5C,MAAMC,kBAAkB,GAAGT,SAAS,CAACC,QAAD,CAApC;AACA,MACES,QADF,GAMID,kBANJ,CACEC,QADF;AAAA,MAEEC,eAFF,GAMIF,kBANJ,CAEEE,eAFF;AAAA,MAGEC,MAHF,GAMIH,kBANJ,CAGEG,MAHF;AAAA,MAIEV,aAJF,GAMIO,kBANJ,CAIEP,aAJF;AAAA,MAKEG,sBALF,GAMII,kBANJ,CAKEJ,sBALF;AAQA,SAAO,IAAIQ,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC5B,QAAMC,GAAG,GAAG;AACVC,MAAAA,QAAQ,EAAER,GAAG,CAACS,IAAJ,KAAa,QADb;AAEVA,MAAAA,IAAI,EAAET,GAAG,CAACS,IAFA;AAGVN,MAAAA,eAAe,EAAfA,eAHU;AAIVD,MAAAA,QAAQ,EAARA,QAJU;AAKVE,MAAAA,MAAM,EAAEV,aAAa,GAAGU,MAAH,GAAY,IALvB;AAMVP,MAAAA,sBAAsB,EAAtBA;AANU,KAAZ;;AASA,QAAIG,GAAG,CAACU,IAAJ,KAAa,YAAb,KAA8BV,GAAG,CAACS,IAAJ,KAAa,MAAb,IAAuBT,GAAG,CAACS,IAAJ,KAAa,UAAlE,CAAJ,EAAmF;AACjFF,MAAAA,GAAG,CAACI,mBAAJ,GAA0BV,kBAAkB,CAACN,0BAAnB,GAAgDM,kBAAkB,CAACU,mBAAnE,GAAyF,IAAnH;AACD,KAFD,MAEO;AACLJ,MAAAA,GAAG,CAACI,mBAAJ,GAA0B,IAA1B;AACD;;AAEDL,IAAAA,OAAO,CAACC,GAAD,CAAP;AACD,GAjBM,CAAP;AAkBD;;AAEM,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,MAACd,KAAD,uEAAS,EAAT;AAAA,SAChC,IAAIO,OAAJ,CAAY,UAAAC,OAAO,EAAI;AACrBA,IAAAA,OAAO,iCACFO,oBADE,GAEFf,KAFE,EAAP;AAID,GALD,CADgC;AAAA,CAA3B;;;;AAQA,SAASgB,OAAT,GAAsC;AAC3C,SAAO,IAAIT,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC5Bf,IAAAA,GAAG,CAAC,YAAD,CAAH;AACAe,IAAAA,OAAO,CAAC;AACNS,MAAAA,KAAK,EAAE,CADD;AAENC,MAAAA,SAAS,EAAE,KAFL;AAGNC,MAAAA,IAAI,EAAE;AAHA,KAAD,CAAP;AAKD,GAPM,CAAP;AAQD","sourcesContent":["import debug from 'debug';\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:drawing-response:controller');\n\nexport const normalize = question => ({\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n backgroundImageEnabled: true,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const {\n imageUrl,\n imageDimensions,\n prompt,\n promptEnabled,\n backgroundImageEnabled\n } = normalizedQuestion;\n\n return new Promise(resolve => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n imageDimensions,\n imageUrl,\n prompt: promptEnabled ? prompt : null,\n backgroundImageEnabled\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise(resolve => {\n resolve({\n ...defaults,\n ...model,\n })\n });\n\nexport function outcome(/*config, session*/) {\n return new Promise(resolve => {\n log('outcome...');\n resolve({\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring'\n });\n });\n}\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/drawing-response-controller",
3
3
  "private": true,
4
- "version": "3.2.7",
4
+ "version": "3.2.8",
5
5
  "description": "",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -12,7 +12,8 @@ describe('controller', () => {
12
12
  height: 0,
13
13
  width: 0
14
14
  },
15
- teacherInstructions: 'Teacher Instructions'
15
+ teacherInstructions: 'Teacher Instructions',
16
+ backgroundImageEnabled: true
16
17
  };
17
18
  });
18
19
 
@@ -56,7 +57,8 @@ describe('controller', () => {
56
57
  imageUrl: question.imageUrl,
57
58
  imageDimensions: question.imageDimensions,
58
59
  prompt: question.prompt,
59
- teacherInstructions: null
60
+ teacherInstructions: null,
61
+ backgroundImageEnabled: question.backgroundImageEnabled
60
62
  });
61
63
  });
62
64
 
@@ -69,7 +71,8 @@ describe('controller', () => {
69
71
  imageUrl: question.imageUrl,
70
72
  imageDimensions: question.imageDimensions,
71
73
  prompt: null,
72
- teacherInstructions: null
74
+ teacherInstructions: null,
75
+ backgroundImageEnabled: question.backgroundImageEnabled
73
76
  });
74
77
  });
75
78
 
@@ -83,7 +86,8 @@ describe('controller', () => {
83
86
  imageUrl: question.imageUrl,
84
87
  imageDimensions: question.imageDimensions,
85
88
  prompt: question.prompt,
86
- teacherInstructions: null
89
+ teacherInstructions: null,
90
+ backgroundImageEnabled: question.backgroundImageEnabled
87
91
  });
88
92
  });
89
93
 
@@ -96,7 +100,8 @@ describe('controller', () => {
96
100
  imageUrl: question.imageUrl,
97
101
  imageDimensions: question.imageDimensions,
98
102
  prompt: question.prompt,
99
- teacherInstructions: question.teacherInstructions
103
+ teacherInstructions: question.teacherInstructions,
104
+ backgroundImageEnabled: question.backgroundImageEnabled
100
105
  });
101
106
  });
102
107
 
@@ -112,7 +117,8 @@ describe('controller', () => {
112
117
  imageUrl: question.imageUrl,
113
118
  imageDimensions: question.imageDimensions,
114
119
  prompt: question.prompt,
115
- teacherInstructions: null
120
+ teacherInstructions: null,
121
+ backgroundImageEnabled: question.backgroundImageEnabled
116
122
  });
117
123
  });
118
124
 
@@ -125,7 +131,8 @@ describe('controller', () => {
125
131
  imageUrl: question.imageUrl,
126
132
  imageDimensions: question.imageDimensions,
127
133
  prompt: question.prompt,
128
- teacherInstructions: null
134
+ teacherInstructions: null,
135
+ backgroundImageEnabled: question.backgroundImageEnabled
129
136
  });
130
137
  });
131
138
 
@@ -138,7 +145,8 @@ describe('controller', () => {
138
145
  imageUrl: question.imageUrl,
139
146
  imageDimensions: question.imageDimensions,
140
147
  prompt: question.prompt,
141
- teacherInstructions: question.teacherInstructions
148
+ teacherInstructions: question.teacherInstructions,
149
+ backgroundImageEnabled: question.backgroundImageEnabled
142
150
  });
143
151
  });
144
152
 
@@ -154,7 +162,8 @@ describe('controller', () => {
154
162
  imageUrl: question.imageUrl,
155
163
  imageDimensions: question.imageDimensions,
156
164
  prompt: question.prompt,
157
- teacherInstructions: null
165
+ teacherInstructions: null,
166
+ backgroundImageEnabled: question.backgroundImageEnabled
158
167
  });
159
168
  });
160
169
  });
@@ -7,6 +7,7 @@ export const normalize = question => ({
7
7
  promptEnabled: true,
8
8
  teacherInstructionsEnabled: true,
9
9
  studentInstructionsEnabled: true,
10
+ backgroundImageEnabled: true,
10
11
  ...question,
11
12
  });
12
13
 
@@ -16,7 +17,8 @@ export function model(question, session, env) {
16
17
  imageUrl,
17
18
  imageDimensions,
18
19
  prompt,
19
- promptEnabled
20
+ promptEnabled,
21
+ backgroundImageEnabled
20
22
  } = normalizedQuestion;
21
23
 
22
24
  return new Promise(resolve => {
@@ -26,6 +28,7 @@ export function model(question, session, env) {
26
28
  imageDimensions,
27
29
  imageUrl,
28
30
  prompt: promptEnabled ? prompt : null,
31
+ backgroundImageEnabled
29
32
  };
30
33
 
31
34
  if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
@@ -40,6 +40,22 @@
40
40
  }
41
41
  }
42
42
  },
43
+ "spellCheck": {
44
+ "title": "ConfigureProp",
45
+ "type": "object",
46
+ "properties": {
47
+ "settings": {
48
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
49
+ "type": "boolean",
50
+ "title": "settings"
51
+ },
52
+ "label": {
53
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
54
+ "type": "string",
55
+ "title": "label"
56
+ }
57
+ }
58
+ },
43
59
  "studentInstructions": {
44
60
  "title": "ConfigureProp",
45
61
  "type": "object",
@@ -31,6 +31,18 @@ Indicates if the item has to be displayed in the Settings Panel
31
31
 
32
32
  Indicates the label for the item that has to be displayed in the Settings Panel
33
33
 
34
+ # `spellCheck` (object)
35
+
36
+ Properties of the `spellCheck` object:
37
+
38
+ ## `settings` (boolean)
39
+
40
+ Indicates if the item has to be displayed in the Settings Panel
41
+
42
+ ## `label` (string)
43
+
44
+ Indicates the label for the item that has to be displayed in the Settings Panel
45
+
34
46
  # `studentInstructions` (object)
35
47
 
36
48
  Properties of the `studentInstructions` object:
@@ -3,6 +3,7 @@ exports.model = (id, element) => ({
3
3
  element,
4
4
  prompt: 'This is the question prompt',
5
5
  promptEnabled: true,
6
+ backgroundImageEnabled: true,
6
7
  toolbarEditorPosition: 'bottom',
7
8
  imageUrl: '',
8
9
  imageDimensions: {
@@ -63,6 +63,16 @@
63
63
  "type": "boolean",
64
64
  "title": "teacherInstructionsEnabled"
65
65
  },
66
+ "spellCheckEnabled": {
67
+ "description": "Indicates if spellcheck is enabled",
68
+ "type": "boolean",
69
+ "title": "spellCheckEnabled"
70
+ },
71
+ "backgroundImageEnabled": {
72
+ "description": "Indicates if Background Image is enabled",
73
+ "type": "boolean",
74
+ "title": "backgroundImageEnabled"
75
+ },
66
76
  "toolbarEditorPosition": {
67
77
  "description": "Indicates the editor's toolbar position which can be 'bottom' or 'top'",
68
78
  "default": ": 'bottom'",
@@ -85,9 +95,11 @@
85
95
  }
86
96
  },
87
97
  "required": [
98
+ "backgroundImageEnabled",
88
99
  "element",
89
100
  "id",
90
101
  "imageDimensions",
102
+ "spellCheckEnabled",
91
103
  "studentInstructionsEnabled",
92
104
  "teacherInstructionsEnabled"
93
105
  ],
@@ -46,6 +46,14 @@ Indicates if Student Instructions are enabled
46
46
 
47
47
  Indicates if Teacher Instructions are enabled
48
48
 
49
+ # `spellCheckEnabled` (boolean, required)
50
+
51
+ Indicates if spellcheck is enabled
52
+
53
+ # `backgroundImageEnabled` (boolean, required)
54
+
55
+ Indicates if Background Image is enabled
56
+
49
57
  # `toolbarEditorPosition` (string, enum)
50
58
 
51
59
  Indicates the editor's toolbar position which can be 'bottom' or 'top'