@pie-element/extended-text-entry 6.8.12 → 7.1.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.
@@ -52,6 +52,18 @@ Whether a control to allow insertion of math forumulas should be displayed
52
52
 
53
53
  Default: `false`
54
54
 
55
+ # `spanishInput` (boolean)
56
+
57
+ Whether a control to allow insertion of spanish characters should be displayed
58
+
59
+ Default: `false`
60
+
61
+ # `specialInput` (boolean)
62
+
63
+ Whether a control to allow insertion of special characters should be displayed
64
+
65
+ Default: `false`
66
+
55
67
  # `multiple` (boolean)
56
68
 
57
69
  Indicates if multiple parts are enabled
@@ -157,6 +169,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
157
169
  Indicates the value of the item if it affects config-ui
158
170
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
159
171
 
172
+ ## `ConfigureMaxImageDimensionsProp` (object)
173
+
174
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
175
+
176
+ ### `teacherInstructions` (number)
177
+
178
+ Indicates the max dimension for images in teacher instructions
179
+
180
+ ### `prompt` (number)
181
+
182
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
183
+
184
+ ### `rationale` (number)
185
+
186
+ Indicates the max dimension for images in rationale
187
+
160
188
  ## `Dimensions` (object)
161
189
 
162
190
  Properties of the `Dimensions` object:
package/lib/main.js CHANGED
@@ -93,6 +93,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
93
93
  feedback = model.feedback,
94
94
  teacherInstructions = model.teacherInstructions,
95
95
  mathInput = model.mathInput,
96
+ spanishInput = model.spanishInput,
97
+ specialInput = model.specialInput,
96
98
  animationsDisabled = model.animationsDisabled,
97
99
  playersToolbarPosition = model.playersToolbarPosition,
98
100
  spellCheckEnabled = model.spellCheckEnabled;
@@ -121,6 +123,20 @@ var Main = /*#__PURE__*/function (_React$Component) {
121
123
  break;
122
124
  }
123
125
 
