@pie-element/hotspot 4.11.4 → 5.0.0
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 +17 -0
- package/configure/CHANGELOG.md +17 -0
- package/configure/lib/defaults.js +11 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/root.js +16 -4
- package/configure/lib/root.js.map +1 -1
- package/configure/package.json +3 -3
- package/configure/src/__tests__/__snapshots__/root.test.js.snap +10 -0
- package/configure/src/defaults.js +11 -1
- package/configure/src/root.jsx +12 -1
- package/docs/config-schema.json +63 -0
- package/docs/config-schema.json.md +49 -1
- package/docs/pie-schema.json +21 -0
- package/docs/pie-schema.json.md +16 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [5.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.11.4...@pie-element/hotspot@5.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [4.11.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot@4.11.3...@pie-element/hotspot@4.11.4) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @pie-element/hotspot
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [5.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.7.4...@pie-element/hotspot-configure@5.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [4.7.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-configure@4.7.3...@pie-element/hotspot-configure@4.7.4) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @pie-element/hotspot-configure
|
|
@@ -60,7 +60,17 @@ var _default = {
|
|
|
60
60
|
enabled: true,
|
|
61
61
|
label: 'Preserve aspect ratio'
|
|
62
62
|
},
|
|
63
|
-
minShapes: 2
|
|
63
|
+
minShapes: 2,
|
|
64
|
+
maxImageWidth: {
|
|
65
|
+
teacherInstructions: 300,
|
|
66
|
+
prompt: 300,
|
|
67
|
+
rationale: 300
|
|
68
|
+
},
|
|
69
|
+
maxImageHeight: {
|
|
70
|
+
teacherInstructions: 300,
|
|
71
|
+
prompt: 300,
|
|
72
|
+
rationale: 300
|
|
73
|
+
}
|
|
64
74
|
}
|
|
65
75
|
};
|
|
66
76
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","prompt","toolbarEditorPosition","promptEnabled","imageUrl","shapes","rectangles","polygons","multipleCorrect","partialScoring","dimensions","height","width","hotspotColor","hotspotList","outlineColor","outlineList","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","strokeWidth","configuration","settings","label","rationale","spellCheck","enabled","teacherInstructions","preserveAspectRatio","minShapes"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,6BADH;AAELC,IAAAA,qBAAqB,EAAE,QAFlB;AAGLC,IAAAA,aAAa,EAAE,IAHV;AAILC,IAAAA,QAAQ,EAAE,EAJL;AAKLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAE,EADN;AAENC,MAAAA,QAAQ,EAAE;AAFJ,KALH;AASLC,IAAAA,eAAe,EAAE,IATZ;AAULC,IAAAA,cAAc,EAAE,KAVX;AAWLC,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,CADE;AAEVC,MAAAA,KAAK,EAAE;AAFG,KAXP;AAeLC,IAAAA,YAAY,EAAE,2BAfT;AAgBLC,IAAAA,WAAW,EAAE,CACX,2BADW,CAhBR;AAmBLC,IAAAA,YAAY,EAAE,MAnBT;AAoBLC,IAAAA,WAAW,EAAE,CACX,MADW,CApBR;AAuBLC,IAAAA,gBAAgB,EAAE,IAvBb;AAwBLC,IAAAA,0BAA0B,EAAE,IAxBvB;AAyBLC,IAAAA,0BAA0B,EAAE,IAzBvB;AA0BLC,IAAAA,WAAW,EAAE;AA1BR,GADM;AA6BbC,EAAAA,aAAa,EAAE;AACbb,IAAAA,eAAe,EAAE;AACfc,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KADJ;AAKbd,IAAAA,cAAc,EAAE;AACda,MAAAA,QAAQ,EAAE,KADI;AAEdC,MAAAA,KAAK,EAAE;AAFO,KALH;AASbC,IAAAA,SAAS,EAAE;AACTF,MAAAA,QAAQ,EAAE,IADD;AAETC,MAAAA,KAAK,EAAE;AAFE,KATE;AAabtB,IAAAA,MAAM,EAAE;AACNqB,MAAAA,QAAQ,EAAE,IADJ;AAENC,MAAAA,KAAK,EAAE;AAFD,KAbK;AAiBbE,IAAAA,UAAU,EAAE;AACVF,MAAAA,KAAK,EAAE,YADG;AAEVD,MAAAA,QAAQ,EAAC,KAFC;AAGVI,MAAAA,OAAO,EAAC;AAHE,KAjBC;AAsBbC,IAAAA,mBAAmB,EAAE;AACnBL,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KAtBR;AA0BbK,IAAAA,mBAAmB,EAAE;AACnBN,MAAAA,QAAQ,EAAE,KADS;AAEnBI,MAAAA,OAAO,EAAE,IAFU;AAGnBH,MAAAA,KAAK,EAAE;AAHY,KA1BR;AA+BbM,IAAAA,SAAS,EAAE
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","prompt","toolbarEditorPosition","promptEnabled","imageUrl","shapes","rectangles","polygons","multipleCorrect","partialScoring","dimensions","height","width","hotspotColor","hotspotList","outlineColor","outlineList","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","strokeWidth","configuration","settings","label","rationale","spellCheck","enabled","teacherInstructions","preserveAspectRatio","minShapes","maxImageWidth","maxImageHeight"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,6BADH;AAELC,IAAAA,qBAAqB,EAAE,QAFlB;AAGLC,IAAAA,aAAa,EAAE,IAHV;AAILC,IAAAA,QAAQ,EAAE,EAJL;AAKLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAE,EADN;AAENC,MAAAA,QAAQ,EAAE;AAFJ,KALH;AASLC,IAAAA,eAAe,EAAE,IATZ;AAULC,IAAAA,cAAc,EAAE,KAVX;AAWLC,IAAAA,UAAU,EAAE;AACVC,MAAAA,MAAM,EAAE,CADE;AAEVC,MAAAA,KAAK,EAAE;AAFG,KAXP;AAeLC,IAAAA,YAAY,EAAE,2BAfT;A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O,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEd1B,MAAAA,MAAM,EAAE,GAFM;AAGduB,MAAAA,SAAS,EAAE;AAHG;AArCH;AA7BF,C","sourcesContent":["export default {\n model: {\n prompt: 'This is the question prompt',\n toolbarEditorPosition: 'bottom',\n promptEnabled: true,\n imageUrl: '',\n shapes: {\n rectangles: [],\n polygons: []\n },\n multipleCorrect: true,\n partialScoring: false,\n dimensions: {\n height: 0,\n width: 0\n },\n hotspotColor: 'rgba(137, 183, 244, 0.65)',\n hotspotList: [\n 'rgba(137, 183, 244, 0.65)'\n ],\n outlineColor: 'blue',\n outlineList: [\n 'blue'\n ],\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n strokeWidth: 5\n },\n configuration: {\n multipleCorrect: {\n settings: true,\n label: 'Multiple Correct Responses'\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n prompt: {\n settings: true,\n label: 'Prompt'\n },\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n preserveAspectRatio: {\n settings: false,\n enabled: true,\n label: 'Preserve aspect ratio'\n },\n minShapes: 2,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n }\n }\n};\n"],"file":"defaults.js"}
|
package/configure/lib/root.js
CHANGED
|
@@ -134,7 +134,11 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
134
134
|
_ref$spellCheck = _ref.spellCheck,
|
|
135
135
|
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
136
136
|
_ref$preserveAspectRa = _ref.preserveAspectRatio,
|
|
137
|
-
preserveAspectRatio = _ref$preserveAspectRa === void 0 ? {} : _ref$preserveAspectRa
|
|
137
|
+
preserveAspectRatio = _ref$preserveAspectRa === void 0 ? {} : _ref$preserveAspectRa,
|
|
138
|
+
_ref$maxImageWidth = _ref.maxImageWidth,
|
|
139
|
+
maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
|
|
140
|
+
_ref$maxImageHeight = _ref.maxImageHeight,
|
|
141
|
+
maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight;
|
|
138
142
|
|
|
139
143
|
var _ref2 = model || {},
|
|
140
144
|
teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
|
|
@@ -149,6 +153,8 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
149
153
|
|
|
150
154
|
var toolbarOpts = {};
|
|
151
155
|
var validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
156
|
+
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
157
|
+
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
152
158
|
|
|
153
159
|
switch (model.toolbarEditorPosition) {
|
|
154
160
|
case 'top':
|
|
@@ -192,7 +198,9 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
192
198
|
imageSupport: imageSupport,
|
|
193
199
|
nonEmpty: false,
|
|
194
200
|
toolbarOpts: toolbarOpts,
|
|
195
|
-
spellCheck: spellCheckEnabled
|
|
201
|
+
spellCheck: spellCheckEnabled,
|
|
202
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
203
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight
|
|
196
204
|
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
197
205
|
label: prompt.label,
|
|
198
206
|
className: classes.prompt
|
|
@@ -202,7 +210,9 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
202
210
|
imageSupport: imageSupport,
|
|
203
211
|
nonEmpty: false,
|
|
204
212
|
toolbarOpts: toolbarOpts,
|
|
205
|
-
spellCheck: spellCheckEnabled
|
|
213
|
+
spellCheck: spellCheckEnabled,
|
|
214
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
215
|
+
maxImageHeight: defaultImageMaxHeight
|
|
206
216
|
})), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
207
217
|
label: rationale.label,
|
|
208
218
|
className: classes.prompt
|
|
@@ -211,7 +221,9 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
211
221
|
onChange: onRationaleChanged,
|
|
212
222
|
imageSupport: imageSupport,
|
|
213
223
|
toolbarOpts: toolbarOpts,
|
|
214
|
-
spellCheck: spellCheckEnabled
|
|
224
|
+
spellCheck: spellCheckEnabled,
|
|
225
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
226
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight
|
|
215
227
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
216
228
|
className: (0, _classnames["default"])(classes.label, classes.flexContainer)
|
|
217
229
|
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/root.jsx"],"names":["Panel","settings","toggle","Root","fieldType","color","onColorChanged","props","cType","value","resizeType","model","dimensions","shapes","configuration","preserveAspectRatio","onUpdateImageDimension","onUpdateShapes","nextImageDimensions","updatedDimensions","enabled","shapesArray","updatedShapes","classes","imageSupport","onConfigurationChanged","onImageUpload","onModelChangedByConfig","onPromptChanged","onRationaleChanged","onTeacherInstructionsChanged","multipleCorrect","partialScoring","prompt","teacherInstructions","rationale","spellCheck","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","errors","shapesError","selectionsError","toolbarOpts","validationMessage","toolbarEditorPosition","position","base","label","Properties","regular","flexContainer","subheading","tooltip","errorText","hotspotColor","hotspotList","outlineColor","outlineList","handleColorChange","imageUrl","strokeWidth","width","e","handleOnUpdateImageDimensions","field","height","React","Component","styles","theme","marginTop","spacing","unit","container","display","flex","paddingTop","marginRight","marginBottom","switchElement","justifyContent","margin","alignItems","fontSize","whiteSpace","maxWidth","padding","propTypes","PropTypes","object","isRequired","shape","add","func"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAQA,IAAQA,KAAR,GAA0BC,kBAA1B,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA0BD,kBAA1B,CAAeC,MAAf;;IAEaC,I;;;;;;;;;;;;;;;0GACS,UAACC,SAAD,EAAYC,KAAZ,EAAsB;AACxC,UAAQC,cAAR,GAA2B,MAAKC,KAAhC,CAAQD,cAAR;AACA,UAAME,KAAK,aAAMJ,SAAN,UAAX;AAEAE,MAAAA,cAAc,CAACE,KAAD,EAAQH,KAAR,CAAd;AACD,K;sHAE+B,UAACI,KAAD,EAAQC,UAAR,EAAuB;AACrD,wBAKI,MAAKH,KALT;AAAA,0CACEI,KADF;AAAA,UACWC,UADX,qBACWA,UADX;AAAA,UACuBC,MADvB,qBACuBA,MADvB;AAAA,8CAEEC,aAFF,CAEmBC,mBAFnB;AAAA,UAEmBA,mBAFnB,sCAEyC,EAFzC;AAAA,UAGEC,sBAHF,eAGEA,sBAHF;AAAA,UAIEC,cAJF,eAIEA,cAJF;;AAOA,UAAMC,mBAAmB,mCAAQN,UAAR,4CAAqBF,UAArB,EAAkCD,KAAlC,EAAzB,CARqD,CAUrD;;;AACA,UAAMU,iBAAiB,GAAG,kCACxBP,UADwB,EAExBM,mBAFwB,EAGxBH,mBAAmB,CAACK,OAHI,EAIxBV,UAJwB,CAA1B,CAXqD,CAiBrD;;AACA,UAAMW,WAAW,GAAG,yBAAaR,MAAb,CAApB,CAlBqD,CAmBrD;;AACA,UAAMS,aAAa,GAAG,6B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,CAAeH,UAfxB;AAgBf9D,EAAAA,4BAA4B,EAAE4D,sBAAUK,IAAV,CAAeH;AAhB9B,CAAjB;;eAmBe,wBAAWtB,MAAX,EAAmBnE,IAAnB,C","sourcesContent":["import React from 'react';\nimport {\n settings,\n layout,\n InputContainer,\n NumberTextField\n} from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport HotspotPalette from './hotspot-palette';\nimport HotspotContainer from './hotspot-container';\nimport classNames from 'classnames';\nimport {\n updateImageDimensions,\n generateValidationMessage,\n getUpdatedShapes,\n getAllShapes,\n groupShapes\n} from './utils';\n\nconst { Panel, toggle } = settings;\n\nexport class Root extends React.Component {\n handleColorChange = (fieldType, color) => {\n const { onColorChanged } = this.props;\n const cType = `${fieldType}Color`;\n\n onColorChanged(cType, color);\n };\n\n handleOnUpdateImageDimensions = (value, resizeType) => {\n const {\n model: { dimensions, shapes },\n configuration: { preserveAspectRatio = {} },\n onUpdateImageDimension,\n onUpdateShapes,\n } = this.props;\n\n const nextImageDimensions = { ...dimensions, [resizeType]: value };\n\n // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept\n const updatedDimensions = updateImageDimensions(\n dimensions,\n nextImageDimensions,\n preserveAspectRatio.enabled,\n resizeType\n );\n // transform shapes map into shapes array\n const shapesArray = getAllShapes(shapes);\n // transform all the shapes to fit the re-sized image\n const updatedShapes = getUpdatedShapes(dimensions, updatedDimensions, shapesArray);\n // transform shapes array back into shapes map\n\n onUpdateShapes(groupShapes(updatedShapes));\n onUpdateImageDimension(updatedDimensions);\n };\n\n render() {\n const {\n classes,\n configuration,\n model,\n imageSupport,\n onConfigurationChanged,\n onImageUpload,\n onModelChangedByConfig,\n onPromptChanged,\n onRationaleChanged,\n onUpdateImageDimension,\n onTeacherInstructionsChanged,\n onUpdateShapes\n } = this.props;\n const {\n multipleCorrect = {},\n partialScoring = {},\n prompt = {},\n teacherInstructions = {},\n rationale = {},\n spellCheck = {},\n preserveAspectRatio = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled, errors } = model || {};\n const { shapesError, selectionsError } = errors || {};\n const toolbarOpts = {};\n\n const validationMessage = generateValidationMessage(configuration);\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={onModelChangedByConfig}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Settings': {\n multipleCorrect:\n multipleCorrect.settings && toggle(multipleCorrect.label),\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n promptEnabled:\n prompt.settings && toggle(prompt.label),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings && toggle(teacherInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n }\n }}\n />\n }\n >\n <div className={classes.regular}>\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.prompt}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.prompt}>\n <EditableHtml\n markup={model.prompt || ''}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.prompt}\n >\n <EditableHtml\n markup={model.rationale || ''}\n onChange={onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n <div className={classNames(classes.label, classes.flexContainer)}>\n <Typography className={classes.subheading} variant=\"subheading\">\n Define Hotspot\n </Typography>\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'left'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }}/>\n </Tooltip>\n </div>\n {shapesError && <div className={classes.errorText}>{shapesError}</div>}\n {selectionsError && <div className={classes.errorText}>{selectionsError}</div>}\n\n <HotspotPalette\n hotspotColor={model.hotspotColor}\n hotspotList={model.hotspotList}\n outlineColor={model.outlineColor}\n outlineList={model.outlineList}\n onHotspotColorChange={color =>\n this.handleColorChange('hotspot', color)\n }\n onOutlineColorChange={color =>\n this.handleColorChange('outline', color)\n }\n />\n\n <HotspotContainer\n dimensions={model.dimensions}\n imageUrl={model.imageUrl}\n multipleCorrect={model.multipleCorrect}\n hotspotColor={model.hotspotColor}\n outlineColor={model.outlineColor}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={onUpdateShapes}\n onImageUpload={onImageUpload}\n shapes={model.shapes}\n strokeWidth={model.strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatio.enabled}\n />\n\n {model.imageUrl && (\n <div>\n <Typography className={classes.label} variant=\"subheading\">\n Image Dimensions\n </Typography>\n\n <div className={classes.dimensions}>\n <NumberTextField\n key=\"hotspot-manual-width\"\n label=\"Width\"\n value={model.dimensions.width}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}\n showErrorWhenOutsideRange\n className={classes.field}\n />\n <NumberTextField\n key=\"hotspot-manual-height\"\n label=\"Height\"\n value={model.dimensions.height}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}\n showErrorWhenOutsideRange\n className={classes.field}\n />\n </div>\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 container: {\n display: 'flex',\n marginTop: theme.spacing.unit\n },\n dimensions: {\n display: 'flex'\n },\n field: {\n flex: 1,\n width: '90%'\n },\n label: {\n marginTop: theme.spacing.unit * 4\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n subheading: {\n marginRight: '5px'\n },\n regular: {\n marginBottom: theme.spacing.unit * 3\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'center'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n padding: '5px 0'\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 onImageUpload: PropTypes.func.isRequired,\n onColorChanged: PropTypes.func.isRequired,\n onPromptChanged: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n onModelChangedByConfig: PropTypes.func.isRequired,\n onRationaleChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n onTeacherInstructionsChanged: 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","fieldType","color","onColorChanged","props","cType","value","resizeType","model","dimensions","shapes","configuration","preserveAspectRatio","onUpdateImageDimension","onUpdateShapes","nextImageDimensions","updatedDimensions","enabled","shapesArray","updatedShapes","classes","imageSupport","onConfigurationChanged","onImageUpload","onModelChangedByConfig","onPromptChanged","onRationaleChanged","onTeacherInstructionsChanged","multipleCorrect","partialScoring","prompt","teacherInstructions","rationale","spellCheck","maxImageWidth","maxImageHeight","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","errors","shapesError","selectionsError","toolbarOpts","validationMessage","defaultImageMaxWidth","defaultImageMaxHeight","toolbarEditorPosition","position","base","label","Properties","regular","flexContainer","subheading","tooltip","errorText","hotspotColor","hotspotList","outlineColor","outlineList","handleColorChange","imageUrl","strokeWidth","width","e","handleOnUpdateImageDimensions","field","height","React","Component","styles","theme","marginTop","spacing","unit","container","display","flex","paddingTop","marginRight","marginBottom","switchElement","justifyContent","margin","alignItems","fontSize","whiteSpace","maxWidth","padding","propTypes","PropTypes","object","isRequired","shape","add","func"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAQA,IAAQA,KAAR,GAA0BC,kBAA1B,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA0BD,kBAA1B,CAAeC,MAAf;;IAEaC,I;;;;;;;;;;;;;;;0GACS,UAACC,SAAD,EAAYC,KAAZ,EAAsB;AACxC,UAAQC,cAAR,GAA2B,MAAKC,KAAhC,CAAQD,cAAR;AACA,UAAME,KAAK,aAAMJ,SAAN,UAAX;AAEAE,MAAAA,cAAc,CAACE,KAAD,EAAQH,KAAR,CAAd;AACD,K;sHAE+B,UAACI,KAAD,EAAQC,UAAR,EAAuB;AACrD,wBAKI,MAAKH,KALT;AAAA,0CACEI,KADF;AAAA,UACWC,UADX,qBACWA,UADX;AAAA,UACuBC,MADvB,qBACuBA,MADvB;AAAA,8CAEEC,aAFF,CAEmBC,mBAFnB;AAAA,UAEmBA,mBAFnB,sCAEyC,EAFzC;AAAA,UAGEC,sBAHF,eAGEA,sBAHF;AAAA,UAIEC,cAJF,eAIEA,cAJF;;AAOA,UAAMC,mBAAmB,mCAAQN,UAAR,4CAAqBF,UAArB,EA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FE;AAGTuF,MAAAA,OAAO,EAAE;AAHA;AAzCY,GAAL;AAAA,CAApB;;AAgDAzF,IAAI,CAAC0F,SAAL,GAAiB;AACftE,EAAAA,OAAO,EAAEuE,sBAAUC,MAAV,CAAiBC,UADX;AAEflF,EAAAA,aAAa,EAAEgF,sBAAUC,MAFV;AAGfpF,EAAAA,KAAK,EAAEmF,sBAAUC,MAAV,CAAiBC,UAHT;AAIfxE,EAAAA,YAAY,EAAEsE,sBAAUG,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEJ,sBAAUK,IADa;AAE5B,cAAQL,sBAAUK;AAFU,GAAhB,CAJC;AAQfzE,EAAAA,aAAa,EAAEoE,sBAAUK,IAAV,CAAeH,UARf;AASf1F,EAAAA,cAAc,EAAEwF,sBAAUK,IAAV,CAAeH,UAThB;AAUfpE,EAAAA,eAAe,EAAEkE,sBAAUK,IAAV,CAAeH,UAVjB;AAWfhF,EAAAA,sBAAsB,EAAE8E,sBAAUK,IAAV,CAAeH,UAXxB;AAYf/E,EAAAA,cAAc,EAAE6E,sBAAUK,IAAV,CAAeH,UAZhB;AAafrE,EAAAA,sBAAsB,EAAEmE,sBAAUK,IAAV,CAAeH,UAbxB;AAcfnE,EAAAA,kBAAkB,EAAEiE,sBAAUK,IAAV,CAAeH,UAdpB;AAefvE,EAAAA,sBAAsB,EAAEqE,sBAAUK,IAAV,CAAeH,UAfxB;AAgBflE,EAAAA,4BAA4B,EAAEgE,sBAAUK,IAAV,CAAeH;AAhB9B,CAAjB;;eAmBe,wBAAWtB,MAAX,EAAmBvE,IAAnB,C","sourcesContent":["import React from 'react';\nimport {\n settings,\n layout,\n InputContainer,\n NumberTextField\n} from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport HotspotPalette from './hotspot-palette';\nimport HotspotContainer from './hotspot-container';\nimport classNames from 'classnames';\nimport {\n updateImageDimensions,\n generateValidationMessage,\n getUpdatedShapes,\n getAllShapes,\n groupShapes\n} from './utils';\n\nconst { Panel, toggle } = settings;\n\nexport class Root extends React.Component {\n handleColorChange = (fieldType, color) => {\n const { onColorChanged } = this.props;\n const cType = `${fieldType}Color`;\n\n onColorChanged(cType, color);\n };\n\n handleOnUpdateImageDimensions = (value, resizeType) => {\n const {\n model: { dimensions, shapes },\n configuration: { preserveAspectRatio = {} },\n onUpdateImageDimension,\n onUpdateShapes,\n } = this.props;\n\n const nextImageDimensions = { ...dimensions, [resizeType]: value };\n\n // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept\n const updatedDimensions = updateImageDimensions(\n dimensions,\n nextImageDimensions,\n preserveAspectRatio.enabled,\n resizeType\n );\n // transform shapes map into shapes array\n const shapesArray = getAllShapes(shapes);\n // transform all the shapes to fit the re-sized image\n const updatedShapes = getUpdatedShapes(dimensions, updatedDimensions, shapesArray);\n // transform shapes array back into shapes map\n\n onUpdateShapes(groupShapes(updatedShapes));\n onUpdateImageDimension(updatedDimensions);\n };\n\n render() {\n const {\n classes,\n configuration,\n model,\n imageSupport,\n onConfigurationChanged,\n onImageUpload,\n onModelChangedByConfig,\n onPromptChanged,\n onRationaleChanged,\n onUpdateImageDimension,\n onTeacherInstructionsChanged,\n onUpdateShapes\n } = this.props;\n const {\n multipleCorrect = {},\n partialScoring = {},\n prompt = {},\n teacherInstructions = {},\n rationale = {},\n spellCheck = {},\n preserveAspectRatio = {},\n maxImageWidth = {},\n maxImageHeight = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled, errors } = model || {};\n const { shapesError, selectionsError } = errors || {};\n const toolbarOpts = {};\n\n const validationMessage = generateValidationMessage(configuration);\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={onModelChangedByConfig}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Settings': {\n multipleCorrect:\n multipleCorrect.settings && toggle(multipleCorrect.label),\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n promptEnabled:\n prompt.settings && toggle(prompt.label),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings && toggle(teacherInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n }\n }}\n />\n }\n >\n <div className={classes.regular}>\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.prompt}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={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 />\n </InputContainer>\n )}\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.prompt}>\n <EditableHtml\n markup={model.prompt || ''}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.prompt}\n >\n <EditableHtml\n markup={model.rationale || ''}\n onChange={onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n <div className={classNames(classes.label, classes.flexContainer)}>\n <Typography className={classes.subheading} variant=\"subheading\">\n Define Hotspot\n </Typography>\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'left'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }}/>\n </Tooltip>\n </div>\n {shapesError && <div className={classes.errorText}>{shapesError}</div>}\n {selectionsError && <div className={classes.errorText}>{selectionsError}</div>}\n\n <HotspotPalette\n hotspotColor={model.hotspotColor}\n hotspotList={model.hotspotList}\n outlineColor={model.outlineColor}\n outlineList={model.outlineList}\n onHotspotColorChange={color =>\n this.handleColorChange('hotspot', color)\n }\n onOutlineColorChange={color =>\n this.handleColorChange('outline', color)\n }\n />\n\n <HotspotContainer\n dimensions={model.dimensions}\n imageUrl={model.imageUrl}\n multipleCorrect={model.multipleCorrect}\n hotspotColor={model.hotspotColor}\n outlineColor={model.outlineColor}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={onUpdateShapes}\n onImageUpload={onImageUpload}\n shapes={model.shapes}\n strokeWidth={model.strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatio.enabled}\n />\n\n {model.imageUrl && (\n <div>\n <Typography className={classes.label} variant=\"subheading\">\n Image Dimensions\n </Typography>\n\n <div className={classes.dimensions}>\n <NumberTextField\n key=\"hotspot-manual-width\"\n label=\"Width\"\n value={model.dimensions.width}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}\n showErrorWhenOutsideRange\n className={classes.field}\n />\n <NumberTextField\n key=\"hotspot-manual-height\"\n label=\"Height\"\n value={model.dimensions.height}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}\n showErrorWhenOutsideRange\n className={classes.field}\n />\n </div>\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 container: {\n display: 'flex',\n marginTop: theme.spacing.unit\n },\n dimensions: {\n display: 'flex'\n },\n field: {\n flex: 1,\n width: '90%'\n },\n label: {\n marginTop: theme.spacing.unit * 4\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n subheading: {\n marginRight: '5px'\n },\n regular: {\n marginBottom: theme.spacing.unit * 3\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'center'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n padding: '5px 0'\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 onImageUpload: PropTypes.func.isRequired,\n onColorChanged: PropTypes.func.isRequired,\n onPromptChanged: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n onModelChangedByConfig: PropTypes.func.isRequired,\n onRationaleChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n onTeacherInstructionsChanged: PropTypes.func.isRequired,\n};\n\nexport default withStyles(styles)(Root);\n"],"file":"root.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/hotspot-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
11
|
"@material-ui/icons": "^3.0.2",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
13
|
-
"@pie-lib/config-ui": "^
|
|
14
|
-
"@pie-lib/editable-html": "^
|
|
13
|
+
"@pie-lib/config-ui": "^11.0.1",
|
|
14
|
+
"@pie-lib/editable-html": "^8.1.0",
|
|
15
15
|
"classnames": "^2.2.6",
|
|
16
16
|
"debug": "^3.1.0",
|
|
17
17
|
"konva": "^3.2.4",
|
|
@@ -7,6 +7,16 @@ exports[`Root render renders 1`] = `
|
|
|
7
7
|
<Panel
|
|
8
8
|
configuration={
|
|
9
9
|
Object {
|
|
10
|
+
"maxImageHeight": Object {
|
|
11
|
+
"prompt": 300,
|
|
12
|
+
"rationale": 300,
|
|
13
|
+
"teacherInstructions": 300,
|
|
14
|
+
},
|
|
15
|
+
"maxImageWidth": Object {
|
|
16
|
+
"prompt": 300,
|
|
17
|
+
"rationale": 300,
|
|
18
|
+
"teacherInstructions": 300,
|
|
19
|
+
},
|
|
10
20
|
"minShapes": 2,
|
|
11
21
|
"multipleCorrect": Object {
|
|
12
22
|
"label": "Multiple Correct Responses",
|
|
@@ -58,6 +58,16 @@ export default {
|
|
|
58
58
|
enabled: true,
|
|
59
59
|
label: 'Preserve aspect ratio'
|
|
60
60
|
},
|
|
61
|
-
minShapes: 2
|
|
61
|
+
minShapes: 2,
|
|
62
|
+
maxImageWidth: {
|
|
63
|
+
teacherInstructions: 300,
|
|
64
|
+
prompt: 300,
|
|
65
|
+
rationale: 300,
|
|
66
|
+
},
|
|
67
|
+
maxImageHeight: {
|
|
68
|
+
teacherInstructions: 300,
|
|
69
|
+
prompt: 300,
|
|
70
|
+
rationale: 300,
|
|
71
|
+
}
|
|
62
72
|
}
|
|
63
73
|
};
|
package/configure/src/root.jsx
CHANGED
|
@@ -81,7 +81,9 @@ export class Root extends React.Component {
|
|
|
81
81
|
teacherInstructions = {},
|
|
82
82
|
rationale = {},
|
|
83
83
|
spellCheck = {},
|
|
84
|
-
preserveAspectRatio = {}
|
|
84
|
+
preserveAspectRatio = {},
|
|
85
|
+
maxImageWidth = {},
|
|
86
|
+
maxImageHeight = {}
|
|
85
87
|
} = configuration || {};
|
|
86
88
|
const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled, errors } = model || {};
|
|
87
89
|
const { shapesError, selectionsError } = errors || {};
|
|
@@ -89,6 +91,9 @@ export class Root extends React.Component {
|
|
|
89
91
|
|
|
90
92
|
const validationMessage = generateValidationMessage(configuration);
|
|
91
93
|
|
|
94
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
95
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
96
|
+
|
|
92
97
|
switch (model.toolbarEditorPosition) {
|
|
93
98
|
case 'top':
|
|
94
99
|
toolbarOpts.position = 'top';
|
|
@@ -137,6 +142,8 @@ export class Root extends React.Component {
|
|
|
137
142
|
nonEmpty={false}
|
|
138
143
|
toolbarOpts={toolbarOpts}
|
|
139
144
|
spellCheck={spellCheckEnabled}
|
|
145
|
+
maxImageWidth={maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth}
|
|
146
|
+
maxImageHeight={maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight}
|
|
140
147
|
/>
|
|
141
148
|
</InputContainer>
|
|
142
149
|
)}
|
|
@@ -149,6 +156,8 @@ export class Root extends React.Component {
|
|
|
149
156
|
nonEmpty={false}
|
|
150
157
|
toolbarOpts={toolbarOpts}
|
|
151
158
|
spellCheck={spellCheckEnabled}
|
|
159
|
+
maxImageWidth={defaultImageMaxWidth}
|
|
160
|
+
maxImageHeight={defaultImageMaxHeight}
|
|
152
161
|
/>
|
|
153
162
|
</InputContainer>
|
|
154
163
|
)}
|
|
@@ -164,6 +173,8 @@ export class Root extends React.Component {
|
|
|
164
173
|
imageSupport={imageSupport}
|
|
165
174
|
toolbarOpts={toolbarOpts}
|
|
166
175
|
spellCheck={spellCheckEnabled}
|
|
176
|
+
maxImageWidth={maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth}
|
|
177
|
+
maxImageHeight={maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight}
|
|
167
178
|
/>
|
|
168
179
|
</InputContainer>
|
|
169
180
|
)}
|
package/docs/config-schema.json
CHANGED
|
@@ -98,6 +98,48 @@
|
|
|
98
98
|
"type": "number",
|
|
99
99
|
"title": "maxSelections"
|
|
100
100
|
},
|
|
101
|
+
"maxImageWidth": {
|
|
102
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
103
|
+
"type": "object",
|
|
104
|
+
"properties": {
|
|
105
|
+
"teacherInstructions": {
|
|
106
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
107
|
+
"type": "number",
|
|
108
|
+
"title": "teacherInstructions"
|
|
109
|
+
},
|
|
110
|
+
"prompt": {
|
|
111
|
+
"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",
|
|
112
|
+
"type": "number",
|
|
113
|
+
"title": "prompt"
|
|
114
|
+
},
|
|
115
|
+
"rationale": {
|
|
116
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
117
|
+
"type": "number",
|
|
118
|
+
"title": "rationale"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"maxImageHeight": {
|
|
123
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
124
|
+
"type": "object",
|
|
125
|
+
"properties": {
|
|
126
|
+
"teacherInstructions": {
|
|
127
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
128
|
+
"type": "number",
|
|
129
|
+
"title": "teacherInstructions"
|
|
130
|
+
},
|
|
131
|
+
"prompt": {
|
|
132
|
+
"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",
|
|
133
|
+
"type": "number",
|
|
134
|
+
"title": "prompt"
|
|
135
|
+
},
|
|
136
|
+
"rationale": {
|
|
137
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
138
|
+
"type": "number",
|
|
139
|
+
"title": "rationale"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
101
143
|
"showPrompt": {
|
|
102
144
|
"description": "Determines whether prompt field will be displayed or not",
|
|
103
145
|
"default": true,
|
|
@@ -127,6 +169,27 @@
|
|
|
127
169
|
"title": "label"
|
|
128
170
|
}
|
|
129
171
|
}
|
|
172
|
+
},
|
|
173
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
174
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"teacherInstructions": {
|
|
178
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
179
|
+
"type": "number",
|
|
180
|
+
"title": "teacherInstructions"
|
|
181
|
+
},
|
|
182
|
+
"prompt": {
|
|
183
|
+
"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",
|
|
184
|
+
"type": "number",
|
|
185
|
+
"title": "prompt"
|
|
186
|
+
},
|
|
187
|
+
"rationale": {
|
|
188
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
189
|
+
"type": "number",
|
|
190
|
+
"title": "rationale"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
130
193
|
}
|
|
131
194
|
},
|
|
132
195
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -74,6 +74,38 @@ Maximum number of shapes
|
|
|
74
74
|
|
|
75
75
|
Maximum number of selected shapes in correct answer
|
|
76
76
|
|
|
77
|
+
# `maxImageWidth` (object)
|
|
78
|
+
|
|
79
|
+
Properties of the `maxImageWidth` object:
|
|
80
|
+
|
|
81
|
+
## `teacherInstructions` (number)
|
|
82
|
+
|
|
83
|
+
Indicates the max dimension for images in teacher instructions
|
|
84
|
+
|
|
85
|
+
## `prompt` (number)
|
|
86
|
+
|
|
87
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
88
|
+
|
|
89
|
+
## `rationale` (number)
|
|
90
|
+
|
|
91
|
+
Indicates the max dimension for images in rationale
|
|
92
|
+
|
|
93
|
+
# `maxImageHeight` (object)
|
|
94
|
+
|
|
95
|
+
Properties of the `maxImageHeight` object:
|
|
96
|
+
|
|
97
|
+
## `teacherInstructions` (number)
|
|
98
|
+
|
|
99
|
+
Indicates the max dimension for images in teacher instructions
|
|
100
|
+
|
|
101
|
+
## `prompt` (number)
|
|
102
|
+
|
|
103
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
104
|
+
|
|
105
|
+
## `rationale` (number)
|
|
106
|
+
|
|
107
|
+
Indicates the max dimension for images in rationale
|
|
108
|
+
|
|
77
109
|
# `showPrompt` (boolean)
|
|
78
110
|
|
|
79
111
|
Determines whether prompt field will be displayed or not
|
|
@@ -102,4 +134,20 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
102
134
|
|
|
103
135
|
### `label` (string)
|
|
104
136
|
|
|
105
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
137
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
138
|
+
|
|
139
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
140
|
+
|
|
141
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
142
|
+
|
|
143
|
+
### `teacherInstructions` (number)
|
|
144
|
+
|
|
145
|
+
Indicates the max dimension for images in teacher instructions
|
|
146
|
+
|
|
147
|
+
### `prompt` (number)
|
|
148
|
+
|
|
149
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
150
|
+
|
|
151
|
+
### `rationale` (number)
|
|
152
|
+
|
|
153
|
+
Indicates the max dimension for images in rationale
|
package/docs/pie-schema.json
CHANGED
|
@@ -266,6 +266,27 @@
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
},
|
|
269
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
270
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
271
|
+
"type": "object",
|
|
272
|
+
"properties": {
|
|
273
|
+
"teacherInstructions": {
|
|
274
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
275
|
+
"type": "number",
|
|
276
|
+
"title": "teacherInstructions"
|
|
277
|
+
},
|
|
278
|
+
"prompt": {
|
|
279
|
+
"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",
|
|
280
|
+
"type": "number",
|
|
281
|
+
"title": "prompt"
|
|
282
|
+
},
|
|
283
|
+
"rationale": {
|
|
284
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
285
|
+
"type": "number",
|
|
286
|
+
"title": "rationale"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
269
290
|
"Shape": {
|
|
270
291
|
"title": "Shape",
|
|
271
292
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -187,6 +187,22 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
187
187
|
|
|
188
188
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
189
189
|
|
|
190
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
191
|
+
|
|
192
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
193
|
+
|
|
194
|
+
### `teacherInstructions` (number)
|
|
195
|
+
|
|
196
|
+
Indicates the max dimension for images in teacher instructions
|
|
197
|
+
|
|
198
|
+
### `prompt` (number)
|
|
199
|
+
|
|
200
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
201
|
+
|
|
202
|
+
### `rationale` (number)
|
|
203
|
+
|
|
204
|
+
Indicates the max dimension for images in rationale
|
|
205
|
+
|
|
190
206
|
## `Shape` (object)
|
|
191
207
|
|
|
192
208
|
Properties of the `Shape` object:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/hotspot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"author": "pie framework developers",
|
|
21
21
|
"license": "ISC",
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "ff92cee6f9a7bf3f3dc75dbafd2263710f0a6b3d",
|
|
23
23
|
"scripts": {
|
|
24
24
|
"postpublish": "../../scripts/postpublish"
|
|
25
25
|
},
|