@pie-element/drawing-response 4.2.2 → 4.2.3-next.2
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/index.js +15 -4
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/root.js +1 -1
- package/configure/lib/root.js.map +1 -1
- package/configure/src/index.js +17 -7
- package/configure/src/root.jsx +1 -1
- package/docs/config-schema.json +28 -2
- package/docs/config-schema.json.md +21 -1
- package/docs/pie-schema.json +21 -0
- package/docs/pie-schema.json.md +16 -0
- package/package.json +2 -2
package/configure/lib/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var DrawableResponseConfigure = /*#__PURE__*/function (_HTMLElement) {
|
|
|
69
69
|
case 0:
|
|
70
70
|
_ref2 = c || {}, withRubric = _ref2.withRubric;
|
|
71
71
|
|
|
72
|
-
if (withRubric.
|
|
72
|
+
if (withRubric.forceEnabled && !_this._model.rubricEnabled) {
|
|
73
73
|
_this._model.rubricEnabled = true;
|
|
74
74
|
|
|
75
75
|
_this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(_this._model));
|
|
@@ -107,8 +107,8 @@ var DrawableResponseConfigure = /*#__PURE__*/function (_HTMLElement) {
|
|
|
107
107
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDeleteImage", function (src, done) {
|
|
108
108
|
_this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
|
|
109
109
|
});
|
|
110
|
-
_this._model = DrawableResponseConfigure.createDefaultModel();
|
|
111
110
|
_this._configuration = _defaults["default"].configuration;
|
|
111
|
+
_this._model = DrawableResponseConfigure.createDefaultModel({}, _this._configuration);
|
|
112
112
|
_this.onModelChanged = _this.onModelChanged.bind((0, _assertThisInitialized2["default"])(_this));
|
|
113
113
|
return _this;
|
|
114
114
|
}
|
|
@@ -116,7 +116,7 @@ var DrawableResponseConfigure = /*#__PURE__*/function (_HTMLElement) {
|
|
|
116
116
|
(0, _createClass2["default"])(DrawableResponseConfigure, [{
|
|
117
117
|
key: "model",
|
|
118
118
|
set: function set(s) {
|
|
119
|
-
this._model = DrawableResponseConfigure.createDefaultModel(s);
|
|
119
|
+
this._model = DrawableResponseConfigure.createDefaultModel(s, this._configuration);
|
|
120
120
|
|
|
121
121
|
this._render();
|
|
122
122
|
}
|
|
@@ -148,6 +148,7 @@ var DrawableResponseConfigure = /*#__PURE__*/function (_HTMLElement) {
|
|
|
148
148
|
key: "_render",
|
|
149
149
|
value: function _render() {
|
|
150
150
|
log('_render');
|
|
151
|
+
console.log('this._model.rubricEnabled', this._model.rubricEnabled);
|
|
151
152
|
|
|
152
153
|
var element = /*#__PURE__*/_react["default"].createElement(_root["default"], {
|
|
153
154
|
model: this._model,
|
|
@@ -172,7 +173,17 @@ var DrawableResponseConfigure = /*#__PURE__*/function (_HTMLElement) {
|
|
|
172
173
|
|
|
173
174
|
exports["default"] = DrawableResponseConfigure;
|
|
174
175
|
(0, _defineProperty2["default"])(DrawableResponseConfigure, "createDefaultModel", function () {
|
|
176
|
+
var _config$withRubric;
|
|
177
|
+
|
|
175
178
|
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
176
|
-
|
|
179
|
+
var config = arguments.length > 1 ? arguments[1] : undefined;
|
|
180
|
+
|
|
181
|
+
var defaultModel = _objectSpread(_objectSpread({}, _defaults["default"].model), model);
|
|
182
|
+
|
|
183
|
+
if (config !== null && config !== void 0 && (_config$withRubric = config.withRubric) !== null && _config$withRubric !== void 0 && _config$withRubric.forceEnabled && !defaultModel.rubricEnabled) {
|
|
184
|
+
defaultModel.rubricEnabled = true;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return defaultModel;
|
|
177
188
|
});
|
|
178
189
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","DrawableResponseConfigure","c","withRubric","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","DrawableResponseConfigure","c","withRubric","forceEnabled","_model","rubricEnabled","dispatchEvent","ModelUpdatedEvent","m","reset","dispatchModelUpdated","_render","_configuration","verifyRubric","handler","InsertImageEvent","src","done","DeleteImageEvent","sensibleDefaults","configuration","createDefaultModel","onModelChanged","bind","s","resetValue","InsertSoundEvent","DeleteSoundEvent","console","element","React","createElement","Root","model","onConfigurationChanged","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","config","defaultModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,mBAAN,CAAZ;;IAEqBC,yB;;;;;AAcnB,uCAAc;AAAA;;AAAA;AACZ;AADY;AAAA,+FAOC,iBAAOC,CAAP;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,wBACUA,CAAC,IAAI,EADf,EACLC,UADK,SACLA,UADK;;AAGb,oBAAIA,UAAU,CAACC,YAAX,IAA2B,CAAC,MAAKC,MAAL,CAAYC,aAA5C,EAA2D;AACzD,wBAAKD,MAAL,CAAYC,aAAZ,GAA4B,IAA5B;;AACA,wBAAKC,aAAL,CAAmB,IAAIC,qCAAJ,CAAsB,MAAKH,MAA3B,CAAnB;AACD;;AANY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAPD;;AAAA;AAAA;AAAA;AAAA;AAAA,uGAmCG,UAACI,CAAD,EAAIC,KAAJ,EAAc;AAC7B,YAAKL,MAAL,GAAcI,CAAd;;AACA,YAAKE,oBAAL,CAA0BD,KAA1B;;AACA,YAAKE,OAAL;AACD,KAvCa;AAAA,+GAyCW,UAACV,CAAD,EAAO;AAC9B,YAAKW,cAAL,GAAsBX,CAAtB;;AAEA,YAAKY,YAAL,CAAkB,MAAKD,cAAvB;;AAEA,YAAKD,OAAL;AACD,KA/Ca;AAAA,oGAiDA,UAACG,OAAD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K,MAAL,CAAYC,aAArD;;AACA,UAAIwB,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACtCC,QAAAA,KAAK,EAAE,KAAK7B,MAD0B;AAEtCgB,QAAAA,aAAa,EAAE,KAAKR,cAFkB;AAGtCU,QAAAA,cAAc,EAAE,KAAKA,cAHiB;AAItCY,QAAAA,sBAAsB,EAAE,KAAKA,sBAJS;AAKtCC,QAAAA,YAAY,EAAE;AACZC,UAAAA,GAAG,EAAE,KAAKC,WADE;AAEZ,oBAAQ,KAAKC;AAFD,SALwB;AAStCC,QAAAA,kBAAkB,EAAE;AAClBH,UAAAA,GAAG,EAAE,KAAKI,WAAL,CAAiBjB,IAAjB,CAAsB,IAAtB,CADa;AAElB,oBAAQ,KAAKkB,aAAL,CAAmBlB,IAAnB,CAAwB,IAAxB;AAFU;AATkB,OAA1B,CAAd;;AAcAmB,2BAASC,MAAT,CAAgBd,OAAhB,EAAyB,IAAzB;AACD;;;kDAlGoDe,W;;;iCAAlC5C,yB,wBACS,YAAwB;AAAA;;AAAA,MAAvBiC,KAAuB,uEAAf,EAAe;AAAA,MAAXY,MAAW;;AAClD,MAAMC,YAAY,mCACb3B,qBAAiBc,KADJ,GAEbA,KAFa,CAAlB;;AAKA,MAAIY,MAAM,SAAN,IAAAA,MAAM,WAAN,0BAAAA,MAAM,CAAE3C,UAAR,kEAAoBC,YAApB,IAAoC,CAAC2C,YAAY,CAACzC,aAAtD,EAAqE;AACnEyC,IAAAA,YAAY,CAACzC,aAAb,GAA6B,IAA7B;AACD;;AAED,SAAOyC,YAAP;AACD,C","sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent\n} from '@pie-framework/pie-configure-events';\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\n\nimport Root from './root';\nimport sensibleDefaults from './defaults';\n\nconst log = debug('hotspot:configure');\n\nexport default class DrawableResponseConfigure extends HTMLElement {\n static createDefaultModel = (model = {}, config) => {\n const defaultModel = {\n ...sensibleDefaults.model,\n ...model,\n };\n\n if (config?.withRubric?.forceEnabled && !defaultModel.rubricEnabled) {\n defaultModel.rubricEnabled = true;\n }\n\n return defaultModel;\n };\n\n constructor() {\n super();\n this._configuration = sensibleDefaults.configuration;\n this._model = DrawableResponseConfigure.createDefaultModel({}, this._configuration);\n this.onModelChanged = this.onModelChanged.bind(this);\n }\n\n verifyRubric = async (c) => {\n const { withRubric } = c || {};\n\n if (withRubric.forceEnabled && !this._model.rubricEnabled) {\n this._model.rubricEnabled = true;\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n }\n }\n\n set model(s) {\n this._model = DrawableResponseConfigure.createDefaultModel(s, this._configuration);\n this._render();\n }\n\n set configuration(c) {\n this._configuration = c;\n\n this.verifyRubric(this._configuration);\n\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged = (m, reset) => {\n this._model = m;\n this.dispatchModelUpdated(reset);\n this._render();\n };\n\n onConfigurationChanged = (c) => {\n this._configuration = c;\n\n this.verifyRubric(this._configuration);\n\n this._render();\n };\n\n insertImage = (handler) => {\n this.dispatchEvent(new InsertImageEvent(handler));\n };\n\n onDeleteImage = (src, done) => {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n };\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n log('_render');\n\n console.log('this._model.rubricEnabled', this._model.rubricEnabled);\n let element = React.createElement(Root, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n imageSupport: {\n add: this.insertImage,\n delete: this.onDeleteImage\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this)\n }\n });\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
package/configure/lib/root.js
CHANGED
|
@@ -162,7 +162,7 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
162
162
|
Properties: {
|
|
163
163
|
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
164
164
|
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
165
|
-
rubricEnabled: withRubric.settings && toggle(withRubric.label)
|
|
165
|
+
rubricEnabled: !withRubric.forceEnabled && withRubric.settings && toggle(withRubric.label)
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/root.jsx"],"names":["Panel","settings","toggle","Root","prompt","props","model","onModelChanged","update","teacherInstructions","dimensions","imageDimensions","imageUrl","classes","configuration","imageSupport","uploadSoundSupport","onConfigurationChanged","backgroundImage","spellCheck","maxImageWidth","maxImageHeight","withRubric","teacherInstructionsEnabled","promptEnabled","spellCheckEnabled","backgroundImageEnabled","toolbarOpts","defaultImageMaxWidth","defaultImageMaxHeight","toolbarEditorPosition","position","base","Settings","label","Properties","rubricEnabled","regular","onTeacherInstructionsChanged","language","onPromptChanged","onUpdateImageDimension","onImageUpload","React","Component","styles","theme","marginTop","spacing","unit","paddingTop","width","marginBottom","propTypes","PropTypes","object","isRequired","shape","add","func"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAQA,KAAR,GAA0BC,kBAA1B,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA0BD,kBAA1B,CAAeC,MAAf;;IAEaC,I;;;;;;;;;;;;;;;wGACO,UAACC,MAAD,EAAY;AAC5B,wBAAkC,MAAKC,KAAvC;AAAA,UAAQC,KAAR,eAAQA,KAAR;AAAA,UAAeC,cAAf,eAAeA,cAAf;AACA,UA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XgB,GAAZ;AAAA,CAAf;;AAgBA9C,IAAI,CAACkD,SAAL,GAAiB;AACfxC,EAAAA,OAAO,EAAEyC,sBAAUC,MAAV,CAAiBC,UADX;AAEf1C,EAAAA,aAAa,EAAEwC,sBAAUC,MAFV;AAGfjD,EAAAA,KAAK,EAAEgD,sBAAUC,MAAV,CAAiBC,UAHT;AAIfzC,EAAAA,YAAY,EAAEuC,sBAAUG,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEJ,sBAAUK,IADa;AAE5B,cAAQL,sBAAUK;AAFU,GAAhB,CAJC;AAQf3C,EAAAA,kBAAkB,EAAEsC,sBAAUG,KAAV,CAAgB;AAClCC,IAAAA,GAAG,EAAEJ,sBAAUK,IADmB;AAElC,cAAQL,sBAAUK;AAFgB,GAAhB,CARL;AAYfpD,EAAAA,cAAc,EAAE+C,sBAAUK,IAAV,CAAeH,UAZhB;AAafvC,EAAAA,sBAAsB,EAAEqC,sBAAUK,IAAV,CAAeH;AAbxB,CAAjB;;eAgBe,wBAAWX,MAAX,EAAmB1C,IAAnB,C","sourcesContent":["import React from 'react';\nimport { settings, layout, InputContainer } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport ImageContainer from './image-container';\nimport cloneDeep from 'lodash/cloneDeep';\n\nconst { Panel, toggle } = settings;\n\nexport class Root extends React.Component {\n onPromptChanged = (prompt) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n onModelChanged({\n ...update,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n teacherInstructions,\n });\n };\n\n onUpdateImageDimension = (dimensions) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n imageDimensions: dimensions,\n });\n };\n\n onImageUpload = (imageUrl) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n imageUrl,\n });\n };\n\n render() {\n const {\n classes,\n configuration,\n model,\n imageSupport,\n uploadSoundSupport,\n onConfigurationChanged,\n onModelChanged,\n } = this.props;\n const {\n backgroundImage = {},\n prompt = {},\n teacherInstructions = {},\n spellCheck = {},\n maxImageWidth = {},\n maxImageHeight = {},\n withRubric,\n } = configuration || {};\n const {\n teacherInstructionsEnabled,\n promptEnabled,\n spellCheckEnabled,\n backgroundImageEnabled,\n } = model || {};\n const toolbarOpts = {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n return (\n <div className={classes.base}>\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: {\n backgroundImageEnabled: backgroundImage.settings && toggle(backgroundImage.label),\n promptEnabled: prompt.settings && toggle(prompt.label)\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n rubricEnabled: withRubric.settings && toggle(withRubric.label)\n },\n }}\n />\n }\n >\n <div className={classes.regular}>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.prompt}\n >\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\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 />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label=\"Item Stem\" className={classes.prompt}>\n <EditableHtml\n markup={model.prompt}\n onChange={this.onPromptChanged}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n imageSupport={imageSupport}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {backgroundImageEnabled && (\n <div>\n <Typography className={classes.label} variant=\"subheading\">\n Define Background Image\n </Typography>\n\n <ImageContainer\n imageUrl={model.imageUrl}\n onUpdateImageDimension={this.onUpdateImageDimension}\n onImageUpload={this.onImageUpload}\n imageDimensions={model.imageDimensions}\n />\n </div>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n base: {\n marginTop: theme.spacing.unit * 3,\n },\n label: {\n marginTop: theme.spacing.unit * 4,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n regular: {\n marginBottom: theme.spacing.unit * 3,\n },\n});\n\nRoot.propTypes = {\n classes: PropTypes.object.isRequired,\n configuration: PropTypes.object,\n model: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n};\n\nexport default withStyles(styles)(Root);\n"],"file":"root.js"}
|
|
1
|
+
{"version":3,"sources":["../src/root.jsx"],"names":["Panel","settings","toggle","Root","prompt","props","model","onModelChanged","update","teacherInstructions","dimensions","imageDimensions","imageUrl","classes","configuration","imageSupport","uploadSoundSupport","onConfigurationChanged","backgroundImage","spellCheck","maxImageWidth","maxImageHeight","withRubric","teacherInstructionsEnabled","promptEnabled","spellCheckEnabled","backgroundImageEnabled","toolbarOpts","defaultImageMaxWidth","defaultImageMaxHeight","toolbarEditorPosition","position","base","Settings","label","Properties","rubricEnabled","forceEnabled","regular","onTeacherInstructionsChanged","language","onPromptChanged","onUpdateImageDimension","onImageUpload","React","Component","styles","theme","marginTop","spacing","unit","paddingTop","width","marginBottom","propTypes","PropTypes","object","isRequired","shape","add","func"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAQA,KAAR,GAA0BC,kBAA1B,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA0BD,kBAA1B,CAAeC,MAAf;;IAEaC,I;;;;;;;;;;;;;;;wGACO,UAACC,MAAD,EAAY;AAC5B,wBAAkC,MAAKC,KAAvC;AAAA,UAAQC,KAAR,eAAQA,KAAR;AAAA,UAAeC,cAAf,eAAeA,cAAf;AACA,UAAMC,MAAM,GAAG,2BAAUF,KAAV,CAAf;AAEAC,MAAAA,cAAc,iCACTC,MADS;AAEZJ,QAAAA,MAAM,EAANA;AAFY,SAAd;AAID,K;qHAE8B,UAACK,mBAAD,EAAyB;AACtD,yBAAkC,MAAKJ,KAAvC;AAAA,UAAQC,KAAR,gBAAQA,KAAR;AAAA,UAAeC,cAAf,gBAAeA,cAAf;AAEAA,MAAAA,cAAc,iCACTD,KADS;AAEZG,QAAAA,mBAAmB,EAAnBA;AAFY,SAAd;AAID,K;+GAEwB,UAACC,UAAD,EAAgB;AACvC,yBAAkC,MAAKL,KAAvC;AAAA,UAAQC,KAAR,gBAAQA,KAAR;AAAA,UAAeC,cAAf,gBAAeA,cAAf;AAEAA,MAAAA,cAAc,iCACTD,KADS;AAEZK,QAAAA,eAAe,EAAED;AAFL,SAAd;AAID,K;sGAEe,UAACE,QAAD,EAAc;AAC5B,yBAAkC,MAAKP,KAAvC;AAAA,UAAQC,KAAR,gBAAQA,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sB,EAAEsC,sBAAUK,IAAV,CAAeH;AAbxB,CAAjB;;eAgBe,wBAAWX,MAAX,EAAmB3C,IAAnB,C","sourcesContent":["import React from 'react';\nimport { settings, layout, InputContainer } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport ImageContainer from './image-container';\nimport cloneDeep from 'lodash/cloneDeep';\n\nconst { Panel, toggle } = settings;\n\nexport class Root extends React.Component {\n onPromptChanged = (prompt) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n onModelChanged({\n ...update,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n teacherInstructions,\n });\n };\n\n onUpdateImageDimension = (dimensions) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n imageDimensions: dimensions,\n });\n };\n\n onImageUpload = (imageUrl) => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n imageUrl,\n });\n };\n\n render() {\n const {\n classes,\n configuration,\n model,\n imageSupport,\n uploadSoundSupport,\n onConfigurationChanged,\n onModelChanged,\n } = this.props;\n const {\n backgroundImage = {},\n prompt = {},\n teacherInstructions = {},\n spellCheck = {},\n maxImageWidth = {},\n maxImageHeight = {},\n withRubric,\n } = configuration || {};\n const {\n teacherInstructionsEnabled,\n promptEnabled,\n spellCheckEnabled,\n backgroundImageEnabled,\n } = model || {};\n const toolbarOpts = {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n return (\n <div className={classes.base}>\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: {\n backgroundImageEnabled: backgroundImage.settings && toggle(backgroundImage.label),\n promptEnabled: prompt.settings && toggle(prompt.label)\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n rubricEnabled: !withRubric.forceEnabled && withRubric.settings && toggle(withRubric.label)\n },\n }}\n />\n }\n >\n <div className={classes.regular}>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.prompt}\n >\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\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 />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label=\"Item Stem\" className={classes.prompt}>\n <EditableHtml\n markup={model.prompt}\n onChange={this.onPromptChanged}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n imageSupport={imageSupport}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {backgroundImageEnabled && (\n <div>\n <Typography className={classes.label} variant=\"subheading\">\n Define Background Image\n </Typography>\n\n <ImageContainer\n imageUrl={model.imageUrl}\n onUpdateImageDimension={this.onUpdateImageDimension}\n onImageUpload={this.onImageUpload}\n imageDimensions={model.imageDimensions}\n />\n </div>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n base: {\n marginTop: theme.spacing.unit * 3,\n },\n label: {\n marginTop: theme.spacing.unit * 4,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n regular: {\n marginBottom: theme.spacing.unit * 3,\n },\n});\n\nRoot.propTypes = {\n classes: PropTypes.object.isRequired,\n configuration: PropTypes.object,\n model: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n};\n\nexport default withStyles(styles)(Root);\n"],"file":"root.js"}
|
package/configure/src/index.js
CHANGED
|
@@ -16,29 +16,37 @@ import sensibleDefaults from './defaults';
|
|
|
16
16
|
const log = debug('hotspot:configure');
|
|
17
17
|
|
|
18
18
|
export default class DrawableResponseConfigure extends HTMLElement {
|
|
19
|
-
static createDefaultModel = (model = {}) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
static createDefaultModel = (model = {}, config) => {
|
|
20
|
+
const defaultModel = {
|
|
21
|
+
...sensibleDefaults.model,
|
|
22
|
+
...model,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (config?.withRubric?.forceEnabled && !defaultModel.rubricEnabled) {
|
|
26
|
+
defaultModel.rubricEnabled = true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return defaultModel;
|
|
30
|
+
};
|
|
23
31
|
|
|
24
32
|
constructor() {
|
|
25
33
|
super();
|
|
26
|
-
this._model = DrawableResponseConfigure.createDefaultModel();
|
|
27
34
|
this._configuration = sensibleDefaults.configuration;
|
|
35
|
+
this._model = DrawableResponseConfigure.createDefaultModel({}, this._configuration);
|
|
28
36
|
this.onModelChanged = this.onModelChanged.bind(this);
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
verifyRubric = async (c) => {
|
|
32
40
|
const { withRubric } = c || {};
|
|
33
41
|
|
|
34
|
-
if (withRubric.
|
|
42
|
+
if (withRubric.forceEnabled && !this._model.rubricEnabled) {
|
|
35
43
|
this._model.rubricEnabled = true;
|
|
36
44
|
this.dispatchEvent(new ModelUpdatedEvent(this._model));
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
set model(s) {
|
|
41
|
-
this._model = DrawableResponseConfigure.createDefaultModel(s);
|
|
49
|
+
this._model = DrawableResponseConfigure.createDefaultModel(s, this._configuration);
|
|
42
50
|
this._render();
|
|
43
51
|
}
|
|
44
52
|
|
|
@@ -88,6 +96,8 @@ export default class DrawableResponseConfigure extends HTMLElement {
|
|
|
88
96
|
|
|
89
97
|
_render() {
|
|
90
98
|
log('_render');
|
|
99
|
+
|
|
100
|
+
console.log('this._model.rubricEnabled', this._model.rubricEnabled);
|
|
91
101
|
let element = React.createElement(Root, {
|
|
92
102
|
model: this._model,
|
|
93
103
|
configuration: this._configuration,
|
package/configure/src/root.jsx
CHANGED
|
@@ -107,7 +107,7 @@ export class Root extends React.Component {
|
|
|
107
107
|
toggle(teacherInstructions.label),
|
|
108
108
|
spellCheckEnabled:
|
|
109
109
|
spellCheck.settings && toggle(spellCheck.label),
|
|
110
|
-
rubricEnabled: withRubric.settings && toggle(withRubric.label)
|
|
110
|
+
rubricEnabled: !withRubric.forceEnabled && withRubric.settings && toggle(withRubric.label)
|
|
111
111
|
},
|
|
112
112
|
}}
|
|
113
113
|
/>
|
package/docs/config-schema.json
CHANGED
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
"withRubric": {
|
|
134
|
-
"title": "
|
|
134
|
+
"title": "ConfigureWithForceProp",
|
|
135
135
|
"type": "object",
|
|
136
136
|
"properties": {
|
|
137
137
|
"settings": {
|
|
@@ -143,6 +143,11 @@
|
|
|
143
143
|
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
144
144
|
"type": "string",
|
|
145
145
|
"title": "label"
|
|
146
|
+
},
|
|
147
|
+
"forceEnabled": {
|
|
148
|
+
"description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"title": "forceEnabled"
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
153
|
},
|
|
@@ -217,7 +222,28 @@
|
|
|
217
222
|
"title": "rationale"
|
|
218
223
|
}
|
|
219
224
|
}
|
|
225
|
+
},
|
|
226
|
+
"ConfigureWithForceProp": {
|
|
227
|
+
"title": "ConfigureWithForceProp",
|
|
228
|
+
"type": "object",
|
|
229
|
+
"properties": {
|
|
230
|
+
"settings": {
|
|
231
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
232
|
+
"type": "boolean",
|
|
233
|
+
"title": "settings"
|
|
234
|
+
},
|
|
235
|
+
"label": {
|
|
236
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
237
|
+
"type": "string",
|
|
238
|
+
"title": "label"
|
|
239
|
+
},
|
|
240
|
+
"forceEnabled": {
|
|
241
|
+
"description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
|
|
242
|
+
"type": "boolean",
|
|
243
|
+
"title": "forceEnabled"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
220
246
|
}
|
|
221
247
|
},
|
|
222
248
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
223
|
-
}
|
|
249
|
+
}
|
|
@@ -111,6 +111,10 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
111
111
|
|
|
112
112
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
113
113
|
|
|
114
|
+
## `forceEnabled` (boolean)
|
|
115
|
+
|
|
116
|
+
Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
|
|
117
|
+
|
|
114
118
|
# `showPrompt` (boolean)
|
|
115
119
|
|
|
116
120
|
Determines whether prompt field will be displayed or not
|
|
@@ -172,4 +176,20 @@ Indicates the max dimension for images in prompt - this is also the default dime
|
|
|
172
176
|
|
|
173
177
|
### `rationale` (number)
|
|
174
178
|
|
|
175
|
-
Indicates the max dimension for images in rationale
|
|
179
|
+
Indicates the max dimension for images in rationale
|
|
180
|
+
|
|
181
|
+
## `ConfigureWithForceProp` (object)
|
|
182
|
+
|
|
183
|
+
Properties of the `ConfigureWithForceProp` object:
|
|
184
|
+
|
|
185
|
+
### `settings` (boolean)
|
|
186
|
+
|
|
187
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
188
|
+
|
|
189
|
+
### `label` (string)
|
|
190
|
+
|
|
191
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
192
|
+
|
|
193
|
+
### `forceEnabled` (boolean)
|
|
194
|
+
|
|
195
|
+
Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
|
package/docs/pie-schema.json
CHANGED
|
@@ -168,6 +168,27 @@
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
|
+
"ConfigureWithForceProp": {
|
|
172
|
+
"title": "ConfigureWithForceProp",
|
|
173
|
+
"type": "object",
|
|
174
|
+
"properties": {
|
|
175
|
+
"settings": {
|
|
176
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
177
|
+
"type": "boolean",
|
|
178
|
+
"title": "settings"
|
|
179
|
+
},
|
|
180
|
+
"label": {
|
|
181
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
182
|
+
"type": "string",
|
|
183
|
+
"title": "label"
|
|
184
|
+
},
|
|
185
|
+
"forceEnabled": {
|
|
186
|
+
"description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
|
|
187
|
+
"type": "boolean",
|
|
188
|
+
"title": "forceEnabled"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
},
|
|
171
192
|
"Dimension": {
|
|
172
193
|
"title": "Dimension",
|
|
173
194
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -128,6 +128,22 @@ Indicates the max dimension for images in prompt - this is also the default dime
|
|
|
128
128
|
|
|
129
129
|
Indicates the max dimension for images in rationale
|
|
130
130
|
|
|
131
|
+
## `ConfigureWithForceProp` (object)
|
|
132
|
+
|
|
133
|
+
Properties of the `ConfigureWithForceProp` object:
|
|
134
|
+
|
|
135
|
+
### `settings` (boolean)
|
|
136
|
+
|
|
137
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
138
|
+
|
|
139
|
+
### `label` (string)
|
|
140
|
+
|
|
141
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
142
|
+
|
|
143
|
+
### `forceEnabled` (boolean)
|
|
144
|
+
|
|
145
|
+
Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
|
|
146
|
+
|
|
131
147
|
## `Dimension` (object)
|
|
132
148
|
|
|
133
149
|
Properties of the `Dimension` object:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/drawing-response",
|
|
3
|
-
"version": "4.2.2",
|
|
3
|
+
"version": "4.2.3-next.2+efeedec0b",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"author": "pie framework developers",
|
|
26
26
|
"license": "ISC",
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "efeedec0b1046804ab1acac50834b3e6eeb67571",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"postpublish": "../../scripts/postpublish"
|
|
30
30
|
},
|