@pie-element/explicit-constructed-response 7.2.6-next.5 → 7.2.6-next.9
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.
|
@@ -95,15 +95,12 @@ var ECRToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
95
95
|
});
|
|
96
96
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onKeyDown", function (event) {
|
|
97
97
|
if (event.key === 'Enter') {
|
|
98
|
-
_this.onAddChoice();
|
|
99
|
-
|
|
100
98
|
return false;
|
|
101
99
|
}
|
|
102
100
|
});
|
|
103
101
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function () {
|
|
104
102
|
if (_this.clickedInside) {
|
|
105
103
|
_this.clickedInside = false;
|
|
106
|
-
return;
|
|
107
104
|
}
|
|
108
105
|
});
|
|
109
106
|
return _this;
|
|
@@ -173,8 +170,7 @@ var ECRToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
173
170
|
_this2.onDone(val);
|
|
174
171
|
},
|
|
175
172
|
onBlur: function onBlur(e) {
|
|
176
|
-
|
|
177
|
-
_this2.preventDone = inInInsertCharacter;
|
|
173
|
+
_this2.preventDone = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');
|
|
178
174
|
|
|
179
175
|
_this2.onBlur(e);
|
|
180
176
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ecr-toolbar.jsx"],"names":["findSlateNode","key","window","document","querySelector","ECRToolbar","markup","toolbarStyle","props","node","value","onToolbarDone","onChangeResponse","sanitizedMarkup","setState","updatedData","data","toJSON","change","setNodeByKey","nextText","getNextText","moveFocusTo","moveAnchorTo","respAreaMarkup","event","onAddChoice","clickedInside","correctChoice","choice","domNode","domNodeRect","getBoundingClientRect","editor","closest","editorRect","top","left","label","position","height","width","classes","maxLengthPerChoiceEnabled","pluginProps","spellCheck","state","inputProps","maxLength","preventDone","onRespAreaChange","val","onDone","e","inInInsertCharacter","relatedTarget","onBlur","onKeyDown","language","minWidth","React","Component","PropTypes","object","func","isRequired","shape","bool","StyledECRToolbar","theme","backgroundColor","palette","common","white","outline","lineHeight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,GAAD,EAAS;AAC7B,SAAOC,MAAM,CAACC,QAAP,CAAgBC,aAAhB,CAA8B,gBAAgBH,GAAhB,GAAsB,IAApD,CAAP;AACD,CAFD;;IAIaI,U;;;;;;;;;;;;;;;8FAmBD;AACJC,MAAAA,MAAM,EAAE,EADJ;AAEJC,MAAAA,YAAY,EAAE;AAFV,K;+FA+BC,UAACD,MAAD,EAAY;AACjB,wBAAyD,MAAKE,KAA9D;AAAA,UAAQC,IAAR,eAAQA,IAAR;AAAA,UAAcC,KAAd,eAAcA,KAAd;AAAA,UAAqBC,aAArB,eAAqBA,aAArB;AAAA,UAAoCC,gBAApC,eAAoCA,gBAApC;AACA,UAAMC,eAAe,GAAG,gCAAcP,MAAd,CAAxB;;AACA,YAAKQ,QAAL,CAAc;AAAER,QAAAA,MAAM,EAAEO;AAAV,OAAd;;AAEA,UAAME,WAAW,mCAAQN,IAAI,CAACO,IAAL,CAAUC,MAAV,EAAR;AAA4BP,QAAAA,KAAK,EAAEG;AAAnC,QAAjB;;AACA,UAAMK,MAAM,GAAGR,KAAK,CAACQ,MAAN,GAAeC,YAAf,CAA4BV,IAAI,CAACR,GAAjC,EAAsC;AAAEe,QAAAA,IAAI,EAAED;AAAR,OAAtC,CAAf;AACA,UAAMK,QAAQ,GAAGV,KAAK,CAACP,QAAN,CAAekB,WAAf,CAA2BZ,IAAI,CAACR,GAAhC,CAAjB;AAEAiB,MAAAA,MAAM,CAACI,WAAP,CAAmBF,QAAQ,CAACnB,GAA5B,EAAiC,CAAjC,EAAoCsB,YAApC,CAAiDH,QAAQ,C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L,C;AA+HrB,IAAMC,gBAAgB,GAAG,wBAAW,UAACC,KAAD;AAAA,SAAY;AAC5C/D,IAAAA,MAAM,EAAE;AACJgE,MAAAA,eAAe,EAAED,KAAK,CAACE,OAAN,CAAcC,MAAd,CAAqBC,KADlC;AAEJC,MAAAA,OAAO,EAAE,MAFL;AAGJC,MAAAA,UAAU,EAAE;AAHR;AADoC,GAAZ;AAAA,CAAX,EAMrBtE,UANqB,CAAzB;eAQe+D,gB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { EditableHtml } from '@pie-lib/pie-toolbox/editable-html';\nimport { stripHtmlTags } from './markupUtils';\n\nconst findSlateNode = (key) => {\n return window.document.querySelector('[data-key=\"' + key + '\"]');\n};\n\nexport class ECRToolbar extends React.Component {\n static propTypes = {\n correctChoice: PropTypes.object,\n classes: PropTypes.object,\n node: PropTypes.object,\n onDone: PropTypes.func,\n onChangeResponse: PropTypes.func.isRequired,\n onToolbarDone: PropTypes.func.isRequired,\n value: PropTypes.shape({\n change: PropTypes.func.isRequired,\n document: PropTypes.shape({\n getNextText: PropTypes.func.isRequired,\n }),\n }),\n maxLengthPerChoiceEnabled: PropTypes.bool,\n pluginProps: PropTypes.object,\n spellCheck: PropTypes.bool,\n };\n\n state = {\n markup: '',\n toolbarStyle: {},\n };\n\n componentDidMount() {\n const { correctChoice, node } = this.props;\n const choice = correctChoice || {};\n\n const domNode = findSlateNode(node.key);\n\n if (domNode) {\n //eslint-disable-next-line\n const domNodeRect = domNode.getBoundingClientRect();\n const editor = domNode.closest('[data-slate-editor]');\n const editorRect = editor.getBoundingClientRect();\n const top = domNodeRect.top - editorRect.top;\n const left = domNodeRect.left - editorRect.left;\n\n this.setState({\n markup: choice.label,\n toolbarStyle: {\n position: 'absolute',\n top: `${top + domNodeRect.height + 20}px`,\n left: `${left + 20}px`,\n width: `${domNodeRect.width - 4}px`,\n },\n });\n }\n }\n\n onDone = (markup) => {\n const { node, value, onToolbarDone, onChangeResponse } = this.props;\n const sanitizedMarkup = stripHtmlTags(markup);\n this.setState({ markup: sanitizedMarkup });\n\n const updatedData = { ...node.data.toJSON(), value: sanitizedMarkup };\n const change = value.change().setNodeByKey(node.key, { data: updatedData });\n const nextText = value.document.getNextText(node.key);\n\n change.moveFocusTo(nextText.key, 0).moveAnchorTo(nextText.key, 0);\n onToolbarDone(change, true);\n onChangeResponse(sanitizedMarkup);\n };\n\n onRespAreaChange = (respAreaMarkup) => {\n this.setState({ respAreaMarkup });\n };\n\n onKeyDown = (event) => {\n if (event.key === 'Enter') {\n this.onAddChoice();\n return false;\n }\n };\n\n onBlur = () => {\n if (this.clickedInside) {\n this.clickedInside = false;\n return;\n }\n };\n\n render() {\n const { classes, maxLengthPerChoiceEnabled, pluginProps, spellCheck } = this.props;\n const { markup, toolbarStyle } = this.state;\n const inputProps = maxLengthPerChoiceEnabled ? {} : { maxLength: 25 };\n\n return (\n <div style={toolbarStyle}>\n <EditableHtml\n autoFocus={true}\n className={classes.markup}\n disableUnderline\n onChange={(respAreaMarkup) => {\n if (this.preventDone) {\n return;\n }\n this.onRespAreaChange(respAreaMarkup);\n }}\n onDone={(val) => {\n if (this.preventDone) {\n return;\n }\n this.onDone(val);\n }}\n onBlur={(e) => {\n const inInInsertCharacter = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');\n this.preventDone = inInInsertCharacter;\n this.onBlur(e);\n }}\n onKeyDown={this.onKeyDown}\n markup={markup || ''}\n activePlugins={['languageCharacters']}\n pluginProps={pluginProps}\n languageCharactersProps={[{ language: 'spanish' }]}\n minHeight={'10px'}\n maxHeight={'10px'}\n spellCheck={spellCheck}\n toolbarOpts={{\n minWidth: 'auto'\n }}\n {...inputProps}\n />\n </div>\n );\n }\n}\n\nconst StyledECRToolbar = withStyles((theme) => ({\n markup: {\n backgroundColor: theme.palette.common.white,\n outline: 'none',\n lineHeight: '10px'\n },\n}))(ECRToolbar);\n\nexport default StyledECRToolbar;\n"],"file":"ecr-toolbar.js"}
|
|
1
|
+
{"version":3,"sources":["../src/ecr-toolbar.jsx"],"names":["findSlateNode","key","window","document","querySelector","ECRToolbar","markup","toolbarStyle","props","node","value","onToolbarDone","onChangeResponse","sanitizedMarkup","setState","updatedData","data","toJSON","change","setNodeByKey","nextText","getNextText","moveFocusTo","moveAnchorTo","respAreaMarkup","event","clickedInside","correctChoice","choice","domNode","domNodeRect","getBoundingClientRect","editor","closest","editorRect","top","left","label","position","height","width","classes","maxLengthPerChoiceEnabled","pluginProps","spellCheck","state","inputProps","maxLength","preventDone","onRespAreaChange","val","onDone","e","relatedTarget","onBlur","onKeyDown","language","minWidth","React","Component","PropTypes","object","func","isRequired","shape","bool","StyledECRToolbar","theme","backgroundColor","palette","common","white","outline","lineHeight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,GAAD,EAAS;AAC7B,SAAOC,MAAM,CAACC,QAAP,CAAgBC,aAAhB,CAA8B,gBAAgBH,GAAhB,GAAsB,IAApD,CAAP;AACD,CAFD;;IAIaI,U;;;;;;;;;;;;;;;8FAmBD;AACJC,MAAAA,MAAM,EAAE,EADJ;AAEJC,MAAAA,YAAY,EAAE;AAFV,K;+FA+BC,UAACD,MAAD,EAAY;AACjB,wBAAyD,MAAKE,KAA9D;AAAA,UAAQC,IAAR,eAAQA,IAAR;AAAA,UAAcC,KAAd,eAAcA,KAAd;AAAA,UAAqBC,aAArB,eAAqBA,aAArB;AAAA,UAAoCC,gBAApC,eAAoCA,gBAApC;AACA,UAAMC,eAAe,GAAG,gCAAcP,MAAd,CAAxB;;AACA,YAAKQ,QAAL,CAAc;AAAER,QAAAA,MAAM,EAAEO;AAAV,OAAd;;AAEA,UAAME,WAAW,mCAAQN,IAAI,CAACO,IAAL,CAAUC,MAAV,EAAR;AAA4BP,QAAAA,KAAK,EAAEG;AAAnC,QAA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,CAAeC,UADF;AAErB5D,IAAAA,QAAQ,EAAEyD,sBAAUI,KAAV,CAAgB;AACxB3C,MAAAA,WAAW,EAAEuC,sBAAUE,IAAV,CAAeC;AADJ,KAAhB;AAFW,GAAhB,CAPU;AAajBrB,EAAAA,yBAAyB,EAAEkB,sBAAUK,IAbpB;AAcjBtB,EAAAA,WAAW,EAAEiB,sBAAUC,MAdN;AAejBjB,EAAAA,UAAU,EAAEgB,sBAAUK;AAfL,C;AA4HrB,IAAMC,gBAAgB,GAAG,wBAAW,UAACC,KAAD;AAAA,SAAY;AAC5C7D,IAAAA,MAAM,EAAE;AACJ8D,MAAAA,eAAe,EAAED,KAAK,CAACE,OAAN,CAAcC,MAAd,CAAqBC,KADlC;AAEJC,MAAAA,OAAO,EAAE,MAFL;AAGJC,MAAAA,UAAU,EAAE;AAHR;AADoC,GAAZ;AAAA,CAAX,EAMrBpE,UANqB,CAAzB;eAQe6D,gB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { EditableHtml } from '@pie-lib/pie-toolbox/editable-html';\nimport { stripHtmlTags } from './markupUtils';\n\nconst findSlateNode = (key) => {\n return window.document.querySelector('[data-key=\"' + key + '\"]');\n};\n\nexport class ECRToolbar extends React.Component {\n static propTypes = {\n correctChoice: PropTypes.object,\n classes: PropTypes.object,\n node: PropTypes.object,\n onDone: PropTypes.func,\n onChangeResponse: PropTypes.func.isRequired,\n onToolbarDone: PropTypes.func.isRequired,\n value: PropTypes.shape({\n change: PropTypes.func.isRequired,\n document: PropTypes.shape({\n getNextText: PropTypes.func.isRequired,\n }),\n }),\n maxLengthPerChoiceEnabled: PropTypes.bool,\n pluginProps: PropTypes.object,\n spellCheck: PropTypes.bool,\n };\n\n state = {\n markup: '',\n toolbarStyle: {},\n };\n\n componentDidMount() {\n const { correctChoice, node } = this.props;\n const choice = correctChoice || {};\n\n const domNode = findSlateNode(node.key);\n\n if (domNode) {\n //eslint-disable-next-line\n const domNodeRect = domNode.getBoundingClientRect();\n const editor = domNode.closest('[data-slate-editor]');\n const editorRect = editor.getBoundingClientRect();\n const top = domNodeRect.top - editorRect.top;\n const left = domNodeRect.left - editorRect.left;\n\n this.setState({\n markup: choice.label,\n toolbarStyle: {\n position: 'absolute',\n top: `${top + domNodeRect.height + 20}px`,\n left: `${left + 20}px`,\n width: `${domNodeRect.width - 4}px`,\n },\n });\n }\n }\n\n onDone = (markup) => {\n const { node, value, onToolbarDone, onChangeResponse } = this.props;\n const sanitizedMarkup = stripHtmlTags(markup);\n this.setState({ markup: sanitizedMarkup });\n\n const updatedData = { ...node.data.toJSON(), value: sanitizedMarkup };\n const change = value.change().setNodeByKey(node.key, { data: updatedData });\n const nextText = value.document.getNextText(node.key);\n\n change.moveFocusTo(nextText.key, 0).moveAnchorTo(nextText.key, 0);\n onToolbarDone(change, true);\n onChangeResponse(sanitizedMarkup);\n };\n\n onRespAreaChange = (respAreaMarkup) => {\n this.setState({ respAreaMarkup });\n };\n\n onKeyDown = (event) => {\n if (event.key === 'Enter') {\n return false;\n }\n };\n\n onBlur = () => {\n if (this.clickedInside) {\n this.clickedInside = false;\n }\n };\n\n render() {\n const { classes, maxLengthPerChoiceEnabled, pluginProps, spellCheck } = this.props;\n const { markup, toolbarStyle } = this.state;\n const inputProps = maxLengthPerChoiceEnabled ? {} : { maxLength: 25 };\n\n return (\n <div style={toolbarStyle}>\n <EditableHtml\n autoFocus={true}\n className={classes.markup}\n disableUnderline\n onChange={(respAreaMarkup) => {\n if (this.preventDone) {\n return;\n }\n this.onRespAreaChange(respAreaMarkup);\n }}\n onDone={(val) => {\n if (this.preventDone) {\n return;\n }\n this.onDone(val);\n }}\n onBlur={(e) => {\n this.preventDone = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');\n this.onBlur(e);\n }}\n onKeyDown={this.onKeyDown}\n markup={markup || ''}\n activePlugins={['languageCharacters']}\n pluginProps={pluginProps}\n languageCharactersProps={[{ language: 'spanish' }]}\n minHeight={'10px'}\n maxHeight={'10px'}\n spellCheck={spellCheck}\n toolbarOpts={{\n minWidth: 'auto'\n }}\n {...inputProps}\n />\n </div>\n );\n }\n}\n\nconst StyledECRToolbar = withStyles((theme) => ({\n markup: {\n backgroundColor: theme.palette.common.white,\n outline: 'none',\n lineHeight: '10px'\n },\n}))(ECRToolbar);\n\nexport default StyledECRToolbar;\n"],"file":"ecr-toolbar.js"}
|
package/module/configure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.1/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.4.0/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
@@ -9017,14 +9017,12 @@ const require$$12$9 = _dll_pie_lib__pie_toolbox_editable_html;
|
|
|
9017
9017
|
});
|
|
9018
9018
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onKeyDown", function (event) {
|
|
9019
9019
|
if (event.key === 'Enter') {
|
|
9020
|
-
_this.onAddChoice();
|
|
9021
9020
|
return false;
|
|
9022
9021
|
}
|
|
9023
9022
|
});
|
|
9024
9023
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function () {
|
|
9025
9024
|
if (_this.clickedInside) {
|
|
9026
9025
|
_this.clickedInside = false;
|
|
9027
|
-
return;
|
|
9028
9026
|
}
|
|
9029
9027
|
});
|
|
9030
9028
|
return _this;
|
|
@@ -9080,8 +9078,7 @@ const require$$12$9 = _dll_pie_lib__pie_toolbox_editable_html;
|
|
|
9080
9078
|
_this2.onDone(val);
|
|
9081
9079
|
},
|
|
9082
9080
|
onBlur: function onBlur(e) {
|
|
9083
|
-
|
|
9084
|
-
_this2.preventDone = inInInsertCharacter;
|
|
9081
|
+
_this2.preventDone = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');
|
|
9085
9082
|
_this2.onBlur(e);
|
|
9086
9083
|
},
|
|
9087
9084
|
onKeyDown: this.onKeyDown,
|
package/module/element.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.1/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.4.0/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
package/module/manifest.json
CHANGED
package/module/print.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.1/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.4.0/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "7.2.6-next.
|
|
7
|
+
"version": "7.2.6-next.9+0e4534490",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"postpublish": "../../scripts/postpublish"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "ISC",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "0e45344900790b405c12993941b7ef4a03f99ef7",
|
|
25
25
|
"main": "lib/index.js",
|
|
26
26
|
"module": "src/index.js",
|
|
27
27
|
"exports": {
|