126
+ var languageCharactersProps = [];
127
+
128
+ if (spanishInput) {
129
+ languageCharactersProps.push({
130
+ language: 'spanish'
131
+ });
132
+ }
133
+
134
+ if (specialInput) {
135
+ languageCharactersProps.push({
136
+ language: 'special'
137
+ });
138
+ }
139
+
124
140
  return /*#__PURE__*/_react["default"].createElement("div", {
125
141
  className: classes.main,
126
142
  ref: function ref(_ref2) {
@@ -162,7 +178,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
162
178
  audio: {
163
179
  disabled: true
164
180
  }
165
- }
181
+ },
182
+ languageCharactersProps: languageCharactersProps
166
183
  }), feedback && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_renderUi.Feedback, {
167
184
  correctness: "correct",
168
185
  feedback: feedback
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["log","style","theme","main","backgroundColor","color","background","text","prompt","width","marginBottom","spacing","unit","fontSize","Main","props","onChange","model","classes","session","dimensions","disabled","feedback","teacherInstructions","mathInput","animationsDisabled","playersToolbarPosition","spellCheckEnabled","value","height","maxHeight","toolbarOpts","teacherInstructionsDiv","position","ref","containerRef","hidden","visible","collapsible","changeSession","toString","math","customKeys","keypadMode","equationEditor","controlledKeypadMode","video","audio","React","Component","PropTypes","func","isRequired","object","shape","string"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;;AAEA,IAAMC,KAAK,GAAG,SAARA,KAAQ,CAAAC,KAAK;AAAA,SAAK;AACtBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADb;AAEJD,MAAAA,KAAK,EAAEA,gBAAME,IAAN;AAFH,KADgB;AAKtBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE,MADD;AAENJ,MAAA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UAAAA,IAAI,EAAE;AACJpB,YAAAA,QAAQ,EAAE,CAACG,SADP;AAEJkB,YAAAA,UAAU,EAAE,KAAK3B,KAAL,CAAWE,KAAX,CAAiByB,UAFzB;AAGJC,YAAAA,UAAU,EAAE,KAAK5B,KAAL,CAAWE,KAAX,CAAiB2B,cAHzB;AAIJC,YAAAA,oBAAoB,EAAE;AAJlB,WADK;AAOXC,UAAAA,KAAK,EAAE;AACLzB,YAAAA,QAAQ,EAAE;AADL,WAPI;AAUV0B,UAAAA,KAAK,EAAE;AACN1B,YAAAA,QAAQ,EAAE;AADJ;AAVG;AAXf,QA7BF,EAuDGC,QAAQ,iBACP,0DACE,2CADF,eAEE,gCAAC,kBAAD;AAAU,QAAA,WAAW,EAAC,SAAtB;AAAgC,QAAA,QAAQ,EAAEA;AAA1C,QAFF,CAxDJ,CADF;AAgED;;;EAjGuB0B,kBAAMC,S;;;iCAAnBnC,I,eACQ;AACjBE,EAAAA,QAAQ,EAAEkC,sBAAUC,IAAV,CAAeC,UADR;AAEjBnC,EAAAA,KAAK,EAAEiC,sBAAUG,MAFA;AAGjBnC,EAAAA,OAAO,EAAEgC,sBAAUG,MAAV,CAAiBD,UAHT;AAIjBjC,EAAAA,OAAO,EAAE+B,sBAAUI,KAAV,CAAgB;AACvB1B,IAAAA,KAAK,EAAEsB,sBAAUK;AADM,GAAhB,EAENH;AANc,C;;eAmGN,wBAAWnD,KAAX,EAAkBa,IAAlB,C","sourcesContent":["import React from 'react';\nimport EditableHTML from '@pie-lib/editable-html';\nimport PropTypes from 'prop-types';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport debug from 'debug';\nimport debounce from 'lodash/debounce';\nimport {color, Feedback, Collapsible, PreviewPrompt} from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst style = theme => ({\n main: {\n backgroundColor: color.background(),\n color: color.text()\n },\n prompt: {\n width: '100%',\n color: color.text(),\n marginBottom: theme.spacing.unit * 2,\n fontSize: 'inherit'\n }\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n onChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n classes: PropTypes.object.isRequired,\n session: PropTypes.shape({\n value: PropTypes.string\n }).isRequired\n };\n\n changeSession = debounce(this.props.onChange, 1500);\n\n render() {\n const { model, classes, session } = this.props;\n const { dimensions, disabled, feedback, teacherInstructions, mathInput, animationsDisabled, playersToolbarPosition, spellCheckEnabled } = model;\n const { value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n const toolbarOpts = {};\n\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />;\n\n switch (playersToolbarPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n return (\n <div\n className={classes.main}\n ref={ref => {\n this.containerRef = ref;\n }}\n >\n {\n teacherInstructions && (\n <div>\n {!animationsDisabled ? (\n <Collapsible\n labels={{hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions'}}\n className={classes.collapsible}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : teacherInstructionsDiv }\n <br/>\n </div>\n )\n }\n {model.prompt && (\n <Typography\n component={'span'}\n className={classes.prompt}\n >\n <PreviewPrompt defaultClassName=\"prompt\" prompt={model.prompt} />\n </Typography>\n )}\n <EditableHTML\n className=\"response-area-editor\"\n onChange={this.changeSession}\n markup={value || ''}\n width={width && width.toString()}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n pluginProps={{\n math: {\n disabled: !mathInput,\n customKeys: this.props.model.customKeys,\n keypadMode: this.props.model.equationEditor,\n controlledKeypadMode: false\n },\n video: {\n disabled: true\n },\n audio: {\n disabled: true\n }\n }}\n />\n {feedback && (\n <div>\n <br />\n <Feedback correctness=\"correct\" feedback={feedback}/>\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default withStyles(style)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["log","style","theme","main","backgroundColor","color","background","text","prompt","width","marginBottom","spacing","unit","fontSize","Main","props","onChange","model","classes","session","dimensions","disabled","feedback","teacherInstructions","mathInput","spanishInput","specialInput","animationsDisabled","playersToolbarPosition","spellCheckEnabled","value","height","maxHeight","toolbarOpts","teacherInstructionsDiv","position","languageCharactersProps","push","language","ref","containerRef","hidden","visible","collapsible","changeSession","toString","math","customKeys","keypadMode","equationEditor","controlledKeypadMode","video","audio","React","Component","PropTypes","func","isRequired","object","shape","string"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;;AAEA,IAAMC,KAAK,GAAG,SAARA,KAAQ,CAAAC,KAAK;AAAA,SAAK;AACtBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EADb;AAEJD,MAAAA,KAAK,EAAEA,gBAAME,IAAN;AAFH,KADgB;AAKtBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE,MADD;AAENJ,MAAAA,KAAK,EAAEA,gBAAME,IAAN,EAFD;AAGNG,MAAAA,YAAY,EAAER,KAAK,CAACS,OAAN,CAAcC,IAAd,GAAqB,CAH7B;AAINC,MAAAA,QAAQ,EAAE;AAJJ;AALc,GAAL;AAAA,CAAnB;;IAaaC,I;;;;;;;;;;;;;;;sGAUK,0BAAS,MAAKC,KAAL,CAAWC,QAApB,EAA8B,IAA9B,C;;;;;;WAEhB,kBAAS;AAAA;;AACP,wBAAoC,KAAKD,KAAzC;AAAA,UAAQE,KAAR,eAAQA,KAAR;AAAA,UAAeC,OAAf,eAAeA,O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G,SADP;AAEJuB,YAAAA,UAAU,EAAE,KAAKhC,KAAL,CAAWE,KAAX,CAAiB8B,UAFzB;AAGJC,YAAAA,UAAU,EAAE,KAAKjC,KAAL,CAAWE,KAAX,CAAiBgC,cAHzB;AAIJC,YAAAA,oBAAoB,EAAE;AAJlB,WADK;AAOXC,UAAAA,KAAK,EAAE;AACL9B,YAAAA,QAAQ,EAAE;AADL,WAPI;AAUV+B,UAAAA,KAAK,EAAE;AACN/B,YAAAA,QAAQ,EAAE;AADJ;AAVG,SAXf;AAyBE,QAAA,uBAAuB,EAAEe;AAzB3B,QA7BF,EAwDGd,QAAQ,iBACP,0DACE,2CADF,eAEE,gCAAC,kBAAD;AAAU,QAAA,WAAW,EAAC,SAAtB;AAAgC,QAAA,QAAQ,EAAEA;AAA1C,QAFF,CAzDJ,CADF;AAiED;;;EAvHuB+B,kBAAMC,S;;;iCAAnBxC,I,eACQ;AACjBE,EAAAA,QAAQ,EAAEuC,sBAAUC,IAAV,CAAeC,UADR;AAEjBxC,EAAAA,KAAK,EAAEsC,sBAAUG,MAFA;AAGjBxC,EAAAA,OAAO,EAAEqC,sBAAUG,MAAV,CAAiBD,UAHT;AAIjBtC,EAAAA,OAAO,EAAEoC,sBAAUI,KAAV,CAAgB;AACvB7B,IAAAA,KAAK,EAAEyB,sBAAUK;AADM,GAAhB,EAENH;AANc,C;;eAyHN,wBAAWxD,KAAX,EAAkBa,IAAlB,C","sourcesContent":["import React from 'react';\nimport EditableHTML from '@pie-lib/editable-html';\nimport PropTypes from 'prop-types';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport debug from 'debug';\nimport debounce from 'lodash/debounce';\nimport {color, Feedback, Collapsible, PreviewPrompt} from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst style = theme => ({\n main: {\n backgroundColor: color.background(),\n color: color.text()\n },\n prompt: {\n width: '100%',\n color: color.text(),\n marginBottom: theme.spacing.unit * 2,\n fontSize: 'inherit'\n }\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n onChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n classes: PropTypes.object.isRequired,\n session: PropTypes.shape({\n value: PropTypes.string\n }).isRequired\n };\n\n changeSession = debounce(this.props.onChange, 1500);\n\n render() {\n const { model, classes, session } = this.props;\n const {\n dimensions,\n disabled,\n feedback,\n teacherInstructions,\n mathInput,\n spanishInput,\n specialInput,\n animationsDisabled,\n playersToolbarPosition,\n spellCheckEnabled\n } = model;\n const { value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n const toolbarOpts = {};\n\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />;\n\n switch (playersToolbarPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n const languageCharactersProps = [];\n\n if (spanishInput) {\n languageCharactersProps.push({ language: 'spanish' });\n }\n\n if (specialInput) {\n languageCharactersProps.push({ language: 'special' });\n }\n\n return (\n <div\n className={classes.main}\n ref={ref => {\n this.containerRef = ref;\n }}\n >\n {\n teacherInstructions && (\n <div>\n {!animationsDisabled ? (\n <Collapsible\n labels={{hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions'}}\n className={classes.collapsible}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : teacherInstructionsDiv }\n <br/>\n </div>\n )\n }\n {model.prompt && (\n <Typography\n component={'span'}\n className={classes.prompt}\n >\n <PreviewPrompt defaultClassName=\"prompt\" prompt={model.prompt} />\n </Typography>\n )}\n <EditableHTML\n className=\"response-area-editor\"\n onChange={this.changeSession}\n markup={value || ''}\n width={width && width.toString()}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n pluginProps={{\n math: {\n disabled: !mathInput,\n customKeys: this.props.model.customKeys,\n keypadMode: this.props.model.equationEditor,\n controlledKeypadMode: false\n },\n video: {\n disabled: true\n },\n audio: {\n disabled: true\n }\n }}\n languageCharactersProps={languageCharactersProps}\n />\n {feedback && (\n <div>\n <br />\n <Feedback correctness=\"correct\" feedback={feedback}/>\n </div>\n )}\n </div>\n );\n }\n}\n\nexport default withStyles(style)(Main);\n"],"file":"main.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry",
3
- "version": "6.8.12",
3
+ "version": "7.1.0",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -12,9 +12,9 @@
12
12
  "@material-ui/core": "^3.9.2",
13
13
  "@material-ui/icons": "^3.0.2",
14
14
  "@pie-framework/pie-player-events": "^0.1.0",
15
- "@pie-lib/editable-html": "^7.22.5",
16
- "@pie-lib/math-rendering": "^2.4.2",
17
- "@pie-lib/render-ui": "^4.12.8",
15
+ "@pie-lib/editable-html": "^8.1.2",
16
+ "@pie-lib/math-rendering": "^2.4.3",
17
+ "@pie-lib/render-ui": "^4.12.9",
18
18
  "classnames": "^2.2.5",
19
19
  "debug": "^4.1.1",
20
20
  "lodash.throttle": "^4.1.1",
@@ -22,7 +22,7 @@
22
22
  "react": "^16.8.1",
23
23
  "react-dom": "^16.8.1"
24
24
  },
25
- "gitHead": "3f3d6edc68890098821978ebd5a8b90da31ab222",
25
+ "gitHead": "9b55e36b358084c7a96a08bad969f4856d6802da",
26
26
  "scripts": {
27
27
  "postpublish": "../../scripts/postpublish"
28
28
  },
@@ -1,402 +0,0 @@
1
- import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.19/module/index.js";
2
- import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.3.1/module/index.js";
3
- import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.5.6/module/index.js";
4
- var lib = {};
5
- Object.defineProperty(lib, "__esModule", {
6
- value: true
7
- });
8
- class ModelUpdatedEvent extends CustomEvent {
9
- constructor(update, reset = false) {
10
- super(ModelUpdatedEvent.TYPE, {
11
- bubbles: true,
12
- detail: {
13
- update,
14
- reset
15
- }
16
- });
17
- this.update = update;
18
- this.reset = reset;
19
- }
20
- }
21
- ModelUpdatedEvent.TYPE = 'model.updated';
22
- var ModelUpdatedEvent_1 = lib.ModelUpdatedEvent = ModelUpdatedEvent;
23
- class DeleteImageEvent extends CustomEvent {
24
- constructor(src, done) {
25
- super(DeleteImageEvent.TYPE, {
26
- bubbles: true,
27
- detail: {
28
- src,
29
- done
30
- }
31
- });
32
- this.src = src;
33
- this.done = done;
34
- }
35
- }
36
- DeleteImageEvent.TYPE = 'delete.image';
37
- var DeleteImageEvent_1 = lib.DeleteImageEvent = DeleteImageEvent;
38
- class InsertImageEvent extends CustomEvent {
39
- constructor(handler) {
40
- super(InsertImageEvent.TYPE, {
41
- bubbles: true,
42
- detail: handler
43
- });
44
- this.handler = handler;
45
- }
46
- }
47
- InsertImageEvent.TYPE = 'insert.image';
48
- var InsertImageEvent_1 = lib.InsertImageEvent = InsertImageEvent;
49
- const React$1 = _dll_react;
50
- const PropTypes = _dll_prop_types;
51
- const {Typography: Typography} = _dll_material_ui__core;
52
- const {withStyles: withStyles} = _dll_material_ui__core_styles;
53
- const {FeedbackSelector: FeedbackSelector} = _dll_pie_lib__config_ui;
54
- const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
55
- const {settings: settings} = _dll_pie_lib__config_ui;
56
- const {layout: layout} = _dll_pie_lib__config_ui;
57
- const EditableHtml = _dll_pie_lib__editable_html;
58
- const {ALL_PLUGINS: ALL_PLUGINS} = _dll_pie_lib__editable_html;
59
- const _jsxFileName = "/home/circleci/repo/packages/extended-text-entry/configure/src/main.jsx";
60
- const {Panel, toggle, numberFields, dropdown} = settings;
61
- const defaultFeedback = {
62
- type: 'default',
63
- default: 'Your answer has been submitted'
64
- };
65
- class Main extends React$1.Component {
66
- static __initStatic() {
67
- this.propTypes = {
68
- onModelChanged: PropTypes.func.isRequired,
69
- onConfigurationChanged: PropTypes.func,
70
- model: PropTypes.object.isRequired,
71
- configuration: PropTypes.object.isRequired,
72
- imageSupport: PropTypes.object.isRequired,
73
- classes: PropTypes.object.isRequired
74
- };
75
- }
76
- constructor(props) {
77
- super(props);
78
- Main.prototype.__init.call(this);
79
- Main.prototype.__init2.call(this);
80
- Main.prototype.__init3.call(this);
81
- this.state = {
82
- setDimensions: true
83
- };
84
- }
85
- __init() {
86
- this.onPromptChange = markup => {
87
- const {onModelChanged, model} = this.props;
88
- onModelChanged({
89
- ...model,
90
- prompt: markup
91
- });
92
- };
93
- }
94
- __init2() {
95
- this.changeFeedback = feedback => {
96
- const {model, onModelChanged} = this.props;
97
- const update = {
98
- ...model,
99
- feedback
100
- };
101
- onModelChanged(update);
102
- };
103
- }
104
- __init3() {
105
- this.changeTeacherInstructions = teacherInstructions => {
106
- const {model, onModelChanged} = this.props;
107
- const update = {
108
- ...model,
109
- teacherInstructions
110
- };
111
- onModelChanged(update);
112
- };
113
- }
114
- render() {
115
- const {model, classes, onModelChanged, configuration, onConfigurationChanged, imageSupport} = this.props;
116
- const {multiple = {}, feedback = {}, teacherInstructions = {}, prompt = {}, studentInstructions = {}, mathInput = {}, dimensions = {}, equationEditor = {}, spellCheck = {}, playerSpellCheck = {}} = configuration || ({});
117
- const {teacherInstructionsEnabled, promptEnabled, feedbackEnabled, spellCheckEnabled} = model || ({});
118
- const toolbarOpts = {};
119
- switch (model.toolbarEditorPosition) {
120
- case 'top':
121
- toolbarOpts.position = 'top';
122
- break;
123
- default:
124
- toolbarOpts.position = 'bottom';
125
- break;
126
- }
127
- return React$1.createElement(layout.ConfigLayout, {
128
- settings: React$1.createElement(Panel, {
129
- model: model,
130
- configuration: configuration,
131
- onChangeModel: model => onModelChanged(model),
132
- onChangeConfiguration: config => onConfigurationChanged(config),
133
- groups: {
134
- Settings: {
135
- mathInput: mathInput.settings && toggle(mathInput.label),
136
- equationEditor: equationEditor.enabled && model.mathInput && dropdown(equationEditor.label, ['non-negative-integers', 'integers', 'decimals', 'fractions', 'Grade 1 - 2', 'Grade 3 - 5', 'Grade 6 - 7', 'Grade 8 - HS', 'geometry', 'advanced-algebra', 'statistics', 'item-authoring']),
137
- dimensions: numberFields(dimensions.label, {
138
- width: {
139
- label: 'Width (px)',
140
- suffix: 'px',
141
- min: 100,
142
- max: 500
143
- },
144
- height: {
145
- label: 'Height (px)',
146
- suffix: 'px',
147
- min: 100,
148
- max: 500
149
- }
150
- }),
151
- 'multiple.enabled': multiple.settings && toggle(multiple.label, true),
152
- promptEnabled: prompt.settings && toggle(prompt.label),
153
- feedbackEnabled: feedback.settings && toggle(feedback.label),
154
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
155
- playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label)
156
- },
157
- Properties: {
158
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
159
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label)
160
- }
161
- },
162
- __self: this,
163
- __source: {
164
- fileName: _jsxFileName,
165
- lineNumber: 94
166
- }
167
- }),
168
- __self: this,
169
- __source: {
170
- fileName: _jsxFileName,
171
- lineNumber: 92
172
- }
173
- }, React$1.createElement('div', {
174
- __self: this,
175
- __source: {
176
- fileName: _jsxFileName,
177
- lineNumber: 154
178
- }
179
- }, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
180
- label: teacherInstructions.label,
181
- className: classes.promptContainer,
182
- __self: this,
183
- __source: {
184
- fileName: _jsxFileName,
185
- lineNumber: 156
186
- }
187
- }, React$1.createElement(EditableHtml, {
188
- className: classes.prompt,
189
- markup: model.teacherInstructions || '',
190
- onChange: this.changeTeacherInstructions,
191
- imageSupport: imageSupport,
192
- nonEmpty: false,
193
- toolbarOpts: toolbarOpts,
194
- spellCheck: spellCheckEnabled,
195
- __self: this,
196
- __source: {
197
- fileName: _jsxFileName,
198
- lineNumber: 160
199
- }
200
- })), React$1.createElement('br', {
201
- __self: this,
202
- __source: {
203
- fileName: _jsxFileName,
204
- lineNumber: 172
205
- }
206
- }), promptEnabled && React$1.createElement(InputContainer, {
207
- label: prompt.label,
208
- className: classes.promptContainer,
209
- __self: this,
210
- __source: {
211
- fileName: _jsxFileName,
212
- lineNumber: 175
213
- }
214
- }, React$1.createElement(EditableHtml, {
215
- activePlugins: ALL_PLUGINS,
216
- className: classes.prompt,
217
- markup: model.prompt || '',
218
- onChange: this.onPromptChange,
219
- imageSupport: imageSupport,
220
- nonEmpty: false,
221
- toolbarOpts: toolbarOpts,
222
- spellCheck: spellCheckEnabled,
223
- __self: this,
224
- __source: {
225
- fileName: _jsxFileName,
226
- lineNumber: 179
227
- }
228
- })), feedbackEnabled && React$1.createElement(React$1.Fragment, {
229
- __self: this,
230
- __source: {
231
- fileName: _jsxFileName,
232
- lineNumber: 193
233
- }
234
- }, React$1.createElement(Typography, {
235
- className: classes.header,
236
- variant: "subheading",
237
- __self: this,
238
- __source: {
239
- fileName: _jsxFileName,
240
- lineNumber: 194
241
- }
242
- }, "Feedback"), React$1.createElement(FeedbackSelector, {
243
- label: "When submitted, show",
244
- feedback: model.feedback || defaultFeedback,
245
- onChange: this.changeFeedback,
246
- toolbarOpts: toolbarOpts,
247
- __self: this,
248
- __source: {
249
- fileName: _jsxFileName,
250
- lineNumber: 198
251
- }
252
- }))));
253
- }
254
- }
255
- Main.__initStatic();
256
- var Main$1 = withStyles(theme => ({
257
- header: {
258
- paddingBottom: theme.spacing.unit
259
- },
260
- promptContainer: {
261
- paddingTop: theme.spacing.unit * 2,
262
- marginBottom: theme.spacing.unit * 2,
263
- width: '100%'
264
- },
265
- promptInput: {
266
- width: '100%',
267
- marginBottom: theme.spacing.unit
268
- },
269
- field: {
270
- width: '200px'
271
- }
272
- }))(Main);
273
- var defaults = {
274
- model: {
275
- dimensions: {
276
- height: 100,
277
- width: 500
278
- },
279
- prompt: 'This is the question prompt',
280
- mathInput: false,
281
- equationEditor: 'Grade 8 - HS',
282
- feedbackEnabled: true,
283
- rationaleEnabled: true,
284
- promptEnabled: true,
285
- teacherInstructionsEnabled: true,
286
- studentInstructionsEnabled: true,
287
- spellCheckEnabled: true,
288
- playerSpellCheckEnabled: true,
289
- toolbarEditorPosition: 'bottom'
290
- },
291
- configuration: {
292
- dimensions: {
293
- settings: true,
294
- label: 'Text-Entry Display Size'
295
- },
296
- spellCheck: {
297
- label: 'Spellcheck',
298
- settings: false,
299
- enabled: true
300
- },
301
- playerSpellCheck: {
302
- label: 'Student Spellcheck',
303
- settings: true,
304
- enabled: true
305
- },
306
- equationEditor: {
307
- settings: false,
308
- label: 'Equation Editor',
309
- enabled: true
310
- },
311
- feedback: {
312
- settings: true,
313
- label: 'Feedback'
314
- },
315
- mathInput: {
316
- settings: true,
317
- label: 'Student response can include math notation',
318
- enabled: false
319
- },
320
- multiple: {
321
- settings: false,
322
- label: 'Multiple Parts',
323
- enabled: false
324
- },
325
- studentInstructions: {
326
- settings: false,
327
- label: 'Student Instructions'
328
- },
329
- prompt: {
330
- settings: true,
331
- label: 'Prompt'
332
- },
333
- teacherInstructions: {
334
- settings: true,
335
- label: 'Teacher Instructions'
336
- }
337
- }
338
- };
339
- const React = _dll_react;
340
- const ReactDOM = _dll_react_dom;
341
- class ExtendedTextEntry extends HTMLElement {
342
- static __initStatic() {
343
- this.createDefaultModel = (model = {}) => ({
344
- ...defaults.model,
345
- ...model
346
- });
347
- }
348
- constructor() {
349
- super();
350
- this._model = ExtendedTextEntry.createDefaultModel();
351
- this._configuration = defaults.configuration;
352
- }
353
- set model(m) {
354
- this._model = ExtendedTextEntry.createDefaultModel(m);
355
- this.render();
356
- }
357
- set configuration(c) {
358
- this._configuration = {
359
- ...defaults.configuration,
360
- ...c
361
- };
362
- this.render();
363
- }
364
- onModelChanged(m) {
365
- this._model = m;
366
- this.render();
367
- this.dispatchEvent(new ModelUpdatedEvent_1(this._model, false));
368
- }
369
- onConfigurationChanged(c) {
370
- this._configuration = {
371
- ...defaults.configuration,
372
- ...c
373
- };
374
- if (this._model) {
375
- this.onModelChanged(this._model);
376
- }
377
- this.render();
378
- }
379
- insertImage(handler) {
380
- this.dispatchEvent(new InsertImageEvent_1(handler));
381
- }
382
- onDeleteImage(src, done) {
383
- this.dispatchEvent(new DeleteImageEvent_1(src, done));
384
- }
385
- render() {
386
- if (this._model) {
387
- const element = React.createElement(Main$1, {
388
- model: this._model,
389
- configuration: this._configuration,
390
- onModelChanged: this.onModelChanged.bind(this),
391
- onConfigurationChanged: this.onConfigurationChanged.bind(this),
392
- imageSupport: {
393
- add: this.insertImage.bind(this),
394
- delete: this.onDeleteImage.bind(this)
395
- }
396
- });
397
- ReactDOM.render(element, this);
398
- }
399
- }
400
- }
401
- ExtendedTextEntry.__initStatic();
402
- export {ExtendedTextEntry as default};
@@ -1,99 +0,0 @@
1
- /**
2
- * Get the feedback from a {FeedbackConfig}
3
- *
4
- * @param {FeedbackConfig} feedback
5
- * @param {string} fallback
6
- */
7
- const getFeedback = (feedback, fallback) =>
8
- new Promise(resolve => {
9
- if (!feedback || feedback.type === 'none') {
10
- resolve(undefined);
11
- return;
12
- }
13
- feedback = feedback || {};
14
- const out = feedback[feedback.type] || fallback;
15
- resolve(out);
16
- });
17
-
18
- var defaults = {
19
- dimensions: {
20
- height: 100,
21
- width: 500,
22
- }
23
- };
24
-
25
- async function createDefaultModel(model = {}) {
26
-
27
- return {
28
- ...defaults,
29
- ...model,
30
- };
31
- }
32
-
33
- const normalize = question => ({
34
- ...defaults,
35
- feedbackEnabled: true,
36
- rationaleEnabled: true,
37
- promptEnabled: true,
38
- teacherInstructionsEnabled: true,
39
- studentInstructionsEnabled: true,
40
- playerSpellCheckEnabled: true,
41
- ...question,
42
- });
43
-
44
-
45
- async function model(question, session, env) {
46
- const normalizedQuestion = normalize(question);
47
-
48
- const fb =
49
- env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled
50
- ? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')
51
- : Promise.resolve(undefined);
52
-
53
- let teacherInstructions = null;
54
- if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
55
- teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
56
- } else {
57
- teacherInstructions = null;
58
- }
59
-
60
- let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';
61
-
62
- switch (normalizedQuestion.equationEditor) {
63
- case 'Grade 1 - 2':
64
- equationEditor = 1;
65
- break;
66
- case 'Grade 3 - 5':
67
- equationEditor = 3;
68
- break;
69
- case 'Grade 6 - 7':
70
- equationEditor = 6;
71
- break;
72
- case 'Grade 8 - HS':
73
- equationEditor = 8;
74
- break;
75
- }
76
-
77
- return fb.then(feedback => ({
78
- prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
79
- dimensions: normalizedQuestion.dimensions,
80
- customKeys: normalizedQuestion.customKeys || [],
81
- disabled: env.mode !== 'gather',
82
- feedback,
83
- teacherInstructions,
84
- mathInput: normalizedQuestion.mathInput,
85
- equationEditor,
86
- spellCheckEnabled: normalizedQuestion.playerSpellCheckEnabled,
87
- playersToolbarPosition: normalizedQuestion.playersToolbarPosition || 'bottom'
88
- }));
89
- }
90
-
91
- async function outcome(/*question, session, env*/) {
92
- return {
93
- score: 0,
94
- completed: 'n/a',
95
- note: 'Requires manual scoring'
96
- };
97
- }
98
-
99
- export { createDefaultModel, model, normalize, outcome };