@pie-element/drawing-response 3.7.2 → 3.7.3-next.1016
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 +158 -0
- package/configure/CHANGELOG.md +117 -0
- package/configure/lib/defaults.js +18 -3
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/image-container.js +23 -14
- package/configure/lib/image-container.js.map +1 -1
- package/configure/lib/index.js +3 -9
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +44 -11
- package/configure/lib/root.js.map +1 -1
- package/configure/package.json +3 -3
- package/configure/src/__tests__/__snapshots__/image-container.test.jsx.snap +3 -2
- package/configure/src/__tests__/__snapshots__/root.test.jsx.snap +22 -14
- package/configure/src/defaults.js +17 -2
- package/configure/src/image-container.jsx +71 -45
- package/configure/src/index.js +0 -6
- package/configure/src/root.jsx +53 -24
- package/controller/CHANGELOG.md +24 -0
- package/controller/lib/index.js +13 -9
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/controller/src/__tests__/index.test.js +18 -9
- package/controller/src/index.js +4 -1
- package/docs/config-schema.json +79 -0
- package/docs/config-schema.json.md +61 -1
- package/docs/demo/generate.js +2 -0
- package/docs/pie-schema.json +43 -0
- package/docs/pie-schema.json.md +35 -0
- package/lib/drawing-response/container.js +65 -15
- package/lib/drawing-response/container.js.map +1 -1
- package/lib/drawing-response/drawable-circle.js +1 -1
- package/lib/drawing-response/drawable-circle.js.map +1 -1
- package/lib/drawing-response/drawable-eraser.js +1 -1
- package/lib/drawing-response/drawable-eraser.js.map +1 -1
- package/lib/drawing-response/drawable-free-path.js +1 -1
- package/lib/drawing-response/drawable-free-path.js.map +1 -1
- package/lib/drawing-response/drawable-helper.js.map +1 -1
- package/lib/drawing-response/drawable-image.js +1 -0
- package/lib/drawing-response/drawable-image.js.map +1 -1
- package/lib/drawing-response/drawable-line.js +1 -1
- package/lib/drawing-response/drawable-line.js.map +1 -1
- package/lib/drawing-response/drawable-main.js +37 -14
- package/lib/drawing-response/drawable-main.js.map +1 -1
- package/lib/drawing-response/drawable-palette.js +1 -1
- package/lib/drawing-response/drawable-palette.js.map +1 -1
- package/lib/drawing-response/drawable-rectangle.js +1 -1
- package/lib/drawing-response/drawable-rectangle.js.map +1 -1
- package/lib/drawing-response/drawable-text.js +15 -5
- package/lib/drawing-response/drawable-text.js.map +1 -1
- package/lib/drawing-response/drawable-transformer.js +1 -1
- package/lib/drawing-response/drawable-transformer.js.map +1 -1
- package/lib/drawing-response/index.js +9 -9
- package/lib/drawing-response/index.js.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/drawing-response/__tests__/__snapshots__/container.test.jsx.snap +18 -130
- package/src/drawing-response/__tests__/__snapshots__/drawing-main.test.jsx.snap +26 -2
- package/src/drawing-response/__tests__/container.test.jsx +7 -0
- package/src/drawing-response/__tests__/drawing-main.test.jsx +2 -1
- package/src/drawing-response/container.jsx +55 -15
- package/src/drawing-response/drawable-image.jsx +1 -0
- package/src/drawing-response/drawable-main.jsx +39 -15
- package/src/drawing-response/drawable-text.jsx +7 -1
- package/src/drawing-response/index.jsx +6 -4
- package/src/index.js +5 -0
- package/module/configure.js +0 -1099
- package/module/controller.js +0 -66
- package/module/demo.js +0 -38
- package/module/element.js +0 -1893
- package/module/index.html +0 -16
- package/module/manifest.json +0 -14
package/configure/src/root.jsx
CHANGED
|
@@ -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,12 +55,31 @@ 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 {
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const {
|
|
61
|
+
backgroundImage = {},
|
|
62
|
+
prompt = {},
|
|
63
|
+
teacherInstructions = {},
|
|
64
|
+
spellCheck = {},
|
|
65
|
+
maxImageWidth = {},
|
|
66
|
+
maxImageHeight = {}
|
|
67
|
+
} = configuration || {};
|
|
68
|
+
const { teacherInstructionsEnabled, promptEnabled, spellCheckEnabled, backgroundImageEnabled } =
|
|
63
69
|
model || {};
|
|
70
|
+
const toolbarOpts = {};
|
|
71
|
+
|
|
72
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
73
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
74
|
+
|
|
75
|
+
switch (model.toolbarEditorPosition) {
|
|
76
|
+
case 'top':
|
|
77
|
+
toolbarOpts.position = 'top';
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
toolbarOpts.position = 'bottom';
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
64
83
|
|
|
65
84
|
return (
|
|
66
85
|
<div className={classes.base}>
|
|
@@ -73,16 +92,16 @@ export class Root extends React.Component {
|
|
|
73
92
|
onChangeConfiguration={onConfigurationChanged}
|
|
74
93
|
groups={{
|
|
75
94
|
Settings: {
|
|
76
|
-
|
|
77
|
-
backgroundImage.settings &&
|
|
78
|
-
toggle(backgroundImage.label, true),
|
|
95
|
+
backgroundImageEnabled: backgroundImage.settings && toggle(backgroundImage.label),
|
|
79
96
|
promptEnabled: prompt.settings && toggle(prompt.label)
|
|
80
97
|
},
|
|
81
98
|
Properties: {
|
|
82
99
|
teacherInstructionsEnabled:
|
|
83
100
|
teacherInstructions.settings &&
|
|
84
|
-
toggle(teacherInstructions.label)
|
|
85
|
-
|
|
101
|
+
toggle(teacherInstructions.label),
|
|
102
|
+
spellCheckEnabled:
|
|
103
|
+
spellCheck.settings && toggle(spellCheck.label),
|
|
104
|
+
},
|
|
86
105
|
}}
|
|
87
106
|
/>
|
|
88
107
|
}
|
|
@@ -98,6 +117,10 @@ export class Root extends React.Component {
|
|
|
98
117
|
onChange={this.onTeacherInstructionsChanged}
|
|
99
118
|
imageSupport={imageSupport}
|
|
100
119
|
nonEmpty={false}
|
|
120
|
+
toolbarOpts={toolbarOpts}
|
|
121
|
+
spellCheck={spellCheckEnabled}
|
|
122
|
+
maxImageWidth={maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth}
|
|
123
|
+
maxImageHeight={maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight}
|
|
101
124
|
/>
|
|
102
125
|
</InputContainer>
|
|
103
126
|
)}
|
|
@@ -107,11 +130,16 @@ export class Root extends React.Component {
|
|
|
107
130
|
<EditableHtml
|
|
108
131
|
markup={model.prompt}
|
|
109
132
|
onChange={this.onPromptChanged}
|
|
133
|
+
toolbarOpts={toolbarOpts}
|
|
134
|
+
spellCheck={spellCheckEnabled}
|
|
135
|
+
imageSupport={imageSupport}
|
|
136
|
+
maxImageWidth={defaultImageMaxWidth}
|
|
137
|
+
maxImageHeight={defaultImageMaxHeight}
|
|
110
138
|
/>
|
|
111
139
|
</InputContainer>
|
|
112
140
|
)}
|
|
113
141
|
|
|
114
|
-
{
|
|
142
|
+
{backgroundImageEnabled && (
|
|
115
143
|
<div>
|
|
116
144
|
<Typography className={classes.label} variant="subheading">
|
|
117
145
|
Define Background Image
|
|
@@ -121,6 +149,7 @@ export class Root extends React.Component {
|
|
|
121
149
|
imageUrl={model.imageUrl}
|
|
122
150
|
onUpdateImageDimension={this.onUpdateImageDimension}
|
|
123
151
|
onImageUpload={this.onImageUpload}
|
|
152
|
+
imageDimensions={model.imageDimensions}
|
|
124
153
|
/>
|
|
125
154
|
</div>
|
|
126
155
|
)}
|
|
@@ -131,20 +160,20 @@ export class Root extends React.Component {
|
|
|
131
160
|
}
|
|
132
161
|
}
|
|
133
162
|
|
|
134
|
-
const styles = theme => ({
|
|
163
|
+
const styles = (theme) => ({
|
|
135
164
|
base: {
|
|
136
|
-
marginTop: theme.spacing.unit * 3
|
|
165
|
+
marginTop: theme.spacing.unit * 3,
|
|
137
166
|
},
|
|
138
167
|
label: {
|
|
139
|
-
marginTop: theme.spacing.unit * 4
|
|
168
|
+
marginTop: theme.spacing.unit * 4,
|
|
140
169
|
},
|
|
141
170
|
prompt: {
|
|
142
171
|
paddingTop: theme.spacing.unit * 2,
|
|
143
|
-
width: '100%'
|
|
172
|
+
width: '100%',
|
|
144
173
|
},
|
|
145
174
|
regular: {
|
|
146
|
-
marginBottom: theme.spacing.unit * 3
|
|
147
|
-
}
|
|
175
|
+
marginBottom: theme.spacing.unit * 3,
|
|
176
|
+
},
|
|
148
177
|
});
|
|
149
178
|
|
|
150
179
|
Root.propTypes = {
|
|
@@ -153,7 +182,7 @@ Root.propTypes = {
|
|
|
153
182
|
model: PropTypes.object.isRequired,
|
|
154
183
|
imageSupport: PropTypes.shape({
|
|
155
184
|
add: PropTypes.func,
|
|
156
|
-
delete: PropTypes.func
|
|
185
|
+
delete: PropTypes.func,
|
|
157
186
|
}),
|
|
158
187
|
onModelChanged: PropTypes.func.isRequired,
|
|
159
188
|
onConfigurationChanged: PropTypes.func.isRequired,
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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
|
+
|
|
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)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/drawing-response-controller
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/drawing-response-controller@3.2.2...@pie-element/drawing-response-controller@3.2.3) (2021-11-11)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/drawing-response-controller
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [3.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/drawing-response-controller@3.2.0...@pie-element/drawing-response-controller@3.2.2) (2021-08-05)
|
|
7
31
|
|
|
8
32
|
|
package/controller/lib/index.js
CHANGED
|
@@ -5,9 +5,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.createDefaultModel = void 0;
|
|
8
9
|
exports.model = model;
|
|
10
|
+
exports.normalize = void 0;
|
|
9
11
|
exports.outcome = outcome;
|
|
10
|
-
exports.createDefaultModel = exports.normalize = void 0;
|
|
11
12
|
|
|
12
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
14
|
|
|
@@ -15,9 +16,9 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
15
16
|
|
|
16
17
|
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
17
18
|
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
19
|
+
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; }
|
|
19
20
|
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
21
|
+
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; }
|
|
21
22
|
|
|
22
23
|
var log = (0, _debug["default"])('pie-elements:drawing-response:controller');
|
|
23
24
|
|
|
@@ -25,7 +26,8 @@ var normalize = function normalize(question) {
|
|
|
25
26
|
return _objectSpread({
|
|
26
27
|
promptEnabled: true,
|
|
27
28
|
teacherInstructionsEnabled: true,
|
|
28
|
-
studentInstructionsEnabled: true
|
|
29
|
+
studentInstructionsEnabled: true,
|
|
30
|
+
backgroundImageEnabled: true
|
|
29
31
|
}, question);
|
|
30
32
|
};
|
|
31
33
|
|
|
@@ -36,14 +38,16 @@ function model(question, session, env) {
|
|
|
36
38
|
var imageUrl = normalizedQuestion.imageUrl,
|
|
37
39
|
imageDimensions = normalizedQuestion.imageDimensions,
|
|
38
40
|
prompt = normalizedQuestion.prompt,
|
|
39
|
-
promptEnabled = normalizedQuestion.promptEnabled
|
|
41
|
+
promptEnabled = normalizedQuestion.promptEnabled,
|
|
42
|
+
backgroundImageEnabled = normalizedQuestion.backgroundImageEnabled;
|
|
40
43
|
return new Promise(function (resolve) {
|
|
41
44
|
var out = {
|
|
42
45
|
disabled: env.mode !== 'gather',
|
|
43
46
|
mode: env.mode,
|
|
44
47
|
imageDimensions: imageDimensions,
|
|
45
48
|
imageUrl: imageUrl,
|
|
46
|
-
prompt: promptEnabled ? prompt : null
|
|
49
|
+
prompt: promptEnabled ? prompt : null,
|
|
50
|
+
backgroundImageEnabled: backgroundImageEnabled
|
|
47
51
|
};
|
|
48
52
|
|
|
49
53
|
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
@@ -65,9 +69,9 @@ var createDefaultModel = function createDefaultModel() {
|
|
|
65
69
|
|
|
66
70
|
exports.createDefaultModel = createDefaultModel;
|
|
67
71
|
|
|
68
|
-
function
|
|
69
|
-
/*config, session*/
|
|
70
|
-
{
|
|
72
|
+
function
|
|
73
|
+
/*config, session*/
|
|
74
|
+
outcome() {
|
|
71
75
|
return new Promise(function (resolve) {
|
|
72
76
|
log('outcome...');
|
|
73
77
|
resolve({
|
|
@@ -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":"
|
|
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;AAAiB;AAARgB,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"}
|
package/controller/package.json
CHANGED
|
@@ -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
|
});
|
package/controller/src/index.js
CHANGED
|
@@ -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')) {
|
package/docs/config-schema.json
CHANGED
|
@@ -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",
|
|
@@ -72,6 +88,48 @@
|
|
|
72
88
|
}
|
|
73
89
|
}
|
|
74
90
|
},
|
|
91
|
+
"maxImageWidth": {
|
|
92
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"teacherInstructions": {
|
|
96
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
97
|
+
"type": "number",
|
|
98
|
+
"title": "teacherInstructions"
|
|
99
|
+
},
|
|
100
|
+
"prompt": {
|
|
101
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
102
|
+
"type": "number",
|
|
103
|
+
"title": "prompt"
|
|
104
|
+
},
|
|
105
|
+
"rationale": {
|
|
106
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
107
|
+
"type": "number",
|
|
108
|
+
"title": "rationale"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"maxImageHeight": {
|
|
113
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
114
|
+
"type": "object",
|
|
115
|
+
"properties": {
|
|
116
|
+
"teacherInstructions": {
|
|
117
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
118
|
+
"type": "number",
|
|
119
|
+
"title": "teacherInstructions"
|
|
120
|
+
},
|
|
121
|
+
"prompt": {
|
|
122
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
123
|
+
"type": "number",
|
|
124
|
+
"title": "prompt"
|
|
125
|
+
},
|
|
126
|
+
"rationale": {
|
|
127
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
128
|
+
"type": "number",
|
|
129
|
+
"title": "rationale"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
75
133
|
"showPrompt": {
|
|
76
134
|
"description": "Determines whether prompt field will be displayed or not",
|
|
77
135
|
"default": true,
|
|
@@ -122,6 +180,27 @@
|
|
|
122
180
|
"title": "label"
|
|
123
181
|
}
|
|
124
182
|
}
|
|
183
|
+
},
|
|
184
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
185
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
186
|
+
"type": "object",
|
|
187
|
+
"properties": {
|
|
188
|
+
"teacherInstructions": {
|
|
189
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
190
|
+
"type": "number",
|
|
191
|
+
"title": "teacherInstructions"
|
|
192
|
+
},
|
|
193
|
+
"prompt": {
|
|
194
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
195
|
+
"type": "number",
|
|
196
|
+
"title": "prompt"
|
|
197
|
+
},
|
|
198
|
+
"rationale": {
|
|
199
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
200
|
+
"type": "number",
|
|
201
|
+
"title": "rationale"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
125
204
|
}
|
|
126
205
|
},
|
|
127
206
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -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:
|
|
@@ -55,6 +67,38 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
55
67
|
|
|
56
68
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
57
69
|
|
|
70
|
+
# `maxImageWidth` (object)
|
|
71
|
+
|
|
72
|
+
Properties of the `maxImageWidth` object:
|
|
73
|
+
|
|
74
|
+
## `teacherInstructions` (number)
|
|
75
|
+
|
|
76
|
+
Indicates the max dimension for images in teacher instructions
|
|
77
|
+
|
|
78
|
+
## `prompt` (number)
|
|
79
|
+
|
|
80
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
81
|
+
|
|
82
|
+
## `rationale` (number)
|
|
83
|
+
|
|
84
|
+
Indicates the max dimension for images in rationale
|
|
85
|
+
|
|
86
|
+
# `maxImageHeight` (object)
|
|
87
|
+
|
|
88
|
+
Properties of the `maxImageHeight` object:
|
|
89
|
+
|
|
90
|
+
## `teacherInstructions` (number)
|
|
91
|
+
|
|
92
|
+
Indicates the max dimension for images in teacher instructions
|
|
93
|
+
|
|
94
|
+
## `prompt` (number)
|
|
95
|
+
|
|
96
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
97
|
+
|
|
98
|
+
## `rationale` (number)
|
|
99
|
+
|
|
100
|
+
Indicates the max dimension for images in rationale
|
|
101
|
+
|
|
58
102
|
# `showPrompt` (boolean)
|
|
59
103
|
|
|
60
104
|
Determines whether prompt field will be displayed or not
|
|
@@ -100,4 +144,20 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
100
144
|
|
|
101
145
|
### `label` (string)
|
|
102
146
|
|
|
103
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
147
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
148
|
+
|
|
149
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
150
|
+
|
|
151
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
152
|
+
|
|
153
|
+
### `teacherInstructions` (number)
|
|
154
|
+
|
|
155
|
+
Indicates the max dimension for images in teacher instructions
|
|
156
|
+
|
|
157
|
+
### `prompt` (number)
|
|
158
|
+
|
|
159
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
160
|
+
|
|
161
|
+
### `rationale` (number)
|
|
162
|
+
|
|
163
|
+
Indicates the max dimension for images in rationale
|
package/docs/demo/generate.js
CHANGED
package/docs/pie-schema.json
CHANGED
|
@@ -63,6 +63,26 @@
|
|
|
63
63
|
"type": "boolean",
|
|
64
64
|
"title": "teacherInstructionsEnabled"
|
|
65
65
|
},
|
|
66
|
+
"spellCheckEnabled": {
|
|
67
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
68
|
+
"type": "boolean",
|
|
69
|
+
"title": "spellCheckEnabled"
|
|
70
|
+
},
|
|
71
|
+
"backgroundImageEnabled": {
|
|
72
|
+
"description": "Indicates if Background Image is enabled",
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"title": "backgroundImageEnabled"
|
|
75
|
+
},
|
|
76
|
+
"toolbarEditorPosition": {
|
|
77
|
+
"description": "Indicates the editor's toolbar position which can be 'bottom' or 'top'",
|
|
78
|
+
"default": ": 'bottom'",
|
|
79
|
+
"enum": [
|
|
80
|
+
"bottom",
|
|
81
|
+
"top"
|
|
82
|
+
],
|
|
83
|
+
"type": "string",
|
|
84
|
+
"title": "toolbarEditorPosition"
|
|
85
|
+
},
|
|
66
86
|
"id": {
|
|
67
87
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
68
88
|
"type": "string",
|
|
@@ -75,9 +95,11 @@
|
|
|
75
95
|
}
|
|
76
96
|
},
|
|
77
97
|
"required": [
|
|
98
|
+
"backgroundImageEnabled",
|
|
78
99
|
"element",
|
|
79
100
|
"id",
|
|
80
101
|
"imageDimensions",
|
|
102
|
+
"spellCheckEnabled",
|
|
81
103
|
"studentInstructionsEnabled",
|
|
82
104
|
"teacherInstructionsEnabled"
|
|
83
105
|
],
|
|
@@ -119,6 +141,27 @@
|
|
|
119
141
|
}
|
|
120
142
|
}
|
|
121
143
|
},
|
|
144
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
145
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
146
|
+
"type": "object",
|
|
147
|
+
"properties": {
|
|
148
|
+
"teacherInstructions": {
|
|
149
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
150
|
+
"type": "number",
|
|
151
|
+
"title": "teacherInstructions"
|
|
152
|
+
},
|
|
153
|
+
"prompt": {
|
|
154
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
155
|
+
"type": "number",
|
|
156
|
+
"title": "prompt"
|
|
157
|
+
},
|
|
158
|
+
"rationale": {
|
|
159
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
160
|
+
"type": "number",
|
|
161
|
+
"title": "rationale"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
122
165
|
"Dimension": {
|
|
123
166
|
"title": "Dimension",
|
|
124
167
|
"type": "object",
|