@pie-element/explicit-constructed-response 7.2.1-next.6 → 7.2.1-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.
@@ -219,7 +219,8 @@ var StyledECRToolbar = (0, _styles.withStyles)(function (theme) {
219
219
  return {
220
220
  markup: {
221
221
  backgroundColor: theme.palette.common.white,
222
- outline: 'none'
222
+ outline: 'none',
223
+ lineHeight: '10px'
223
224
  }
224
225
  };
225
226
  })(ECRToolbar);
@@ -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"],"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;AAA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AAA,aAAa,EAAEkC,sBAAUC,MADR;AAEjBrB,EAAAA,OAAO,EAAEoB,sBAAUC,MAFF;AAGjBtD,EAAAA,IAAI,EAAEqD,sBAAUC,MAHC;AAIjBX,EAAAA,MAAM,EAAEU,sBAAUE,IAJD;AAKjBpD,EAAAA,gBAAgB,EAAEkD,sBAAUE,IAAV,CAAeC,UALhB;AAMjBtD,EAAAA,aAAa,EAAEmD,sBAAUE,IAAV,CAAeC,UANb;AAOjBvD,EAAAA,KAAK,EAAEoD,sBAAUI,KAAV,CAAgB;AACrBhD,IAAAA,MAAM,EAAE4C,sBAAUE,IAAV,CAAeC,UADF;AAErB9D,IAAAA,QAAQ,EAAE2D,sBAAUI,KAAV,CAAgB;AACxB7C,MAAAA,WAAW,EAAEyC,sBAAUE,IAAV,CAAeC;AADJ,KAAhB;AAFW,GAAhB,CAPU;AAajBtB,EAAAA,yBAAyB,EAAEmB,sBAAUK,IAbpB;AAcjBvB,EAAAA,WAAW,EAAEkB,sBAAUC,MAdN;AAejBlB,EAAAA,UAAU,EAAEiB,sBAAUK;AAfL,C;AAmIrB,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;AAFL;AADoC,GAAZ;AAAA,CAAX,EAKrBrE,UALqB,CAAzB;eAOe+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\n this.onRespAreaChange(respAreaMarkup);\n }}\n onDone={(val) => {\n if (this.preventDone) {\n return;\n }\n\n this.onDone(val);\n }}\n onBlur={(e) => {\n const inInInsertCharacter = e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog');\n\n this.preventDone = inInInsertCharacter;\n\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 },\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","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,S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AAZ;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"}
@@ -8,7 +8,7 @@
8
8
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "2.1.2",
11
+ "@pie-lib/pie-toolbox": "2.1.3",
12
12
  "classnames": "^2.2.6",
13
13
  "debug": "^3.1.0",
14
14
  "lodash": "^4.17.15",
@@ -8,7 +8,7 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/pie-toolbox": "2.1.2",
11
+ "@pie-lib/pie-toolbox": "2.1.3",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "type-of": "^2.0.1"
@@ -1,5 +1,5 @@
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.1.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.1.1/module/index.js";
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.1.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.1.2/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) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -9124,7 +9124,8 @@ const require$$12$9 = _dll_pie_lib__pie_toolbox_editable_html;
9124
9124
  return {
9125
9125
  markup: {
9126
9126
  backgroundColor: theme.palette.common.white,
9127
- outline: 'none'
9127
+ outline: 'none',
9128
+ lineHeight: '10px'
9128
9129
  }
9129
9130
  };
9130
9131
  })(ECRToolbar);
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
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.1.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.1.1/module/index.js";
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.1.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.1.2/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -113947,7 +113947,7 @@ const require$$24 = _dll_classnames;
113947
113947
  readOnly: disabled,
113948
113948
  spellCheck: spellCheck,
113949
113949
  autoCorrect: spellCheck,
113950
- className: (0, _classnames["default"])((0, _defineProperty2["default"])({}, classes.noPadding, toolbarOpts && toolbarOpts.noPadding), classes.slateEditor),
113950
+ className: (0, _classnames["default"])((0, _defineProperty2["default"])({}, classes.noPadding, toolbarOpts === null || toolbarOpts === void 0 ? void 0 : toolbarOpts.noPadding), classes.slateEditor),
113951
113951
  style: {
113952
113952
  minHeight: sizeStyle.minHeight,
113953
113953
  height: sizeStyle.height,
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "2.1.1"
7
+ "version": "2.1.2"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "5.1.1"
11
+ "version": "5.1.2"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
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.1.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.1.1/module/index.js";
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.1.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.1.2/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -113910,7 +113910,7 @@ const require$$24 = _dll_classnames;
113910
113910
  readOnly: disabled,
113911
113911
  spellCheck: spellCheck,
113912
113912
  autoCorrect: spellCheck,
113913
- className: (0, _classnames["default"])((0, _defineProperty2["default"])({}, classes.noPadding, toolbarOpts && toolbarOpts.noPadding), classes.slateEditor),
113913
+ className: (0, _classnames["default"])((0, _defineProperty2["default"])({}, classes.noPadding, toolbarOpts === null || toolbarOpts === void 0 ? void 0 : toolbarOpts.noPadding), classes.slateEditor),
113914
113914
  style: {
113915
113915
  minHeight: sizeStyle.minHeight,
113916
113916
  height: sizeStyle.height,
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.1-next.6+434e6f51d",
7
+ "version": "7.2.1-next.9+dc734705a",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@material-ui/core": "^3.9.2",
14
14
  "@pie-framework/pie-player-events": "^0.1.0",
15
- "@pie-lib/pie-toolbox": "2.1.2",
15
+ "@pie-lib/pie-toolbox": "2.1.3",
16
16
  "classnames": "^2.2.5",
17
17
  "lodash": "^4.17.10",
18
18
  "prop-types": "^15.6.1",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "author": "",
23
23
  "license": "ISC",
24
- "gitHead": "434e6f51dd53d7ef82d4902be16af5618f68826b",
24
+ "gitHead": "dc734705a6aefa0f69eb29d3d695c57e31671ab8",
25
25
  "main": "lib/index.js",
26
26
  "module": "src/index.js",
27
27
  "exports": {