@pie-element/extended-text-entry 15.2.2 → 15.2.4
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 +10 -0
- package/configure/CHANGELOG.md +4 -0
- package/configure/package.json +3 -3
- package/lib/index.js +34 -2
- package/lib/index.js.map +1 -1
- package/lib/main.js +5 -9
- package/lib/main.js.map +1 -1
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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
|
+
## [15.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@15.2.3...@pie-element/extended-text-entry@15.2.4) (2026-09-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **extended-text-entry:** commit the response before teardown (PIE-1058) ([89de901](https://github.com/pie-framework/pie-elements/commit/89de9014029ea60ebf5b3362fad5cccf8d7c370b))
|
|
11
|
+
|
|
12
|
+
## [15.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@15.2.2...@pie-element/extended-text-entry@15.2.3) (2026-09-17)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @pie-element/extended-text-entry
|
|
15
|
+
|
|
6
16
|
## [15.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@15.2.1...@pie-element/extended-text-entry@15.2.2) (2026-09-04)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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
|
+
## [13.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@13.2.2...@pie-element/extended-text-entry-configure@13.2.3) (2026-09-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/extended-text-entry-configure
|
|
9
|
+
|
|
6
10
|
## [13.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@13.2.1...@pie-element/extended-text-entry-configure@13.2.2) (2026-09-04)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
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": "13.2.
|
|
4
|
+
"version": "13.2.3",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@mui/icons-material": "^7.3.4",
|
|
14
14
|
"@mui/material": "^7.3.4",
|
|
15
15
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
16
|
-
"@pie-lib/config-ui": "13.0.
|
|
17
|
-
"@pie-lib/editable-html-tip-tap": "2.1.
|
|
16
|
+
"@pie-lib/config-ui": "13.0.20",
|
|
17
|
+
"@pie-lib/editable-html-tip-tap": "2.1.18",
|
|
18
18
|
"lodash-es": "^4.17.23",
|
|
19
19
|
"prop-types": "^15.8.1",
|
|
20
20
|
"react": "18.3.1",
|
package/lib/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var _main = _interopRequireDefault(require("./main"));
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _client = require("react-dom/client");
|
|
13
13
|
var _debug = _interopRequireDefault(require("debug"));
|
|
14
|
+
var _lodashEs = require("lodash-es");
|
|
14
15
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
15
16
|
var _piePlayerEvents = require("@pie-framework/pie-player-events");
|
|
16
17
|
const log = (0, _debug.default)('@pie-elements:extended-text-entry');
|
|
@@ -41,6 +42,20 @@ class RootExtendedTextEntry extends HTMLElement {
|
|
|
41
42
|
this._model = null;
|
|
42
43
|
this._session = null;
|
|
43
44
|
this._root = null;
|
|
45
|
+
|
|
46
|
+
// The session is written synchronously on commit and only the dispatch is
|
|
47
|
+
// deferred, so any layer that reads `this._session` sees the response as
|
|
48
|
+
// soon as the editor commits it. Debouncing the write instead left the
|
|
49
|
+
// session stale until the timer fired, which is what made the response
|
|
50
|
+
// unrecoverable when the element was torn down inside the window.
|
|
51
|
+
//
|
|
52
|
+
// One debouncer per session field, so each keeps its own `complete`.
|
|
53
|
+
this._dispatchValueChanged = (0, _lodashEs.debounce)(() => {
|
|
54
|
+
this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), isComplete(this._session && this._session.value)));
|
|
55
|
+
}, 1500);
|
|
56
|
+
this._dispatchCommentChanged = (0, _lodashEs.debounce)(() => {
|
|
57
|
+
this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), isComplete(this._session && this._session.comment)));
|
|
58
|
+
}, 1500);
|
|
44
59
|
}
|
|
45
60
|
setLangAttribute() {
|
|
46
61
|
const language = this._model && typeof this._model.language ? this._model.language : '';
|
|
@@ -61,7 +76,7 @@ class RootExtendedTextEntry extends HTMLElement {
|
|
|
61
76
|
}
|
|
62
77
|
valueChange(value) {
|
|
63
78
|
this._session.value = value;
|
|
64
|
-
this.
|
|
79
|
+
this._dispatchValueChanged();
|
|
65
80
|
this.render();
|
|
66
81
|
}
|
|
67
82
|
annotationsChange(annotations) {
|
|
@@ -71,9 +86,22 @@ class RootExtendedTextEntry extends HTMLElement {
|
|
|
71
86
|
}
|
|
72
87
|
commentChange(comment) {
|
|
73
88
|
this._session.comment = comment;
|
|
74
|
-
this.
|
|
89
|
+
this._dispatchCommentChanged();
|
|
75
90
|
this.render();
|
|
76
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Dispatch every deferred `session-changed` now.
|
|
95
|
+
*
|
|
96
|
+
* A player calls this before it discards the element, while the element is
|
|
97
|
+
* still attached and the event can therefore still reach a `document`-level
|
|
98
|
+
* listener. A no-op when nothing is pending, so a teardown adds no event in
|
|
99
|
+
* the normal path.
|
|
100
|
+
*/
|
|
101
|
+
commitPendingSession() {
|
|
102
|
+
this._dispatchValueChanged.flush();
|
|
103
|
+
this._dispatchCommentChanged.flush();
|
|
104
|
+
}
|
|
77
105
|
connectedCallback() {
|
|
78
106
|
this.setAttribute('aria-label', 'Written Response Question');
|
|
79
107
|
this.setAttribute('role', 'region');
|
|
@@ -99,6 +127,10 @@ class RootExtendedTextEntry extends HTMLElement {
|
|
|
99
127
|
}
|
|
100
128
|
}
|
|
101
129
|
disconnectedCallback() {
|
|
130
|
+
// For a host on a player with no commit seam. This runs after removal, so
|
|
131
|
+
// the event reaches a listener bound inside the removed subtree and not one
|
|
132
|
+
// on `document`; `commitPendingSession()` is the path that reaches both.
|
|
133
|
+
this.commitPendingSession();
|
|
102
134
|
if (this._root) {
|
|
103
135
|
this._root.unmount();
|
|
104
136
|
this._root = null;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_main","_interopRequireDefault","require","_react","_client","_debug","_mathRendering","_piePlayerEvents","log","debug","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","HTMLElement","constructor","_model","_session","_root","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_main","_interopRequireDefault","require","_react","_client","_debug","_lodashEs","_mathRendering","_piePlayerEvents","log","debug","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","HTMLElement","constructor","_model","_session","_root","_dispatchValueChanged","debounce","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","_dispatchCommentChanged","comment","setLangAttribute","language","lang","slice","setAttribute","model","m","ModelSetEvent","render","session","s","valueChange","annotationsChange","annotations","commentChange","commitPendingSession","flush","connectedCallback","elem","React","createElement","Main","onValueChange","bind","onAnnotationsChange","onCommentChange","createRoot","queueMicrotask","renderMath","disconnectedCallback","unmount","exports","default"],"sources":["../src/index.js"],"sourcesContent":["import Main from './main';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport { debounce } from 'lodash-es';\n\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\n\nconst log = debug('@pie-elements:extended-text-entry');\n\nconst domParser = typeof window !== undefined ? new DOMParser() : { parseFromString: (v) => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n this._root = null;\n\n // The session is written synchronously on commit and only the dispatch is\n // deferred, so any layer that reads `this._session` sees the response as\n // soon as the editor commits it. Debouncing the write instead left the\n // session stale until the timer fired, which is what made the response\n // unrecoverable when the element was torn down inside the window.\n //\n // One debouncer per session field, so each keeps its own `complete`.\n this._dispatchValueChanged = debounce(() => {\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(this._session && this._session.value)),\n );\n }, 1500);\n\n this._dispatchCommentChanged = debounce(() => {\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(this._session && this._session.comment)),\n );\n }, 1500);\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model));\n\n this.render();\n }\n\n set session(s) {\n this._session = s;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n valueChange(value) {\n this._session.value = value;\n\n this._dispatchValueChanged();\n\n this.render();\n }\n\n annotationsChange(annotations) {\n this._session.annotations = annotations;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n\n this.render();\n }\n\n commentChange(comment) {\n this._session.comment = comment;\n\n this._dispatchCommentChanged();\n\n this.render();\n }\n\n /**\n * Dispatch every deferred `session-changed` now.\n *\n * A player calls this before it discards the element, while the element is\n * still attached and the event can therefore still reach a `document`-level\n * listener. A no-op when nothing is pending, so a teardown adds no event in\n * the normal path.\n */\n commitPendingSession() {\n this._dispatchValueChanged.flush();\n this._dispatchCommentChanged.flush();\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Written Response Question');\n this.setAttribute('role', 'region');\n\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onValueChange: this.valueChange.bind(this),\n onAnnotationsChange: this.annotationsChange.bind(this),\n onCommentChange: this.commentChange.bind(this),\n });\n\n this.setLangAttribute();\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n queueMicrotask(() => {\n renderMath(this);\n });\n }\n }\n\n disconnectedCallback() {\n // For a host on a player with no commit seam. This runs after removal, so\n // the event reaches a listener bound inside the removed subtree and not one\n // on `document`; `commitPendingSession()` is the path that reaches both.\n this.commitPendingSession();\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ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E,IAAI,CAACX,WAAW,CAACY,IAAI,CAAC,IAAI,CAAC;QAC1CC,mBAAmB,EAAE,IAAI,CAACZ,iBAAiB,CAACW,IAAI,CAAC,IAAI,CAAC;QACtDE,eAAe,EAAE,IAAI,CAACX,aAAa,CAACS,IAAI,CAAC,IAAI;MAC/C,CAAC,CAAC;MAEF,IAAI,CAACvB,gBAAgB,CAAC,CAAC;MAEvB,IAAI,CAAC,IAAI,CAACT,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAAmC,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAACnC,KAAK,CAACiB,MAAM,CAACU,IAAI,CAAC;MACvBS,cAAc,CAAC,MAAM;QACnB,IAAAC,yBAAU,EAAC,IAAI,CAAC;MAClB,CAAC,CAAC;IACJ;EACF;EAEAC,oBAAoBA,CAAA,EAAG;IACrB;IACA;IACA;IACA,IAAI,CAACd,oBAAoB,CAAC,CAAC;IAE3B,IAAI,IAAI,CAACxB,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACuC,OAAO,CAAC,CAAC;MACpB,IAAI,CAACvC,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACwC,OAAA,CAAAC,OAAA,GAAA9C,qBAAA","ignoreList":[]}
|
package/lib/main.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.default = exports.Main = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _lodashEs = require("lodash-es");
|
|
12
11
|
var _debug = _interopRequireDefault(require("debug"));
|
|
13
12
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
14
13
|
var _styles = require("@mui/material/styles");
|
|
@@ -49,16 +48,13 @@ const SrOnly = (0, _styles.styled)('h2')({
|
|
|
49
48
|
overflow: 'hidden'
|
|
50
49
|
});
|
|
51
50
|
class Main extends _react.default.Component {
|
|
52
|
-
constructor(...args) {
|
|
53
|
-
super(...args);
|
|
54
|
-
(0, _defineProperty2.default)(this, "changeSessionValue", (0, _lodashEs.debounce)(this.props.onValueChange, 1500));
|
|
55
|
-
(0, _defineProperty2.default)(this, "changeSessionComment", (0, _lodashEs.debounce)(this.props.onCommentChange, 1500));
|
|
56
|
-
}
|
|
57
51
|
render() {
|
|
58
52
|
const {
|
|
59
53
|
model,
|
|
60
54
|
session,
|
|
61
|
-
onAnnotationsChange
|
|
55
|
+
onAnnotationsChange,
|
|
56
|
+
onCommentChange,
|
|
57
|
+
onValueChange
|
|
62
58
|
} = this.props;
|
|
63
59
|
const {
|
|
64
60
|
animationsDisabled,
|
|
@@ -129,7 +125,7 @@ class Main extends _react.default.Component {
|
|
|
129
125
|
comment: comment || '',
|
|
130
126
|
predefinedAnnotations: predefinedAnnotations || [],
|
|
131
127
|
onChange: onAnnotationsChange,
|
|
132
|
-
onCommentChange:
|
|
128
|
+
onCommentChange: onCommentChange,
|
|
133
129
|
width: width,
|
|
134
130
|
height: height,
|
|
135
131
|
maxHeight: maxHeight,
|
|
@@ -139,7 +135,7 @@ class Main extends _react.default.Component {
|
|
|
139
135
|
keypadMode: equationEditor
|
|
140
136
|
}) : /*#__PURE__*/_react.default.createElement(Editor, {
|
|
141
137
|
className: "response-area-editor",
|
|
142
|
-
onChange:
|
|
138
|
+
onChange: onValueChange,
|
|
143
139
|
markup: value || '',
|
|
144
140
|
maxWidth: width && width.toString(),
|
|
145
141
|
minWidth: '100px',
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_lodashEs","_debug","_Typography","_styles","_editableHtmlTipTap","_renderUi","_annotationEditor","log","debug","MainContainer","styled","UiLayout","backgroundColor","color","background","text","StyledPrompt","Typography","theme","width","marginBottom","spacing","fontSize","display","TeacherInstructions","Editor","EditableHtml","borderRadius","SrOnly","position","left","top","height","overflow","Main","React","Component","constructor","args","_defineProperty2","default","debounce","props","onValueChange","onCommentChange","render","model","session","onAnnotationsChange","animationsDisabled","annotatorMode","customKeys","dimensions","disabled","disabledAnnotator","equationEditor","extraCSSRules","feedback","mathInput","playersToolbarPosition","predefinedAnnotations","prompt","spanishInput","specialInput","spellCheckEnabled","teacherInstructions","annotations","comment","value","maxHeight","toolbarOpts","teacherInstructionsDiv","createElement","PreviewPrompt","defaultClassName","languageCharactersProps","push","language","ref","containerRef","Collapsible","labels","hidden","visible","component","onChange","changeSessionComment","disabledMath","keypadMode","className","changeSessionValue","markup","maxWidth","toString","minWidth","minHeight","highlightShape","spellCheck","charactersLimit","autoWidthToolbar","pluginProps","math","controlledKeypadMode","video","audio","table","textAlign","h3","separateParagraphs","ul_list","ol_list","Feedback","correctness","exports","PropTypes","func","isRequired","object","shape","string","array","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { debounce } from 'lodash-es';\nimport debug from 'debug';\n\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\n\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { color, Feedback, Collapsible, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\n\nimport AnnotationEditor from './annotation/annotation-editor';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst MainContainer = styled(UiLayout)({\n backgroundColor: color.background(),\n color: color.text(),\n});\n\nconst StyledPrompt = styled(Typography)(({ theme }) => ({\n width: '100%',\n color: color.text(),\n marginBottom: theme.spacing(2),\n fontSize: 'inherit',\n display: 'block',\n}));\n\nconst TeacherInstructions = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst Editor = styled(EditableHtml)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n borderRadius: '4px',\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n onValueChange: PropTypes.func.isRequired,\n onAnnotationsChange: PropTypes.func.isRequired,\n onCommentChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n session: PropTypes.shape({\n value: PropTypes.string,\n annotations: PropTypes.array,\n comment: PropTypes.string,\n }).isRequired,\n };\n\n changeSessionValue = debounce(this.props.onValueChange, 1500);\n\n changeSessionComment = debounce(this.props.onCommentChange, 1500);\n\n render() {\n const { model, session, onAnnotationsChange } = this.props;\n const {\n animationsDisabled,\n annotatorMode,\n customKeys,\n dimensions,\n disabled,\n disabledAnnotator,\n equationEditor,\n extraCSSRules,\n feedback,\n mathInput,\n playersToolbarPosition,\n predefinedAnnotations,\n prompt,\n spanishInput,\n specialInput,\n spellCheckEnabled,\n teacherInstructions,\n } = model;\n const { annotations, comment, value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n const toolbarOpts = { position: playersToolbarPosition === 'top' ? 'top' : 'bottom' };\n\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\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 <MainContainer\n extraCSSRules={extraCSSRules}\n ref={(ref) => {\n this.containerRef = ref;\n }}\n >\n <SrOnly>Constructed Response Question</SrOnly>\n\n {teacherInstructions && (\n <TeacherInstructions>\n {!animationsDisabled ? (\n <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </TeacherInstructions>\n )}\n\n {prompt && (\n <StyledPrompt component={'span'}>\n <PreviewPrompt defaultClassName=\"prompt\" prompt={model.prompt} />\n </StyledPrompt>\n )}\n\n {annotatorMode ? (\n <AnnotationEditor\n text={value || ''}\n annotations={annotations || []}\n comment={comment || ''}\n predefinedAnnotations={predefinedAnnotations || []}\n onChange={onAnnotationsChange}\n onCommentChange={this.changeSessionComment}\n width={width}\n height={height}\n maxHeight={maxHeight}\n disabled={disabledAnnotator}\n disabledMath={!mathInput}\n customKeys={customKeys}\n keypadMode={equationEditor}\n />\n ) : (\n <Editor\n className=\"response-area-editor\"\n onChange={this.changeSessionValue}\n markup={value || ''}\n maxWidth={width && width.toString()}\n minWidth={'100px'}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n charactersLimit={50000}\n autoWidthToolbar\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 table: {\n disabled: true,\n },\n textAlign: {\n disabled: true,\n },\n h3: {\n disabled: true,\n },\n separateParagraphs: { disabled: false },\n ul_list: { disabled: true },\n ol_list: { disabled: true },\n }}\n languageCharactersProps={languageCharactersProps}\n />\n )}\n\n {feedback && <Feedback correctness=\"correct\" feedback={feedback} />}\n </MainContainer>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,IAAAM,mBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,iBAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,M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AEvD,QAAQ,EAAE;QAAM,CAAC;QACvCwD,OAAO,EAAE;UAAExD,QAAQ,EAAE;QAAK,CAAC;QAC3ByD,OAAO,EAAE;UAAEzD,QAAQ,EAAE;QAAK;MAC5B,CAAE;MACFsB,uBAAuB,EAAEA;IAAwB,CAClD,CACF,EAEAlB,QAAQ,iBAAI7D,MAAA,CAAA4C,OAAA,CAAAgC,aAAA,CAACnE,SAAA,CAAA0G,QAAQ;MAACC,WAAW,EAAC,SAAS;MAACvD,QAAQ,EAAEA;IAAS,CAAE,CACrD,CAAC;EAEpB;AACF;AAACwD,OAAA,CAAA/E,IAAA,GAAAA,IAAA;AAAA,IAAAK,gBAAA,CAAAC,OAAA,EAzJYN,IAAI,eACI;EACjBS,aAAa,EAAEuE,kBAAS,CAACC,IAAI,CAACC,UAAU;EACxCpE,mBAAmB,EAAEkE,kBAAS,CAACC,IAAI,CAACC,UAAU;EAC9CxE,eAAe,EAAEsE,kBAAS,CAACC,IAAI,CAACC,UAAU;EAC1CtE,KAAK,EAAEoE,kBAAS,CAACG,MAAM;EACvBtE,OAAO,EAAEmE,kBAAS,CAACI,KAAK,CAAC;IACvBlD,KAAK,EAAE8C,kBAAS,CAACK,MAAM;IACvBrD,WAAW,EAAEgD,kBAAS,CAACM,KAAK;IAC5BrD,OAAO,EAAE+C,kBAAS,CAACK;EACrB,CAAC,CAAC,CAACH;AACL,CAAC;AAAA,IAAAK,QAAA,GAAAR,OAAA,CAAAzE,OAAA,GAgJYN,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_debug","_Typography","_styles","_editableHtmlTipTap","_renderUi","_annotationEditor","log","debug","MainContainer","styled","UiLayout","backgroundColor","color","background","text","StyledPrompt","Typography","theme","width","marginBottom","spacing","fontSize","display","TeacherInstructions","Editor","EditableHtml","borderRadius","SrOnly","position","left","top","height","overflow","Main","React","Component","render","model","session","onAnnotationsChange","onCommentChange","onValueChange","props","animationsDisabled","annotatorMode","customKeys","dimensions","disabled","disabledAnnotator","equationEditor","extraCSSRules","feedback","mathInput","playersToolbarPosition","predefinedAnnotations","prompt","spanishInput","specialInput","spellCheckEnabled","teacherInstructions","annotations","comment","value","maxHeight","toolbarOpts","teacherInstructionsDiv","default","createElement","PreviewPrompt","defaultClassName","languageCharactersProps","push","language","ref","containerRef","Collapsible","labels","hidden","visible","component","onChange","disabledMath","keypadMode","className","markup","maxWidth","toString","minWidth","minHeight","highlightShape","spellCheck","charactersLimit","autoWidthToolbar","pluginProps","math","controlledKeypadMode","video","audio","table","textAlign","h3","separateParagraphs","ul_list","ol_list","Feedback","correctness","exports","_defineProperty2","PropTypes","func","isRequired","object","shape","string","array","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\n\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\n\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { color, Feedback, Collapsible, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\n\nimport AnnotationEditor from './annotation/annotation-editor';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst MainContainer = styled(UiLayout)({\n backgroundColor: color.background(),\n color: color.text(),\n});\n\nconst StyledPrompt = styled(Typography)(({ theme }) => ({\n width: '100%',\n color: color.text(),\n marginBottom: theme.spacing(2),\n fontSize: 'inherit',\n display: 'block',\n}));\n\nconst TeacherInstructions = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst Editor = styled(EditableHtml)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n borderRadius: '4px',\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n onValueChange: PropTypes.func.isRequired,\n onAnnotationsChange: PropTypes.func.isRequired,\n onCommentChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n session: PropTypes.shape({\n value: PropTypes.string,\n annotations: PropTypes.array,\n comment: PropTypes.string,\n }).isRequired,\n };\n\n render() {\n const { model, session, onAnnotationsChange, onCommentChange, onValueChange } = this.props;\n const {\n animationsDisabled,\n annotatorMode,\n customKeys,\n dimensions,\n disabled,\n disabledAnnotator,\n equationEditor,\n extraCSSRules,\n feedback,\n mathInput,\n playersToolbarPosition,\n predefinedAnnotations,\n prompt,\n spanishInput,\n specialInput,\n spellCheckEnabled,\n teacherInstructions,\n } = model;\n const { annotations, comment, value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n const toolbarOpts = { position: playersToolbarPosition === 'top' ? 'top' : 'bottom' };\n\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\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 <MainContainer\n extraCSSRules={extraCSSRules}\n ref={(ref) => {\n this.containerRef = ref;\n }}\n >\n <SrOnly>Constructed Response Question</SrOnly>\n\n {teacherInstructions && (\n <TeacherInstructions>\n {!animationsDisabled ? (\n <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </TeacherInstructions>\n )}\n\n {prompt && (\n <StyledPrompt component={'span'}>\n <PreviewPrompt defaultClassName=\"prompt\" prompt={model.prompt} />\n </StyledPrompt>\n )}\n\n {annotatorMode ? (\n <AnnotationEditor\n text={value || ''}\n annotations={annotations || []}\n comment={comment || ''}\n predefinedAnnotations={predefinedAnnotations || []}\n onChange={onAnnotationsChange}\n onCommentChange={onCommentChange}\n width={width}\n height={height}\n maxHeight={maxHeight}\n disabled={disabledAnnotator}\n disabledMath={!mathInput}\n customKeys={customKeys}\n keypadMode={equationEditor}\n />\n ) : (\n <Editor\n className=\"response-area-editor\"\n onChange={onValueChange}\n markup={value || ''}\n maxWidth={width && width.toString()}\n minWidth={'100px'}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n charactersLimit={50000}\n autoWidthToolbar\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 table: {\n disabled: true,\n },\n textAlign: {\n disabled: true,\n },\n h3: {\n disabled: true,\n },\n separateParagraphs: { disabled: false },\n ul_list: { disabled: true },\n ol_list: { disabled: true },\n }}\n languageCharactersProps={languageCharactersProps}\n />\n )}\n\n {feedback && <Feedback correctness=\"correct\" feedback={feedback} />}\n </MainContainer>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,mBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,iBAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,MAAMQ,GAAG,GAAG,IAAAC,cAAK,EAAC,6BAA6B,CAAC;AAEhD,MAAMC,aAAa,GAAG,IAAAC,cAAM,EAACC,kBAAQ,CAAC,CAAC;EACrCC,eAAe,EAAEC,eAAK,CAACC,UAAU,CAAC,CAAC;EACnCD,KAAK,EAAEA,eAAK,CAACE,IAAI,CAAC;AACpB,CAAC,CAAC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