@pie-element/extended-text-entry 10.7.1-next.33 → 10.7.1-next.43
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/configure/lib/defaults.js +4 -2
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/main.js +17 -2
- package/configure/lib/main.js.map +1 -1
- package/controller/lib/index.js +28 -1
- package/controller/lib/index.js.map +1 -1
- package/docs/config-schema.json +24 -9
- package/docs/config-schema.json.md +24 -12
- package/docs/pie-schema.json +9 -4
- package/docs/pie-schema.json.md +10 -6
- package/module/configure.js +38 -14
- package/module/controller.js +16 -1
- package/package.json +2 -2
|
@@ -97,7 +97,8 @@ var _default = {
|
|
|
97
97
|
image: {
|
|
98
98
|
disabled: false
|
|
99
99
|
}
|
|
100
|
-
}
|
|
100
|
+
},
|
|
101
|
+
required: false
|
|
101
102
|
},
|
|
102
103
|
teacherInstructions: {
|
|
103
104
|
settings: true,
|
|
@@ -112,7 +113,8 @@ var _default = {
|
|
|
112
113
|
image: {
|
|
113
114
|
disabled: false
|
|
114
115
|
}
|
|
115
|
-
}
|
|
116
|
+
},
|
|
117
|
+
required: false
|
|
116
118
|
},
|
|
117
119
|
maxImageWidth: {
|
|
118
120
|
teacherInstructions: 300,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","dimensions","height","width","prompt","mathInput","spanishInput","specialInput","equationEditor","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","spellCheckEnabled","playerSpellCheckDisabled","toolbarEditorPosition","configuration","baseInputConfiguration","audio","disabled","video","image","settings","label","spellCheck","enabled","playerSpellCheck","feedback","settingsPanelDisabled","multiple","studentInstructions","inputConfiguration","teacherInstructions","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAA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GdE,MAAAA,OAAO,EAAE;AAHK,KApBH;AAyBbE,IAAAA,QAAQ,EAAE;AACRL,MAAAA,QAAQ,EAAE,IADF;AAERC,MAAAA,KAAK,EAAE;AAFC,KAzBG;AA6BbnB,IAAAA,SAAS,EAAE;AACTkB,MAAAA,QAAQ,EAAE,IADD;AAETC,MAAAA,KAAK,EAAE,4CAFE;AAGTE,MAAAA,OAAO,EAAE;AAHA,KA7BE;AAkCbG,IAAAA,qBAAqB,EAAE,KAlCV;AAmCbvB,IAAAA,YAAY,EAAE;AACZiB,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE,6BAFK;AAGZE,MAAAA,OAAO,EAAE;AAHG,KAnCD;AAwCbnB,IAAAA,YAAY,EAAE;AACZgB,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE,wCAFK;AAGZE,MAAAA,OAAO,EAAE;AAHG,KAxCD;AA6CbI,IAAAA,QAAQ,EAAE;AACRP,MAAAA,QAAQ,EAAE,KADF;AAERC,MAAAA,KAAK,EAAE,gBAFC;AAGRE,MAAAA,OAAO,EAAE;AAHD,KA7CG;AAkDbK,IAAAA,mBAAmB,EAAE;AACnBR,MAAAA,QAAQ,EAAE,KADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KAlDR;AAsDbpB,IAAAA,MAAM,EAAE;AACNmB,MAAAA,QAAQ,EAAE,IADJ;AAENC,MAAAA,KAAK,EAAE,QAFD;AAGNQ,MAAAA,kBAAkB,EAAE;AAClBb,QAAAA,KAAK,EAAE;AAAEC,UAAAA,QAAQ,EAAE;AAAZ,SADW;AAElBC,QAAAA,KAAK,EAAE;AAAED,UAAAA,QAAQ,EAAE;AAAZ,SAFW;AAGlBE,QAAAA,KAAK,EAAE;AAAEF,UAAAA,QAAQ,EAAE;AAAZ;AAHW;
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","dimensions","height","width","prompt","mathInput","spanishInput","specialInput","equationEditor","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","spellCheckEnabled","playerSpellCheckDisabled","toolbarEditorPosition","configuration","baseInputConfiguration","audio","disabled","video","image","settings","label","spellCheck","enabled","playerSpellCheck","feedback","settingsPanelDisabled","multiple","studentInstructions","inputConfiguration","required","teacherInstructions","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,GADE;AAEVC,MAAAA,KAAK,EAAE;AAFG,KADP;AAKLC,IAAAA,MAAM,EAAE,6BALH;AAMLC,IAAAA,SAAS,EAAE,KANN;AAOLC,IAAAA,YAAY,EAAE,KAPT;AAQLC,IAAAA,YAAY,EAAE,KART;AASLC,IAAAA,cAAc,EAAE,cATX;AAULC,IAAAA,eAAe,EAAE,KAVZ;AAWLC,IAAAA,gBAAgB,EAAE,IAXb;AAYLC,IAAAA,aAAa,EAAE,IAZV;AAaLC,IAAAA,0BAA0B,EAAE,IAbvB;AAcLC,IAAAA,0BAA0B,EAAE,IAdvB;AAeLC,IAAAA,iBAAiB,EAAE,IAfd;AAgBLC,IAAAA,wBAAwB,EAAE,IAhBrB;AAiBLC,IAAAA,qBAAqB,EAAE;AAjBlB,GADM;AAoBbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,sBAAsB,EAAE;AACtBC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OADe;AAEtBC,MAAAA,KAAK,EAAE;AAAED,QAAAA,QAAQ,EAAE;AAAZ,OAFe;AAGtBE,MAAAA,KAAK,EAAE;AAAEF,QAAAA,QAAQ,EAAE;AAAZ;AAHe,KADX;AAMbnB,IAAAA,UAAU,EAAE;AACVsB,MAAAA,QAAQ,EAAE,IADA;AAEVC,MAAAA,KAAK,EAAE;AAFG,KANC;AAUbC,IAAAA,UAAU,EAAE;AACVD,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GNQ,MAAAA,kBAAkB,EAAE;AAClBb,QAAAA,KAAK,EAAE;AAAEC,UAAAA,QAAQ,EAAE;AAAZ,SADW;AAElBC,QAAAA,KAAK,EAAE;AAAED,UAAAA,QAAQ,EAAE;AAAZ,SAFW;AAGlBE,QAAAA,KAAK,EAAE;AAAEF,UAAAA,QAAQ,EAAE;AAAZ;AAHW,OAHd;AAQNa,MAAAA,QAAQ,EAAE;AARJ,KAtDK;AAgEbC,IAAAA,mBAAmB,EAAE;AACnBX,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE,sBAFY;AAGnBQ,MAAAA,kBAAkB,EAAE;AAClBb,QAAAA,KAAK,EAAE;AAAEC,UAAAA,QAAQ,EAAE;AAAZ,SADW;AAElBC,QAAAA,KAAK,EAAE;AAAED,UAAAA,QAAQ,EAAE;AAAZ,SAFW;AAGlBE,QAAAA,KAAK,EAAE;AAAEF,UAAAA,QAAQ,EAAE;AAAZ;AAHW,OAHD;AAQnBa,MAAAA,QAAQ,EAAE;AARS,KAhER;AA0EbE,IAAAA,aAAa,EAAE;AACbD,MAAAA,mBAAmB,EAAE,GADR;AAEb9B,MAAAA,MAAM,EAAE;AAFK,KA1EF;AA8EbgC,IAAAA,cAAc,EAAE;AACdF,MAAAA,mBAAmB,EAAE,GADP;AAEd9B,MAAAA,MAAM,EAAE;AAFM,KA9EH;AAkFbiC,IAAAA,UAAU,EAAE;AACVd,MAAAA,QAAQ,EAAE,KADA;AAEVC,MAAAA,KAAK,EAAE;AAFG,KAlFC;AAsFbc,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC;AAtFF;AApBF,C","sourcesContent":["export default {\n model: {\n dimensions: {\n height: 100,\n width: 500,\n },\n prompt: 'This is the question prompt',\n mathInput: false,\n spanishInput: false,\n specialInput: false,\n equationEditor: 'Grade 8 - HS',\n feedbackEnabled: false,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n spellCheckEnabled: true,\n playerSpellCheckDisabled: true,\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n baseInputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n dimensions: {\n settings: true,\n label: 'Text-Entry Display Size',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n playerSpellCheck: {\n label: 'Disable Student Spellcheck',\n settings: true,\n enabled: true,\n },\n equationEditor: {\n settings: false,\n label: 'Equation Editor',\n enabled: true,\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n mathInput: {\n settings: true,\n label: 'Student response can include math notation',\n enabled: false,\n },\n settingsPanelDisabled: false,\n spanishInput: {\n settings: true,\n label: 'Students can insert Spanish',\n enabled: false,\n },\n specialInput: {\n settings: true,\n label: 'Students can insert Special Characters',\n enabled: false,\n },\n multiple: {\n settings: false,\n label: 'Multiple Parts',\n enabled: false,\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n prompt: {\n settings: true,\n label: 'Prompt',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n },\n};\n"],"file":"defaults.js"}
|
package/configure/lib/main.js
CHANGED
|
@@ -148,12 +148,16 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
148
148
|
baseInputConfiguration = _ref$baseInputConfigu === void 0 ? {} : _ref$baseInputConfigu;
|
|
149
149
|
|
|
150
150
|
var _ref2 = model || {},
|
|
151
|
+
_ref2$errors = _ref2.errors,
|
|
152
|
+
errors = _ref2$errors === void 0 ? {} : _ref2$errors,
|
|
151
153
|
feedbackEnabled = _ref2.feedbackEnabled,
|
|
152
154
|
promptEnabled = _ref2.promptEnabled,
|
|
153
155
|
spellCheckEnabled = _ref2.spellCheckEnabled,
|
|
154
156
|
teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
|
|
155
157
|
toolbarEditorPosition = _ref2.toolbarEditorPosition;
|
|
156
158
|
|
|
159
|
+
var promptError = errors.prompt,
|
|
160
|
+
teacherInstructionsError = errors.teacherInstructions;
|
|
157
161
|
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
158
162
|
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
159
163
|
var toolbarOpts = {
|
|
@@ -220,6 +224,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
220
224
|
onChange: this.changeTeacherInstructions,
|
|
221
225
|
imageSupport: imageSupport,
|
|
222
226
|
nonEmpty: false,
|
|
227
|
+
error: teacherInstructionsError,
|
|
223
228
|
toolbarOpts: toolbarOpts,
|
|
224
229
|
spellCheck: spellCheckEnabled,
|
|
225
230
|
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
@@ -232,7 +237,9 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
232
237
|
}],
|
|
233
238
|
mathMlOptions: mathMlOptions,
|
|
234
239
|
pluginProps: getPluginProps(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration)
|
|
235
|
-
})
|
|
240
|
+
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
241
|
+
className: classes.errorText
|
|
242
|
+
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
236
243
|
label: prompt.label,
|
|
237
244
|
className: classes.promptContainer
|
|
238
245
|
}, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
|
|
@@ -242,6 +249,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
242
249
|
onChange: this.onPromptChange,
|
|
243
250
|
imageSupport: imageSupport,
|
|
244
251
|
nonEmpty: false,
|
|
252
|
+
error: promptError,
|
|
245
253
|
toolbarOpts: toolbarOpts,
|
|
246
254
|
spellCheck: spellCheckEnabled,
|
|
247
255
|
maxImageWidth: defaultImageMaxWidth,
|
|
@@ -254,7 +262,9 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
254
262
|
}],
|
|
255
263
|
mathMlOptions: mathMlOptions,
|
|
256
264
|
pluginProps: getPluginProps(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration)
|
|
257
|
-
})
|
|
265
|
+
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
266
|
+
className: classes.errorText
|
|
267
|
+
}, promptError)), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
258
268
|
className: classes.header,
|
|
259
269
|
variant: "subheading"
|
|
260
270
|
}, "Feedback"), /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackSelector, {
|
|
@@ -288,6 +298,11 @@ var _default = (0, _styles.withStyles)(function (theme) {
|
|
|
288
298
|
paddingTop: theme.spacing.unit * 2,
|
|
289
299
|
marginBottom: theme.spacing.unit * 2,
|
|
290
300
|
width: '100%'
|
|
301
|
+
},
|
|
302
|
+
errorText: {
|
|
303
|
+
fontSize: theme.typography.fontSize - 2,
|
|
304
|
+
color: theme.palette.error.main,
|
|
305
|
+
paddingTop: theme.spacing.unit
|
|
291
306
|
}
|
|
292
307
|
};
|
|
293
308
|
})(Main);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","numberFields","dropdown","defaultFeedback","type","Main","props","markup","onModelChanged","model","prompt","feedback","update","teacherInstructions","state","setDimensions","classes","configuration","imageSupport","onConfigurationChanged","uploadSoundSupport","contentDimensions","dimensions","equationEditor","playerSpellCheck","settingsPanelDisabled","spanishInput","specialInput","spellCheck","studentInstructions","mathInput","maxImageWidth","maxImageHeight","multiple","withRubric","mathMlOptions","baseInputConfiguration","feedbackEnabled","promptEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","label","enabled","width","suffix","min","max","height","playerSpellCheckDisabled","panelProperties","studentInstructionsEnabled","rubricEnabled","getPluginProps","Object","assign","config","Settings","Properties","promptContainer","changeTeacherInstructions","language","inputConfiguration","ALL_PLUGINS","onPromptChange","header","changeFeedback","React","Component","PropTypes","func","isRequired","object","theme","paddingBottom","spacing","unit","paddingTop","marginBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,KAAR,GAAkDC,kBAAlD,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAAkDD,kBAAlD,CAAeC,MAAf;AAAA,IAAuBC,YAAvB,GAAkDF,kBAAlD,CAAuBE,YAAvB;AAAA,IAAqCC,QAArC,GAAkDH,kBAAlD,CAAqCG,QAArC;AAEA,IAAMC,eAAe,GAAG;AACtBC,EAAAA,IAAI,EAAE,SADgB;AAEtB,aAAS;AAFa,CAAxB;;IAKaC,I;;;;;AAWX,gBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,uGAKF,UAACC,MAAD,EAAY;AAC3B,wBAAkC,MAAKD,KAAvC;AAAA,UAAQE,cAAR,eAAQA,cAAR;AAAA,UAAwBC,KAAxB,eAAwBA,KAAxB;AAEAD,MAAAA,cAAc,iCAAMC,KAAN;AAAaC,QAAAA,MAAM,EAAEH;AAArB,SAAd;AACD,KATkB;AAAA,uGAWF,UAACI,QAAD,EAAc;AAC7B,yBAA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AiBD,UAJf;AAKjB1D,EAAAA,YAAY,EAAEwD,sBAAUG,MAAV,CAAiBD,UALd;AAMjBxD,EAAAA,kBAAkB,EAAEsD,sBAAUG,MAAV,CAAiBD,UANpB;AAOjB5D,EAAAA,OAAO,EAAE0D,sBAAUG,MAAV,CAAiBD;AAPT,C;;eA+LN,wBAAW,UAACE,KAAD;AAAA,SAAY;AACpCR,IAAAA,MAAM,EAAE;AACNS,MAAAA,aAAa,EAAED,KAAK,CAACE,OAAN,CAAcC;AADvB,KAD4B;AAIpCjB,IAAAA,eAAe,EAAE;AACfkB,MAAAA,UAAU,EAAEJ,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CADlB;AAEfE,MAAAA,YAAY,EAAEL,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAFpB;AAGfhC,MAAAA,KAAK,EAAE;AAHQ;AAJmB,GAAZ;AAAA,CAAX,EASX5C,IATW,C","sourcesContent":["import React from 'react';\nimport { FeedbackSelector, InputContainer, settings, layout } from '@pie-lib/pie-toolbox/config-ui';\nimport PropTypes from 'prop-types';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport { EditableHtml, ALL_PLUGINS } from '@pie-lib/pie-toolbox/editable-html';\n\nconst { Panel, toggle, numberFields, dropdown } = settings;\n\nconst defaultFeedback = {\n type: 'default',\n default: 'Your answer has been submitted',\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n imageSupport: PropTypes.object.isRequired,\n uploadSoundSupport: PropTypes.object.isRequired,\n classes: PropTypes.object.isRequired,\n };\n\n constructor(props) {\n super(props);\n this.state = { setDimensions: true };\n }\n\n onPromptChange = (markup) => {\n const { onModelChanged, model } = this.props;\n\n onModelChanged({ ...model, prompt: markup });\n };\n\n changeFeedback = (feedback) => {\n const { model, onModelChanged } = this.props;\n const update = { ...model, feedback };\n\n onModelChanged(update);\n };\n\n changeTeacherInstructions = (teacherInstructions) => {\n const { model, onModelChanged } = this.props;\n const update = { ...model, teacherInstructions };\n\n onModelChanged(update);\n };\n\n render() {\n const { model, classes, configuration, imageSupport, onConfigurationChanged, onModelChanged, uploadSoundSupport } =\n this.props;\n const {\n contentDimensions = {},\n dimensions = {},\n equationEditor = {},\n feedback = {},\n playerSpellCheck = {},\n prompt = {},\n settingsPanelDisabled,\n spanishInput = {},\n specialInput = {},\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n mathInput = {},\n maxImageWidth = {},\n maxImageHeight = {},\n multiple = {},\n withRubric = {},\n mathMlOptions = {},\n baseInputConfiguration = {},\n } = configuration || {};\n const { feedbackEnabled, promptEnabled, spellCheckEnabled, teacherInstructionsEnabled, toolbarEditorPosition } =\n model || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n mathInput: mathInput.settings && toggle(mathInput.label),\n equationEditor:\n equationEditor.enabled &&\n model.mathInput &&\n dropdown(equationEditor.label, [\n 'non-negative-integers',\n 'integers',\n 'decimals',\n 'fractions',\n 'Grade 1 - 2',\n 'Grade 3 - 5',\n 'Grade 6 - 7',\n 'Grade 8 - HS',\n 'geometry',\n 'advanced-algebra',\n 'statistics',\n 'item-authoring',\n ]),\n spanishInput: spanishInput.settings && toggle(spanishInput.label),\n specialInput: specialInput.settings && toggle(specialInput.label),\n dimensions: numberFields(dimensions.label, {\n width: { label: 'Width (px)', suffix: 'px', min: 100, max: 500 },\n height: { label: 'Height (px)', suffix: 'px', min: 100, max: 500 },\n }),\n 'multiple.enabled': multiple.settings && toggle(multiple.label, true),\n promptEnabled: prompt.settings && toggle(prompt.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n playerSpellCheckDisabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props) => {\n return Object.assign(\n {\n ...baseInputConfiguration,\n },\n props || {},\n );\n };\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(config) => onConfigurationChanged(config)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.promptContainer}>\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.changeTeacherInstructions}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptContainer}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n className={classes.prompt}\n markup={model.prompt || ''}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n />\n </InputContainer>\n )}\n\n {feedbackEnabled && (\n <React.Fragment>\n <Typography className={classes.header} variant=\"subheading\">\n Feedback\n </Typography>\n\n <FeedbackSelector\n label=\"When submitted, show\"\n feedback={model.feedback || defaultFeedback}\n onChange={this.changeFeedback}\n toolbarOpts={toolbarOpts}\n />\n </React.Fragment>\n )}\n </layout.ConfigLayout>\n );\n }\n}\nexport default withStyles((theme) => ({\n header: {\n paddingBottom: theme.spacing.unit,\n },\n promptContainer: {\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n width: '100%',\n },\n}))(Main);\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","numberFields","dropdown","defaultFeedback","type","Main","props","markup","onModelChanged","model","prompt","feedback","update","teacherInstructions","state","setDimensions","classes","configuration","imageSupport","onConfigurationChanged","uploadSoundSupport","contentDimensions","dimensions","equationEditor","playerSpellCheck","settingsPanelDisabled","spanishInput","specialInput","spellCheck","studentInstructions","mathInput","maxImageWidth","maxImageHeight","multiple","withRubric","mathMlOptions","baseInputConfiguration","errors","feedbackEnabled","promptEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","teacherInstructionsError","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","label","enabled","width","suffix","min","max","height","playerSpellCheckDisabled","panelProperties","studentInstructionsEnabled","rubricEnabled","getPluginProps","Object","assign","config","Settings","Properties","promptContainer","changeTeacherInstructions","language","inputConfiguration","errorText","ALL_PLUGINS","onPromptChange","header","changeFeedback","React","Component","PropTypes","func","isRequired","object","theme","paddingBottom","spacing","unit","paddingTop","marginBottom","fontSize","typography","color","palette","error","main"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA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AV,CAAiBD;AAPT,C;;eA0MN,wBAAW,UAACE,KAAD;AAAA,SAAY;AACpCR,IAAAA,MAAM,EAAE;AACNS,MAAAA,aAAa,EAAED,KAAK,CAACE,OAAN,CAAcC;AADvB,KAD4B;AAIpClB,IAAAA,eAAe,EAAE;AACfmB,MAAAA,UAAU,EAAEJ,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CADlB;AAEfE,MAAAA,YAAY,EAAEL,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAFpB;AAGfjC,MAAAA,KAAK,EAAE;AAHQ,KAJmB;AASpCmB,IAAAA,SAAS,EAAE;AACTiB,MAAAA,QAAQ,EAAEN,KAAK,CAACO,UAAN,CAAiBD,QAAjB,GAA4B,CAD7B;AAETE,MAAAA,KAAK,EAAER,KAAK,CAACS,OAAN,CAAcC,KAAd,CAAoBC,IAFlB;AAGTP,MAAAA,UAAU,EAAEJ,KAAK,CAACE,OAAN,CAAcC;AAHjB;AATyB,GAAZ;AAAA,CAAX,EAcXhF,IAdW,C","sourcesContent":["import React from 'react';\nimport { FeedbackSelector, InputContainer, settings, layout } from '@pie-lib/pie-toolbox/config-ui';\nimport PropTypes from 'prop-types';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport { EditableHtml, ALL_PLUGINS } from '@pie-lib/pie-toolbox/editable-html';\n\nconst { Panel, toggle, numberFields, dropdown } = settings;\n\nconst defaultFeedback = {\n type: 'default',\n default: 'Your answer has been submitted',\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n imageSupport: PropTypes.object.isRequired,\n uploadSoundSupport: PropTypes.object.isRequired,\n classes: PropTypes.object.isRequired,\n };\n\n constructor(props) {\n super(props);\n this.state = { setDimensions: true };\n }\n\n onPromptChange = (markup) => {\n const { onModelChanged, model } = this.props;\n\n onModelChanged({ ...model, prompt: markup });\n };\n\n changeFeedback = (feedback) => {\n const { model, onModelChanged } = this.props;\n const update = { ...model, feedback };\n\n onModelChanged(update);\n };\n\n changeTeacherInstructions = (teacherInstructions) => {\n const { model, onModelChanged } = this.props;\n const update = { ...model, teacherInstructions };\n\n onModelChanged(update);\n };\n\n render() {\n const { model, classes, configuration, imageSupport, onConfigurationChanged, onModelChanged, uploadSoundSupport } =\n this.props;\n const {\n contentDimensions = {},\n dimensions = {},\n equationEditor = {},\n feedback = {},\n playerSpellCheck = {},\n prompt = {},\n settingsPanelDisabled,\n spanishInput = {},\n specialInput = {},\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n mathInput = {},\n maxImageWidth = {},\n maxImageHeight = {},\n multiple = {},\n withRubric = {},\n mathMlOptions = {},\n baseInputConfiguration = {},\n } = configuration || {};\n const {\n errors = {},\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const { prompt: promptError, teacherInstructions: teacherInstructionsError } = errors;\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n mathInput: mathInput.settings && toggle(mathInput.label),\n equationEditor:\n equationEditor.enabled &&\n model.mathInput &&\n dropdown(equationEditor.label, [\n 'non-negative-integers',\n 'integers',\n 'decimals',\n 'fractions',\n 'Grade 1 - 2',\n 'Grade 3 - 5',\n 'Grade 6 - 7',\n 'Grade 8 - HS',\n 'geometry',\n 'advanced-algebra',\n 'statistics',\n 'item-authoring',\n ]),\n spanishInput: spanishInput.settings && toggle(spanishInput.label),\n specialInput: specialInput.settings && toggle(specialInput.label),\n dimensions: numberFields(dimensions.label, {\n width: { label: 'Width (px)', suffix: 'px', min: 100, max: 500 },\n height: { label: 'Height (px)', suffix: 'px', min: 100, max: 500 },\n }),\n 'multiple.enabled': multiple.settings && toggle(multiple.label, true),\n promptEnabled: prompt.settings && toggle(prompt.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n playerSpellCheckDisabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props) => {\n return Object.assign(\n {\n ...baseInputConfiguration,\n },\n props || {},\n );\n };\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(config) => onConfigurationChanged(config)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.promptContainer}>\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.changeTeacherInstructions}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n />\n {teacherInstructionsError && <div className={classes.errorText}>{teacherInstructionsError}</div>}\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptContainer}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n className={classes.prompt}\n markup={model.prompt || ''}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={promptError}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n />\n {promptError && <div className={classes.errorText}>{promptError}</div>}\n </InputContainer>\n )}\n\n {feedbackEnabled && (\n <React.Fragment>\n <Typography className={classes.header} variant=\"subheading\">\n Feedback\n </Typography>\n\n <FeedbackSelector\n label=\"When submitted, show\"\n feedback={model.feedback || defaultFeedback}\n onChange={this.changeFeedback}\n toolbarOpts={toolbarOpts}\n />\n </React.Fragment>\n )}\n </layout.ConfigLayout>\n );\n }\n}\nexport default withStyles((theme) => ({\n header: {\n paddingBottom: theme.spacing.unit,\n },\n promptContainer: {\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n width: '100%',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n}))(Main);\n"],"file":"main.js"}
|
package/controller/lib/index.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.createDefaultModel = createDefaultModel;
|
|
|
9
9
|
exports.model = model;
|
|
10
10
|
exports.normalize = void 0;
|
|
11
11
|
exports.outcome = outcome;
|
|
12
|
+
exports.validate = void 0;
|
|
12
13
|
|
|
13
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
15
|
|
|
@@ -145,7 +146,8 @@ function
|
|
|
145
146
|
/*question, session, env*/
|
|
146
147
|
outcome() {
|
|
147
148
|
return _outcome.apply(this, arguments);
|
|
148
|
-
}
|
|
149
|
+
} // remove all html tags
|
|
150
|
+
|
|
149
151
|
|
|
150
152
|
function _outcome() {
|
|
151
153
|
_outcome = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
@@ -168,4 +170,29 @@ function _outcome() {
|
|
|
168
170
|
}));
|
|
169
171
|
return _outcome.apply(this, arguments);
|
|
170
172
|
}
|
|
173
|
+
|
|
174
|
+
var getInnerText = function getInnerText(html) {
|
|
175
|
+
return (html || '').replaceAll(/<[^>]*>/g, '');
|
|
176
|
+
}; // remove all html tags except img and iframe
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
var getContent = function getContent(html) {
|
|
180
|
+
return (html || '').replace(/(<(?!img|iframe)([^>]+)>)/gi, '');
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
var validate = function validate() {
|
|
184
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
185
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
186
|
+
var errors = {};
|
|
187
|
+
['teacherInstructions', 'prompt'].forEach(function (field) {
|
|
188
|
+
var _config$field;
|
|
189
|
+
|
|
190
|
+
if ((_config$field = config[field]) !== null && _config$field !== void 0 && _config$field.required && !getContent(model[field])) {
|
|
191
|
+
errors[field] = 'This field is required.';
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
return errors;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
exports.validate = validate;
|
|
171
198
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","createDefaultModel","model","defaults","normalize","question","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","playerSpellCheckDisabled","session","env","normalizedQuestion","fb","mode","feedback","Promise","resolve","undefined","teacherInstructions","role","equationEditor","then","prompt","dimensions","customKeys","disabled","mathInput","spanishInput","specialInput","spellCheckEnabled","playersToolbarPosition","outcome","score","completed","note"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","createDefaultModel","model","defaults","normalize","question","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","playerSpellCheckDisabled","session","env","normalizedQuestion","fb","mode","feedback","Promise","resolve","undefined","teacherInstructions","role","equationEditor","then","prompt","dimensions","customKeys","disabled","mathInput","spanishInput","specialInput","spellCheckEnabled","playersToolbarPosition","outcome","score","completed","note","getInnerText","html","replaceAll","getContent","replace","validate","config","errors","forEach","field","required"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AAEA;;;;;;AAHA,IAAMA,GAAG,GAAG,uBAAM,6CAAN,CAAZ;;SAKsBC,kB;;;;;sGAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAkCC,YAAAA,KAAlC,2DAA0C,EAA1C;AACLF,YAAAA,GAAG,CAAC,sBAAD,EAAyBE,KAAzB,CAAH;AADK,6EAIAC,oBAJA,GAKAD,KALA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AASA,IAAME,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA,yCACpBF,oBADoB;AAEvBG,IAAAA,eAAe,EAAE,KAFM;AAGvBC,IAAAA,gBAAgB,EAAE,IAHK;AAIvBC,IAAAA,aAAa,EAAE,IAJQ;AAKvBC,IAAAA,0BAA0B,EAAE,IALL;AAMvBC,IAAAA,0BAA0B,EAAE,IANL;AAOvBC,IAAAA,wBAAwB,EAAE;AAPH,KAQpBN,QARoB;AAAA,CAAlB;;;;SAWeH,K;;;;;yFAAf,kBAAqBG,QAArB,EAA+BO,OAA/B,EAAwCC,GAAxC;AAAA;AAAA;AAAA;AAAA;AAAA;AACLb,YAAAA,GAAG,CAAC,YAAD,EAAeK,QAAf,CAAH;AACMS,YAAAA,kBAFD,GAEsBV,SAAS,CAACC,QAAD,CAF/B;AAICU,YAAAA,EAJD,GAKHF,GAAG,CAACG,IAAJ,KAA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BAAAH,MAAM,CAACG,KAAD,CAAN,wDAAeC,QAAf,IAA2B,CAACP,UAAU,CAACvC,KAAK,CAAC6C,KAAD,CAAN,CAA1C,EAA0D;AACxDF,MAAAA,MAAM,CAACE,KAAD,CAAN,GAAgB,yBAAhB;AACD;AACF,GAJD;AAMA,SAAOF,MAAP;AACD,CAVM","sourcesContent":["import debug from 'debug';\n\nconst log = debug('@pie-element:extended-text-entry:controller');\nimport { getFeedback } from '@pie-lib/pie-toolbox/feedback';\n\nimport defaults from './defaults';\n\nexport async function createDefaultModel(model = {}) {\n log('[createDefaultModel]', model);\n\n return {\n ...defaults,\n ...model,\n };\n}\n\nexport const normalize = (question) => ({\n ...defaults,\n feedbackEnabled: false,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n playerSpellCheckDisabled: true,\n ...question,\n});\n\nexport async function model(question, session, env) {\n log('[question]', question);\n const normalizedQuestion = normalize(question);\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')\n : Promise.resolve(undefined);\n\n let teacherInstructions = null;\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n teacherInstructions = null;\n }\n\n let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';\n\n switch (normalizedQuestion.equationEditor) {\n case 'Grade 1 - 2':\n equationEditor = 1;\n break;\n case 'Grade 3 - 5':\n equationEditor = 3;\n break;\n case 'Grade 6 - 7':\n equationEditor = 6;\n break;\n case 'Grade 8 - HS':\n equationEditor = 8;\n break;\n default:\n break;\n }\n\n return fb.then((feedback) => ({\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n dimensions: normalizedQuestion.dimensions,\n customKeys: normalizedQuestion.customKeys || [],\n disabled: env.mode !== 'gather',\n feedback,\n teacherInstructions,\n mathInput: normalizedQuestion.mathInput,\n spanishInput: normalizedQuestion.spanishInput,\n specialInput: normalizedQuestion.specialInput,\n equationEditor,\n spellCheckEnabled: !normalizedQuestion.playerSpellCheckDisabled,\n playersToolbarPosition: normalizedQuestion.playersToolbarPosition || 'bottom',\n }));\n}\n\nexport async function outcome(/*question, session, env*/) {\n return {\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring',\n };\n}\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img and iframe\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n return errors;\n};\n"],"file":"index.js"}
|
package/docs/config-schema.json
CHANGED
|
@@ -110,14 +110,14 @@
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"teacherInstructions": {
|
|
113
|
-
"title": "
|
|
113
|
+
"title": "EditableHtmlPluginConfigureRequired",
|
|
114
114
|
"type": "object",
|
|
115
115
|
"properties": {
|
|
116
116
|
"inputConfiguration": {
|
|
117
117
|
"title": "EditableHtmlConfigureProp",
|
|
118
118
|
"type": "object",
|
|
119
119
|
"properties": {
|
|
120
|
-
"
|
|
120
|
+
"math": {
|
|
121
121
|
"title": "EditableHtmlButtonConfigure",
|
|
122
122
|
"type": "object",
|
|
123
123
|
"properties": {
|
|
@@ -163,6 +163,11 @@
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
},
|
|
166
|
+
"required": {
|
|
167
|
+
"description": "Indicates if the item is required and the value cannot be empty",
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"title": "required"
|
|
170
|
+
},
|
|
166
171
|
"settings": {
|
|
167
172
|
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
168
173
|
"type": "boolean",
|
|
@@ -176,14 +181,14 @@
|
|
|
176
181
|
}
|
|
177
182
|
},
|
|
178
183
|
"prompt": {
|
|
179
|
-
"title": "
|
|
184
|
+
"title": "EditableHtmlPluginConfigureRequired",
|
|
180
185
|
"type": "object",
|
|
181
186
|
"properties": {
|
|
182
187
|
"inputConfiguration": {
|
|
183
188
|
"title": "EditableHtmlConfigureProp",
|
|
184
189
|
"type": "object",
|
|
185
190
|
"properties": {
|
|
186
|
-
"
|
|
191
|
+
"math": {
|
|
187
192
|
"title": "EditableHtmlButtonConfigure",
|
|
188
193
|
"type": "object",
|
|
189
194
|
"properties": {
|
|
@@ -229,6 +234,11 @@
|
|
|
229
234
|
}
|
|
230
235
|
}
|
|
231
236
|
},
|
|
237
|
+
"required": {
|
|
238
|
+
"description": "Indicates if the item is required and the value cannot be empty",
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"title": "required"
|
|
241
|
+
},
|
|
232
242
|
"settings": {
|
|
233
243
|
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
234
244
|
"type": "boolean",
|
|
@@ -372,7 +382,7 @@
|
|
|
372
382
|
"title": "EditableHtmlConfigureProp",
|
|
373
383
|
"type": "object",
|
|
374
384
|
"properties": {
|
|
375
|
-
"
|
|
385
|
+
"math": {
|
|
376
386
|
"title": "EditableHtmlButtonConfigure",
|
|
377
387
|
"type": "object",
|
|
378
388
|
"properties": {
|
|
@@ -519,15 +529,15 @@
|
|
|
519
529
|
}
|
|
520
530
|
}
|
|
521
531
|
},
|
|
522
|
-
"
|
|
523
|
-
"title": "
|
|
532
|
+
"EditableHtmlPluginConfigureRequired": {
|
|
533
|
+
"title": "EditableHtmlPluginConfigureRequired",
|
|
524
534
|
"type": "object",
|
|
525
535
|
"properties": {
|
|
526
536
|
"inputConfiguration": {
|
|
527
537
|
"title": "EditableHtmlConfigureProp",
|
|
528
538
|
"type": "object",
|
|
529
539
|
"properties": {
|
|
530
|
-
"
|
|
540
|
+
"math": {
|
|
531
541
|
"title": "EditableHtmlButtonConfigure",
|
|
532
542
|
"type": "object",
|
|
533
543
|
"properties": {
|
|
@@ -573,6 +583,11 @@
|
|
|
573
583
|
}
|
|
574
584
|
}
|
|
575
585
|
},
|
|
586
|
+
"required": {
|
|
587
|
+
"description": "Indicates if the item is required and the value cannot be empty",
|
|
588
|
+
"type": "boolean",
|
|
589
|
+
"title": "required"
|
|
590
|
+
},
|
|
576
591
|
"settings": {
|
|
577
592
|
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
578
593
|
"type": "boolean",
|
|
@@ -589,7 +604,7 @@
|
|
|
589
604
|
"title": "EditableHtmlConfigureProp",
|
|
590
605
|
"type": "object",
|
|
591
606
|
"properties": {
|
|
592
|
-
"
|
|
607
|
+
"math": {
|
|
593
608
|
"title": "EditableHtmlButtonConfigure",
|
|
594
609
|
"type": "object",
|
|
595
610
|
"properties": {
|
|
@@ -91,9 +91,9 @@ Properties of the `teacherInstructions` object:
|
|
|
91
91
|
|
|
92
92
|
Properties of the `inputConfiguration` object:
|
|
93
93
|
|
|
94
|
-
### `
|
|
94
|
+
### `math` (object)
|
|
95
95
|
|
|
96
|
-
Properties of the `
|
|
96
|
+
Properties of the `math` object:
|
|
97
97
|
|
|
98
98
|
#### `disabled` (boolean)
|
|
99
99
|
|
|
@@ -123,6 +123,10 @@ Properties of the `image` object:
|
|
|
123
123
|
|
|
124
124
|
Indicates if the plugin is disabled or not
|
|
125
125
|
|
|
126
|
+
## `required` (boolean)
|
|
127
|
+
|
|
128
|
+
Indicates if the item is required and the value cannot be empty
|
|
129
|
+
|
|
126
130
|
## `settings` (boolean)
|
|
127
131
|
|
|
128
132
|
Indicates if the item has to be displayed in the Settings Panel
|
|
@@ -139,9 +143,9 @@ Properties of the `prompt` object:
|
|
|
139
143
|
|
|
140
144
|
Properties of the `inputConfiguration` object:
|
|
141
145
|
|
|
142
|
-
### `
|
|
146
|
+
### `math` (object)
|
|
143
147
|
|
|
144
|
-
Properties of the `
|
|
148
|
+
Properties of the `math` object:
|
|
145
149
|
|
|
146
150
|
#### `disabled` (boolean)
|
|
147
151
|
|
|
@@ -171,6 +175,10 @@ Properties of the `image` object:
|
|
|
171
175
|
|
|
172
176
|
Indicates if the plugin is disabled or not
|
|
173
177
|
|
|
178
|
+
## `required` (boolean)
|
|
179
|
+
|
|
180
|
+
Indicates if the item is required and the value cannot be empty
|
|
181
|
+
|
|
174
182
|
## `settings` (boolean)
|
|
175
183
|
|
|
176
184
|
Indicates if the item has to be displayed in the Settings Panel
|
|
@@ -282,9 +290,9 @@ Indicates if mathML that's already in model should be editable
|
|
|
282
290
|
|
|
283
291
|
Properties of the `baseInputConfiguration` object:
|
|
284
292
|
|
|
285
|
-
## `
|
|
293
|
+
## `math` (object)
|
|
286
294
|
|
|
287
|
-
Properties of the `
|
|
295
|
+
Properties of the `math` object:
|
|
288
296
|
|
|
289
297
|
### `disabled` (boolean)
|
|
290
298
|
|
|
@@ -401,17 +409,17 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
401
409
|
|
|
402
410
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
403
411
|
|
|
404
|
-
## `
|
|
412
|
+
## `EditableHtmlPluginConfigureRequired` (object)
|
|
405
413
|
|
|
406
|
-
Properties of the `
|
|
414
|
+
Properties of the `EditableHtmlPluginConfigureRequired` object:
|
|
407
415
|
|
|
408
416
|
### `inputConfiguration` (object)
|
|
409
417
|
|
|
410
418
|
Properties of the `inputConfiguration` object:
|
|
411
419
|
|
|
412
|
-
#### `
|
|
420
|
+
#### `math` (object)
|
|
413
421
|
|
|
414
|
-
Properties of the `
|
|
422
|
+
Properties of the `math` object:
|
|
415
423
|
|
|
416
424
|
##### `disabled` (boolean)
|
|
417
425
|
|
|
@@ -441,6 +449,10 @@ Properties of the `image` object:
|
|
|
441
449
|
|
|
442
450
|
Indicates if the plugin is disabled or not
|
|
443
451
|
|
|
452
|
+
### `required` (boolean)
|
|
453
|
+
|
|
454
|
+
Indicates if the item is required and the value cannot be empty
|
|
455
|
+
|
|
444
456
|
### `settings` (boolean)
|
|
445
457
|
|
|
446
458
|
Indicates if the item has to be displayed in the Settings Panel
|
|
@@ -453,9 +465,9 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
453
465
|
|
|
454
466
|
Properties of the `EditableHtmlConfigureProp` object:
|
|
455
467
|
|
|
456
|
-
### `
|
|
468
|
+
### `math` (object)
|
|
457
469
|
|
|
458
|
-
Properties of the `
|
|
470
|
+
Properties of the `math` object:
|
|
459
471
|
|
|
460
472
|
#### `disabled` (boolean)
|
|
461
473
|
|
package/docs/pie-schema.json
CHANGED
|
@@ -214,15 +214,15 @@
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
|
-
"
|
|
218
|
-
"title": "
|
|
217
|
+
"EditableHtmlPluginConfigureRequired": {
|
|
218
|
+
"title": "EditableHtmlPluginConfigureRequired",
|
|
219
219
|
"type": "object",
|
|
220
220
|
"properties": {
|
|
221
221
|
"inputConfiguration": {
|
|
222
222
|
"title": "EditableHtmlConfigureProp",
|
|
223
223
|
"type": "object",
|
|
224
224
|
"properties": {
|
|
225
|
-
"
|
|
225
|
+
"math": {
|
|
226
226
|
"title": "EditableHtmlButtonConfigure",
|
|
227
227
|
"type": "object",
|
|
228
228
|
"properties": {
|
|
@@ -268,6 +268,11 @@
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
|
+
"required": {
|
|
272
|
+
"description": "Indicates if the item is required and the value cannot be empty",
|
|
273
|
+
"type": "boolean",
|
|
274
|
+
"title": "required"
|
|
275
|
+
},
|
|
271
276
|
"settings": {
|
|
272
277
|
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
273
278
|
"type": "boolean",
|
|
@@ -284,7 +289,7 @@
|
|
|
284
289
|
"title": "EditableHtmlConfigureProp",
|
|
285
290
|
"type": "object",
|
|
286
291
|
"properties": {
|
|
287
|
-
"
|
|
292
|
+
"math": {
|
|
288
293
|
"title": "EditableHtmlButtonConfigure",
|
|
289
294
|
"type": "object",
|
|
290
295
|
"properties": {
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -173,17 +173,17 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
173
173
|
|
|
174
174
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
175
175
|
|
|
176
|
-
## `
|
|
176
|
+
## `EditableHtmlPluginConfigureRequired` (object)
|
|
177
177
|
|
|
178
|
-
Properties of the `
|
|
178
|
+
Properties of the `EditableHtmlPluginConfigureRequired` object:
|
|
179
179
|
|
|
180
180
|
### `inputConfiguration` (object)
|
|
181
181
|
|
|
182
182
|
Properties of the `inputConfiguration` object:
|
|
183
183
|
|
|
184
|
-
#### `
|
|
184
|
+
#### `math` (object)
|
|
185
185
|
|
|
186
|
-
Properties of the `
|
|
186
|
+
Properties of the `math` object:
|
|
187
187
|
|
|
188
188
|
##### `disabled` (boolean)
|
|
189
189
|
|
|
@@ -213,6 +213,10 @@ Properties of the `image` object:
|
|
|
213
213
|
|
|
214
214
|
Indicates if the plugin is disabled or not
|
|
215
215
|
|
|
216
|
+
### `required` (boolean)
|
|
217
|
+
|
|
218
|
+
Indicates if the item is required and the value cannot be empty
|
|
219
|
+
|
|
216
220
|
### `settings` (boolean)
|
|
217
221
|
|
|
218
222
|
Indicates if the item has to be displayed in the Settings Panel
|
|
@@ -225,9 +229,9 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
225
229
|
|
|
226
230
|
Properties of the `EditableHtmlConfigureProp` object:
|
|
227
231
|
|
|
228
|
-
### `
|
|
232
|
+
### `math` (object)
|
|
229
233
|
|
|
230
|
-
Properties of the `
|
|
234
|
+
Properties of the `math` object:
|
|
231
235
|
|
|
232
236
|
#### `disabled` (boolean)
|
|
233
237
|
|
package/module/configure.js
CHANGED
|
@@ -5841,7 +5841,8 @@ class Main extends React$1.Component {
|
|
|
5841
5841
|
render() {
|
|
5842
5842
|
const {model, classes, configuration, imageSupport, onConfigurationChanged, onModelChanged, uploadSoundSupport} = this.props;
|
|
5843
5843
|
const {contentDimensions = {}, dimensions = {}, equationEditor = {}, feedback = {}, playerSpellCheck = {}, prompt = {}, settingsPanelDisabled, spanishInput = {}, specialInput = {}, spellCheck = {}, studentInstructions = {}, teacherInstructions = {}, mathInput = {}, maxImageWidth = {}, maxImageHeight = {}, multiple = {}, withRubric = {}, mathMlOptions = {}, baseInputConfiguration = {}} = configuration || ({});
|
|
5844
|
-
const {feedbackEnabled, promptEnabled, spellCheckEnabled, teacherInstructionsEnabled, toolbarEditorPosition} = model || ({});
|
|
5844
|
+
const {errors = {}, feedbackEnabled, promptEnabled, spellCheckEnabled, teacherInstructionsEnabled, toolbarEditorPosition} = model || ({});
|
|
5845
|
+
const {prompt: promptError, teacherInstructions: teacherInstructionsError} = errors;
|
|
5845
5846
|
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
5846
5847
|
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
5847
5848
|
const toolbarOpts = {
|
|
@@ -5897,13 +5898,13 @@ class Main extends React$1.Component {
|
|
|
5897
5898
|
__self: this,
|
|
5898
5899
|
__source: {
|
|
5899
5900
|
fileName: _jsxFileName,
|
|
5900
|
-
lineNumber:
|
|
5901
|
+
lineNumber: 143
|
|
5901
5902
|
}
|
|
5902
5903
|
}),
|
|
5903
5904
|
__self: this,
|
|
5904
5905
|
__source: {
|
|
5905
5906
|
fileName: _jsxFileName,
|
|
5906
|
-
lineNumber:
|
|
5907
|
+
lineNumber: 139
|
|
5907
5908
|
}
|
|
5908
5909
|
}, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
|
|
5909
5910
|
label: teacherInstructions.label,
|
|
@@ -5911,7 +5912,7 @@ class Main extends React$1.Component {
|
|
|
5911
5912
|
__self: this,
|
|
5912
5913
|
__source: {
|
|
5913
5914
|
fileName: _jsxFileName,
|
|
5914
|
-
lineNumber:
|
|
5915
|
+
lineNumber: 156
|
|
5915
5916
|
}
|
|
5916
5917
|
}, React$1.createElement(EditableHtml, {
|
|
5917
5918
|
className: classes.prompt,
|
|
@@ -5919,6 +5920,7 @@ class Main extends React$1.Component {
|
|
|
5919
5920
|
onChange: this.changeTeacherInstructions,
|
|
5920
5921
|
imageSupport: imageSupport,
|
|
5921
5922
|
nonEmpty: false,
|
|
5923
|
+
error: teacherInstructionsError,
|
|
5922
5924
|
toolbarOpts: toolbarOpts,
|
|
5923
5925
|
spellCheck: spellCheckEnabled,
|
|
5924
5926
|
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
@@ -5934,15 +5936,22 @@ class Main extends React$1.Component {
|
|
|
5934
5936
|
__self: this,
|
|
5935
5937
|
__source: {
|
|
5936
5938
|
fileName: _jsxFileName,
|
|
5937
|
-
lineNumber:
|
|
5939
|
+
lineNumber: 157
|
|
5938
5940
|
}
|
|
5939
|
-
})
|
|
5941
|
+
}), teacherInstructionsError && React$1.createElement('div', {
|
|
5942
|
+
className: classes.errorText,
|
|
5943
|
+
__self: this,
|
|
5944
|
+
__source: {
|
|
5945
|
+
fileName: _jsxFileName,
|
|
5946
|
+
lineNumber: 173
|
|
5947
|
+
}
|
|
5948
|
+
}, teacherInstructionsError)), promptEnabled && React$1.createElement(InputContainer, {
|
|
5940
5949
|
label: prompt.label,
|
|
5941
5950
|
className: classes.promptContainer,
|
|
5942
5951
|
__self: this,
|
|
5943
5952
|
__source: {
|
|
5944
5953
|
fileName: _jsxFileName,
|
|
5945
|
-
lineNumber:
|
|
5954
|
+
lineNumber: 178
|
|
5946
5955
|
}
|
|
5947
5956
|
}, React$1.createElement(EditableHtml, {
|
|
5948
5957
|
activePlugins: ALL_PLUGINS,
|
|
@@ -5951,6 +5960,7 @@ class Main extends React$1.Component {
|
|
|
5951
5960
|
onChange: this.onPromptChange,
|
|
5952
5961
|
imageSupport: imageSupport,
|
|
5953
5962
|
nonEmpty: false,
|
|
5963
|
+
error: promptError,
|
|
5954
5964
|
toolbarOpts: toolbarOpts,
|
|
5955
5965
|
spellCheck: spellCheckEnabled,
|
|
5956
5966
|
maxImageWidth: defaultImageMaxWidth,
|
|
@@ -5966,13 +5976,20 @@ class Main extends React$1.Component {
|
|
|
5966
5976
|
__self: this,
|
|
5967
5977
|
__source: {
|
|
5968
5978
|
fileName: _jsxFileName,
|
|
5969
|
-
lineNumber:
|
|
5979
|
+
lineNumber: 179
|
|
5970
5980
|
}
|
|
5971
|
-
})
|
|
5981
|
+
}), promptError && React$1.createElement('div', {
|
|
5982
|
+
className: classes.errorText,
|
|
5972
5983
|
__self: this,
|
|
5973
5984
|
__source: {
|
|
5974
5985
|
fileName: _jsxFileName,
|
|
5975
|
-
lineNumber:
|
|
5986
|
+
lineNumber: 196
|
|
5987
|
+
}
|
|
5988
|
+
}, promptError)), feedbackEnabled && React$1.createElement(React$1.Fragment, {
|
|
5989
|
+
__self: this,
|
|
5990
|
+
__source: {
|
|
5991
|
+
fileName: _jsxFileName,
|
|
5992
|
+
lineNumber: 201
|
|
5976
5993
|
}
|
|
5977
5994
|
}, React$1.createElement(Typography, {
|
|
5978
5995
|
className: classes.header,
|
|
@@ -5980,7 +5997,7 @@ class Main extends React$1.Component {
|
|
|
5980
5997
|
__self: this,
|
|
5981
5998
|
__source: {
|
|
5982
5999
|
fileName: _jsxFileName,
|
|
5983
|
-
lineNumber:
|
|
6000
|
+
lineNumber: 202
|
|
5984
6001
|
}
|
|
5985
6002
|
}, "Feedback"), React$1.createElement(FeedbackSelector, {
|
|
5986
6003
|
label: "When submitted, show",
|
|
@@ -5990,7 +6007,7 @@ class Main extends React$1.Component {
|
|
|
5990
6007
|
__self: this,
|
|
5991
6008
|
__source: {
|
|
5992
6009
|
fileName: _jsxFileName,
|
|
5993
|
-
lineNumber:
|
|
6010
|
+
lineNumber: 206
|
|
5994
6011
|
}
|
|
5995
6012
|
})));
|
|
5996
6013
|
}
|
|
@@ -6004,6 +6021,11 @@ var Main$1 = styles.withStyles(theme => ({
|
|
|
6004
6021
|
paddingTop: theme.spacing.unit * 2,
|
|
6005
6022
|
marginBottom: theme.spacing.unit * 2,
|
|
6006
6023
|
width: '100%'
|
|
6024
|
+
},
|
|
6025
|
+
errorText: {
|
|
6026
|
+
fontSize: theme.typography.fontSize - 2,
|
|
6027
|
+
color: theme.palette.error.main,
|
|
6028
|
+
paddingTop: theme.spacing.unit
|
|
6007
6029
|
}
|
|
6008
6030
|
}))(Main);
|
|
6009
6031
|
var defaults = {
|
|
@@ -6099,7 +6121,8 @@ var defaults = {
|
|
|
6099
6121
|
image: {
|
|
6100
6122
|
disabled: false
|
|
6101
6123
|
}
|
|
6102
|
-
}
|
|
6124
|
+
},
|
|
6125
|
+
required: false
|
|
6103
6126
|
},
|
|
6104
6127
|
teacherInstructions: {
|
|
6105
6128
|
settings: true,
|
|
@@ -6114,7 +6137,8 @@ var defaults = {
|
|
|
6114
6137
|
image: {
|
|
6115
6138
|
disabled: false
|
|
6116
6139
|
}
|
|
6117
|
-
}
|
|
6140
|
+
},
|
|
6141
|
+
required: false
|
|
6118
6142
|
},
|
|
6119
6143
|
maxImageWidth: {
|
|
6120
6144
|
teacherInstructions: 300,
|
package/module/controller.js
CHANGED
|
@@ -245,4 +245,19 @@ async function outcome(/*question, session, env*/) {
|
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
// remove all html tags except img and iframe
|
|
249
|
+
const getContent = (html) => (html || '').replace(/(<(?!img|iframe)([^>]+)>)/gi, '');
|
|
250
|
+
|
|
251
|
+
const validate = (model = {}, config = {}) => {
|
|
252
|
+
const errors = {};
|
|
253
|
+
|
|
254
|
+
['teacherInstructions', 'prompt'].forEach((field) => {
|
|
255
|
+
if (config[field]?.required && !getContent(model[field])) {
|
|
256
|
+
errors[field] = 'This field is required.';
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
return errors;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export { createDefaultModel, model, normalize, outcome, validate };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/extended-text-entry",
|
|
3
|
-
"version": "10.7.1-next.
|
|
3
|
+
"version": "10.7.1-next.43+9e3c59b3e",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"react": "^16.8.1",
|
|
21
21
|
"react-dom": "^16.8.1"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "9e3c59b3e3daacce248e754dc10bfffc09f06a0d",
|
|
24
24
|
"scripts": {
|
|
25
25
|
"postpublish": "../../scripts/postpublish"
|
|
26
26
|
},
|