@pie-element/extended-text-entry 6.7.6 → 6.7.7
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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/package.json +3 -3
- package/lib/main.js +1 -0
- package/lib/main.js.map +1 -1
- package/module/configure.js +386 -0
- package/module/controller.js +96 -0
- package/module/demo.js +36 -0
- package/module/element.js +33581 -0
- package/module/index.html +21 -0
- package/module/manifest.json +22 -0
- package/module/print-demo.js +74 -0
- package/module/print.html +18 -0
- package/module/print.js +33546 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [6.7.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@6.7.6...@pie-element/extended-text-entry@6.7.7) (2021-12-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/extended-text-entry
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [6.7.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@6.7.4...@pie-element/extended-text-entry@6.7.5) (2021-12-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/extended-text-entry
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.4.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@5.4.6...@pie-element/extended-text-entry-configure@5.4.7) (2021-12-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/extended-text-entry-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [5.4.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@5.4.4...@pie-element/extended-text-entry-configure@5.4.5) (2021-12-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/extended-text-entry-configure
|
package/configure/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/extended-text-entry-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "5.4.
|
|
4
|
+
"version": "5.4.7",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@material-ui/core": "^3.9.2",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
13
|
-
"@pie-lib/config-ui": "^10.10.
|
|
14
|
-
"@pie-lib/editable-html": "^7.17.
|
|
13
|
+
"@pie-lib/config-ui": "^10.10.14",
|
|
14
|
+
"@pie-lib/editable-html": "^7.17.14",
|
|
15
15
|
"lodash": "^4.17.15",
|
|
16
16
|
"prop-types": "^15.6.2",
|
|
17
17
|
"react": "^16.8.1",
|
package/lib/main.js
CHANGED
|
@@ -132,6 +132,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
132
132
|
defaultClassName: "prompt",
|
|
133
133
|
prompt: model.prompt
|
|
134
134
|
})), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
135
|
+
className: "response-area-editor",
|
|
135
136
|
onChange: this.changeSession,
|
|
136
137
|
markup: value || '',
|
|
137
138
|
width: width && width.toString(),
|
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","containerRef","model","classes","session","dimensions","disabled","feedback","teacherInstructions","mathInput","animationsDisabled","value","height","maxHeight","teacherInstructionsDiv","ref","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;;;;;;;;;;;;;;;sGAgBK,0BAAS,MAAKC,KAAL,CAAWC,QAApB,EAA8B,IAA9B,C;;;;;;WANhB,8BAAqB;AACnB,UAAI,KAAKC,YAAT,EAAuB;AACrB,uCAAW,KAAKA,YAAhB;AACD;AACF;;;WAID,kBAAS;AAAA;;AACP,wBAAoC,KAAKF,KAAzC;AAAA,UAAQG,KAAR,eAAQA,KAAR;AAAA,UAAeC,OAAf,eAAeA,OAAf;AAAA,UAAwBC,OAAxB,eAAwBA,OAAxB;AACA,UAAQC,UAAR,GAA+FH,KAA/F,CAAQG,UAAR;AAAA,UAAoBC,QAApB,GAA+FJ,KAA/F,CAAoBI,QAApB;AAAA,UAA8BC,QAA9B,GAA+FL,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,"sources":["../src/main.jsx"],"names":["log","style","theme","main","backgroundColor","color","background","text","prompt","width","marginBottom","spacing","unit","fontSize","Main","props","onChange","containerRef","model","classes","session","dimensions","disabled","feedback","teacherInstructions","mathInput","animationsDisabled","value","height","maxHeight","teacherInstructionsDiv","ref","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;;;;;;;;;;;;;;;sGAgBK,0BAAS,MAAKC,KAAL,CAAWC,QAApB,EAA8B,IAA9B,C;;;;;;WANhB,8BAAqB;AACnB,UAAI,KAAKC,YAAT,EAAuB;AACrB,uCAAW,KAAKA,YAAhB;AACD;AACF;;;WAID,kBAAS;AAAA;;AACP,wBAAoC,KAAKF,KAAzC;AAAA,UAAQG,KAAR,eAAQA,KAAR;AAAA,UAAeC,OAAf,eAAeA,OAAf;AAAA,UAAwBC,OAAxB,eAAwBA,OAAxB;AACA,UAAQC,UAAR,GAA+FH,KAA/F,CAAQG,UAAR;AAAA,UAAoBC,QAApB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A2FN,wBAAW/C,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 componentDidUpdate() {\n if (this.containerRef) {\n renderMath(this.containerRef);\n }\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 } = model;\n const { value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />;\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 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 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"}
|
|
@@ -0,0 +1,386 @@
|
|
|
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.2.15/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.16/module/index.js";
|
|
3
|
+
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.0.16/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 = {}} = configuration || ({});
|
|
117
|
+
const {teacherInstructionsEnabled, promptEnabled, feedbackEnabled} = 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, ['Grade 1 - 2', 'Grade 3 - 5', 'Grade 6 - 7', 'Grade 8 - HS', 'geometry', 'advanced-algebra', 'statistics', 'miscellaneous']),
|
|
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
|
+
},
|
|
155
|
+
'Properties': {
|
|
156
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
157
|
+
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label)
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
__self: this,
|
|
161
|
+
__source: {
|
|
162
|
+
fileName: _jsxFileName,
|
|
163
|
+
lineNumber: 84
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
__self: this,
|
|
167
|
+
__source: {
|
|
168
|
+
fileName: _jsxFileName,
|
|
169
|
+
lineNumber: 82
|
|
170
|
+
}
|
|
171
|
+
}, React$1.createElement('div', {
|
|
172
|
+
__self: this,
|
|
173
|
+
__source: {
|
|
174
|
+
fileName: _jsxFileName,
|
|
175
|
+
lineNumber: 132
|
|
176
|
+
}
|
|
177
|
+
}, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
|
|
178
|
+
label: teacherInstructions.label,
|
|
179
|
+
className: classes.promptContainer,
|
|
180
|
+
__self: this,
|
|
181
|
+
__source: {
|
|
182
|
+
fileName: _jsxFileName,
|
|
183
|
+
lineNumber: 135
|
|
184
|
+
}
|
|
185
|
+
}, React$1.createElement(EditableHtml, {
|
|
186
|
+
className: classes.prompt,
|
|
187
|
+
markup: model.teacherInstructions || '',
|
|
188
|
+
onChange: this.changeTeacherInstructions,
|
|
189
|
+
imageSupport: imageSupport,
|
|
190
|
+
nonEmpty: false,
|
|
191
|
+
toolbarOpts: toolbarOpts,
|
|
192
|
+
__self: this,
|
|
193
|
+
__source: {
|
|
194
|
+
fileName: _jsxFileName,
|
|
195
|
+
lineNumber: 136
|
|
196
|
+
}
|
|
197
|
+
})), React$1.createElement('br', {
|
|
198
|
+
__self: this,
|
|
199
|
+
__source: {
|
|
200
|
+
fileName: _jsxFileName,
|
|
201
|
+
lineNumber: 147
|
|
202
|
+
}
|
|
203
|
+
}), promptEnabled && React$1.createElement(InputContainer, {
|
|
204
|
+
label: prompt.label,
|
|
205
|
+
className: classes.promptContainer,
|
|
206
|
+
__self: this,
|
|
207
|
+
__source: {
|
|
208
|
+
fileName: _jsxFileName,
|
|
209
|
+
lineNumber: 150
|
|
210
|
+
}
|
|
211
|
+
}, React$1.createElement(EditableHtml, {
|
|
212
|
+
activePlugins: ALL_PLUGINS,
|
|
213
|
+
className: classes.prompt,
|
|
214
|
+
markup: model.prompt || '',
|
|
215
|
+
onChange: this.onPromptChange,
|
|
216
|
+
imageSupport: imageSupport,
|
|
217
|
+
nonEmpty: false,
|
|
218
|
+
toolbarOpts: toolbarOpts,
|
|
219
|
+
__self: this,
|
|
220
|
+
__source: {
|
|
221
|
+
fileName: _jsxFileName,
|
|
222
|
+
lineNumber: 151
|
|
223
|
+
}
|
|
224
|
+
})), feedbackEnabled && React$1.createElement(React$1.Fragment, {
|
|
225
|
+
__self: this,
|
|
226
|
+
__source: {
|
|
227
|
+
fileName: _jsxFileName,
|
|
228
|
+
lineNumber: 165
|
|
229
|
+
}
|
|
230
|
+
}, React$1.createElement(Typography, {
|
|
231
|
+
className: classes.header,
|
|
232
|
+
variant: "subheading",
|
|
233
|
+
__self: this,
|
|
234
|
+
__source: {
|
|
235
|
+
fileName: _jsxFileName,
|
|
236
|
+
lineNumber: 166
|
|
237
|
+
}
|
|
238
|
+
}, "Feedback"), React$1.createElement(FeedbackSelector, {
|
|
239
|
+
label: "When submitted, show",
|
|
240
|
+
feedback: model.feedback || defaultFeedback,
|
|
241
|
+
onChange: this.changeFeedback,
|
|
242
|
+
toolbarOpts: toolbarOpts,
|
|
243
|
+
__self: this,
|
|
244
|
+
__source: {
|
|
245
|
+
fileName: _jsxFileName,
|
|
246
|
+
lineNumber: 170
|
|
247
|
+
}
|
|
248
|
+
}))));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
Main.__initStatic();
|
|
252
|
+
var Main$1 = withStyles(theme => ({
|
|
253
|
+
header: {
|
|
254
|
+
paddingBottom: theme.spacing.unit
|
|
255
|
+
},
|
|
256
|
+
promptContainer: {
|
|
257
|
+
paddingTop: theme.spacing.unit * 2,
|
|
258
|
+
marginBottom: theme.spacing.unit * 2,
|
|
259
|
+
width: '100%'
|
|
260
|
+
},
|
|
261
|
+
promptInput: {
|
|
262
|
+
width: '100%',
|
|
263
|
+
marginBottom: theme.spacing.unit
|
|
264
|
+
},
|
|
265
|
+
field: {
|
|
266
|
+
width: '200px'
|
|
267
|
+
}
|
|
268
|
+
}))(Main);
|
|
269
|
+
var defaults = {
|
|
270
|
+
model: {
|
|
271
|
+
dimensions: {
|
|
272
|
+
height: 100,
|
|
273
|
+
width: 500
|
|
274
|
+
},
|
|
275
|
+
prompt: 'This is the question prompt',
|
|
276
|
+
mathInput: false,
|
|
277
|
+
equationEditor: 'miscellaneous',
|
|
278
|
+
feedbackEnabled: true,
|
|
279
|
+
rationaleEnabled: true,
|
|
280
|
+
promptEnabled: true,
|
|
281
|
+
teacherInstructionsEnabled: true,
|
|
282
|
+
studentInstructionsEnabled: true,
|
|
283
|
+
toolbarEditorPosition: 'bottom'
|
|
284
|
+
},
|
|
285
|
+
configuration: {
|
|
286
|
+
dimensions: {
|
|
287
|
+
settings: true,
|
|
288
|
+
label: 'Text-Entry Display Size'
|
|
289
|
+
},
|
|
290
|
+
equationEditor: {
|
|
291
|
+
settings: false,
|
|
292
|
+
label: 'Equation Editor',
|
|
293
|
+
enabled: true
|
|
294
|
+
},
|
|
295
|
+
feedback: {
|
|
296
|
+
settings: true,
|
|
297
|
+
label: 'Feedback'
|
|
298
|
+
},
|
|
299
|
+
mathInput: {
|
|
300
|
+
settings: true,
|
|
301
|
+
label: 'Student response can include math notation',
|
|
302
|
+
enabled: false
|
|
303
|
+
},
|
|
304
|
+
multiple: {
|
|
305
|
+
settings: false,
|
|
306
|
+
label: 'Multiple Parts',
|
|
307
|
+
enabled: false
|
|
308
|
+
},
|
|
309
|
+
studentInstructions: {
|
|
310
|
+
settings: false,
|
|
311
|
+
label: 'Student Instructions'
|
|
312
|
+
},
|
|
313
|
+
prompt: {
|
|
314
|
+
settings: true,
|
|
315
|
+
label: 'Prompt'
|
|
316
|
+
},
|
|
317
|
+
teacherInstructions: {
|
|
318
|
+
settings: true,
|
|
319
|
+
label: 'Teacher Instructions'
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
const React = _dll_react;
|
|
324
|
+
const ReactDOM = _dll_react_dom;
|
|
325
|
+
class ExtendedTextEntry extends HTMLElement {
|
|
326
|
+
static __initStatic() {
|
|
327
|
+
this.createDefaultModel = (model = {}) => ({
|
|
328
|
+
...defaults.model,
|
|
329
|
+
...model
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
constructor() {
|
|
333
|
+
super();
|
|
334
|
+
this._model = ExtendedTextEntry.createDefaultModel();
|
|
335
|
+
this._configuration = defaults.configuration;
|
|
336
|
+
}
|
|
337
|
+
set model(m) {
|
|
338
|
+
this._model = ExtendedTextEntry.createDefaultModel(m);
|
|
339
|
+
this.render();
|
|
340
|
+
}
|
|
341
|
+
set configuration(c) {
|
|
342
|
+
this._configuration = {
|
|
343
|
+
...defaults.configuration,
|
|
344
|
+
...c
|
|
345
|
+
};
|
|
346
|
+
this.render();
|
|
347
|
+
}
|
|
348
|
+
onModelChanged(m) {
|
|
349
|
+
this._model = m;
|
|
350
|
+
this.render();
|
|
351
|
+
this.dispatchEvent(new ModelUpdatedEvent_1(this._model, false));
|
|
352
|
+
}
|
|
353
|
+
onConfigurationChanged(c) {
|
|
354
|
+
this._configuration = {
|
|
355
|
+
...defaults.configuration,
|
|
356
|
+
...c
|
|
357
|
+
};
|
|
358
|
+
if (this._model) {
|
|
359
|
+
this.onModelChanged(this._model);
|
|
360
|
+
}
|
|
361
|
+
this.render();
|
|
362
|
+
}
|
|
363
|
+
insertImage(handler) {
|
|
364
|
+
this.dispatchEvent(new InsertImageEvent_1(handler));
|
|
365
|
+
}
|
|
366
|
+
onDeleteImage(src, done) {
|
|
367
|
+
this.dispatchEvent(new DeleteImageEvent_1(src, done));
|
|
368
|
+
}
|
|
369
|
+
render() {
|
|
370
|
+
if (this._model) {
|
|
371
|
+
const element = React.createElement(Main$1, {
|
|
372
|
+
model: this._model,
|
|
373
|
+
configuration: this._configuration,
|
|
374
|
+
onModelChanged: this.onModelChanged.bind(this),
|
|
375
|
+
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
376
|
+
imageSupport: {
|
|
377
|
+
add: this.insertImage.bind(this),
|
|
378
|
+
delete: this.onDeleteImage.bind(this)
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
ReactDOM.render(element, this);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
ExtendedTextEntry.__initStatic();
|
|
386
|
+
export {ExtendedTextEntry as default};
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
...question,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
async function model(question, session, env) {
|
|
45
|
+
const normalizedQuestion = normalize(question);
|
|
46
|
+
|
|
47
|
+
const fb =
|
|
48
|
+
env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled
|
|
49
|
+
? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')
|
|
50
|
+
: Promise.resolve(undefined);
|
|
51
|
+
|
|
52
|
+
let teacherInstructions = null;
|
|
53
|
+
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
54
|
+
teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
|
|
55
|
+
} else {
|
|
56
|
+
teacherInstructions = null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';
|
|
60
|
+
|
|
61
|
+
switch (normalizedQuestion.equationEditor) {
|
|
62
|
+
case 'Grade 1 - 2':
|
|
63
|
+
equationEditor = 1;
|
|
64
|
+
break;
|
|
65
|
+
case 'Grade 3 - 5':
|
|
66
|
+
equationEditor = 3;
|
|
67
|
+
break;
|
|
68
|
+
case 'Grade 6 - 7':
|
|
69
|
+
equationEditor = 6;
|
|
70
|
+
break;
|
|
71
|
+
case 'Grade 8 - HS':
|
|
72
|
+
equationEditor = 8;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return fb.then(feedback => ({
|
|
77
|
+
prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
|
|
78
|
+
dimensions: normalizedQuestion.dimensions,
|
|
79
|
+
customKeys: normalizedQuestion.customKeys || [],
|
|
80
|
+
disabled: env.mode !== 'gather',
|
|
81
|
+
feedback,
|
|
82
|
+
teacherInstructions,
|
|
83
|
+
mathInput: normalizedQuestion.mathInput,
|
|
84
|
+
equationEditor
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function outcome(/*question, session, env*/) {
|
|
89
|
+
return {
|
|
90
|
+
score: 0,
|
|
91
|
+
completed: 'n/a',
|
|
92
|
+
note: 'Requires manual scoring'
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { createDefaultModel, model, normalize, outcome };
|
package/module/demo.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Configure from './configure.js';
|
|
2
|
+
import Element from './element.js';
|
|
3
|
+
import * as controller from './controller.js';
|
|
4
|
+
|
|
5
|
+
var generate = {};
|
|
6
|
+
|
|
7
|
+
generate.model = (id, element) => ({
|
|
8
|
+
id,
|
|
9
|
+
element,
|
|
10
|
+
customKeys: [
|
|
11
|
+
'\\square'
|
|
12
|
+
],
|
|
13
|
+
feedback: { type: 'default', default: 'this is default feedback' },
|
|
14
|
+
prompt: 'This is the question prompt',
|
|
15
|
+
promptEnabled: true,
|
|
16
|
+
mathInput: true,
|
|
17
|
+
toolbarEditorPosition: 'bottom',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const { model } = generate;
|
|
21
|
+
var config = {
|
|
22
|
+
elements: {
|
|
23
|
+
'extended-text-entry': '../..'
|
|
24
|
+
},
|
|
25
|
+
models: [model('1', 'extended-text-entry')]
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//Note: demo-el is a custom element loaded in the markup.
|
|
29
|
+
customElements.whenDefined("demo-el").then(() => {
|
|
30
|
+
config.models.forEach((m) => {
|
|
31
|
+
const de = document.createElement("demo-el");
|
|
32
|
+
document.body.appendChild(de);
|
|
33
|
+
de.def = { tagName: m.element, Element, Configure, controller };
|
|
34
|
+
de.model = m;
|
|
35
|
+
});
|
|
36
|
+
});
|