@pie-element/extended-text-entry 14.0.0-beta.0 → 14.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -17
- package/configure/CHANGELOG.md +0 -11
- package/configure/lib/main.js +4 -4
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +6 -6
- package/controller/CHANGELOG.md +0 -11
- package/controller/package.json +2 -2
- package/lib/annotation/annotation-editor.js +2 -2
- package/lib/annotation/annotation-editor.js.map +1 -1
- package/lib/main.js +5 -5
- package/lib/main.js.map +1 -1
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/module/configure.js +1 -0
- package/module/controller.js +139 -0
- package/module/demo.js +38 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +22 -0
- package/module/print-demo.js +76 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +13 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,23 +3,6 @@
|
|
|
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.4.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@13.3.2...@pie-element/extended-text-entry@13.4.0) (2025-11-27)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* bump libs PD-5274, PD-5211, PD-5248 ([7610b25](https://github.com/pie-framework/pie-elements/commit/7610b25423956b6492f33322513b3430051fca77))
|
|
12
|
-
* tests ([4648663](https://github.com/pie-framework/pie-elements/commit/464866307e8f8dc10cd7983cc3f4429ce82c4a47))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Features
|
|
16
|
-
|
|
17
|
-
* remove list tools from extended-text-entry player view PD-5266 ([bc282d1](https://github.com/pie-framework/pie-elements/commit/bc282d1ea47c26115a6890fa72da3bab2206580d))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
6
|
## [13.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@13.3.1...@pie-element/extended-text-entry@13.3.2) (2025-10-22)
|
|
24
7
|
|
|
25
8
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,17 +3,6 @@
|
|
|
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
|
-
## [11.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@11.3.2...@pie-element/extended-text-entry-configure@11.3.3) (2025-11-27)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* bump libs PD-5274, PD-5211, PD-5248 ([7610b25](https://github.com/pie-framework/pie-elements/commit/7610b25423956b6492f33322513b3430051fca77))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
6
|
## [11.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@11.3.1...@pie-element/extended-text-entry-configure@11.3.2) (2025-10-22)
|
|
18
7
|
|
|
19
8
|
|
package/configure/lib/main.js
CHANGED
|
@@ -11,7 +11,7 @@ var _configUi = require("@pie-lib/config-ui");
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
|
-
var
|
|
14
|
+
var _editableHtmlTipTap = _interopRequireWildcard(require("@pie-lib/editable-html-tip-tap"));
|
|
15
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
16
|
const {
|
|
17
17
|
Panel,
|
|
@@ -183,7 +183,7 @@ class Main extends _react.default.Component {
|
|
|
183
183
|
})
|
|
184
184
|
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
|
|
185
185
|
label: teacherInstructions.label
|
|
186
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
186
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
187
187
|
className: "prompt",
|
|
188
188
|
markup: model.teacherInstructions || '',
|
|
189
189
|
onChange: this.changeTeacherInstructions,
|
|
@@ -204,8 +204,8 @@ class Main extends _react.default.Component {
|
|
|
204
204
|
pluginProps: getPluginProps(teacherInstructions?.inputConfiguration)
|
|
205
205
|
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
|
|
206
206
|
label: prompt.label
|
|
207
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
208
|
-
activePlugins:
|
|
207
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
208
|
+
activePlugins: _editableHtmlTipTap.ALL_PLUGINS,
|
|
209
209
|
className: "prompt",
|
|
210
210
|
markup: model.prompt || '',
|
|
211
211
|
onChange: this.onPromptChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_configUi","_propTypes","_Typography","_styles","_editableHtml","_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';\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,GA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,QAAQ,qBACb3I,MAAA,CAAAmB,OAAA,CAAAmG,aAAA,CAACnF,YAAY;MAACyG,OAAO,EAAC;IAAI,GAAC,UAEb,CAAC,eAEf5I,MAAA,CAAAmB,OAAA,CAAAmG,aAAA,CAACnH,SAAA,CAAA0I,gBAAgB;MACfpC,KAAK,EAAC,sBAAsB;MAC5BzC,QAAQ,EAAEF,KAAK,CAACE,QAAQ,IAAI/B,eAAgB;MAC5CgG,QAAQ,EAAE,IAAI,CAACa,cAAe;MAC9BxC,WAAW,EAAEA;IAAY,CAC1B,CACa,CAEC,CAAC;EAE1B;AACF;AAACyC,OAAA,CAAAzF,IAAA,GAAAA,IAAA;AAAA,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
|
+
{"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,CAA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,KAAK,EAAC,sBAAsB;MAC5BzC,QAAQ,EAAEF,KAAK,CAACE,QAAQ,IAAI/B,eAAgB;MAC5CgG,QAAQ,EAAE,IAAI,CAACa,cAAe;MAC9BxC,WAAW,EAAEA;IAAY,CAC1B,CACa,CAEC,CAAC;EAE1B;AACF;AAACyC,OAAA,CAAAzF,IAAA,GAAAA,IAAA;AAAA,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":[]}
|
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": "12.0.0-beta.
|
|
4
|
+
"version": "12.0.0-beta.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -13,11 +13,11 @@
|
|
|
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": "
|
|
17
|
-
"@pie-lib/editable-html": "
|
|
18
|
-
"lodash": "^4.17.
|
|
16
|
+
"@pie-lib/config-ui": "12.1.1-next.3",
|
|
17
|
+
"@pie-lib/editable-html-tip-tap": "1.1.1-next.3",
|
|
18
|
+
"lodash-es": "^4.17.23",
|
|
19
19
|
"prop-types": "^15.6.2",
|
|
20
|
-
"react": "18.
|
|
21
|
-
"react-dom": "18.
|
|
20
|
+
"react": "18.3.1",
|
|
21
|
+
"react-dom": "18.3.1"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,17 +3,6 @@
|
|
|
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
|
-
## [7.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-controller@7.3.2...@pie-element/extended-text-entry-controller@7.3.3) (2025-11-27)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* bump libs PD-5274, PD-5211, PD-5248 ([7610b25](https://github.com/pie-framework/pie-elements/commit/7610b25423956b6492f33322513b3430051fca77))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
6
|
## [7.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-controller@7.3.1...@pie-element/extended-text-entry-controller@7.3.2) (2025-10-22)
|
|
18
7
|
|
|
19
8
|
|
package/controller/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/extended-text-entry-controller",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "8.0.0-beta.
|
|
4
|
+
"version": "8.0.0-beta.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@pie-lib/feedback": "
|
|
9
|
+
"@pie-lib/feedback": "1.1.1-next.1"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -12,7 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _annotationUtils = require("./annotation-utils");
|
|
13
13
|
var _freeformEditor = _interopRequireDefault(require("./freeform-editor"));
|
|
14
14
|
var _annotationMenu = _interopRequireDefault(require("./annotation-menu"));
|
|
15
|
-
var
|
|
15
|
+
var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
|
|
16
16
|
var _configUi = require("@pie-lib/config-ui");
|
|
17
17
|
const TextContainer = (0, _styles.styled)('div')({
|
|
18
18
|
padding: '10px 120px 10px 16px',
|
|
@@ -568,7 +568,7 @@ class AnnotationEditor extends _react.default.Component {
|
|
|
568
568
|
ref: r => this.labelsRef = r
|
|
569
569
|
})), /*#__PURE__*/_react.default.createElement(CommentContainer, {
|
|
570
570
|
label: 'Comment'
|
|
571
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
571
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
572
572
|
className: "prompt",
|
|
573
573
|
markup: comment || '',
|
|
574
574
|
onChange: onCommentChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation-editor.js","names":["_react","_interopRequireDefault","require","_styles","_propTypes","_annotationUtils","_freeformEditor","_annotationMenu","_editableHtml","_configUi","TextContainer","styled","padding","backgroundColor","border","borderRadius","overflowY","lineHeight","whiteSpace","overflowWrap","margin","userSelect","LabelsContainer","width","Wrapper","position","overflowX","display","CommentContainer","InputContainer","theme","paddingTop","spacing","marginBottom","marginTop","globalStyles","document","getElementById","styleElement","createElement","id","textContent","head","appendChild","AnnotationEditor","React","Component","constructor","props","_defineProperty2","default","textRef","labelsRef","left","offsetLeft","offsetWidth","Array","from","children","forEach","label","spans","getAnnotationElements","dataset","annId","spanOffset","offsetTop","offsetParent","top","scrollTop","style","event","annotations","selectionDetails","state","target","annotationId","selectedElems","labelElem","getLabelElement","annotationIndex","findIndex","annotation","isSideLabel","hasAttribute","zIndex","setState","anchorEl","openedMenu","openedEditor","elem","classList","contains","setProperty","color","removeProperty","length","removeElemsWrapping","clearSelection","selection","window","getSelection","detail","rangeCount","selectedRange","getRangeAt","selectedText","toString","isSelectionInside","commonAncestorContainer","isCollapsed","getRangeDetails","wrapRange","onChange","parentRef","removeChild","splice","handleClose","elems","disabled","type","className","cursor","onclick","handleClick","onmouseover","handleHover","onmouseout","handleCancelHover","firstSpan","innerHTML","freeform","marginLeft","wordBreak","fontSize","fontStyle","fontWeight","webkitUserSelect","mozUserSelect","msUserSelect","start","end","Date","getTime","join","createDOMAnnotation","newAnnotation","text","updatedAnnotation","oldType","oldLabel","updateLabel","createNewAnnotation","push","remove","add","newLabel","span","componentDidMount","domStart","domEnd","getDOMNodes","range","createRange","setStart","node","offset","setEnd","adjustAnnotationsPosition","addEventListener","componentWillUnmount","removeEventListener","render","comment","customKeys","disabledMath","keypadMode","height","maxHeight","onCommentChange","predefinedAnnotations","anchorOffset","topOffset","minHeight","ref","r","onMouseDown","onMouseUp","handleSelection","dangerouslySetInnerHTML","__html","markup","pluginProps","math","controlledKeypadMode","video","audio","textAlign","open","isNewAnnotation","onClose","onDelete","deleteAnnotation","onEdit","editAnnotation","onWrite","addAnnotation","onAnnotate","handleMenuClick","value","onSave","updateAnnotation","onTypeChange","changeAnnotationType","PropTypes","string","array","func","isRequired","number","bool","_default","exports"],"sources":["../../src/annotation/annotation-editor.jsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\n\nimport {\n clearSelection,\n isSideLabel,\n getAnnotationElements,\n getDOMNodes,\n getLabelElement,\n getRangeDetails,\n removeElemsWrapping,\n wrapRange,\n} from './annotation-utils';\nimport FreeformEditor from './freeform-editor';\nimport AnnotationMenu from './annotation-menu';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { InputContainer } from '@pie-lib/config-ui';\n\nconst TextContainer = styled('div')({\n padding: '10px 120px 10px 16px',\n backgroundColor: 'rgba(0, 0, 0, 0.06)',\n border: '1px solid #ccc',\n borderRadius: '4px',\n overflowY: 'scroll',\n lineHeight: '36px',\n whiteSpace: 'pre-wrap',\n overflowWrap: 'break-word',\n '& p': {\n margin: 0,\n },\n '& span[data-latex]': {\n userSelect: 'none',\n '-webkit-user-select': 'none',\n '-moz-user-select': 'none',\n '-ms-user-select': 'none',\n },\n});\n\nconst LabelsContainer = styled('div')({\n width: '230px',\n});\n\nconst Wrapper = styled('div')({\n position: 'relative',\n overflowX: 'hidden',\n display: 'flex',\n});\n\nconst CommentContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\n// Global styles for pseudo-elements that can't be applied inline\nconst globalStyles = `\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: \"\";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n`;\n\n// Inject styles if not already injected\nif (!document.getElementById('annotation-editor-styles')) {\n const styleElement = document.createElement('style');\n styleElement.id = 'annotation-editor-styles';\n styleElement.textContent = globalStyles;\n document.head.appendChild(styleElement);\n}\n\nclass AnnotationEditor extends React.Component {\n static propTypes = {\n text: PropTypes.string,\n comment: PropTypes.string,\n annotations: PropTypes.array,\n predefinedAnnotations: PropTypes.array,\n onChange: PropTypes.func.isRequired,\n onCommentChange: PropTypes.func.isRequired,\n width: PropTypes.number,\n height: PropTypes.number,\n maxHeight: PropTypes.string,\n disabled: PropTypes.bool,\n disabledMath: PropTypes.bool,\n customKeys: PropTypes.array,\n keypadMode: PropTypes.string,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n anchorEl: null,\n openedMenu: false,\n openedEditor: false,\n selectedElems: [],\n labelElem: null,\n selectionDetails: null,\n annotation: null,\n annotationIndex: null,\n };\n }\n\n componentDidMount() {\n const { annotations, text } = this.props;\n\n if (text) {\n annotations.forEach((annotation) => {\n const [domStart, domEnd] = getDOMNodes(annotation.start, annotation.end, this.textRef);\n\n if (domStart && domEnd) {\n const range = document.createRange();\n\n range.setStart(domStart.node, domStart.offset);\n range.setEnd(domEnd.node, domEnd.offset);\n\n const spans = wrapRange(range);\n\n this.createDOMAnnotation(spans, annotation);\n }\n });\n }\n\n if (this.textRef) {\n this.adjustAnnotationsPosition();\n this.textRef.addEventListener('scroll', this.adjustAnnotationsPosition);\n }\n }\n\n adjustAnnotationsPosition = () => {\n if (this.textRef && this.labelsRef) {\n const left = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;\n\n Array.from(this.labelsRef.children).forEach((label) => {\n const spans = getAnnotationElements(label.dataset.annId);\n const spanOffset = spans[0].offsetTop ? spans[0].offsetTop : spans[0].offsetParent.offsetTop;\n const top = spanOffset - this.textRef.scrollTop - 6;\n\n label.style.top = `${top}px`;\n label.style.left = `${left}px`;\n });\n }\n };\n\n handleClick = (event) => {\n const { annotations } = this.props;\n const { selectionDetails } = this.state;\n\n if (selectionDetails) {\n // new selection was made inside another annotation and should not update that annotation\n return;\n }\n\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const annotationIndex = annotations.findIndex((annotation) => annotation.id === annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n if (isSideLabel) {\n labelElem.style.zIndex = '10';\n }\n\n this.setState({\n anchorEl: selectedElems[0],\n openedMenu: !!id || (!!annId && !isSideLabel), // true if the annotation or the label was clicked\n openedEditor: !!annId && isSideLabel, // true if the side label was clicked\n selectedElems,\n labelElem,\n annotationIndex,\n annotation: annotations[annotationIndex],\n selectionDetails: null,\n });\n };\n\n handleHover = (event) => {\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n selectedElems.forEach((elem) => {\n elem.style.zIndex = '20';\n if (elem.classList.contains('positive')) {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.7)';\n } else if (elem.classList.contains('negative')) {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.55)';\n }\n });\n\n if (isSideLabel) {\n labelElem.style.zIndex = '20';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.backgroundColor = 'rgb(128, 255, 128)';\n labelElem.style.setProperty('--before-border-color', 'rgb(153, 255, 153)');\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.backgroundColor = 'rgb(255, 179, 230)';\n labelElem.style.setProperty('--before-border-color', 'rgb(255, 179, 230)');\n }\n } else {\n labelElem.style.zIndex = '20';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.color = 'rgb(0, 77, 0)';\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.color = 'rgb(153, 0, 102)';\n }\n }\n };\n\n handleCancelHover = (event) => {\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n selectedElems.forEach((elem) => {\n elem.style.zIndex = '';\n if (elem.classList.contains('positive')) {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.5)';\n } else if (elem.classList.contains('negative')) {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.4)';\n }\n });\n\n if (isSideLabel) {\n labelElem.style.zIndex = '';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.backgroundColor = 'rgb(153, 255, 153)';\n labelElem.style.removeProperty('--before-border-color');\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.backgroundColor = 'rgb(255, 204, 238)';\n labelElem.style.removeProperty('--before-border-color');\n }\n } else {\n labelElem.style.zIndex = '';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.color = 'rgb(0, 128, 0)';\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.color = 'rgb(204, 0, 136)';\n }\n }\n };\n\n handleClose = (event) => {\n const { selectedElems, labelElem } = this.state;\n\n if (selectedElems.length && !selectedElems[0].hasAttribute('data-id')) {\n removeElemsWrapping(selectedElems, this.textRef);\n }\n\n if (labelElem) {\n labelElem.style.zIndex = '';\n }\n\n this.setState({\n anchorEl: null,\n openedMenu: false,\n openedEditor: false,\n selectedElems: [],\n labelElem: null,\n selectionDetails: null,\n annotationIndex: null,\n annotation: null,\n });\n\n clearSelection();\n };\n\n handleSelection = (event) => {\n const selection = window.getSelection();\n\n // prevent unwanted selections\n if (event.detail > 2) {\n clearSelection();\n return;\n }\n\n if (selection && selection.rangeCount > 0) {\n const selectedRange = selection.getRangeAt(0);\n const selectedText = selectedRange.toString();\n const isSelectionInside = this.textRef.contains(selectedRange.commonAncestorContainer);\n\n if (!selection.isCollapsed && selectedText !== '' && isSelectionInside) {\n const selectionDetails = getRangeDetails(selectedRange, this.textRef);\n const selectedElems = wrapRange(selectedRange);\n\n this.setState({\n anchorEl: selectedElems[0],\n openedMenu: true,\n selectedElems,\n selectionDetails,\n });\n }\n }\n };\n\n deleteAnnotation = () => {\n const { annotations, onChange } = this.props;\n const { selectedElems, labelElem, annotationIndex, annotation } = this.state;\n const parentRef = isSideLabel(annotation.label) ? this.labelsRef : selectedElems[0];\n\n parentRef.removeChild(labelElem);\n removeElemsWrapping(selectedElems, this.textRef);\n annotations.splice(annotationIndex, 1);\n\n onChange(annotations);\n this.handleClose();\n };\n\n createDOMAnnotation = (elems, annotation) => {\n const { disabled } = this.props;\n const { id, label, type } = annotation;\n\n (elems || []).forEach((elem) => {\n elem.dataset.id = id;\n elem.className = `annotation ${type}`;\n // Apply annotation styles directly\n elem.style.position = 'relative';\n elem.style.cursor = 'pointer';\n if (type === 'positive') {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.5)';\n } else if (type === 'negative') {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.4)';\n }\n elem.onclick = !disabled && this.handleClick;\n elem.onmouseover = this.handleHover;\n elem.onmouseout = this.handleCancelHover;\n });\n\n const firstSpan = (elems && elems[0]) || {};\n const labelElem = document.createElement('SPAN');\n\n labelElem.dataset.annId = id;\n labelElem.innerHTML = label;\n labelElem.onclick = !disabled && this.handleClick;\n labelElem.onmouseover = this.handleHover;\n labelElem.onmouseout = this.handleCancelHover;\n\n if (isSideLabel(label)) {\n const spanOffset = firstSpan.offsetTop ? firstSpan.offsetTop : firstSpan.offsetParent.offsetTop;\n const top = spanOffset - this.textRef.scrollTop;\n const left = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;\n\n labelElem.dataset.freeform = true;\n labelElem.className = `sideAnnotation ${type}`;\n \n // Apply side annotation styles directly\n labelElem.style.position = 'absolute';\n labelElem.style.padding = '4px';\n labelElem.style.borderRadius = '4px';\n labelElem.style.marginLeft = '8px';\n labelElem.style.width = '180px';\n labelElem.style.whiteSpace = 'pre-wrap';\n labelElem.style.wordBreak = 'break-word';\n labelElem.style.border = '2px solid #ffffff';\n labelElem.style.fontSize = '14px';\n labelElem.style.fontStyle = 'normal';\n labelElem.style.fontWeight = 'normal';\n labelElem.style.top = `${top}px`;\n labelElem.style.left = `${left}px`;\n \n if (type === 'negative') {\n labelElem.style.backgroundColor = 'rgb(255, 204, 238)';\n } else if (type === 'positive') {\n labelElem.style.backgroundColor = 'rgb(153, 255, 153)';\n }\n \n // Add pseudo-element styles via CSS\n labelElem.style.setProperty('--before-border-width', '7px');\n labelElem.style.setProperty('--before-top', '5px');\n labelElem.style.setProperty('--before-right', '100%');\n if (type === 'negative') {\n labelElem.style.setProperty('--before-border-color', 'rgb(255, 204, 238)');\n } else if (type === 'positive') {\n labelElem.style.setProperty('--before-border-color', 'rgb(153, 255, 153)');\n }\n\n this.labelsRef.appendChild(labelElem);\n } else {\n labelElem.className = `annotationLabel ${type}`;\n \n // Apply annotation label styles directly\n labelElem.style.backgroundColor = 'rgb(242, 242, 242)';\n labelElem.style.padding = '2px';\n labelElem.style.position = 'absolute';\n labelElem.style.userSelect = 'none';\n labelElem.style.whiteSpace = 'nowrap';\n labelElem.style.top = '-10px';\n labelElem.style.left = '-2px';\n labelElem.style.fontSize = '12px';\n labelElem.style.fontStyle = 'normal';\n labelElem.style.fontWeight = 'normal';\n labelElem.style.lineHeight = '6px';\n labelElem.style.webkitUserSelect = 'none';\n labelElem.style.mozUserSelect = 'none';\n labelElem.style.msUserSelect = 'none';\n \n if (type === 'positive') {\n labelElem.style.color = 'rgb(0, 128, 0)';\n } else if (type === 'negative') {\n labelElem.style.color = 'rgb(204, 0, 136)';\n }\n \n firstSpan.appendChild(labelElem);\n }\n };\n\n createNewAnnotation = (label, type) => {\n const { selectedElems, selectionDetails } = this.state;\n const annotation = {\n id: [selectionDetails.start, selectionDetails.end, new Date().getTime()].join('-'),\n label,\n type,\n ...selectionDetails,\n };\n\n this.createDOMAnnotation(selectedElems, annotation);\n\n return annotation;\n };\n\n handleMenuClick = (newAnnotation) => {\n const { annotations, onChange } = this.props;\n const { annotation, annotationIndex } = this.state;\n const { type, text: label } = newAnnotation;\n\n if (annotation) {\n const updatedAnnotation = { ...annotation, label, type };\n const { type: oldType, label: oldLabel } = annotation;\n\n this.updateLabel(oldLabel, updatedAnnotation, type !== oldType && oldType);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n } else {\n const newAnnotation = this.createNewAnnotation(label, type);\n\n annotations.push(newAnnotation);\n }\n\n onChange(annotations);\n this.handleClose();\n };\n\n editAnnotation = () => {\n this.setState({\n openedMenu: false,\n openedEditor: true,\n });\n };\n\n addAnnotation = (type) => {\n const { annotations, onChange } = this.props;\n const annotation = this.createNewAnnotation('', type);\n const labelElem = getLabelElement(annotation.id);\n\n annotations.push(annotation);\n\n this.setState({\n openedMenu: false,\n openedEditor: true,\n annotationIndex: annotations.length - 1,\n annotation,\n labelElem,\n });\n\n onChange(annotations);\n };\n\n updateLabel = (oldLabel, annotation, oldType) => {\n const { selectedElems, labelElem } = this.state;\n const { label, type } = annotation;\n\n if ((isSideLabel(label) && isSideLabel(oldLabel)) || (!isSideLabel(label) && !isSideLabel(oldLabel))) {\n labelElem.innerHTML = label;\n\n if (oldType) {\n labelElem.classList.remove(oldType);\n labelElem.classList.add(type);\n\n selectedElems.forEach((elem) => {\n elem.classList.remove(oldType);\n elem.classList.add(type);\n });\n }\n } else if (isSideLabel(label) && !isSideLabel(oldLabel)) {\n selectedElems[0].removeChild(labelElem);\n this.createDOMAnnotation(selectedElems, annotation);\n } else if (!isSideLabel(label) && isSideLabel(oldLabel)) {\n this.labelsRef.removeChild(labelElem);\n this.createDOMAnnotation(selectedElems, annotation);\n }\n };\n\n changeAnnotationType = (newLabel) => {\n const { annotations, onChange } = this.props;\n const { annotationIndex, selectedElems } = this.state;\n const { type: oldType, label: oldLabel } = annotations[annotationIndex];\n const type = oldType === 'positive' ? 'negative' : 'positive';\n const updatedAnnotation = { ...annotations[annotationIndex], type, label: newLabel };\n\n selectedElems.forEach((span) => {\n span.classList.remove(oldType);\n span.classList.add(type);\n });\n\n this.updateLabel(oldLabel, updatedAnnotation, oldType);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n\n onChange(annotations);\n this.handleClose();\n };\n\n updateAnnotation = (oldLabel, newLabel) => {\n const { annotations, onChange } = this.props;\n const { annotationIndex } = this.state;\n const updatedAnnotation = { ...annotations[annotationIndex], label: newLabel };\n\n this.updateLabel(oldLabel, updatedAnnotation);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n\n onChange(annotations);\n };\n\n componentWillUnmount() {\n this.textRef.removeEventListener('scroll', this.adjustAnnotationsPosition);\n }\n\n render() {\n const {\n comment,\n customKeys,\n disabled,\n disabledMath,\n keypadMode,\n height,\n width,\n maxHeight,\n onCommentChange,\n predefinedAnnotations,\n text,\n } = this.props;\n const { anchorEl, annotation, openedMenu, openedEditor, selectionDetails } = this.state;\n\n const anchorOffset = anchorEl && (anchorEl.offsetTop ? anchorEl.offsetTop : anchorEl.offsetParent.offsetTop);\n const topOffset = this.textRef && anchorOffset ? anchorOffset - this.textRef.scrollTop - 8 : 0;\n\n return (\n <div>\n <Wrapper>\n <TextContainer\n style={{ width: width - 34, minHeight: height, maxHeight: maxHeight }}\n ref={(r) => (this.textRef = r)}\n onMouseDown={!disabled ? clearSelection : () => {}}\n onMouseUp={!disabled ? this.handleSelection : () => {}}\n dangerouslySetInnerHTML={{ __html: text }}\n />\n <LabelsContainer ref={(r) => (this.labelsRef = r)} />\n </Wrapper>\n\n <CommentContainer label={'Comment'}>\n <EditableHtml\n className=\"prompt\"\n markup={comment || ''}\n onChange={onCommentChange}\n width={width && (width + 104).toString()}\n disabled={disabled}\n pluginProps={{\n math: {\n disabled: disabledMath,\n customKeys: customKeys,\n keypadMode: keypadMode,\n controlledKeypadMode: false,\n },\n video: {\n disabled: true,\n },\n audio: {\n disabled: true,\n },\n textAlign: {\n disabled: true,\n },\n }}\n />\n </CommentContainer>\n\n <AnnotationMenu\n anchorEl={anchorEl}\n open={openedMenu && !disabled}\n annotations={predefinedAnnotations}\n isNewAnnotation={!!selectionDetails}\n onClose={this.handleClose}\n onDelete={this.deleteAnnotation}\n onEdit={this.editAnnotation}\n onWrite={this.addAnnotation}\n onAnnotate={this.handleMenuClick}\n />\n\n <FreeformEditor\n anchorEl={this.textRef}\n open={openedEditor && !disabled}\n offset={topOffset}\n value={(annotation && annotation.label) || ''}\n type={annotation && annotation.type}\n onClose={this.handleClose}\n onDelete={this.deleteAnnotation}\n onSave={this.updateAnnotation}\n onTypeChange={this.changeAnnotationType}\n />\n </div>\n );\n }\n}\n\nexport default AnnotationEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,gBAAA,GAAAH,OAAA;AAUA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,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,YAAY,EAAE,IAAI,CAACC;IAAqB,CACzC,CACE,CAAC;EAEV;AACF;AAAC,IAAApK,gBAAA,CAAAC,OAAA,EA9hBKN,gBAAgB,eACD;EACjBuG,IAAI,EAAEmE,kBAAS,CAACC,MAAM;EACtB1C,OAAO,EAAEyC,kBAAS,CAACC,MAAM;EACzB/I,WAAW,EAAE8I,kBAAS,CAACE,KAAK;EAC5BpC,qBAAqB,EAAEkC,kBAAS,CAACE,KAAK;EACtCvG,QAAQ,EAAEqG,kBAAS,CAACG,IAAI,CAACC,UAAU;EACnCvC,eAAe,EAAEmC,kBAAS,CAACG,IAAI,CAACC,UAAU;EAC1CnM,KAAK,EAAE+L,kBAAS,CAACK,MAAM;EACvB1C,MAAM,EAAEqC,kBAAS,CAACK,MAAM;EACxBzC,SAAS,EAAEoC,kBAAS,CAACC,MAAM;EAC3BhG,QAAQ,EAAE+F,kBAAS,CAACM,IAAI;EACxB7C,YAAY,EAAEuC,kBAAS,CAACM,IAAI;EAC5B9C,UAAU,EAAEwC,kBAAS,CAACE,KAAK;EAC3BxC,UAAU,EAAEsC,kBAAS,CAACC;AACxB,CAAC;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAA5K,OAAA,GAihBYN,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"annotation-editor.js","names":["_react","_interopRequireDefault","require","_styles","_propTypes","_annotationUtils","_freeformEditor","_annotationMenu","_editableHtmlTipTap","_configUi","TextContainer","styled","padding","backgroundColor","border","borderRadius","overflowY","lineHeight","whiteSpace","overflowWrap","margin","userSelect","LabelsContainer","width","Wrapper","position","overflowX","display","CommentContainer","InputContainer","theme","paddingTop","spacing","marginBottom","marginTop","globalStyles","document","getElementById","styleElement","createElement","id","textContent","head","appendChild","AnnotationEditor","React","Component","constructor","props","_defineProperty2","default","textRef","labelsRef","left","offsetLeft","offsetWidth","Array","from","children","forEach","label","spans","getAnnotationElements","dataset","annId","spanOffset","offsetTop","offsetParent","top","scrollTop","style","event","annotations","selectionDetails","state","target","annotationId","selectedElems","labelElem","getLabelElement","annotationIndex","findIndex","annotation","isSideLabel","hasAttribute","zIndex","setState","anchorEl","openedMenu","openedEditor","elem","classList","contains","setProperty","color","removeProperty","length","removeElemsWrapping","clearSelection","selection","window","getSelection","detail","rangeCount","selectedRange","getRangeAt","selectedText","toString","isSelectionInside","commonAncestorContainer","isCollapsed","getRangeDetails","wrapRange","onChange","parentRef","removeChild","splice","handleClose","elems","disabled","type","className","cursor","onclick","handleClick","onmouseover","handleHover","onmouseout","handleCancelHover","firstSpan","innerHTML","freeform","marginLeft","wordBreak","fontSize","fontStyle","fontWeight","webkitUserSelect","mozUserSelect","msUserSelect","start","end","Date","getTime","join","createDOMAnnotation","newAnnotation","text","updatedAnnotation","oldType","oldLabel","updateLabel","createNewAnnotation","push","remove","add","newLabel","span","componentDidMount","domStart","domEnd","getDOMNodes","range","createRange","setStart","node","offset","setEnd","adjustAnnotationsPosition","addEventListener","componentWillUnmount","removeEventListener","render","comment","customKeys","disabledMath","keypadMode","height","maxHeight","onCommentChange","predefinedAnnotations","anchorOffset","topOffset","minHeight","ref","r","onMouseDown","onMouseUp","handleSelection","dangerouslySetInnerHTML","__html","markup","pluginProps","math","controlledKeypadMode","video","audio","textAlign","open","isNewAnnotation","onClose","onDelete","deleteAnnotation","onEdit","editAnnotation","onWrite","addAnnotation","onAnnotate","handleMenuClick","value","onSave","updateAnnotation","onTypeChange","changeAnnotationType","PropTypes","string","array","func","isRequired","number","bool","_default","exports"],"sources":["../../src/annotation/annotation-editor.jsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\n\nimport {\n clearSelection,\n isSideLabel,\n getAnnotationElements,\n getDOMNodes,\n getLabelElement,\n getRangeDetails,\n removeElemsWrapping,\n wrapRange,\n} from './annotation-utils';\nimport FreeformEditor from './freeform-editor';\nimport AnnotationMenu from './annotation-menu';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { InputContainer } from '@pie-lib/config-ui';\n\nconst TextContainer = styled('div')({\n padding: '10px 120px 10px 16px',\n backgroundColor: 'rgba(0, 0, 0, 0.06)',\n border: '1px solid #ccc',\n borderRadius: '4px',\n overflowY: 'scroll',\n lineHeight: '36px',\n whiteSpace: 'pre-wrap',\n overflowWrap: 'break-word',\n '& p': {\n margin: 0,\n },\n '& span[data-latex]': {\n userSelect: 'none',\n '-webkit-user-select': 'none',\n '-moz-user-select': 'none',\n '-ms-user-select': 'none',\n },\n});\n\nconst LabelsContainer = styled('div')({\n width: '230px',\n});\n\nconst Wrapper = styled('div')({\n position: 'relative',\n overflowX: 'hidden',\n display: 'flex',\n});\n\nconst CommentContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\n// Global styles for pseudo-elements that can't be applied inline\nconst globalStyles = `\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: \"\";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n`;\n\n// Inject styles if not already injected\nif (!document.getElementById('annotation-editor-styles')) {\n const styleElement = document.createElement('style');\n styleElement.id = 'annotation-editor-styles';\n styleElement.textContent = globalStyles;\n document.head.appendChild(styleElement);\n}\n\nclass AnnotationEditor extends React.Component {\n static propTypes = {\n text: PropTypes.string,\n comment: PropTypes.string,\n annotations: PropTypes.array,\n predefinedAnnotations: PropTypes.array,\n onChange: PropTypes.func.isRequired,\n onCommentChange: PropTypes.func.isRequired,\n width: PropTypes.number,\n height: PropTypes.number,\n maxHeight: PropTypes.string,\n disabled: PropTypes.bool,\n disabledMath: PropTypes.bool,\n customKeys: PropTypes.array,\n keypadMode: PropTypes.string,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n anchorEl: null,\n openedMenu: false,\n openedEditor: false,\n selectedElems: [],\n labelElem: null,\n selectionDetails: null,\n annotation: null,\n annotationIndex: null,\n };\n }\n\n componentDidMount() {\n const { annotations, text } = this.props;\n\n if (text) {\n annotations.forEach((annotation) => {\n const [domStart, domEnd] = getDOMNodes(annotation.start, annotation.end, this.textRef);\n\n if (domStart && domEnd) {\n const range = document.createRange();\n\n range.setStart(domStart.node, domStart.offset);\n range.setEnd(domEnd.node, domEnd.offset);\n\n const spans = wrapRange(range);\n\n this.createDOMAnnotation(spans, annotation);\n }\n });\n }\n\n if (this.textRef) {\n this.adjustAnnotationsPosition();\n this.textRef.addEventListener('scroll', this.adjustAnnotationsPosition);\n }\n }\n\n adjustAnnotationsPosition = () => {\n if (this.textRef && this.labelsRef) {\n const left = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;\n\n Array.from(this.labelsRef.children).forEach((label) => {\n const spans = getAnnotationElements(label.dataset.annId);\n const spanOffset = spans[0].offsetTop ? spans[0].offsetTop : spans[0].offsetParent.offsetTop;\n const top = spanOffset - this.textRef.scrollTop - 6;\n\n label.style.top = `${top}px`;\n label.style.left = `${left}px`;\n });\n }\n };\n\n handleClick = (event) => {\n const { annotations } = this.props;\n const { selectionDetails } = this.state;\n\n if (selectionDetails) {\n // new selection was made inside another annotation and should not update that annotation\n return;\n }\n\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const annotationIndex = annotations.findIndex((annotation) => annotation.id === annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n if (isSideLabel) {\n labelElem.style.zIndex = '10';\n }\n\n this.setState({\n anchorEl: selectedElems[0],\n openedMenu: !!id || (!!annId && !isSideLabel), // true if the annotation or the label was clicked\n openedEditor: !!annId && isSideLabel, // true if the side label was clicked\n selectedElems,\n labelElem,\n annotationIndex,\n annotation: annotations[annotationIndex],\n selectionDetails: null,\n });\n };\n\n handleHover = (event) => {\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n selectedElems.forEach((elem) => {\n elem.style.zIndex = '20';\n if (elem.classList.contains('positive')) {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.7)';\n } else if (elem.classList.contains('negative')) {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.55)';\n }\n });\n\n if (isSideLabel) {\n labelElem.style.zIndex = '20';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.backgroundColor = 'rgb(128, 255, 128)';\n labelElem.style.setProperty('--before-border-color', 'rgb(153, 255, 153)');\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.backgroundColor = 'rgb(255, 179, 230)';\n labelElem.style.setProperty('--before-border-color', 'rgb(255, 179, 230)');\n }\n } else {\n labelElem.style.zIndex = '20';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.color = 'rgb(0, 77, 0)';\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.color = 'rgb(153, 0, 102)';\n }\n }\n };\n\n handleCancelHover = (event) => {\n const { id, annId } = event.target.dataset;\n const annotationId = id || annId;\n const selectedElems = getAnnotationElements(annotationId);\n const labelElem = getLabelElement(annotationId);\n const isSideLabel = labelElem.hasAttribute('data-freeform');\n\n selectedElems.forEach((elem) => {\n elem.style.zIndex = '';\n if (elem.classList.contains('positive')) {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.5)';\n } else if (elem.classList.contains('negative')) {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.4)';\n }\n });\n\n if (isSideLabel) {\n labelElem.style.zIndex = '';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.backgroundColor = 'rgb(153, 255, 153)';\n labelElem.style.removeProperty('--before-border-color');\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.backgroundColor = 'rgb(255, 204, 238)';\n labelElem.style.removeProperty('--before-border-color');\n }\n } else {\n labelElem.style.zIndex = '';\n if (labelElem.classList.contains('positive')) {\n labelElem.style.color = 'rgb(0, 128, 0)';\n } else if (labelElem.classList.contains('negative')) {\n labelElem.style.color = 'rgb(204, 0, 136)';\n }\n }\n };\n\n handleClose = (event) => {\n const { selectedElems, labelElem } = this.state;\n\n if (selectedElems.length && !selectedElems[0].hasAttribute('data-id')) {\n removeElemsWrapping(selectedElems, this.textRef);\n }\n\n if (labelElem) {\n labelElem.style.zIndex = '';\n }\n\n this.setState({\n anchorEl: null,\n openedMenu: false,\n openedEditor: false,\n selectedElems: [],\n labelElem: null,\n selectionDetails: null,\n annotationIndex: null,\n annotation: null,\n });\n\n clearSelection();\n };\n\n handleSelection = (event) => {\n const selection = window.getSelection();\n\n // prevent unwanted selections\n if (event.detail > 2) {\n clearSelection();\n return;\n }\n\n if (selection && selection.rangeCount > 0) {\n const selectedRange = selection.getRangeAt(0);\n const selectedText = selectedRange.toString();\n const isSelectionInside = this.textRef.contains(selectedRange.commonAncestorContainer);\n\n if (!selection.isCollapsed && selectedText !== '' && isSelectionInside) {\n const selectionDetails = getRangeDetails(selectedRange, this.textRef);\n const selectedElems = wrapRange(selectedRange);\n\n this.setState({\n anchorEl: selectedElems[0],\n openedMenu: true,\n selectedElems,\n selectionDetails,\n });\n }\n }\n };\n\n deleteAnnotation = () => {\n const { annotations, onChange } = this.props;\n const { selectedElems, labelElem, annotationIndex, annotation } = this.state;\n const parentRef = isSideLabel(annotation.label) ? this.labelsRef : selectedElems[0];\n\n parentRef.removeChild(labelElem);\n removeElemsWrapping(selectedElems, this.textRef);\n annotations.splice(annotationIndex, 1);\n\n onChange(annotations);\n this.handleClose();\n };\n\n createDOMAnnotation = (elems, annotation) => {\n const { disabled } = this.props;\n const { id, label, type } = annotation;\n\n (elems || []).forEach((elem) => {\n elem.dataset.id = id;\n elem.className = `annotation ${type}`;\n // Apply annotation styles directly\n elem.style.position = 'relative';\n elem.style.cursor = 'pointer';\n if (type === 'positive') {\n elem.style.backgroundColor = 'rgb(51, 255, 51, 0.5)';\n } else if (type === 'negative') {\n elem.style.backgroundColor = 'rgba(255, 102, 204, 0.4)';\n }\n elem.onclick = !disabled && this.handleClick;\n elem.onmouseover = this.handleHover;\n elem.onmouseout = this.handleCancelHover;\n });\n\n const firstSpan = (elems && elems[0]) || {};\n const labelElem = document.createElement('SPAN');\n\n labelElem.dataset.annId = id;\n labelElem.innerHTML = label;\n labelElem.onclick = !disabled && this.handleClick;\n labelElem.onmouseover = this.handleHover;\n labelElem.onmouseout = this.handleCancelHover;\n\n if (isSideLabel(label)) {\n const spanOffset = firstSpan.offsetTop ? firstSpan.offsetTop : firstSpan.offsetParent.offsetTop;\n const top = spanOffset - this.textRef.scrollTop;\n const left = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;\n\n labelElem.dataset.freeform = true;\n labelElem.className = `sideAnnotation ${type}`;\n \n // Apply side annotation styles directly\n labelElem.style.position = 'absolute';\n labelElem.style.padding = '4px';\n labelElem.style.borderRadius = '4px';\n labelElem.style.marginLeft = '8px';\n labelElem.style.width = '180px';\n labelElem.style.whiteSpace = 'pre-wrap';\n labelElem.style.wordBreak = 'break-word';\n labelElem.style.border = '2px solid #ffffff';\n labelElem.style.fontSize = '14px';\n labelElem.style.fontStyle = 'normal';\n labelElem.style.fontWeight = 'normal';\n labelElem.style.top = `${top}px`;\n labelElem.style.left = `${left}px`;\n \n if (type === 'negative') {\n labelElem.style.backgroundColor = 'rgb(255, 204, 238)';\n } else if (type === 'positive') {\n labelElem.style.backgroundColor = 'rgb(153, 255, 153)';\n }\n \n // Add pseudo-element styles via CSS\n labelElem.style.setProperty('--before-border-width', '7px');\n labelElem.style.setProperty('--before-top', '5px');\n labelElem.style.setProperty('--before-right', '100%');\n if (type === 'negative') {\n labelElem.style.setProperty('--before-border-color', 'rgb(255, 204, 238)');\n } else if (type === 'positive') {\n labelElem.style.setProperty('--before-border-color', 'rgb(153, 255, 153)');\n }\n\n this.labelsRef.appendChild(labelElem);\n } else {\n labelElem.className = `annotationLabel ${type}`;\n \n // Apply annotation label styles directly\n labelElem.style.backgroundColor = 'rgb(242, 242, 242)';\n labelElem.style.padding = '2px';\n labelElem.style.position = 'absolute';\n labelElem.style.userSelect = 'none';\n labelElem.style.whiteSpace = 'nowrap';\n labelElem.style.top = '-10px';\n labelElem.style.left = '-2px';\n labelElem.style.fontSize = '12px';\n labelElem.style.fontStyle = 'normal';\n labelElem.style.fontWeight = 'normal';\n labelElem.style.lineHeight = '6px';\n labelElem.style.webkitUserSelect = 'none';\n labelElem.style.mozUserSelect = 'none';\n labelElem.style.msUserSelect = 'none';\n \n if (type === 'positive') {\n labelElem.style.color = 'rgb(0, 128, 0)';\n } else if (type === 'negative') {\n labelElem.style.color = 'rgb(204, 0, 136)';\n }\n \n firstSpan.appendChild(labelElem);\n }\n };\n\n createNewAnnotation = (label, type) => {\n const { selectedElems, selectionDetails } = this.state;\n const annotation = {\n id: [selectionDetails.start, selectionDetails.end, new Date().getTime()].join('-'),\n label,\n type,\n ...selectionDetails,\n };\n\n this.createDOMAnnotation(selectedElems, annotation);\n\n return annotation;\n };\n\n handleMenuClick = (newAnnotation) => {\n const { annotations, onChange } = this.props;\n const { annotation, annotationIndex } = this.state;\n const { type, text: label } = newAnnotation;\n\n if (annotation) {\n const updatedAnnotation = { ...annotation, label, type };\n const { type: oldType, label: oldLabel } = annotation;\n\n this.updateLabel(oldLabel, updatedAnnotation, type !== oldType && oldType);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n } else {\n const newAnnotation = this.createNewAnnotation(label, type);\n\n annotations.push(newAnnotation);\n }\n\n onChange(annotations);\n this.handleClose();\n };\n\n editAnnotation = () => {\n this.setState({\n openedMenu: false,\n openedEditor: true,\n });\n };\n\n addAnnotation = (type) => {\n const { annotations, onChange } = this.props;\n const annotation = this.createNewAnnotation('', type);\n const labelElem = getLabelElement(annotation.id);\n\n annotations.push(annotation);\n\n this.setState({\n openedMenu: false,\n openedEditor: true,\n annotationIndex: annotations.length - 1,\n annotation,\n labelElem,\n });\n\n onChange(annotations);\n };\n\n updateLabel = (oldLabel, annotation, oldType) => {\n const { selectedElems, labelElem } = this.state;\n const { label, type } = annotation;\n\n if ((isSideLabel(label) && isSideLabel(oldLabel)) || (!isSideLabel(label) && !isSideLabel(oldLabel))) {\n labelElem.innerHTML = label;\n\n if (oldType) {\n labelElem.classList.remove(oldType);\n labelElem.classList.add(type);\n\n selectedElems.forEach((elem) => {\n elem.classList.remove(oldType);\n elem.classList.add(type);\n });\n }\n } else if (isSideLabel(label) && !isSideLabel(oldLabel)) {\n selectedElems[0].removeChild(labelElem);\n this.createDOMAnnotation(selectedElems, annotation);\n } else if (!isSideLabel(label) && isSideLabel(oldLabel)) {\n this.labelsRef.removeChild(labelElem);\n this.createDOMAnnotation(selectedElems, annotation);\n }\n };\n\n changeAnnotationType = (newLabel) => {\n const { annotations, onChange } = this.props;\n const { annotationIndex, selectedElems } = this.state;\n const { type: oldType, label: oldLabel } = annotations[annotationIndex];\n const type = oldType === 'positive' ? 'negative' : 'positive';\n const updatedAnnotation = { ...annotations[annotationIndex], type, label: newLabel };\n\n selectedElems.forEach((span) => {\n span.classList.remove(oldType);\n span.classList.add(type);\n });\n\n this.updateLabel(oldLabel, updatedAnnotation, oldType);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n\n onChange(annotations);\n this.handleClose();\n };\n\n updateAnnotation = (oldLabel, newLabel) => {\n const { annotations, onChange } = this.props;\n const { annotationIndex } = this.state;\n const updatedAnnotation = { ...annotations[annotationIndex], label: newLabel };\n\n this.updateLabel(oldLabel, updatedAnnotation);\n annotations.splice(annotationIndex, 1, updatedAnnotation);\n\n onChange(annotations);\n };\n\n componentWillUnmount() {\n this.textRef.removeEventListener('scroll', this.adjustAnnotationsPosition);\n }\n\n render() {\n const {\n comment,\n customKeys,\n disabled,\n disabledMath,\n keypadMode,\n height,\n width,\n maxHeight,\n onCommentChange,\n predefinedAnnotations,\n text,\n } = this.props;\n const { anchorEl, annotation, openedMenu, openedEditor, selectionDetails } = this.state;\n\n const anchorOffset = anchorEl && (anchorEl.offsetTop ? anchorEl.offsetTop : anchorEl.offsetParent.offsetTop);\n const topOffset = this.textRef && anchorOffset ? anchorOffset - this.textRef.scrollTop - 8 : 0;\n\n return (\n <div>\n <Wrapper>\n <TextContainer\n style={{ width: width - 34, minHeight: height, maxHeight: maxHeight }}\n ref={(r) => (this.textRef = r)}\n onMouseDown={!disabled ? clearSelection : () => {}}\n onMouseUp={!disabled ? this.handleSelection : () => {}}\n dangerouslySetInnerHTML={{ __html: text }}\n />\n <LabelsContainer ref={(r) => (this.labelsRef = r)} />\n </Wrapper>\n\n <CommentContainer label={'Comment'}>\n <EditableHtml\n className=\"prompt\"\n markup={comment || ''}\n onChange={onCommentChange}\n width={width && (width + 104).toString()}\n disabled={disabled}\n pluginProps={{\n math: {\n disabled: disabledMath,\n customKeys: customKeys,\n keypadMode: keypadMode,\n controlledKeypadMode: false,\n },\n video: {\n disabled: true,\n },\n audio: {\n disabled: true,\n },\n textAlign: {\n disabled: true,\n },\n }}\n />\n </CommentContainer>\n\n <AnnotationMenu\n anchorEl={anchorEl}\n open={openedMenu && !disabled}\n annotations={predefinedAnnotations}\n isNewAnnotation={!!selectionDetails}\n onClose={this.handleClose}\n onDelete={this.deleteAnnotation}\n onEdit={this.editAnnotation}\n onWrite={this.addAnnotation}\n onAnnotate={this.handleMenuClick}\n />\n\n <FreeformEditor\n anchorEl={this.textRef}\n open={openedEditor && !disabled}\n offset={topOffset}\n value={(annotation && annotation.label) || ''}\n type={annotation && annotation.type}\n onClose={this.handleClose}\n onDelete={this.deleteAnnotation}\n onSave={this.updateAnnotation}\n onTypeChange={this.changeAnnotationType}\n />\n </div>\n );\n }\n}\n\nexport default AnnotationEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IA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AQ,EAAE,IAAI,CAACC,gBAAiB;MAChCQ,MAAM,EAAE,IAAI,CAACC,gBAAiB;MAC9BC,YAAY,EAAE,IAAI,CAACC;IAAqB,CACzC,CACE,CAAC;EAEV;AACF;AAAC,IAAApK,gBAAA,CAAAC,OAAA,EA9hBKN,gBAAgB,eACD;EACjBuG,IAAI,EAAEmE,kBAAS,CAACC,MAAM;EACtB1C,OAAO,EAAEyC,kBAAS,CAACC,MAAM;EACzB/I,WAAW,EAAE8I,kBAAS,CAACE,KAAK;EAC5BpC,qBAAqB,EAAEkC,kBAAS,CAACE,KAAK;EACtCvG,QAAQ,EAAEqG,kBAAS,CAACG,IAAI,CAACC,UAAU;EACnCvC,eAAe,EAAEmC,kBAAS,CAACG,IAAI,CAACC,UAAU;EAC1CnM,KAAK,EAAE+L,kBAAS,CAACK,MAAM;EACvB1C,MAAM,EAAEqC,kBAAS,CAACK,MAAM;EACxBzC,SAAS,EAAEoC,kBAAS,CAACC,MAAM;EAC3BhG,QAAQ,EAAE+F,kBAAS,CAACM,IAAI;EACxB7C,YAAY,EAAEuC,kBAAS,CAACM,IAAI;EAC5B9C,UAAU,EAAEwC,kBAAS,CAACE,KAAK;EAC3BxC,UAAU,EAAEsC,kBAAS,CAACC;AACxB,CAAC;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAA5K,OAAA,GAihBYN,gBAAgB","ignoreList":[]}
|
package/lib/main.js
CHANGED
|
@@ -8,11 +8,11 @@ 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
|
|
11
|
+
var _lodashEs = require("lodash-es");
|
|
12
12
|
var _debug = _interopRequireDefault(require("debug"));
|
|
13
13
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
|
-
var
|
|
15
|
+
var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
|
|
16
16
|
var _renderUi = require("@pie-lib/render-ui");
|
|
17
17
|
var _annotationEditor = _interopRequireDefault(require("./annotation/annotation-editor"));
|
|
18
18
|
const log = (0, _debug.default)('@pie-ui:extended-text-entry');
|
|
@@ -33,7 +33,7 @@ const TeacherInstructions = (0, _styles.styled)('div')(({
|
|
|
33
33
|
}) => ({
|
|
34
34
|
marginBottom: theme.spacing(2)
|
|
35
35
|
}));
|
|
36
|
-
const Editor = (0, _styles.styled)(
|
|
36
|
+
const Editor = (0, _styles.styled)(_editableHtmlTipTap.default)(({
|
|
37
37
|
theme
|
|
38
38
|
}) => ({
|
|
39
39
|
marginBottom: theme.spacing(2),
|
|
@@ -50,8 +50,8 @@ const SrOnly = (0, _styles.styled)('h2')({
|
|
|
50
50
|
class Main extends _react.default.Component {
|
|
51
51
|
constructor(...args) {
|
|
52
52
|
super(...args);
|
|
53
|
-
(0, _defineProperty2.default)(this, "changeSessionValue", (0,
|
|
54
|
-
(0, _defineProperty2.default)(this, "changeSessionComment", (0,
|
|
53
|
+
(0, _defineProperty2.default)(this, "changeSessionValue", (0, _lodashEs.debounce)(this.props.onValueChange, 1500));
|
|
54
|
+
(0, _defineProperty2.default)(this, "changeSessionComment", (0, _lodashEs.debounce)(this.props.onCommentChange, 1500));
|
|
55
55
|
}
|
|
56
56
|
render() {
|
|
57
57
|
const {
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_debounce","_debug","_Typography","_styles","_editableHtml","_renderUi","_annotationEditor","log","debug","MainContainer","styled","UiLayout","backgroundColor","color","background","text","StyledPrompt","Typography","theme","width","marginBottom","spacing","fontSize","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","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/debounce';\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';\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}));\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 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,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,IAAAM,aAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,iBAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,MAAMS,GAAG,GAAG,IAAAC,cAAK,EAAC,6BAA6B,CAAC;AAEhD,MAAMC,aAAa,GAAG,IAAAC,cAA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A;IAAwB,CAClD,CACF,EAEAlB,QAAQ,iBAAI5D,MAAA,CAAA2C,OAAA,CAAAgC,aAAA,CAAClE,SAAA,CAAAwG,QAAQ;MAACC,WAAW,EAAC,SAAS;MAACtD,QAAQ,EAAEA;IAAS,CAAE,CACrD,CAAC;EAEpB;AACF;AAACuD,OAAA,CAAA9E,IAAA,GAAAA,IAAA;AAAA,IAAAK,gBAAA,CAAAC,OAAA,EAtJYN,IAAI,eACI;EACjBS,aAAa,EAAEsE,kBAAS,CAACC,IAAI,CAACC,UAAU;EACxCnE,mBAAmB,EAAEiE,kBAAS,CAACC,IAAI,CAACC,UAAU;EAC9CvE,eAAe,EAAEqE,kBAAS,CAACC,IAAI,CAACC,UAAU;EAC1CrE,KAAK,EAAEmE,kBAAS,CAACG,MAAM;EACvBrE,OAAO,EAAEkE,kBAAS,CAACI,KAAK,CAAC;IACvBjD,KAAK,EAAE6C,kBAAS,CAACK,MAAM;IACvBpD,WAAW,EAAE+C,kBAAS,CAACM,KAAK;IAC5BpD,OAAO,EAAE8C,kBAAS,CAACK;EACrB,CAAC,CAAC,CAACH;AACL,CAAC;AAAA,IAAAK,QAAA,GAAAR,OAAA,CAAAxE,OAAA,GA6IYN,IAAI","ignoreList":[]}
|
|
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","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","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}));\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 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,MAAMS,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;AAEF,MAAMC,YAAY,GAAG,IAAAN,cAAM,EAACO,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AACF;AAACuD,OAAA,CAAA9E,IAAA,GAAAA,IAAA;AAAA,IAAAK,gBAAA,CAAAC,OAAA,EAtJYN,IAAI,eACI;EACjBS,aAAa,EAAEsE,kBAAS,CAACC,IAAI,CAACC,UAAU;EACxCnE,mBAAmB,EAAEiE,kBAAS,CAACC,IAAI,CAACC,UAAU;EAC9CvE,eAAe,EAAEqE,kBAAS,CAACC,IAAI,CAACC,UAAU;EAC1CrE,KAAK,EAAEmE,kBAAS,CAACG,MAAM;EACvBrE,OAAO,EAAEkE,kBAAS,CAACI,KAAK,CAAC;IACvBjD,KAAK,EAAE6C,kBAAS,CAACK,MAAM;IACvBpD,WAAW,EAAE+C,kBAAS,CAACM,KAAK;IAC5BpD,OAAO,EAAE8C,kBAAS,CAACK;EACrB,CAAC,CAAC,CAACH;AACL,CAAC;AAAA,IAAAK,QAAA,GAAAR,OAAA,CAAAxE,OAAA,GA6IYN,IAAI","ignoreList":[]}
|
package/lib/print.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _client = require("react-dom/client");
|
|
10
|
-
var
|
|
10
|
+
var _lodashEs = require("lodash-es");
|
|
11
11
|
var _main = _interopRequireDefault(require("./main"));
|
|
12
12
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
13
13
|
var _debug = _interopRequireDefault(require("debug"));
|
|
@@ -38,7 +38,7 @@ class ExtendedTextEntryPrint extends HTMLElement {
|
|
|
38
38
|
this._model = null;
|
|
39
39
|
this._session = [];
|
|
40
40
|
this._root = null;
|
|
41
|
-
this._rerender = (0,
|
|
41
|
+
this._rerender = (0, _lodashEs.debounce)(() => {
|
|
42
42
|
if (this._model && this._session) {
|
|
43
43
|
const printModel = preparePrintModel(this._model, this._options);
|
|
44
44
|
const element = this._options && /*#__PURE__*/_react.default.createElement(_main.default, {
|
package/lib/print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.js","names":["_react","_interopRequireDefault","require","_client","
|
|
1
|
+
{"version":3,"file":"print.js","names":["_react","_interopRequireDefault","require","_client","_lodashEs","_main","_mathRendering","_debug","log","debug","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","mode","defaultDimensions","height","width","dimensions","disabled","feedback","animationsDisabled","ExtendedTextEntryPrint","HTMLElement","constructor","_options","_model","_session","_root","_rerender","debounce","printModel","element","React","createElement","Main","session","onChange","onValueChange","onAnnotationsChange","onCommentChange","createRoot","render","queueMicrotask","renderMath","leading","trailing","options","o","s","connectedCallback","disconnectedCallback","unmount","exports","default"],"sources":["../src/print.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from 'lodash-es';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport debug from 'debug';\n\nconst log = debug('pie-element:extended-text-entry:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n const defaultDimensions = { height: 100, width: 500 };\n\n model.dimensions = {\n ...defaultDimensions,\n ...model.dimensions,\n };\n\n model.disabled = true;\n model.feedback = undefined;\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class ExtendedTextEntryPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._root = null;\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: {},\n onChange: () => {},\n onValueChange: () => {},\n onAnnotationsChange: () => {},\n onCommentChange: () => {},\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n queueMicrotask(() => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,MAAMM,GAAG,GAAG,IAAAC,cAAK,EAAC,uCAAuC,CAAC;AAE1D,MAAMC,iBAAiB,GAAGA,CAACC,KAAK,EAAEC,IAAI,KAAK;EACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,KAAK,YAAY;EAExCH,KAAK,CAACI,MAAM,GAAGJ,KAAK,CAACK,aAAa,KAAK,KAAK,GAAGL,KAAK,CAACI,MAAM,GAAGE,SAAS;EACvEN,KAAK,CAACO,mBAAmB,GACvBL,KAAK,IAAIF,KAAK,CAACQ,0BAA0B,KAAK,KAAK,GAAGR,KAAK,CAACO,mBAAmB,GAAGD,SAAS;EAC7FN,KAAK,CAACS,uBAAuB,GAAGP,KAAK;EACrCF,KAAK,CAACU,IAAI,GAAGR,KAAK,GAAG,UAAU,GAAGF,KAAK,CAACU,IAAI;EAE5C,MAAMC,iBAAiB,GAAG;IAAEC,MAAM,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAI,CAAC;EAErDb,KAAK,CAACc,UAAU,GAAG;IACjB,GAAGH,iBAAiB;IACpB,GAAGX,KAAK,CAACc;EACX,CAAC;EAEDd,KAAK,CAACe,QAAQ,GA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AAG,CAAC,MAAM,CAAC;MACb;IACF,CAAC,EACD,EAAE,EACF;MAAE4C,OAAO,EAAE,KAAK;MAAEC,QAAQ,EAAE;IAAK,CACnC,CAAC;EACH;EACA,IAAIC,OAAOA,CAACC,CAAC,EAAE;IACb,IAAI,CAACvB,QAAQ,GAAGuB,CAAC;EACnB;EAEA,IAAI5C,KAAKA,CAAC6C,CAAC,EAAE;IACX,IAAI,CAACvB,MAAM,GAAGuB,CAAC;IACf,IAAI,CAACpB,SAAS,CAAC,CAAC;EAClB;EAEAqB,iBAAiBA,CAAA,EAAG,CAAC;EAErBC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAACvB,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACwB,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAAhC,sBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as n,_dll_mui__material as i,_dll_mui__material_styles as a}from"../../../@pie-lib/shared-module@^4.0.1/module/index.js";import{_dll_pie_lib__config_ui as s}from"../../../@pie-lib/config-module@^3.0.1/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@^6.1.2/module/index.js";var l={};Object.defineProperty(l,"__esModule",{value:!0});class r extends CustomEvent{constructor(e,t=!1){super(r.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}r.TYPE="model.updated";var d=l.ModelUpdatedEvent=r;class c extends CustomEvent{constructor(e,t){super(c.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}c.TYPE="delete.image";var p=l.DeleteImageEvent=c;class u extends CustomEvent{constructor(e){super(u.TYPE,{bubbles:!0,detail:e}),this.handler=e}}u.TYPE="insert.image";var h=l.InsertImageEvent=u;class g extends CustomEvent{constructor(e,t){super(g.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}g.TYPE="delete.sound";var b=l.DeleteSoundEvent=g;class m extends CustomEvent{constructor(e){super(m.TYPE,{bubbles:!0,detail:e}),this.handler=e}}m.TYPE="insert.sound";var _,E=l.InsertSoundEvent=m,f=e;_=f.createRoot,f.hydrateRoot;const C=t,I=n,{Typography:v}=i,{styled:S}=a,{FeedbackSelector:x}=s,{InputContainer:y}=s,{settings:k}=s,{layout:P}=s,w=o,{ALL_PLUGINS:M}=o;function T(e){let t,n=e[0],i=1;for(;i<e.length;){const a=e[i],s=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=s(n)):"call"!==a&&"optionalCall"!==a||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:A,toggle:D,numberFields:R,dropdown:q}=k,Y={type:"default",default:"Your answer has been submitted"},O=S(v)(({theme:e})=>({paddingBottom:e.spacing(1)})),j=S(y)(({theme:e})=>({paddingTop:e.spacing(1),marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),H=S("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class F extends C.Component{static __initStatic(){this.propTypes={onModelChanged:I.func.isRequired,onConfigurationChanged:I.func,model:I.object.isRequired,configuration:I.object.isRequired,imageSupport:I.object.isRequired,uploadSoundSupport:I.object.isRequired}}constructor(e){super(e),F.prototype.__init.call(this),F.prototype.__init2.call(this),F.prototype.__init3.call(this),this.state={setDimensions:!0}}__init(){this.onPromptChange=e=>{const{onModelChanged:t,model:n}=this.props;t({...n,prompt:e})}}__init2(){this.changeFeedback=e=>{const{model:t,onModelChanged:n}=this.props;n({...t,feedback:e})}}__init3(){this.changeTeacherInstructions=e=>{const{model:t,onModelChanged:n}=this.props;n({...t,teacherInstructions:e})}}render(){const{model:e,configuration:t,imageSupport:n,onConfigurationChanged:i,onModelChanged:a,uploadSoundSupport:s}=this.props,{annotations:o={},contentDimensions:l={},dimensions:r={},equationEditor:d={},feedback:c={},playerSpellCheck:p={},prompt:u={},settingsPanelDisabled:h,spanishInput:g={},specialInput:b={},spellCheck:m={},studentInstructions:_={},teacherInstructions:E={},mathInput:f={},maxImageWidth:I={},maxImageHeight:v={},multiple:S={},withRubric:y={},mathMlOptions:k={},baseInputConfiguration:F={}}=t||{},{errors:G={},extraCSSRules:W,feedbackEnabled:L,promptEnabled:z,spellCheckEnabled:N,teacherInstructionsEnabled:B,toolbarEditorPosition:U}=e||{},{prompt:J,teacherInstructions:K}=G,Q=I&&I.prompt,V=v&&v.prompt,X={position:"top"===U?"top":"bottom"},Z={mathInput:f.settings&&D(f.label),equationEditor:d.enabled&&e.mathInput&&q(d.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"]),spanishInput:g.settings&&D(g.label),specialInput:b.settings&&D(b.label),dimensions:r.settings&&R(r.label,{width:{label:"Width (px)",suffix:"px",min:100,max:1200},height:{label:"Height (px)",suffix:"px",min:100,max:500}}),"multiple.enabled":S.settings&&D(S.label,!0),promptEnabled:u.settings&&D(u.label),feedbackEnabled:c.settings&&D(c.label),annotationsEnabled:o.settings&&D(o.label),spellCheckEnabled:m.settings&&D(m.label),playerSpellCheckDisabled:p.settings&&D(p.label)},$={teacherInstructionsEnabled:E.settings&&D(E.label),studentInstructionsEnabled:_.settings&&D(_.label),rubricEnabled:T([y,"optionalAccess",e=>e.settings])&&D(T([y,"optionalAccess",e=>e.label]))},ee=e=>Object.assign({...F},e||{});return C.createElement(P.ConfigLayout,{extraCSSRules:W,dimensions:l,hideSettings:h,settings:C.createElement(A,{model:e,configuration:t,onChangeModel:e=>a(e),onChangeConfiguration:e=>i(e),groups:{Settings:Z,Properties:$}})},B&&C.createElement(j,{label:E.label},C.createElement(w,{className:"prompt",markup:e.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:n,nonEmpty:!1,error:K,toolbarOpts:X,spellCheck:N,maxImageWidth:I&&I.teacherInstructions||Q,maxImageHeight:v&&v.teacherInstructions||V,uploadSoundSupport:s,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:k,pluginProps:ee(T([E,"optionalAccess",e=>e.inputConfiguration]))}),K&&C.createElement(H,null,K)),z&&C.createElement(j,{label:u.label},C.createElement(w,{activePlugins:M,className:"prompt",markup:e.prompt||"",onChange:this.onPromptChange,imageSupport:n,nonEmpty:!1,error:J,toolbarOpts:X,spellCheck:N,maxImageWidth:Q,maxImageHeight:V,uploadSoundSupport:s,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:k,pluginProps:ee(T([u,"optionalAccess",e=>e.inputConfiguration]))}),J&&C.createElement(H,null,J)),L&&C.createElement(C.Fragment,null,C.createElement(O,{variant:"h6"},"Feedback"),C.createElement(x,{label:"When submitted, show",feedback:e.feedback||Y,onChange:this.changeFeedback,toolbarOpts:X})))}}F.__initStatic();var G={annotationsEnabled:!1,dimensions:{height:100,width:500},equationEditor:"Grade 8 - HS",feedbackEnabled:!1,mathInput:!1,playerSpellCheckDisabled:!0,predefinedAnnotations:[{label:"good",text:"good",type:"positive"},{label:"★",text:"★",type:"positive"},{label:":-)",text:":-)",type:"positive"},{label:"creative",text:"creative",type:"positive"},{label:"run-on",text:"run-on",type:"negative"},{label:"frag",text:"fragment",type:"negative"},{label:"tran",text:"transition",type:"negative"},{label:"supp",text:"support needed",type:"negative"},{label:"punc",text:"punctuation",type:"negative"},{label:"agr",text:"agreement wrong",type:"negative"},{label:"unclear",text:"unclear",type:"negative"},{label:"cut",text:"cut",type:"negative"},{label:"sp",text:"spelling",type:"negative"},{label:"cap",text:"capitalization",type:"negative"},{label:"inf",text:"informal",type:"negative"},{label:"awk",text:"awkward",type:"negative"}],prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,spanishInput:!1,specialInput:!1,spellCheckEnabled:!0,studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom"},W={annotations:{settings:!1,label:"Annotations"},baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},dimensions:{settings:!0,label:"Text-Entry Display Size"},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},playerSpellCheck:{label:"Disable Student Spellcheck",settings:!0,enabled:!0},equationEditor:{settings:!1,label:"Equation Editor",enabled:!0},feedback:{settings:!0,label:"Feedback"},mathInput:{settings:!0,label:"Student response can include math notation",enabled:!1},settingsPanelDisabled:!1,spanishInput:{settings:!0,label:"Students can insert Spanish",enabled:!1},specialInput:{settings:!0,label:"Students can insert Special Characters",enabled:!1},multiple:{settings:!1,label:"Multiple Parts",enabled:!1},studentInstructions:{settings:!1,label:"Student Instructions"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},maxImageWidth:{teacherInstructions:300,prompt:300},maxImageHeight:{teacherInstructions:300,prompt:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1}};const L=t;function z(e){let t,n=e[0],i=1;for(;i<e.length;){const a=e[i],s=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=s(n)):"call"!==a&&"optionalCall"!==a||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}class N extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={},t)=>{const n={...G,...e};return z([t,"optionalAccess",e=>e.withRubric,"optionalAccess",e=>e.forceEnabled])&&!n.rubricEnabled&&(n.rubricEnabled=!0),n}}constructor(){super(),this._root=null,this._configuration=W,z([this,"access",e=>e._configuration,"access",e=>e.withRubric,"optionalAccess",e=>e.forceEnabled])&&(this._configuration.withRubric.settings=!1),this._model=N.createDefaultModel({},this._configuration)}set model(e){this._model=N.createDefaultModel(e,this._configuration),this.render()}set configuration(e){this._configuration={...W,...e};const{withRubric:t={}}=e||{};z([t,"optionalAccess",e=>e.forceEnabled])&&(this._configuration.withRubric.settings=!1,this._model.rubricEnabled||(this._model.rubricEnabled=!0)),this.render()}onModelChanged(e){this._model=e,this.render(),this.dispatchEvent(new d(this._model,!1))}onConfigurationChanged(e){this._configuration={...W,...e},this._model&&this.onModelChanged(this._model),this.render()}insertImage(e){this.dispatchEvent(new h(e))}onDeleteImage(e,t){this.dispatchEvent(new p(e,t))}insertSound(e){this.dispatchEvent(new E(e))}onDeleteSound(e,t){this.dispatchEvent(new b(e,t))}render(){if(this._model){const e=L.createElement(F,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(this._root=_(this)),this._root.render(e)}}disconnectedCallback(){this._root&&this._root.unmount()}}N.__initStatic();export{N as default};
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
annotationsEnabled: false,
|
|
20
|
+
dimensions: { height: 100, width: 500 },
|
|
21
|
+
equationEditor: 'Grade 8 - HS',
|
|
22
|
+
feedbackEnabled: false,
|
|
23
|
+
mathInput: false,
|
|
24
|
+
playerSpellCheckDisabled: true,
|
|
25
|
+
predefinedAnnotations: [
|
|
26
|
+
{ label: 'good', text: 'good', type: 'positive' },
|
|
27
|
+
{ label: '★', text: '★', type: 'positive' },
|
|
28
|
+
{ label: ':-)', text: ':-)', type: 'positive' },
|
|
29
|
+
{ label: 'creative', text: 'creative', type: 'positive' },
|
|
30
|
+
{ label: 'run-on', text: 'run-on', type: 'negative' },
|
|
31
|
+
{ label: 'frag', text: 'fragment', type: 'negative' },
|
|
32
|
+
{ label: 'tran', text: 'transition', type: 'negative' },
|
|
33
|
+
{ label: 'supp', text: 'support needed', type: 'negative' },
|
|
34
|
+
{ label: 'punc', text: 'punctuation', type: 'negative' },
|
|
35
|
+
{ label: 'agr', text: 'agreement wrong', type: 'negative' },
|
|
36
|
+
{ label: 'unclear', text: 'unclear', type: 'negative' },
|
|
37
|
+
{ label: 'cut', text: 'cut', type: 'negative' },
|
|
38
|
+
{ label: 'sp', text: 'spelling', type: 'negative' },
|
|
39
|
+
{ label: 'cap', text: 'capitalization', type: 'negative' },
|
|
40
|
+
{ label: 'inf', text: 'informal', type: 'negative' },
|
|
41
|
+
{ label: 'awk', text: 'awkward', type: 'negative' },
|
|
42
|
+
],
|
|
43
|
+
prompt: '',
|
|
44
|
+
promptEnabled: true,
|
|
45
|
+
rationale: '',
|
|
46
|
+
rationaleEnabled: true,
|
|
47
|
+
studentInstructionsEnabled: true,
|
|
48
|
+
teacherInstructions: '',
|
|
49
|
+
teacherInstructionsEnabled: true,
|
|
50
|
+
toolbarEditorPosition: 'bottom',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
async function createDefaultModel(model = {}) {
|
|
54
|
+
|
|
55
|
+
return { ...defaults, ...model };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const normalize = (question) => ({ ...defaults, ...question });
|
|
59
|
+
|
|
60
|
+
async function model(question, session, env) {
|
|
61
|
+
const normalizedQuestion = normalize(question);
|
|
62
|
+
|
|
63
|
+
const fb =
|
|
64
|
+
env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled
|
|
65
|
+
? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')
|
|
66
|
+
: Promise.resolve(undefined);
|
|
67
|
+
|
|
68
|
+
let teacherInstructions = null;
|
|
69
|
+
if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
|
|
70
|
+
teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
|
|
71
|
+
} else {
|
|
72
|
+
teacherInstructions = null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';
|
|
76
|
+
|
|
77
|
+
switch (normalizedQuestion.equationEditor) {
|
|
78
|
+
case 'Grade 1 - 2':
|
|
79
|
+
equationEditor = 1;
|
|
80
|
+
break;
|
|
81
|
+
case 'Grade 3 - 5':
|
|
82
|
+
equationEditor = 3;
|
|
83
|
+
break;
|
|
84
|
+
case 'Grade 6 - 7':
|
|
85
|
+
equationEditor = 6;
|
|
86
|
+
break;
|
|
87
|
+
case 'Grade 8 - HS':
|
|
88
|
+
equationEditor = 8;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const annotatorMode = normalizedQuestion.annotationsEnabled && (env.role === 'instructor' || env.mode === 'evaluate');
|
|
93
|
+
|
|
94
|
+
return fb.then((feedback) => ({
|
|
95
|
+
prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
|
|
96
|
+
dimensions: normalizedQuestion.dimensions,
|
|
97
|
+
customKeys: normalizedQuestion.customKeys || [],
|
|
98
|
+
id: normalizedQuestion.id,
|
|
99
|
+
disabled: env.mode !== 'gather',
|
|
100
|
+
feedback,
|
|
101
|
+
teacherInstructions,
|
|
102
|
+
language: normalizedQuestion.language,
|
|
103
|
+
mathInput: normalizedQuestion.mathInput,
|
|
104
|
+
spanishInput: normalizedQuestion.spanishInput,
|
|
105
|
+
specialInput: normalizedQuestion.specialInput,
|
|
106
|
+
equationEditor,
|
|
107
|
+
spellCheckEnabled: !normalizedQuestion.playerSpellCheckDisabled,
|
|
108
|
+
playersToolbarPosition: normalizedQuestion.playersToolbarPosition || 'bottom',
|
|
109
|
+
annotatorMode,
|
|
110
|
+
disabledAnnotator: normalizedQuestion.annotationsEnabled ? env.role !== 'instructor' : true,
|
|
111
|
+
predefinedAnnotations: normalizedQuestion.annotationsEnabled ? normalizedQuestion.predefinedAnnotations : [],
|
|
112
|
+
extraCSSRules: normalizedQuestion.extraCSSRules,
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function outcome(/*question, session, env*/) {
|
|
117
|
+
return {
|
|
118
|
+
score: 0,
|
|
119
|
+
completed: 'n/a',
|
|
120
|
+
note: 'Requires manual scoring',
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// remove all html tags except img, iframe and source tag for audio
|
|
125
|
+
const getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
|
|
126
|
+
|
|
127
|
+
const validate = (model = {}, config = {}) => {
|
|
128
|
+
const errors = {};
|
|
129
|
+
|
|
130
|
+
['teacherInstructions', 'prompt'].forEach((field) => {
|
|
131
|
+
if (config[field]?.required && !getContent(model[field])) {
|
|
132
|
+
errors[field] = 'This field is required.';
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return errors;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export { createDefaultModel, model, normalize, outcome, validate };
|
package/module/demo.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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: ['\\square'],
|
|
11
|
+
feedback: { type: 'default', default: 'this is default feedback' },
|
|
12
|
+
prompt: 'This is the question prompt',
|
|
13
|
+
promptEnabled: true,
|
|
14
|
+
mathInput: true,
|
|
15
|
+
playersToolbarPosition: 'bottom',
|
|
16
|
+
toolbarEditorPosition: 'bottom',
|
|
17
|
+
spellCheckEnabled: true,
|
|
18
|
+
rubricEnabled: false,
|
|
19
|
+
annotationsEnabled: false,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const { model } = generate;
|
|
23
|
+
var config = {
|
|
24
|
+
elements: {
|
|
25
|
+
'extended-text-entry': '../..',
|
|
26
|
+
},
|
|
27
|
+
models: [model('1', 'extended-text-entry')],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//Note: demo-el is a custom element loaded in the markup.
|
|
31
|
+
customElements.whenDefined("demo-el").then(() => {
|
|
32
|
+
config.models.forEach((m) => {
|
|
33
|
+
const de = document.createElement("demo-el");
|
|
34
|
+
document.body.appendChild(de);
|
|
35
|
+
de.def = { tagName: m.element, Element, Configure, controller };
|
|
36
|
+
de.model = m;
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as o,_dll_debug as i,_dll_pie_lib__render_ui as s,_dll_react_dom as a}from"../../../@pie-lib/shared-module@^4.0.1/module/index.js";import{_dll_pie_lib__math_rendering as r}from"../../../@pie-lib/math-rendering-module@^4.0.7/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as l}from"../../../@pie-lib/editable-html-module@^6.1.2/module/index.js";import{_dll_pie_lib__config_ui as d}from"../../../@pie-lib/config-module@^3.0.1/module/index.js";var c="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,h=c||p||Function("return this")(),u=h.Symbol,m=Object.prototype,g=m.hasOwnProperty,f=m.toString,b=u?u.toStringTag:void 0;var y=Object.prototype.toString;var v=u?u.toStringTag:void 0;function C(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":v&&v in Object(e)?function(e){var t=g.call(e,b),n=e[b];try{e[b]=void 0;var o=!0}catch(e){}var i=f.call(e);return o&&(t?e[b]=n:delete e[b]),i}(e):function(e){return y.call(e)}(e)}var x=/\s/;var _=/^\s+/;function E(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&x.test(e.charAt(t)););return t}(e)+1).replace(_,""):e}function w(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var S=/^[-+]0x[0-9a-f]+$/i,A=/^0b[01]+$/i,k=/^0o[0-7]+$/i,T=parseInt;function R(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==C(e)}(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=E(e);var n=A.test(e);return n||k.test(e)?T(e.slice(2),n?2:8):S.test(e)?NaN:+e}var M=function(){return h.Date.now()},L=Math.max,P=Math.min;function N(e,t,n){var o,i,s,a,r,l,d=0,c=!1,p=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function u(t){var n=o,s=i;return o=i=void 0,d=t,a=e.apply(s,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||p&&e-d>=s}function g(){var e=M();if(m(e))return f(e);r=setTimeout(g,function(e){var n=t-(e-l);return p?P(n,s-(e-d)):n}(e))}function f(e){return r=void 0,h&&o?u(e):(o=i=void 0,a)}function b(){var e=M(),n=m(e);if(o=arguments,i=this,l=e,n){if(void 0===r)return function(e){return d=e,r=setTimeout(g,t),c?u(e):a}(l);if(p)return clearTimeout(r),r=setTimeout(g,t),u(l)}return void 0===r&&(r=setTimeout(g,t)),a}return t=R(t)||0,w(n)&&(c=!!n.leading,s=(p="maxWait"in n)?L(R(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),b.cancel=function(){void 0!==r&&clearTimeout(r),d=0,o=l=i=r=void 0},b.flush=function(){return void 0===r?a:f(M())},b}const I=(e,t,n)=>{const o=n||[],i=o.reduce((e,t)=>e+t.textContent.length,0);let s=!0;if(i>t)return!1;for(e&&(3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&o.push(e),e=e.firstChild);e&&s;)s=I(e,t,o),e=e.nextSibling;return o},D=e=>{const{commonAncestorContainer:t,startContainer:n,endContainer:o,startOffset:i,endOffset:s}=e,a=[];let r=!1,l=!1,d="";const c=e=>{const{nodeValue:t,childNodes:p}=e;e===n&&e===o?(t&&(d+=t.substring(i,s)),r=l=!0):e===n?(t&&(d+=t.substring(i)),r=!0):e===o?(t&&(d+=t.substring(0,s)),l=!0):e&&3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&t&&r&&!l&&(d+=t,a.push(e)),p.forEach(e=>{l||c(e)})};return c(t),[a,d]},j=e=>{const t=document.createElement("SPAN");return e.surroundContents(t),t},O=e=>{if(e.startContainer===e.endContainer)return[j(e)];const[t]=D(e),n=document.createRange();n.selectNodeContents(e.startContainer),n.setStart(e.startContainer,e.startOffset);const o=j(n),i=document.createRange();i.selectNode(e.endContainer),i.setEnd(e.endContainer,e.endOffset);const s=j(i);return[o,...t.map(e=>{const t=document.createElement("SPAN");return e.parentNode.insertBefore(t,e),t.appendChild(e),t}),s]},W=(e,t)=>{(e||[]).forEach(e=>{const t=e.parentNode,n=e.childNodes,o=n.length;if(o>0)for(let i=0;i<o;i++)t.insertBefore(n[0],e);else t.insertBefore(document.createTextNode(e.textContent),e);t.removeChild(e)}),t.normalize()},$=()=>{document.getSelection?(document.getSelection().removeAllRanges(),document.getSelection().addRange(document.createRange())):window.getSelection?window.getSelection().removeAllRanges?(window.getSelection().removeAllRanges(),window.getSelection().addRange(document.createRange())):window.getSelection().empty&&window.getSelection().empty():document.selection&&document.selection.empty()},H=e=>e.length>=20||-1!==e.search(/\n|\r|\r\n/),z=e=>Array.from(document.querySelectorAll(`[data-id='${e}']`)),q=e=>document.querySelector(`[data-ann-id='${e}']`),B=e,F=t,{Popover:K}=n,{TextField:U}=n,{styled:V}=o,Y=V(K)(({theme:e,annotationType:t})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:e.palette.grey[100]},..."negative"===t&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===t&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),G=V("div")(({theme:e,annotationType:t})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:"#ffffff",border:`4px solid ${e.palette.grey[100]}`,..."negative"===t&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===t&&{borderColor:"rgb(153, 255, 153) !important"}})),X=V("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),Q=V("div")(({theme:e,variant:t,annotationType:n})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===t&&"negative"===n&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===t&&"positive"===n&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class J extends B.Component{static __initStatic(){this.propTypes={anchorEl:F.object,open:F.bool,offset:F.number,value:F.string,type:F.string,onClose:F.func,onDelete:F.func,onSave:F.func,onTypeChange:F.func}}constructor(e){super(e),J.prototype.__init.call(this),J.prototype.__init2.call(this),J.prototype.__init3.call(this),this.state={value:e.value}}UNSAFE_componentWillReceiveProps(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.setState({value:t})}__init(){this.onValueChange=e=>this.setState({value:e.target.value})}__init2(){this.handleSave=()=>{const{value:e,onSave:t,onClose:n,onDelete:o}=this.props,{value:i}=this.state;""===i&&o(),e!==i&&t(e,i),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:e,onDelete:t}=this.props,{value:n}=this.state;""===n?t():e(n),this.setState({value:""})}}render(){const{anchorEl:e,offset:t,onDelete:n,open:o,type:i}=this.props,{value:s}=this.state;return B.createElement(Y,{anchorEl:e,elevation:2,open:o,onClose:this.handleSave,annotationType:i,style:{marginTop:`${t}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},B.createElement(G,{annotationType:i},B.createElement(U,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:s,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),B.createElement(X,null,B.createElement(Q,{onClick:n},"Delete"),B.createElement(Q,{variant:"typeChange",annotationType:i,onClick:this.handleTypeChange},"negative"===i?"Green":"Pink"),B.createElement(Q,{onClick:this.handleSave},"Save"))))}}J.__initStatic();const Z=e,ee=t,{styled:te}=o,{Popover:ne}=n,oe=te(ne)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:"black"}}}),ie=te("div")(({theme:e})=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:e.palette.common.white,border:`2px solid ${e.palette.grey[100]}`})),se=te("div")({display:"flex",flexWrap:"wrap"}),ae=te("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),re=te("div")(({theme:e,variant:t})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${e.palette.grey[100]}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class le extends Z.Component{static __initStatic(){this.propTypes={anchorEl:ee.object,open:ee.bool,annotations:ee.array,isNewAnnotation:ee.bool,onClose:ee.func,onDelete:ee.func,onEdit:ee.func,onWrite:ee.func,onAnnotate:ee.func}}render(){const{anchorEl:e,annotations:t,isNewAnnotation:n,onAnnotate:o,onClose:i,onEdit:s,onDelete:a,onWrite:r,open:l}=this.props;return Z.createElement(oe,{anchorEl:e,open:l,onClose:i,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},Z.createElement(ie,null,Z.createElement(se,null,t.map((e,t)=>Z.createElement(re,{key:`annotation-${t}`,variant:e.type,onClick:()=>o(e)},e.label))),Z.createElement(ae,null,Z.createElement(re,{onClick:i},"Cancel"),Z.createElement(re,{style:{pointerEvents:"none"}}),n?Z.createElement(Z.Fragment,null,Z.createElement(re,{variant:"positive",onClick:()=>r("positive")},"Write"),Z.createElement(re,{variant:"negative",onClick:()=>r("negative")},"Write")):Z.createElement(Z.Fragment,null,Z.createElement(re,{onClick:a},"Delete"),Z.createElement(re,{onClick:s},"Edit")))))}}le.__initStatic();const de=e,{styled:ce}=o,pe=t,he=l,{InputContainer:ue}=d,me=ce("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),ge=ce("div")({width:"230px"}),fe=ce("div")({position:"relative",overflowX:"hidden",display:"flex"}),be=ce(ue)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),marginTop:e.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const e=document.createElement("style");e.id="annotation-editor-styles",e.textContent='\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: "";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n',document.head.appendChild(e)}class ye extends de.Component{static __initStatic(){this.propTypes={text:pe.string,comment:pe.string,annotations:pe.array,predefinedAnnotations:pe.array,onChange:pe.func.isRequired,onCommentChange:pe.func.isRequired,width:pe.number,height:pe.number,maxHeight:pe.string,disabled:pe.bool,disabledMath:pe.bool,customKeys:pe.array,keypadMode:pe.string}}constructor(e){super(e),ye.prototype.__init.call(this),ye.prototype.__init2.call(this),ye.prototype.__init3.call(this),ye.prototype.__init4.call(this),ye.prototype.__init5.call(this),ye.prototype.__init6.call(this),ye.prototype.__init7.call(this),ye.prototype.__init8.call(this),ye.prototype.__init9.call(this),ye.prototype.__init10.call(this),ye.prototype.__init11.call(this),ye.prototype.__init12.call(this),ye.prototype.__init13.call(this),ye.prototype.__init14.call(this),ye.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:e,text:t}=this.props;t&&e.forEach(e=>{const[t,n]=((e,t,n)=>{const o=I(n,t),i=[];let s=0;return o.forEach(n=>{const o=s+n.textContent.length;[e,t].forEach(e=>{s<=e&&e<o&&i.push({node:n,offset:e-s})}),s=o}),i})(e.start,e.end,this.textRef);if(t&&n){const o=document.createRange();o.setStart(t.node,t.offset),o.setEnd(n.node,n.offset);const i=O(o);this.createDOMAnnotation(i,e)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(t=>{const n=z(t.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;t.style.top=`${o}px`,t.style.left=`${e}px`})}}}__init2(){this.handleClick=e=>{const{annotations:t}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:i}=e.target.dataset,s=o||i,a=z(s),r=q(s),l=t.findIndex(e=>e.id===s),d=r.hasAttribute("data-freeform");d&&(r.style.zIndex="10"),this.setState({anchorEl:a[0],openedMenu:!!o||!!i&&!d,openedEditor:!!i&&d,selectedElems:a,labelElem:r,annotationIndex:l,annotation:t[l],selectionDetails:null})}}__init3(){this.handleHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=z(o),s=q(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="20",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.7)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.55)")}),a?(s.style.zIndex="20",s.classList.contains("positive")?(s.style.backgroundColor="rgb(128, 255, 128)",s.style.setProperty("--before-border-color","rgb(153, 255, 153)")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 179, 230)",s.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(s.style.zIndex="20",s.classList.contains("positive")?s.style.color="rgb(0, 77, 0)":s.classList.contains("negative")&&(s.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=z(o),s=q(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)")}),a?(s.style.zIndex="",s.classList.contains("positive")?(s.style.backgroundColor="rgb(153, 255, 153)",s.style.removeProperty("--before-border-color")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 204, 238)",s.style.removeProperty("--before-border-color"))):(s.style.zIndex="",s.classList.contains("positive")?s.style.color="rgb(0, 128, 0)":s.classList.contains("negative")&&(s.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=e=>{const{selectedElems:t,labelElem:n}=this.state;t.length&&!t[0].hasAttribute("data-id")&&W(t,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),$()}}__init6(){this.handleSelection=e=>{const t=window.getSelection();if(e.detail>2)$();else if(t&&t.rangeCount>0){const e=t.getRangeAt(0),n=e.toString(),o=this.textRef.contains(e.commonAncestorContainer);if(!t.isCollapsed&&""!==n&&o){const t=((e,t)=>{const n=document.createRange();n.setStart(t,0),n.setEnd(e.startContainer,e.startOffset);const[,o]=D(n),[,i]=D(e),s=o.length;return{quote:i,start:s,end:s+i.length}})(e,this.textRef),n=O(e);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:t})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:e,onChange:t}=this.props,{selectedElems:n,labelElem:o,annotationIndex:i,annotation:s}=this.state;(H(s.label)?this.labelsRef:n[0]).removeChild(o),W(n,this.textRef),e.splice(i,1),t(e),this.handleClose()}}__init8(){this.createDOMAnnotation=(e,t)=>{const{disabled:n}=this.props,{id:o,label:i,type:s}=t;(e||[]).forEach(e=>{e.dataset.id=o,e.className=`annotation ${s}`,e.style.position="relative",e.style.cursor="pointer","positive"===s?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===s&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)"),e.onclick=!n&&this.handleClick,e.onmouseover=this.handleHover,e.onmouseout=this.handleCancelHover});const a=e&&e[0]||{},r=document.createElement("SPAN");if(r.dataset.annId=o,r.innerHTML=i,r.onclick=!n&&this.handleClick,r.onmouseover=this.handleHover,r.onmouseout=this.handleCancelHover,H(i)){const e=(a.offsetTop?a.offsetTop:a.offsetParent.offsetTop)-this.textRef.scrollTop,t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;r.dataset.freeform=!0,r.className=`sideAnnotation ${s}`,r.style.position="absolute",r.style.padding="4px",r.style.borderRadius="4px",r.style.marginLeft="8px",r.style.width="180px",r.style.whiteSpace="pre-wrap",r.style.wordBreak="break-word",r.style.border="2px solid #ffffff",r.style.fontSize="14px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.top=`${e}px`,r.style.left=`${t}px`,"negative"===s?r.style.backgroundColor="rgb(255, 204, 238)":"positive"===s&&(r.style.backgroundColor="rgb(153, 255, 153)"),r.style.setProperty("--before-border-width","7px"),r.style.setProperty("--before-top","5px"),r.style.setProperty("--before-right","100%"),"negative"===s?r.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===s&&r.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(r)}else r.className=`annotationLabel ${s}`,r.style.backgroundColor="rgb(242, 242, 242)",r.style.padding="2px",r.style.position="absolute",r.style.userSelect="none",r.style.whiteSpace="nowrap",r.style.top="-10px",r.style.left="-2px",r.style.fontSize="12px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.lineHeight="6px",r.style.webkitUserSelect="none",r.style.mozUserSelect="none",r.style.msUserSelect="none","positive"===s?r.style.color="rgb(0, 128, 0)":"negative"===s&&(r.style.color="rgb(204, 0, 136)"),a.appendChild(r)}}__init9(){this.createNewAnnotation=(e,t)=>{const{selectedElems:n,selectionDetails:o}=this.state,i={id:[o.start,o.end,(new Date).getTime()].join("-"),label:e,type:t,...o};return this.createDOMAnnotation(n,i),i}}__init10(){this.handleMenuClick=e=>{const{annotations:t,onChange:n}=this.props,{annotation:o,annotationIndex:i}=this.state,{type:s,text:a}=e;if(o){const e={...o,label:a,type:s},{type:n,label:r}=o;this.updateLabel(r,e,s!==n&&n),t.splice(i,1,e)}else{const e=this.createNewAnnotation(a,s);t.push(e)}n(t),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=e=>{const{annotations:t,onChange:n}=this.props,o=this.createNewAnnotation("",e),i=q(o.id);t.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:t.length-1,annotation:o,labelElem:i}),n(t)}}__init13(){this.updateLabel=(e,t,n)=>{const{selectedElems:o,labelElem:i}=this.state,{label:s,type:a}=t;H(s)&&H(e)||!H(s)&&!H(e)?(i.innerHTML=s,n&&(i.classList.remove(n),i.classList.add(a),o.forEach(e=>{e.classList.remove(n),e.classList.add(a)}))):H(s)&&!H(e)?(o[0].removeChild(i),this.createDOMAnnotation(o,t)):!H(s)&&H(e)&&(this.labelsRef.removeChild(i),this.createDOMAnnotation(o,t))}}__init14(){this.changeAnnotationType=e=>{const{annotations:t,onChange:n}=this.props,{annotationIndex:o,selectedElems:i}=this.state,{type:s,label:a}=t[o],r="positive"===s?"negative":"positive",l={...t[o],type:r,label:e};i.forEach(e=>{e.classList.remove(s),e.classList.add(r)}),this.updateLabel(a,l,s),t.splice(o,1,l),n(t),this.handleClose()}}__init15(){this.updateAnnotation=(e,t)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:i}=this.state,s={...n[i],label:t};this.updateLabel(e,s),n.splice(i,1,s),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:e,customKeys:t,disabled:n,disabledMath:o,keypadMode:i,height:s,width:a,maxHeight:r,onCommentChange:l,predefinedAnnotations:d,text:c}=this.props,{anchorEl:p,annotation:h,openedMenu:u,openedEditor:m,selectionDetails:g}=this.state,f=p&&(p.offsetTop?p.offsetTop:p.offsetParent.offsetTop),b=this.textRef&&f?f-this.textRef.scrollTop-8:0;return de.createElement("div",null,de.createElement(fe,null,de.createElement(me,{style:{width:a-34,minHeight:s,maxHeight:r},ref:e=>this.textRef=e,onMouseDown:n?()=>{}:$,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:c}}),de.createElement(ge,{ref:e=>this.labelsRef=e})),de.createElement(be,{label:"Comment"},de.createElement(he,{className:"prompt",markup:e||"",onChange:l,width:a&&(a+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:t,keypadMode:i,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0}}})),de.createElement(le,{anchorEl:p,open:u&&!n,annotations:d,isNewAnnotation:!!g,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),de.createElement(J,{anchorEl:this.textRef,open:m&&!n,offset:b,value:h&&h.label||"",type:h&&h.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}ye.__initStatic();const ve=e,Ce=t,xe=i,{Typography:_e}=n,{styled:Ee}=o,{color:we}=s,{Feedback:Se}=s,{Collapsible:Ae}=s,{PreviewPrompt:ke}=s,{UiLayout:Te}=s,Re=l,Me=xe("@pie-ui:extended-text-entry"),Le=Ee(Te)({backgroundColor:we.background(),color:we.text()}),Pe=Ee(_e)(({theme:e})=>({width:"100%",color:we.text(),marginBottom:e.spacing(2),fontSize:"inherit"})),Ne=Ee("div")(({theme:e})=>({marginBottom:e.spacing(2)})),Ie=Ee(Re)(({theme:e})=>({marginBottom:e.spacing(2),borderRadius:"4px"})),De=Ee("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class je extends ve.Component{constructor(...e){super(...e),je.prototype.__init.call(this),je.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:Ce.func.isRequired,onAnnotationsChange:Ce.func.isRequired,onCommentChange:Ce.func.isRequired,model:Ce.object,session:Ce.shape({value:Ce.string,annotations:Ce.array,comment:Ce.string}).isRequired}}__init(){this.changeSessionValue=N(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=N(this.props.onCommentChange,1500)}render(){const{model:e,session:t,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:i,customKeys:s,dimensions:a,disabled:r,disabledAnnotator:l,equationEditor:d,extraCSSRules:c,feedback:p,mathInput:h,playersToolbarPosition:u,predefinedAnnotations:m,prompt:g,spanishInput:f,specialInput:b,spellCheckEnabled:y,teacherInstructions:v}=e,{annotations:C,comment:x,value:_}=t,{width:E,height:w}=a||{},S="40vh",A={position:"top"===u?"top":"bottom"};Me("[render] disabled? ",r);const k=ve.createElement(ke,{defaultClassName:"teacher-instructions",prompt:v}),T=[];return f&&T.push({language:"spanish"}),b&&T.push({language:"special"}),ve.createElement(Le,{extraCSSRules:c,ref:e=>{this.containerRef=e}},ve.createElement(De,null,"Constructed Response Question"),v&&ve.createElement(Ne,null,o?k:ve.createElement(Ae,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},k)),g&&ve.createElement(Pe,{component:"span"},ve.createElement(ke,{defaultClassName:"prompt",prompt:e.prompt})),i?ve.createElement(ye,{text:_||"",annotations:C||[],comment:x||"",predefinedAnnotations:m||[],onChange:n,onCommentChange:this.changeSessionComment,width:E,height:w,maxHeight:S,disabled:l,disabledMath:!h,customKeys:s,keypadMode:d}):ve.createElement(Ie,{className:"response-area-editor",onChange:this.changeSessionValue,markup:_||"",maxWidth:E&&E.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:S,disabled:r,highlightShape:!0,toolbarOpts:A,spellCheck:y,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!h,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:T}),p&&ve.createElement(Se,{correctness:"correct",feedback:p}))}}je.__initStatic();var Oe,We=a;Oe=We.createRoot,We.hydrateRoot;var $e={};Object.defineProperty($e,"__esModule",{value:!0});class He extends CustomEvent{constructor(e,t,n){super(He.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}He.TYPE="model-set";var ze=$e.ModelSetEvent=He;class qe extends CustomEvent{constructor(e,t){super(qe.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}qe.TYPE="session-changed";var Be=$e.SessionChangedEvent=qe;const Fe=e,Ke=i,{renderMath:Ue}=r,Ve=Ke("@pie-elements:extended-text-entry"),Ye=void 0!==typeof window?new DOMParser:{parseFromString:e=>e};function Ge(e){if("string"==typeof e)try{const t=Ye.parseFromString(e,"text/html");return t.body.textContent}catch(t){return Ve("tried to parse as dom and failed",e),e}}function Xe(e){const t=Ge(e);return void 0!==t&&t.length>0}class Qe extends HTMLElement{constructor(){super(),this._model=null,this._session=null,this._root=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}set model(e){this._model=e,this.dispatchEvent(new ze(this.tagName.toLowerCase(),!1,!!this._model)),this.render()}set session(e){this._session=e,this.render()}get session(){return this._session}valueChange(e){this._session.value=e,this.dispatchEvent(new Be(this.tagName.toLowerCase(),Xe(e))),this.render()}annotationsChange(e){this._session.annotations=e,this.dispatchEvent(new Be(this.tagName.toLowerCase(),!0)),this.render()}commentChange(e){this._session.comment=e,this.dispatchEvent(new Be(this.tagName.toLowerCase(),Xe(e))),this.render()}connectedCallback(){this.setAttribute("aria-label","Written Response Question"),this.setAttribute("role","region"),this.render()}render(){if(this._model&&this._session){let e=Fe.createElement(je,{model:this._model,session:this._session,onValueChange:this.valueChange.bind(this),onAnnotationsChange:this.annotationsChange.bind(this),onCommentChange:this.commentChange.bind(this)});this.setLangAttribute(),this._root||(this._root=Oe(this)),this._root.render(e),queueMicrotask(()=>{Ue(this)})}}disconnectedCallback(){this._root&&this._root.unmount()}}export{Qe as default,Xe as isComplete,Ge as textContent};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<title>@pie-element/extended-text-entry@14.0.0-beta.1</title>
|
|
6
|
+
<script
|
|
7
|
+
type="module"
|
|
8
|
+
src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
|
|
9
|
+
|
|
10
|
+
<link
|
|
11
|
+
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
12
|
+
rel="stylesheet"
|
|
13
|
+
/>
|
|
14
|
+
<style>
|
|
15
|
+
html, body {
|
|
16
|
+
font-family: 'Roboto', sans-serif;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
<script type="module" src="./demo.js"></script>
|
|
20
|
+
</head>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-element/extended-text-entry",
|
|
3
|
+
"version": "14.0.0-beta.1",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"name": "@pie-lib/shared-module",
|
|
7
|
+
"version": "^4.0.1"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "@pie-lib/math-rendering-module",
|
|
11
|
+
"version": "^4.0.7"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "@pie-lib/editable-html-module",
|
|
15
|
+
"version": "^6.1.2"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "@pie-lib/config-module",
|
|
19
|
+
"version": "^3.0.1"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import PrintElement from './print.js';
|
|
2
|
+
|
|
3
|
+
var generate = {};
|
|
4
|
+
|
|
5
|
+
generate.model = (id, element) => ({
|
|
6
|
+
id,
|
|
7
|
+
element,
|
|
8
|
+
customKeys: ['\\square'],
|
|
9
|
+
feedback: { type: 'default', default: 'this is default feedback' },
|
|
10
|
+
prompt: 'This is the question prompt',
|
|
11
|
+
promptEnabled: true,
|
|
12
|
+
mathInput: true,
|
|
13
|
+
playersToolbarPosition: 'bottom',
|
|
14
|
+
toolbarEditorPosition: 'bottom',
|
|
15
|
+
spellCheckEnabled: true,
|
|
16
|
+
rubricEnabled: false,
|
|
17
|
+
annotationsEnabled: false,
|
|
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
|
+
// new init - just shows off print!
|
|
29
|
+
|
|
30
|
+
const init = async () => {
|
|
31
|
+
console.log('define the element...');
|
|
32
|
+
await Promise.all(
|
|
33
|
+
config.models.map(async (m) => {
|
|
34
|
+
try {
|
|
35
|
+
const printTag = `${m.element}-print`;
|
|
36
|
+
if (customElements.get(printTag)) {
|
|
37
|
+
return true;
|
|
38
|
+
} else {
|
|
39
|
+
customElements.define(printTag, PrintElement);
|
|
40
|
+
await customElements.whenDefined(printTag);
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
console.log('now apply the model...');
|
|
50
|
+
config.models.forEach((m) => {
|
|
51
|
+
const printTag = `${m.element}-print`;
|
|
52
|
+
const h3s = document.createElement('h3');
|
|
53
|
+
h3s.textContent = 'student mode';
|
|
54
|
+
document.body.appendChild(h3s);
|
|
55
|
+
const de = document.createElement(printTag);
|
|
56
|
+
document.body.appendChild(de);
|
|
57
|
+
de.options = {};
|
|
58
|
+
de.model = m;
|
|
59
|
+
|
|
60
|
+
const h3 = document.createElement('h3');
|
|
61
|
+
h3.textContent = 'instructor mode';
|
|
62
|
+
document.body.appendChild(h3);
|
|
63
|
+
const instr = document.createElement(printTag);
|
|
64
|
+
document.body.appendChild(instr);
|
|
65
|
+
instr.options = { mode: 'instructor' };
|
|
66
|
+
instr.model = JSON.parse(JSON.stringify(m));
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
init()
|
|
71
|
+
.then(() => {
|
|
72
|
+
console.log('ready');
|
|
73
|
+
})
|
|
74
|
+
.catch((e) => {
|
|
75
|
+
console.error(e);
|
|
76
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<title>@pie-element/extended-text-entry@14.0.0-beta.1</title>
|
|
6
|
+
<link
|
|
7
|
+
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
/>
|
|
10
|
+
<style>
|
|
11
|
+
html, body {
|
|
12
|
+
font-family: 'Roboto', sans-serif;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
<script type="module" src="./print-demo.js"></script>
|
|
16
|
+
</head>
|
|
17
|
+
<body></body>
|
|
18
|
+
</html>
|
package/module/print.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as n,_dll_mui__material as o,_dll_mui__material_styles as i,_dll_debug as a,_dll_pie_lib__render_ui as s}from"../../../@pie-lib/shared-module@^4.0.1/module/index.js";import{_dll_pie_lib__math_rendering as r}from"../../../@pie-lib/math-rendering-module@^4.0.7/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as l}from"../../../@pie-lib/editable-html-module@^6.1.2/module/index.js";import{_dll_pie_lib__config_ui as d}from"../../../@pie-lib/config-module@^3.0.1/module/index.js";var c,p=e;c=p.createRoot,p.hydrateRoot;var h="object"==typeof global&&global&&global.Object===Object&&global,u="object"==typeof self&&self&&self.Object===Object&&self,m=h||u||Function("return this")(),g=m.Symbol,f=Object.prototype,b=f.hasOwnProperty,y=f.toString,v=g?g.toStringTag:void 0;var C=Object.prototype.toString;var x=g?g.toStringTag:void 0;function _(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":x&&x in Object(e)?function(e){var t=b.call(e,v),n=e[v];try{e[v]=void 0;var o=!0}catch(e){}var i=y.call(e);return o&&(t?e[v]=n:delete e[v]),i}(e):function(e){return C.call(e)}(e)}var E=/\s/;var w=/^\s+/;function S(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&E.test(e.charAt(t)););return t}(e)+1).replace(w,""):e}function k(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var A=/^[-+]0x[0-9a-f]+$/i,R=/^0b[01]+$/i,T=/^0o[0-7]+$/i,M=parseInt;function I(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==_(e)}(e))return NaN;if(k(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=k(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=S(e);var n=R.test(e);return n||T.test(e)?M(e.slice(2),n?2:8):A.test(e)?NaN:+e}var L=function(){return m.Date.now()},P=Math.max,N=Math.min;function D(e,t,n){var o,i,a,s,r,l,d=0,c=!1,p=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function u(t){var n=o,a=i;return o=i=void 0,d=t,s=e.apply(a,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||p&&e-d>=a}function g(){var e=L();if(m(e))return f(e);r=setTimeout(g,function(e){var n=t-(e-l);return p?N(n,a-(e-d)):n}(e))}function f(e){return r=void 0,h&&o?u(e):(o=i=void 0,s)}function b(){var e=L(),n=m(e);if(o=arguments,i=this,l=e,n){if(void 0===r)return function(e){return d=e,r=setTimeout(g,t),c?u(e):s}(l);if(p)return clearTimeout(r),r=setTimeout(g,t),u(l)}return void 0===r&&(r=setTimeout(g,t)),s}return t=I(t)||0,k(n)&&(c=!!n.leading,a=(p="maxWait"in n)?P(I(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),b.cancel=function(){void 0!==r&&clearTimeout(r),d=0,o=l=i=r=void 0},b.flush=function(){return void 0===r?s:f(L())},b}const j=(e,t,n)=>{const o=n||[],i=o.reduce((e,t)=>e+t.textContent.length,0);let a=!0;if(i>t)return!1;for(e&&(3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&o.push(e),e=e.firstChild);e&&a;)a=j(e,t,o),e=e.nextSibling;return o},O=e=>{const{commonAncestorContainer:t,startContainer:n,endContainer:o,startOffset:i,endOffset:a}=e,s=[];let r=!1,l=!1,d="";const c=e=>{const{nodeValue:t,childNodes:p}=e;e===n&&e===o?(t&&(d+=t.substring(i,a)),r=l=!0):e===n?(t&&(d+=t.substring(i)),r=!0):e===o?(t&&(d+=t.substring(0,a)),l=!0):e&&3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&t&&r&&!l&&(d+=t,s.push(e)),p.forEach(e=>{l||c(e)})};return c(t),[s,d]},W=e=>{const t=document.createElement("SPAN");return e.surroundContents(t),t},$=e=>{if(e.startContainer===e.endContainer)return[W(e)];const[t]=O(e),n=document.createRange();n.selectNodeContents(e.startContainer),n.setStart(e.startContainer,e.startOffset);const o=W(n),i=document.createRange();i.selectNode(e.endContainer),i.setEnd(e.endContainer,e.endOffset);const a=W(i);return[o,...t.map(e=>{const t=document.createElement("SPAN");return e.parentNode.insertBefore(t,e),t.appendChild(e),t}),a]},H=(e,t)=>{(e||[]).forEach(e=>{const t=e.parentNode,n=e.childNodes,o=n.length;if(o>0)for(let i=0;i<o;i++)t.insertBefore(n[0],e);else t.insertBefore(document.createTextNode(e.textContent),e);t.removeChild(e)}),t.normalize()},z=()=>{document.getSelection?(document.getSelection().removeAllRanges(),document.getSelection().addRange(document.createRange())):window.getSelection?window.getSelection().removeAllRanges?(window.getSelection().removeAllRanges(),window.getSelection().addRange(document.createRange())):window.getSelection().empty&&window.getSelection().empty():document.selection&&document.selection.empty()},q=e=>e.length>=20||-1!==e.search(/\n|\r|\r\n/),B=e=>Array.from(document.querySelectorAll(`[data-id='${e}']`)),K=e=>document.querySelector(`[data-ann-id='${e}']`),U=t,V=n,{Popover:F}=o,{TextField:G}=o,{styled:X}=i,Y=X(F)(({theme:e,annotationType:t})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:e.palette.grey[100]},..."negative"===t&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===t&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),Q=X("div")(({theme:e,annotationType:t})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:"#ffffff",border:`4px solid ${e.palette.grey[100]}`,..."negative"===t&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===t&&{borderColor:"rgb(153, 255, 153) !important"}})),J=X("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),Z=X("div")(({theme:e,variant:t,annotationType:n})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===t&&"negative"===n&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===t&&"positive"===n&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class ee extends U.Component{static __initStatic(){this.propTypes={anchorEl:V.object,open:V.bool,offset:V.number,value:V.string,type:V.string,onClose:V.func,onDelete:V.func,onSave:V.func,onTypeChange:V.func}}constructor(e){super(e),ee.prototype.__init.call(this),ee.prototype.__init2.call(this),ee.prototype.__init3.call(this),this.state={value:e.value}}UNSAFE_componentWillReceiveProps(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.setState({value:t})}__init(){this.onValueChange=e=>this.setState({value:e.target.value})}__init2(){this.handleSave=()=>{const{value:e,onSave:t,onClose:n,onDelete:o}=this.props,{value:i}=this.state;""===i&&o(),e!==i&&t(e,i),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:e,onDelete:t}=this.props,{value:n}=this.state;""===n?t():e(n),this.setState({value:""})}}render(){const{anchorEl:e,offset:t,onDelete:n,open:o,type:i}=this.props,{value:a}=this.state;return U.createElement(Y,{anchorEl:e,elevation:2,open:o,onClose:this.handleSave,annotationType:i,style:{marginTop:`${t}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},U.createElement(Q,{annotationType:i},U.createElement(G,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:a,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),U.createElement(J,null,U.createElement(Z,{onClick:n},"Delete"),U.createElement(Z,{variant:"typeChange",annotationType:i,onClick:this.handleTypeChange},"negative"===i?"Green":"Pink"),U.createElement(Z,{onClick:this.handleSave},"Save"))))}}ee.__initStatic();const te=t,ne=n,{styled:oe}=i,{Popover:ie}=o,ae=oe(ie)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:"black"}}}),se=oe("div")(({theme:e})=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:e.palette.common.white,border:`2px solid ${e.palette.grey[100]}`})),re=oe("div")({display:"flex",flexWrap:"wrap"}),le=oe("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),de=oe("div")(({theme:e,variant:t})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${e.palette.grey[100]}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class ce extends te.Component{static __initStatic(){this.propTypes={anchorEl:ne.object,open:ne.bool,annotations:ne.array,isNewAnnotation:ne.bool,onClose:ne.func,onDelete:ne.func,onEdit:ne.func,onWrite:ne.func,onAnnotate:ne.func}}render(){const{anchorEl:e,annotations:t,isNewAnnotation:n,onAnnotate:o,onClose:i,onEdit:a,onDelete:s,onWrite:r,open:l}=this.props;return te.createElement(ae,{anchorEl:e,open:l,onClose:i,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},te.createElement(se,null,te.createElement(re,null,t.map((e,t)=>te.createElement(de,{key:`annotation-${t}`,variant:e.type,onClick:()=>o(e)},e.label))),te.createElement(le,null,te.createElement(de,{onClick:i},"Cancel"),te.createElement(de,{style:{pointerEvents:"none"}}),n?te.createElement(te.Fragment,null,te.createElement(de,{variant:"positive",onClick:()=>r("positive")},"Write"),te.createElement(de,{variant:"negative",onClick:()=>r("negative")},"Write")):te.createElement(te.Fragment,null,te.createElement(de,{onClick:s},"Delete"),te.createElement(de,{onClick:a},"Edit")))))}}ce.__initStatic();const pe=t,{styled:he}=i,ue=n,me=l,{InputContainer:ge}=d,fe=he("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),be=he("div")({width:"230px"}),ye=he("div")({position:"relative",overflowX:"hidden",display:"flex"}),ve=he(ge)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),marginTop:e.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const e=document.createElement("style");e.id="annotation-editor-styles",e.textContent='\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: "";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n',document.head.appendChild(e)}class Ce extends pe.Component{static __initStatic(){this.propTypes={text:ue.string,comment:ue.string,annotations:ue.array,predefinedAnnotations:ue.array,onChange:ue.func.isRequired,onCommentChange:ue.func.isRequired,width:ue.number,height:ue.number,maxHeight:ue.string,disabled:ue.bool,disabledMath:ue.bool,customKeys:ue.array,keypadMode:ue.string}}constructor(e){super(e),Ce.prototype.__init.call(this),Ce.prototype.__init2.call(this),Ce.prototype.__init3.call(this),Ce.prototype.__init4.call(this),Ce.prototype.__init5.call(this),Ce.prototype.__init6.call(this),Ce.prototype.__init7.call(this),Ce.prototype.__init8.call(this),Ce.prototype.__init9.call(this),Ce.prototype.__init10.call(this),Ce.prototype.__init11.call(this),Ce.prototype.__init12.call(this),Ce.prototype.__init13.call(this),Ce.prototype.__init14.call(this),Ce.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:e,text:t}=this.props;t&&e.forEach(e=>{const[t,n]=((e,t,n)=>{const o=j(n,t),i=[];let a=0;return o.forEach(n=>{const o=a+n.textContent.length;[e,t].forEach(e=>{a<=e&&e<o&&i.push({node:n,offset:e-a})}),a=o}),i})(e.start,e.end,this.textRef);if(t&&n){const o=document.createRange();o.setStart(t.node,t.offset),o.setEnd(n.node,n.offset);const i=$(o);this.createDOMAnnotation(i,e)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(t=>{const n=B(t.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;t.style.top=`${o}px`,t.style.left=`${e}px`})}}}__init2(){this.handleClick=e=>{const{annotations:t}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:i}=e.target.dataset,a=o||i,s=B(a),r=K(a),l=t.findIndex(e=>e.id===a),d=r.hasAttribute("data-freeform");d&&(r.style.zIndex="10"),this.setState({anchorEl:s[0],openedMenu:!!o||!!i&&!d,openedEditor:!!i&&d,selectedElems:s,labelElem:r,annotationIndex:l,annotation:t[l],selectionDetails:null})}}__init3(){this.handleHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=B(o),a=K(o),s=a.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="20",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.7)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.55)")}),s?(a.style.zIndex="20",a.classList.contains("positive")?(a.style.backgroundColor="rgb(128, 255, 128)",a.style.setProperty("--before-border-color","rgb(153, 255, 153)")):a.classList.contains("negative")&&(a.style.backgroundColor="rgb(255, 179, 230)",a.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(a.style.zIndex="20",a.classList.contains("positive")?a.style.color="rgb(0, 77, 0)":a.classList.contains("negative")&&(a.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=B(o),a=K(o),s=a.hasAttribute("data-freeform");i.forEach(e=>{e.style.zIndex="",e.classList.contains("positive")?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":e.classList.contains("negative")&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)")}),s?(a.style.zIndex="",a.classList.contains("positive")?(a.style.backgroundColor="rgb(153, 255, 153)",a.style.removeProperty("--before-border-color")):a.classList.contains("negative")&&(a.style.backgroundColor="rgb(255, 204, 238)",a.style.removeProperty("--before-border-color"))):(a.style.zIndex="",a.classList.contains("positive")?a.style.color="rgb(0, 128, 0)":a.classList.contains("negative")&&(a.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=e=>{const{selectedElems:t,labelElem:n}=this.state;t.length&&!t[0].hasAttribute("data-id")&&H(t,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),z()}}__init6(){this.handleSelection=e=>{const t=window.getSelection();if(e.detail>2)z();else if(t&&t.rangeCount>0){const e=t.getRangeAt(0),n=e.toString(),o=this.textRef.contains(e.commonAncestorContainer);if(!t.isCollapsed&&""!==n&&o){const t=((e,t)=>{const n=document.createRange();n.setStart(t,0),n.setEnd(e.startContainer,e.startOffset);const[,o]=O(n),[,i]=O(e),a=o.length;return{quote:i,start:a,end:a+i.length}})(e,this.textRef),n=$(e);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:t})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:e,onChange:t}=this.props,{selectedElems:n,labelElem:o,annotationIndex:i,annotation:a}=this.state;(q(a.label)?this.labelsRef:n[0]).removeChild(o),H(n,this.textRef),e.splice(i,1),t(e),this.handleClose()}}__init8(){this.createDOMAnnotation=(e,t)=>{const{disabled:n}=this.props,{id:o,label:i,type:a}=t;(e||[]).forEach(e=>{e.dataset.id=o,e.className=`annotation ${a}`,e.style.position="relative",e.style.cursor="pointer","positive"===a?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===a&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)"),e.onclick=!n&&this.handleClick,e.onmouseover=this.handleHover,e.onmouseout=this.handleCancelHover});const s=e&&e[0]||{},r=document.createElement("SPAN");if(r.dataset.annId=o,r.innerHTML=i,r.onclick=!n&&this.handleClick,r.onmouseover=this.handleHover,r.onmouseout=this.handleCancelHover,q(i)){const e=(s.offsetTop?s.offsetTop:s.offsetParent.offsetTop)-this.textRef.scrollTop,t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;r.dataset.freeform=!0,r.className=`sideAnnotation ${a}`,r.style.position="absolute",r.style.padding="4px",r.style.borderRadius="4px",r.style.marginLeft="8px",r.style.width="180px",r.style.whiteSpace="pre-wrap",r.style.wordBreak="break-word",r.style.border="2px solid #ffffff",r.style.fontSize="14px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.top=`${e}px`,r.style.left=`${t}px`,"negative"===a?r.style.backgroundColor="rgb(255, 204, 238)":"positive"===a&&(r.style.backgroundColor="rgb(153, 255, 153)"),r.style.setProperty("--before-border-width","7px"),r.style.setProperty("--before-top","5px"),r.style.setProperty("--before-right","100%"),"negative"===a?r.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===a&&r.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(r)}else r.className=`annotationLabel ${a}`,r.style.backgroundColor="rgb(242, 242, 242)",r.style.padding="2px",r.style.position="absolute",r.style.userSelect="none",r.style.whiteSpace="nowrap",r.style.top="-10px",r.style.left="-2px",r.style.fontSize="12px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.lineHeight="6px",r.style.webkitUserSelect="none",r.style.mozUserSelect="none",r.style.msUserSelect="none","positive"===a?r.style.color="rgb(0, 128, 0)":"negative"===a&&(r.style.color="rgb(204, 0, 136)"),s.appendChild(r)}}__init9(){this.createNewAnnotation=(e,t)=>{const{selectedElems:n,selectionDetails:o}=this.state,i={id:[o.start,o.end,(new Date).getTime()].join("-"),label:e,type:t,...o};return this.createDOMAnnotation(n,i),i}}__init10(){this.handleMenuClick=e=>{const{annotations:t,onChange:n}=this.props,{annotation:o,annotationIndex:i}=this.state,{type:a,text:s}=e;if(o){const e={...o,label:s,type:a},{type:n,label:r}=o;this.updateLabel(r,e,a!==n&&n),t.splice(i,1,e)}else{const e=this.createNewAnnotation(s,a);t.push(e)}n(t),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=e=>{const{annotations:t,onChange:n}=this.props,o=this.createNewAnnotation("",e),i=K(o.id);t.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:t.length-1,annotation:o,labelElem:i}),n(t)}}__init13(){this.updateLabel=(e,t,n)=>{const{selectedElems:o,labelElem:i}=this.state,{label:a,type:s}=t;q(a)&&q(e)||!q(a)&&!q(e)?(i.innerHTML=a,n&&(i.classList.remove(n),i.classList.add(s),o.forEach(e=>{e.classList.remove(n),e.classList.add(s)}))):q(a)&&!q(e)?(o[0].removeChild(i),this.createDOMAnnotation(o,t)):!q(a)&&q(e)&&(this.labelsRef.removeChild(i),this.createDOMAnnotation(o,t))}}__init14(){this.changeAnnotationType=e=>{const{annotations:t,onChange:n}=this.props,{annotationIndex:o,selectedElems:i}=this.state,{type:a,label:s}=t[o],r="positive"===a?"negative":"positive",l={...t[o],type:r,label:e};i.forEach(e=>{e.classList.remove(a),e.classList.add(r)}),this.updateLabel(s,l,a),t.splice(o,1,l),n(t),this.handleClose()}}__init15(){this.updateAnnotation=(e,t)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:i}=this.state,a={...n[i],label:t};this.updateLabel(e,a),n.splice(i,1,a),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:e,customKeys:t,disabled:n,disabledMath:o,keypadMode:i,height:a,width:s,maxHeight:r,onCommentChange:l,predefinedAnnotations:d,text:c}=this.props,{anchorEl:p,annotation:h,openedMenu:u,openedEditor:m,selectionDetails:g}=this.state,f=p&&(p.offsetTop?p.offsetTop:p.offsetParent.offsetTop),b=this.textRef&&f?f-this.textRef.scrollTop-8:0;return pe.createElement("div",null,pe.createElement(ye,null,pe.createElement(fe,{style:{width:s-34,minHeight:a,maxHeight:r},ref:e=>this.textRef=e,onMouseDown:n?()=>{}:z,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:c}}),pe.createElement(be,{ref:e=>this.labelsRef=e})),pe.createElement(ve,{label:"Comment"},pe.createElement(me,{className:"prompt",markup:e||"",onChange:l,width:s&&(s+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:t,keypadMode:i,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0}}})),pe.createElement(ce,{anchorEl:p,open:u&&!n,annotations:d,isNewAnnotation:!!g,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),pe.createElement(ee,{anchorEl:this.textRef,open:m&&!n,offset:b,value:h&&h.label||"",type:h&&h.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}Ce.__initStatic();const xe=t,_e=n,Ee=a,{Typography:we}=o,{styled:Se}=i,{color:ke}=s,{Feedback:Ae}=s,{Collapsible:Re}=s,{PreviewPrompt:Te}=s,{UiLayout:Me}=s,Ie=l,Le=Ee("@pie-ui:extended-text-entry"),Pe=Se(Me)({backgroundColor:ke.background(),color:ke.text()}),Ne=Se(we)(({theme:e})=>({width:"100%",color:ke.text(),marginBottom:e.spacing(2),fontSize:"inherit"})),De=Se("div")(({theme:e})=>({marginBottom:e.spacing(2)})),je=Se(Ie)(({theme:e})=>({marginBottom:e.spacing(2),borderRadius:"4px"})),Oe=Se("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class We extends xe.Component{constructor(...e){super(...e),We.prototype.__init.call(this),We.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:_e.func.isRequired,onAnnotationsChange:_e.func.isRequired,onCommentChange:_e.func.isRequired,model:_e.object,session:_e.shape({value:_e.string,annotations:_e.array,comment:_e.string}).isRequired}}__init(){this.changeSessionValue=D(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=D(this.props.onCommentChange,1500)}render(){const{model:e,session:t,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:i,customKeys:a,dimensions:s,disabled:r,disabledAnnotator:l,equationEditor:d,extraCSSRules:c,feedback:p,mathInput:h,playersToolbarPosition:u,predefinedAnnotations:m,prompt:g,spanishInput:f,specialInput:b,spellCheckEnabled:y,teacherInstructions:v}=e,{annotations:C,comment:x,value:_}=t,{width:E,height:w}=s||{},S="40vh",k={position:"top"===u?"top":"bottom"};Le("[render] disabled? ",r);const A=xe.createElement(Te,{defaultClassName:"teacher-instructions",prompt:v}),R=[];return f&&R.push({language:"spanish"}),b&&R.push({language:"special"}),xe.createElement(Pe,{extraCSSRules:c,ref:e=>{this.containerRef=e}},xe.createElement(Oe,null,"Constructed Response Question"),v&&xe.createElement(De,null,o?A:xe.createElement(Re,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},A)),g&&xe.createElement(Ne,{component:"span"},xe.createElement(Te,{defaultClassName:"prompt",prompt:e.prompt})),i?xe.createElement(Ce,{text:_||"",annotations:C||[],comment:x||"",predefinedAnnotations:m||[],onChange:n,onCommentChange:this.changeSessionComment,width:E,height:w,maxHeight:S,disabled:l,disabledMath:!h,customKeys:a,keypadMode:d}):xe.createElement(je,{className:"response-area-editor",onChange:this.changeSessionValue,markup:_||"",maxWidth:E&&E.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:S,disabled:r,highlightShape:!0,toolbarOpts:k,spellCheck:y,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!h,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:R}),p&&xe.createElement(Ae,{correctness:"correct",feedback:p}))}}We.__initStatic();const $e=t,He=a,{renderMath:ze}=r,qe=He("pie-element:extended-text-entry:print");class Be extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._root=null,this._rerender=D(()=>{if(this._model&&this._session){const e=((e,t)=>{const n="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=n&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.showTeacherInstructions=n,e.mode=n?"evaluate":e.mode,e.dimensions={height:100,width:500,...e.dimensions},e.disabled=!0,e.feedback=void 0,e.animationsDisabled=!0,e})(this._model,this._options),t=this._options&&$e.createElement(We,{model:e,session:{},onChange:()=>{},onValueChange:()=>{},onAnnotationsChange:()=>{},onCommentChange:()=>{}});this._root||(this._root=c(this)),this._root.render(t),queueMicrotask(()=>{qe("render complete - render math"),ze(this)})}else qe("skip")},50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{Be as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/extended-text-entry",
|
|
3
|
-
"version": "14.0.0-
|
|
3
|
+
"version": "14.0.0-next.0+67da381",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,21 +14,25 @@
|
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
16
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
17
|
-
"@pie-lib/config-ui": "
|
|
18
|
-
"@pie-lib/editable-html": "
|
|
19
|
-
"@pie-lib/math-rendering": "
|
|
20
|
-
"@pie-lib/render-ui": "
|
|
17
|
+
"@pie-lib/config-ui": "12.1.1-next.3",
|
|
18
|
+
"@pie-lib/editable-html-tip-tap": "1.1.1-next.3",
|
|
19
|
+
"@pie-lib/math-rendering": "4.1.1-next.1",
|
|
20
|
+
"@pie-lib/render-ui": "5.1.1-next.1",
|
|
21
21
|
"classnames": "^2.2.5",
|
|
22
22
|
"debug": "^4.1.1",
|
|
23
23
|
"lodash.throttle": "^4.1.1",
|
|
24
24
|
"prop-types": "^15.6.1",
|
|
25
|
-
"react": "18.
|
|
26
|
-
"react-dom": "18.
|
|
25
|
+
"react": "18.3.1",
|
|
26
|
+
"react-dom": "18.3.1"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "67da3818d2af966110c6e85f6e8e238b79515eb2",
|
|
29
29
|
"scripts": {
|
|
30
30
|
"postpublish": "../../scripts/postpublish"
|
|
31
31
|
},
|
|
32
32
|
"main": "lib/index.js",
|
|
33
|
-
"module": "src/index.js"
|
|
33
|
+
"module": "src/index.js",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": "./src/index.js",
|
|
36
|
+
"./print": "./src/print.js"
|
|
37
|
+
}
|
|
34
38
|
}
|