@pie-element/extended-text-entry 15.2.2-beta.5 → 15.2.2-beta.6

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.
@@ -1,247 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Main = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _configUi = require("@pie-lib/config-ui");
11
- var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
13
- var _styles = require("@mui/material/styles");
14
- var _editableHtmlTipTap = _interopRequireWildcard(require("@pie-lib/editable-html-tip-tap"));
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
- const {
17
- Panel,
18
- toggle,
19
- numberFields,
20
- dropdown
21
- } = _configUi.settings;
22
- const defaultFeedback = {
23
- type: 'default',
24
- default: 'Your answer has been submitted'
25
- };
26
- const StyledHeader = (0, _styles.styled)(_Typography.default)(({
27
- theme
28
- }) => ({
29
- paddingBottom: theme.spacing(1)
30
- }));
31
- const PromptContainer = (0, _styles.styled)(_configUi.InputContainer)(({
32
- theme
33
- }) => ({
34
- paddingTop: theme.spacing(1),
35
- marginTop: theme.spacing(2),
36
- marginBottom: theme.spacing(2),
37
- width: '100%'
38
- }));
39
- const ErrorText = (0, _styles.styled)('div')(({
40
- theme
41
- }) => ({
42
- fontSize: theme.typography.fontSize - 2,
43
- color: theme.palette.error.main,
44
- paddingTop: theme.spacing(1)
45
- }));
46
- class Main extends _react.default.Component {
47
- constructor(props) {
48
- super(props);
49
- (0, _defineProperty2.default)(this, "onPromptChange", markup => {
50
- const {
51
- onModelChanged,
52
- model
53
- } = this.props;
54
- onModelChanged({
55
- ...model,
56
- prompt: markup
57
- });
58
- });
59
- (0, _defineProperty2.default)(this, "changeFeedback", feedback => {
60
- const {
61
- model,
62
- onModelChanged
63
- } = this.props;
64
- const update = {
65
- ...model,
66
- feedback
67
- };
68
- onModelChanged(update);
69
- });
70
- (0, _defineProperty2.default)(this, "changeTeacherInstructions", teacherInstructions => {
71
- const {
72
- model,
73
- onModelChanged
74
- } = this.props;
75
- const update = {
76
- ...model,
77
- teacherInstructions
78
- };
79
- onModelChanged(update);
80
- });
81
- this.state = {
82
- setDimensions: true
83
- };
84
- }
85
- render() {
86
- const {
87
- model,
88
- configuration,
89
- imageSupport,
90
- onConfigurationChanged,
91
- onModelChanged,
92
- uploadSoundSupport
93
- } = this.props;
94
- const {
95
- annotations = {},
96
- contentDimensions = {},
97
- dimensions = {},
98
- equationEditor = {},
99
- feedback = {},
100
- playerSpellCheck = {},
101
- prompt = {},
102
- settingsPanelDisabled,
103
- spanishInput = {},
104
- specialInput = {},
105
- spellCheck = {},
106
- studentInstructions = {},
107
- teacherInstructions = {},
108
- mathInput = {},
109
- maxImageWidth = {},
110
- maxImageHeight = {},
111
- multiple = {},
112
- withRubric = {},
113
- mathMlOptions = {},
114
- baseInputConfiguration = {}
115
- } = configuration || {};
116
- const {
117
- errors = {},
118
- extraCSSRules,
119
- feedbackEnabled,
120
- promptEnabled,
121
- spellCheckEnabled,
122
- teacherInstructionsEnabled,
123
- toolbarEditorPosition
124
- } = model || {};
125
- const {
126
- prompt: promptError,
127
- teacherInstructions: teacherInstructionsError
128
- } = errors;
129
- const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
130
- const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
131
- const toolbarOpts = {
132
- position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
133
- };
134
- const panelSettings = {
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
- spanishInput: spanishInput.settings && toggle(spanishInput.label),
138
- specialInput: specialInput.settings && toggle(specialInput.label),
139
- dimensions: dimensions.settings && numberFields(dimensions.label, {
140
- width: {
141
- label: 'Width (px)',
142
- suffix: 'px',
143
- min: 100,
144
- max: 1200
145
- },
146
- height: {
147
- label: 'Height (px)',
148
- suffix: 'px',
149
- min: 100,
150
- max: 500
151
- }
152
- }),
153
- 'multiple.enabled': multiple.settings && toggle(multiple.label, true),
154
- promptEnabled: prompt.settings && toggle(prompt.label),
155
- feedbackEnabled: feedback.settings && toggle(feedback.label),
156
- annotationsEnabled: annotations.settings && toggle(annotations.label),
157
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
158
- playerSpellCheckDisabled: playerSpellCheck.settings && toggle(playerSpellCheck.label)
159
- };
160
- const panelProperties = {
161
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
162
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
163
- rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
164
- };
165
- const getPluginProps = props => {
166
- return Object.assign({
167
- ...baseInputConfiguration
168
- }, props || {});
169
- };
170
- return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
171
- extraCSSRules: extraCSSRules,
172
- dimensions: contentDimensions,
173
- hideSettings: settingsPanelDisabled,
174
- settings: /*#__PURE__*/_react.default.createElement(Panel, {
175
- model: model,
176
- configuration: configuration,
177
- onChangeModel: model => onModelChanged(model),
178
- onChangeConfiguration: config => onConfigurationChanged(config),
179
- groups: {
180
- Settings: panelSettings,
181
- Properties: panelProperties
182
- }
183
- })
184
- }, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
185
- label: teacherInstructions.label
186
- }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
187
- className: "prompt",
188
- markup: model.teacherInstructions || '',
189
- onChange: this.changeTeacherInstructions,
190
- imageSupport: imageSupport,
191
- nonEmpty: false,
192
- error: teacherInstructionsError,
193
- toolbarOpts: toolbarOpts,
194
- spellCheck: spellCheckEnabled,
195
- maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
196
- maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
197
- uploadSoundSupport: uploadSoundSupport,
198
- languageCharactersProps: [{
199
- language: 'spanish'
200
- }, {
201
- language: 'special'
202
- }],
203
- mathMlOptions: mathMlOptions,
204
- pluginProps: getPluginProps(teacherInstructions?.inputConfiguration)
205
- }), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
206
- label: prompt.label
207
- }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
208
- activePlugins: _editableHtmlTipTap.ALL_PLUGINS,
209
- className: "prompt",
210
- markup: model.prompt || '',
211
- onChange: this.onPromptChange,
212
- imageSupport: imageSupport,
213
- nonEmpty: false,
214
- error: promptError,
215
- toolbarOpts: toolbarOpts,
216
- spellCheck: spellCheckEnabled,
217
- maxImageWidth: defaultImageMaxWidth,
218
- maxImageHeight: defaultImageMaxHeight,
219
- uploadSoundSupport: uploadSoundSupport,
220
- languageCharactersProps: [{
221
- language: 'spanish'
222
- }, {
223
- language: 'special'
224
- }],
225
- mathMlOptions: mathMlOptions,
226
- pluginProps: getPluginProps(prompt?.inputConfiguration)
227
- }), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), feedbackEnabled && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(StyledHeader, {
228
- variant: "h6"
229
- }, "Feedback"), /*#__PURE__*/_react.default.createElement(_configUi.FeedbackSelector, {
230
- label: "When submitted, show",
231
- feedback: model.feedback || defaultFeedback,
232
- onChange: this.changeFeedback,
233
- toolbarOpts: toolbarOpts
234
- })));
235
- }
236
- }
237
- exports.Main = Main;
238
- (0, _defineProperty2.default)(Main, "propTypes", {
239
- onModelChanged: _propTypes.default.func.isRequired,
240
- onConfigurationChanged: _propTypes.default.func,
241
- model: _propTypes.default.object.isRequired,
242
- configuration: _propTypes.default.object.isRequired,
243
- imageSupport: _propTypes.default.object.isRequired,
244
- uploadSoundSupport: _propTypes.default.object.isRequired
245
- });
246
- var _default = exports.default = Main;
247
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_configUi","_propTypes","_Typography","_styles","_editableHtmlTipTap","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Panel","toggle","numberFields","dropdown","settings","defaultFeedback","type","StyledHeader","styled","Typography","theme","paddingBottom","spacing","PromptContainer","InputContainer","paddingTop","marginTop","marginBottom","width","ErrorText","fontSize","typography","color","palette","error","main","Main","React","Component","constructor","props","_defineProperty2","markup","onModelChanged","model","prompt","feedback","update","teacherInstructions","state","setDimensions","render","configuration","imageSupport","onConfigurationChanged","uploadSoundSupport","annotations","contentDimensions","dimensions","equationEditor","playerSpellCheck","settingsPanelDisabled","spanishInput","specialInput","spellCheck","studentInstructions","mathInput","maxImageWidth","maxImageHeight","multiple","withRubric","mathMlOptions","baseInputConfiguration","errors","extraCSSRules","feedbackEnabled","promptEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","teacherInstructionsError","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","label","enabled","suffix","min","max","height","annotationsEnabled","playerSpellCheckDisabled","panelProperties","studentInstructionsEnabled","rubricEnabled","getPluginProps","assign","createElement","layout","ConfigLayout","hideSettings","onChangeModel","onChangeConfiguration","config","groups","Settings","Properties","className","onChange","changeTeacherInstructions","nonEmpty","languageCharactersProps","language","pluginProps","inputConfiguration","activePlugins","ALL_PLUGINS","onPromptChange","Fragment","variant","FeedbackSelector","changeFeedback","exports","PropTypes","func","isRequired","object","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport { FeedbackSelector, InputContainer, settings, layout } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\nimport EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html-tip-tap';\n\nconst { Panel, toggle, numberFields, dropdown } = settings;\n\nconst defaultFeedback = {\n type: 'default',\n default: 'Your answer has been submitted',\n};\n\nconst StyledHeader = styled(Typography)(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst PromptContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(1),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n width: '100%',\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class Main extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n imageSupport: PropTypes.object.isRequired,\n uploadSoundSupport: PropTypes.object.isRequired,\n };\n\n constructor(props) {\n super(props);\n this.state = { setDimensions: true };\n }\n\n onPromptChange = (markup) => {\n const { onModelChanged, model } = this.props;\n\n onModelChanged({ ...model, prompt: markup });\n };\n\n changeFeedback = (feedback) => {\n const { model, onModelChanged } = this.props;\n const update = { ...model, feedback };\n\n onModelChanged(update);\n };\n\n changeTeacherInstructions = (teacherInstructions) => {\n const { model, onModelChanged } = this.props;\n const update = { ...model, teacherInstructions };\n\n onModelChanged(update);\n };\n\n render() {\n const { model, configuration, imageSupport, onConfigurationChanged, onModelChanged, uploadSoundSupport } =\n this.props;\n const {\n annotations = {},\n contentDimensions = {},\n dimensions = {},\n equationEditor = {},\n feedback = {},\n playerSpellCheck = {},\n prompt = {},\n settingsPanelDisabled,\n spanishInput = {},\n specialInput = {},\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n mathInput = {},\n maxImageWidth = {},\n maxImageHeight = {},\n multiple = {},\n withRubric = {},\n mathMlOptions = {},\n baseInputConfiguration = {},\n } = configuration || {};\n const {\n errors = {},\n extraCSSRules,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const { prompt: promptError, teacherInstructions: teacherInstructionsError } = errors;\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n mathInput: mathInput.settings && toggle(mathInput.label),\n equationEditor:\n equationEditor.enabled &&\n model.mathInput &&\n dropdown(equationEditor.label, [\n 'non-negative-integers',\n 'integers',\n 'decimals',\n 'fractions',\n 'Grade 1 - 2',\n 'Grade 3 - 5',\n 'Grade 6 - 7',\n 'Grade 8 - HS',\n 'geometry',\n 'advanced-algebra',\n 'statistics',\n 'item-authoring',\n ]),\n spanishInput: spanishInput.settings && toggle(spanishInput.label),\n specialInput: specialInput.settings && toggle(specialInput.label),\n dimensions:\n dimensions.settings &&\n numberFields(dimensions.label, {\n width: { label: 'Width (px)', suffix: 'px', min: 100, max: 1200 },\n height: { label: 'Height (px)', suffix: 'px', min: 100, max: 500 },\n }),\n 'multiple.enabled': multiple.settings && toggle(multiple.label, true),\n promptEnabled: prompt.settings && toggle(prompt.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n annotationsEnabled: annotations.settings && toggle(annotations.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n playerSpellCheckDisabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props) => {\n return Object.assign(\n {\n ...baseInputConfiguration,\n },\n props || {},\n );\n };\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(config) => onConfigurationChanged(config)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptContainer label={teacherInstructions.label}>\n <EditableHtml\n className=\"prompt\"\n markup={model.teacherInstructions || ''}\n onChange={this.changeTeacherInstructions}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptContainer>\n )}\n\n {promptEnabled && (\n <PromptContainer label={prompt.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n className=\"prompt\"\n markup={model.prompt || ''}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={promptError}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptContainer>\n )}\n\n {feedbackEnabled && (\n <React.Fragment>\n <StyledHeader variant=\"h6\">\n Feedback\n </StyledHeader>\n\n <FeedbackSelector\n label=\"When submitted, show\"\n feedback={model.feedback || defaultFeedback}\n onChange={this.changeFeedback}\n toolbarOpts={toolbarOpts}\n />\n </React.Fragment>\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAC,uBAAA,CAAAN,OAAA;AAA2E,SAAAM,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SA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IAAAK,gBAAA,CAAAxC,OAAA,EA/MYmC,IAAI,eACI;EACjBO,cAAc,EAAEmF,kBAAS,CAACC,IAAI,CAACC,UAAU;EACzC1E,sBAAsB,EAAEwE,kBAAS,CAACC,IAAI;EACtCnF,KAAK,EAAEkF,kBAAS,CAACG,MAAM,CAACD,UAAU;EAClC5E,aAAa,EAAE0E,kBAAS,CAACG,MAAM,CAACD,UAAU;EAC1C3E,YAAY,EAAEyE,kBAAS,CAACG,MAAM,CAACD,UAAU;EACzCzE,kBAAkB,EAAEuE,kBAAS,CAACG,MAAM,CAACD;AACvC,CAAC;AAAA,IAAAE,QAAA,GAAAL,OAAA,CAAA5H,OAAA,GAyMYmC,IAAI","ignoreList":[]}
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = exports.default = {
8
- annotationsEnabled: false,
9
- dimensions: {
10
- height: 100,
11
- width: 500
12
- },
13
- equationEditor: 'Grade 8 - HS',
14
- feedbackEnabled: false,
15
- mathInput: false,
16
- playerSpellCheckDisabled: true,
17
- predefinedAnnotations: [{
18
- label: 'good',
19
- text: 'good',
20
- type: 'positive'
21
- }, {
22
- label: '★',
23
- text: '★',
24
- type: 'positive'
25
- }, {
26
- label: ':-)',
27
- text: ':-)',
28
- type: 'positive'
29
- }, {
30
- label: 'creative',
31
- text: 'creative',
32
- type: 'positive'
33
- }, {
34
- label: 'run-on',
35
- text: 'run-on',
36
- type: 'negative'
37
- }, {
38
- label: 'frag',
39
- text: 'fragment',
40
- type: 'negative'
41
- }, {
42
- label: 'tran',
43
- text: 'transition',
44
- type: 'negative'
45
- }, {
46
- label: 'supp',
47
- text: 'support needed',
48
- type: 'negative'
49
- }, {
50
- label: 'punc',
51
- text: 'punctuation',
52
- type: 'negative'
53
- }, {
54
- label: 'agr',
55
- text: 'agreement wrong',
56
- type: 'negative'
57
- }, {
58
- label: 'unclear',
59
- text: 'unclear',
60
- type: 'negative'
61
- }, {
62
- label: 'cut',
63
- text: 'cut',
64
- type: 'negative'
65
- }, {
66
- label: 'sp',
67
- text: 'spelling',
68
- type: 'negative'
69
- }, {
70
- label: 'cap',
71
- text: 'capitalization',
72
- type: 'negative'
73
- }, {
74
- label: 'inf',
75
- text: 'informal',
76
- type: 'negative'
77
- }, {
78
- label: 'awk',
79
- text: 'awkward',
80
- type: 'negative'
81
- }],
82
- prompt: '',
83
- promptEnabled: true,
84
- rationale: '',
85
- rationaleEnabled: true,
86
- studentInstructionsEnabled: true,
87
- teacherInstructions: '',
88
- teacherInstructionsEnabled: true,
89
- toolbarEditorPosition: 'bottom'
90
- };
91
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","names":["annotationsEnabled","dimensions","height","width","equationEditor","feedbackEnabled","mathInput","playerSpellCheckDisabled","predefinedAnnotations","label","text","type","prompt","promptEnabled","rationale","rationaleEnabled","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n annotationsEnabled: false,\n dimensions: { height: 100, width: 500 },\n equationEditor: 'Grade 8 - HS',\n feedbackEnabled: false,\n mathInput: false,\n playerSpellCheckDisabled: true,\n predefinedAnnotations: [\n { label: 'good', text: 'good', type: 'positive' },\n { label: '★', text: '★', type: 'positive' },\n { label: ':-)', text: ':-)', type: 'positive' },\n { label: 'creative', text: 'creative', type: 'positive' },\n { label: 'run-on', text: 'run-on', type: 'negative' },\n { label: 'frag', text: 'fragment', type: 'negative' },\n { label: 'tran', text: 'transition', type: 'negative' },\n { label: 'supp', text: 'support needed', type: 'negative' },\n { label: 'punc', text: 'punctuation', type: 'negative' },\n { label: 'agr', text: 'agreement wrong', type: 'negative' },\n { label: 'unclear', text: 'unclear', type: 'negative' },\n { label: 'cut', text: 'cut', type: 'negative' },\n { label: 'sp', text: 'spelling', type: 'negative' },\n { label: 'cap', text: 'capitalization', type: 'negative' },\n { label: 'inf', text: 'informal', type: 'negative' },\n { label: 'awk', text: 'awkward', type: 'negative' },\n ],\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n};\n"],"mappings":";;;;;;iCAAe;EACbA,kBAAkB,EAAE,KAAK;EACzBC,UAAU,EAAE;IAAEC,MAAM,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAI,CAAC;EACvCC,cAAc,EAAE,cAAc;EAC9BC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAE,KAAK;EAChBC,wBAAwB,EAAE,IAAI;EAC9BC,qBAAqB,EAAE,CACrB;IAAEC,KAAK,EAAE,MAAM;IAAEC,IAAI,EAAE,MAAM;IAAEC,IAAI,EAAE;EAAW,CAAC,EACjD;IAAEF,KAAK,EAAE,GAAG;IAAEC,IAAI,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAW,CAAC,EAC3C;IAAEF,KAAK,EAAE,KAAK;IAAEC,IAAI,EAAE,KAAK;IAAEC,IAAI,EAAE;EAAW,CAAC,EAC/C;IAAEF,KAAK,EAAE,UAAU;IAAEC,IAAI,EAAE,UAAU;IAAEC,IAAI,EAAE;EAAW,CAAC,EACzD;IAAEF,KAAK,EAAE,QAAQ;IAAEC,IAAI,EAAE,QAAQ;IAAEC,IAAI,EAAE;EAAW,CAAC,EACrD;IAAEF,KAAK,EAAE,MAAM;IAAEC,IAAI,EAAE,UAAU;IAAEC,IAAI,EAAE;EAAW,CAAC,EACrD;IAAEF,KAAK,EAAE,MAAM;IAAEC,IAAI,EAAE,YAAY;IAAEC,IAAI,EAAE;EAAW,CAAC,EACvD;IAAEF,KAAK,EAAE,MAAM;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,IAAI,EAAE;EAAW,CAAC,EAC3D;IAAEF,KAAK,EAAE,MAAM;IAAEC,IAAI,EAAE,aAAa;IAAEC,IAAI,EAAE;EAAW,CAAC,EACxD;IAAEF,KAAK,EAAE,KAAK;IAAEC,IAAI,EAAE,iBAAiB;IAAEC,IAAI,EAAE;EAAW,CAAC,EAC3D;IAAEF,KAAK,EAAE,SAAS;IAAEC,IAAI,EAAE,SAAS;IAAEC,IAAI,EAAE;EAAW,CAAC,EACvD;IAAEF,KAAK,EAAE,KAAK;IAAEC,IAAI,EAAE,KAAK;IAAEC,IAAI,EAAE;EAAW,CAAC,EAC/C;IAAEF,KAAK,EAAE,IAAI;IAAEC,IAAI,EAAE,UAAU;IAAEC,IAAI,EAAE;EAAW,CAAC,EACnD;IAAEF,KAAK,EAAE,KAAK;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,IAAI,EAAE;EAAW,CAAC,EAC1D;IAAEF,KAAK,EAAE,KAAK;IAAEC,IAAI,EAAE,UAAU;IAAEC,IAAI,EAAE;EAAW,CAAC,EACpD;IAAEF,KAAK,EAAE,KAAK;IAAEC,IAAI,EAAE,SAAS;IAAEC,IAAI,EAAE;EAAW,CAAC,CACpD;EACDC,MAAM,EAAE,EAAE;EACVC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,EAAE;EACbC,gBAAgB,EAAE,IAAI;EACtBC,0BAA0B,EAAE,IAAI;EAChCC,mBAAmB,EAAE,EAAE;EACvBC,0BAA0B,EAAE,IAAI;EAChCC,qBAAqB,EAAE;AACzB,CAAC","ignoreList":[]}
@@ -1,101 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createDefaultModel = createDefaultModel;
8
- exports.model = model;
9
- exports.normalize = void 0;
10
- exports.outcome = outcome;
11
- exports.validate = void 0;
12
- var _debug = _interopRequireDefault(require("debug"));
13
- var _feedback = require("@pie-lib/feedback");
14
- var _defaults = _interopRequireDefault(require("./defaults"));
15
- const log = (0, _debug.default)('@pie-element:extended-text-entry:controller');
16
- async function createDefaultModel(model = {}) {
17
- log('[createDefaultModel]', model);
18
- return {
19
- ..._defaults.default,
20
- ...model
21
- };
22
- }
23
- const normalize = question => ({
24
- ..._defaults.default,
25
- ...question
26
- });
27
- exports.normalize = normalize;
28
- async function model(question, session, env) {
29
- log('[question]', question);
30
- const normalizedQuestion = normalize(question);
31
- const fb = env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled ? (0, _feedback.getFeedback)(normalizedQuestion.feedback, 'Your answer has been submitted') : Promise.resolve(undefined);
32
- let teacherInstructions = null;
33
- if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
34
- teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
35
- } else {
36
- teacherInstructions = null;
37
- }
38
- let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';
39
- switch (normalizedQuestion.equationEditor) {
40
- case 'Grade 1 - 2':
41
- equationEditor = 1;
42
- break;
43
- case 'Grade 3 - 5':
44
- equationEditor = 3;
45
- break;
46
- case 'Grade 6 - 7':
47
- equationEditor = 6;
48
- break;
49
- case 'Grade 8 - HS':
50
- equationEditor = 8;
51
- break;
52
- default:
53
- break;
54
- }
55
- const annotatorMode = normalizedQuestion.annotationsEnabled && (env.role === 'instructor' || env.mode === 'evaluate');
56
- return fb.then(feedback => ({
57
- prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
58
- dimensions: normalizedQuestion.dimensions,
59
- customKeys: normalizedQuestion.customKeys || [],
60
- id: normalizedQuestion.id,
61
- disabled: env.mode !== 'gather',
62
- feedback,
63
- teacherInstructions,
64
- language: normalizedQuestion.language,
65
- mathInput: normalizedQuestion.mathInput,
66
- spanishInput: normalizedQuestion.spanishInput,
67
- specialInput: normalizedQuestion.specialInput,
68
- equationEditor,
69
- spellCheckEnabled: !normalizedQuestion.playerSpellCheckDisabled,
70
- playersToolbarPosition: normalizedQuestion.playersToolbarPosition || 'bottom',
71
- annotatorMode,
72
- disabledAnnotator: normalizedQuestion.annotationsEnabled ? env.role !== 'instructor' : true,
73
- predefinedAnnotations: normalizedQuestion.annotationsEnabled ? normalizedQuestion.predefinedAnnotations : [],
74
- extraCSSRules: normalizedQuestion.extraCSSRules
75
- }));
76
- }
77
- async function outcome(/*question, session, env*/
78
- ) {
79
- return {
80
- score: 0,
81
- completed: 'n/a',
82
- note: 'Requires manual scoring'
83
- };
84
- }
85
-
86
- // remove all html tags
87
- const getInnerText = html => (html || '').replaceAll(/<[^>]*>/g, '');
88
-
89
- // remove all html tags except img, iframe and source tag for audio
90
- const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
91
- const validate = (model = {}, config = {}) => {
92
- const errors = {};
93
- ['teacherInstructions', 'prompt'].forEach(field => {
94
- if (config[field]?.required && !getContent(model[field])) {
95
- errors[field] = 'This field is required.';
96
- }
97
- });
98
- return errors;
99
- };
100
- exports.validate = validate;
101
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_debug","_interopRequireDefault","require","_feedback","_defaults","log","debug","createDefaultModel","model","defaults","normalize","question","exports","session","env","normalizedQuestion","fb","mode","feedbackEnabled","getFeedback","feedback","Promise","resolve","undefined","teacherInstructions","role","teacherInstructionsEnabled","equationEditor","annotatorMode","annotationsEnabled","then","prompt","promptEnabled","dimensions","customKeys","id","disabled","language","mathInput","spanishInput","specialInput","spellCheckEnabled","playerSpellCheckDisabled","playersToolbarPosition","disabledAnnotator","predefinedAnnotations","extraCSSRules","outcome","score","completed","note","getInnerText","html","replaceAll","getContent","replace","validate","config","errors","forEach","field","required"],"sources":["../src/index.js"],"sourcesContent":["import debug from 'debug';\nimport { getFeedback } from '@pie-lib/feedback';\nimport defaults from './defaults';\n\nconst log = debug('@pie-element:extended-text-entry:controller');\n\nexport async function createDefaultModel(model = {}) {\n log('[createDefaultModel]', model);\n\n return { ...defaults, ...model };\n}\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\nexport async function model(question, session, env) {\n log('[question]', question);\n const normalizedQuestion = normalize(question);\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')\n : Promise.resolve(undefined);\n\n let teacherInstructions = null;\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n teacherInstructions = null;\n }\n\n let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';\n\n switch (normalizedQuestion.equationEditor) {\n case 'Grade 1 - 2':\n equationEditor = 1;\n break;\n case 'Grade 3 - 5':\n equationEditor = 3;\n break;\n case 'Grade 6 - 7':\n equationEditor = 6;\n break;\n case 'Grade 8 - HS':\n equationEditor = 8;\n break;\n default:\n break;\n }\n\n const annotatorMode = normalizedQuestion.annotationsEnabled && (env.role === 'instructor' || env.mode === 'evaluate');\n\n return fb.then((feedback) => ({\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n dimensions: normalizedQuestion.dimensions,\n customKeys: normalizedQuestion.customKeys || [],\n id: normalizedQuestion.id,\n disabled: env.mode !== 'gather',\n feedback,\n teacherInstructions,\n language: normalizedQuestion.language,\n mathInput: normalizedQuestion.mathInput,\n spanishInput: normalizedQuestion.spanishInput,\n specialInput: normalizedQuestion.specialInput,\n equationEditor,\n spellCheckEnabled: !normalizedQuestion.playerSpellCheckDisabled,\n playersToolbarPosition: normalizedQuestion.playersToolbarPosition || 'bottom',\n annotatorMode,\n disabledAnnotator: normalizedQuestion.annotationsEnabled ? env.role !== 'instructor' : true,\n predefinedAnnotations: normalizedQuestion.annotationsEnabled ? normalizedQuestion.predefinedAnnotations : [],\n extraCSSRules: normalizedQuestion.extraCSSRules,\n }));\n}\n\nexport async function outcome(/*question, session, env*/) {\n return {\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring',\n };\n}\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,MAAMG,GAAG,GAAG,IAAAC,cAAK,EAAC,6CAA6C,CAAC;AAEzD,eAAeC,kBAAkBA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EACnDH,GAAG,CAAC,sBAAsB,EAAEG,KAAK,CAAC;EAElC,OAAO;IAAE,GAAGC,iBAAQ;IAAE,GAAGD;EAAM,CAAC;AAClC;AAEO,MAAME,SAAS,GAAIC,QAAQ,KAAM;EAAE,GAAGF,iBAAQ;EAAE,GAAGE;AAAS,CAAC,CAAC;AAACC,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAE/D,eAAeF,KAAKA,CAACG,QAAQ,EAAEE,OAAO,EAAEC,GAAG,EAAE;EAClDT,GAAG,CAAC,YAAY,EAAEM,QAAQ,CAAC;EAC3B,MAAMI,kBAAkB,GAAGL,SAAS,CAACC,QAAQ,CAAC;EAE9C,MAAMK,EAAE,GACNF,GAAG,CAACG,IAAI,KAAK,UAAU,IAAIF,kBAAkB,CAACG,eAAe,GACzD,IAAAC,qBAAW,EAACJ,kBAAkB,CAACK,QAAQ,EAAE,gCAAgC,CAAC,GAC1EC,OAAO,CAACC,OAAO,CAACC,SAAS,CAAC;EAEhC,IAAIC,mBAAmB,GAAG,IAAI;EAC9B,IAAIV,GAAG,CAACW,IAAI,KAAK,YAAY,KAAKX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