@pie-element/complex-rubric 2.18.3-next.0 → 2.18.3-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "1.29.2",
10
+ "@pie-lib/pie-toolbox": "1.29.3",
11
11
  "lodash": "^4.17.15"
12
12
  },
13
13
  "author": "",
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.22.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.22.2/module/index.js";
2
2
  import RubricConfigure from '@pie-element/rubric/configure/lib';
3
3
  import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.23.1/module/index.js";
4
4
  function _mergeNamespaces(n, m) {
@@ -137337,7 +137337,7 @@ const require$$10$w = _dll_classnames;
137337
137337
  key: "render",
137338
137338
  value: function render() {
137339
137339
  var latex = this.state.latex;
137340
- var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, maxResponseAreas = _this$props.maxResponseAreas;
137340
+ var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, maxResponseAreas = _this$props.maxResponseAreas;
137341
137341
  return _react["default"].createElement(PureToolbar, {
137342
137342
  autoFocus: autoFocus,
137343
137343
  classNames: classNames,
@@ -137347,6 +137347,7 @@ const require$$10$w = _dll_classnames;
137347
137347
  additionalKeys: additionalKeys,
137348
137348
  noDecimal: noDecimal,
137349
137349
  keypadMode: keypadMode,
137350
+ keyPadCharacterRef: keyPadCharacterRef,
137350
137351
  onChange: this.onChange,
137351
137352
  onDone: this.done,
137352
137353
  onFocus: onFocus,
@@ -137408,9 +137409,10 @@ const require$$10$w = _dll_classnames;
137408
137409
  (0, _createClass2["default"])(RawPureToolbar, [{
137409
137410
  key: "render",
137410
137411
  value: function render() {
137411
- var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
137412
+ var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
137412
137413
  return _react["default"].createElement("div", {
137413
- className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar)
137414
+ className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar),
137415
+ ref: keyPadCharacterRef
137414
137416
  }, _react["default"].createElement("div", null), _react["default"].createElement(_editorAndPad["default"], {
137415
137417
  autoFocus: autoFocus,
137416
137418
  keypadMode: keypadMode,
@@ -141041,10 +141043,11 @@ var _Check = _interopRequireDefault$1T(Check);
141041
141043
  var _styles$4 = styles$1J;
141042
141044
  var _propTypes$16 = _interopRequireDefault$1T(require$$5$P);
141043
141045
  var RawDoneButton = function RawDoneButton(_ref) {
141044
- var classes = _ref.classes, onClick = _ref.onClick;
141046
+ var classes = _ref.classes, onClick = _ref.onClick, doneButtonRef = _ref.doneButtonRef;
141045
141047
  return _react$1y["default"].createElement(_IconButton$2["default"], {
141046
141048
  "aria-label": "Done",
141047
141049
  className: classes.iconRoot,
141050
+ buttonRef: doneButtonRef,
141048
141051
  onClick: onClick,
141049
141052
  classes: {
141050
141053
  label: classes.label,
@@ -141222,7 +141225,7 @@ const require$$10$q = _dll_debug;
141222
141225
  };
141223
141226
  };
141224
141227
  var DefaultToolbar = function DefaultToolbar(_ref) {
141225
- var plugins = _ref.plugins, pluginProps = _ref.pluginProps, value = _ref.value, onChange = _ref.onChange, getFocusedValue = _ref.getFocusedValue, onDone = _ref.onDone, classes = _ref.classes, showDone = _ref.showDone, deletable = _ref.deletable, isHtmlMode = _ref.isHtmlMode, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
141228
+ var plugins = _ref.plugins, pluginProps = _ref.pluginProps, value = _ref.value, onChange = _ref.onChange, getFocusedValue = _ref.getFocusedValue, onDone = _ref.onDone, classes = _ref.classes, showDone = _ref.showDone, deletable = _ref.deletable, isHtmlMode = _ref.isHtmlMode, doneButtonRef = _ref.doneButtonRef, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
141226
141229
  pluginProps = _objectSpread({
141227
141230
  html: {
141228
141231
  disabled: true
@@ -141255,6 +141258,7 @@ const require$$10$q = _dll_debug;
141255
141258
  getFocusedValue: getFocusedValue
141256
141259
  }));
141257
141260
  })), showDone && !deletable && _react["default"].createElement(_doneButton.DoneButton, {
141261
+ doneButtonRef: doneButtonRef,
141258
141262
  onClick: onDone
141259
141263
  }));
141260
141264
  };
@@ -148074,6 +148078,7 @@ const require$$11$l = _dll_prop_types;
148074
148078
  }
148075
148079
  };
148076
148080
  var el = _react["default"].createElement(_mathToolbar.PureToolbar, {
148081
+ keyPadCharacterRef: opts.keyPadCharacterRef,
148077
148082
  autoFocus: true,
148078
148083
  noDecimal: true,
148079
148084
  hideInput: true,
@@ -148401,7 +148406,7 @@ const {debounce: require$$16$2} = _dll_lodash;
148401
148406
  key: "render",
148402
148407
  value: function render() {
148403
148408
  var _this2 = this, _classNames;
148404
- var _this$props3 = this.props, classes = _this$props3.classes, plugins = _this$props3.plugins, pluginProps = _this$props3.pluginProps, toolbarOpts = _this$props3.toolbarOpts, value = _this$props3.value, autoWidth = _this$props3.autoWidth, onChange = _this$props3.onChange, getFocusedValue = _this$props3.getFocusedValue, isFocused = _this$props3.isFocused, onDone = _this$props3.onDone, toolbarRef = _this$props3.toolbarRef, onBlur = _this$props3.onBlur, onFocus = _this$props3.onFocus;
148409
+ var _this$props3 = this.props, classes = _this$props3.classes, plugins = _this$props3.plugins, pluginProps = _this$props3.pluginProps, toolbarOpts = _this$props3.toolbarOpts, value = _this$props3.value, autoWidth = _this$props3.autoWidth, onChange = _this$props3.onChange, getFocusedValue = _this$props3.getFocusedValue, isFocused = _this$props3.isFocused, onDone = _this$props3.onDone, toolbarRef = _this$props3.toolbarRef, doneButtonRef = _this$props3.doneButtonRef, onBlur = _this$props3.onBlur, onFocus = _this$props3.onFocus;
148405
148410
  var node = (0, _utils.findSingleNode)(value);
148406
148411
  var parentNode = (0, _utils.findParentNode)(value, node);
148407
148412
  log(' --------------> [render] node: ', node);
@@ -148470,6 +148475,7 @@ const {debounce: require$$16$2} = _dll_lodash;
148470
148475
  deletable: deletable,
148471
148476
  isHtmlMode: toolbarOpts.isHtmlMode,
148472
148477
  onFocus: onFocus,
148478
+ doneButtonRef: doneButtonRef,
148473
148479
  onBlur: onBlur
148474
148480
  }), _react["default"].createElement("div", {
148475
148481
  className: classes.shared
@@ -148483,6 +148489,7 @@ const {debounce: require$$16$2} = _dll_lodash;
148483
148489
  root: classes.iconRoot
148484
148490
  }
148485
148491
  }, _react["default"].createElement(_Delete["default"], null)), customToolbarShowDone && _react["default"].createElement(_doneButton.DoneButton, {
148492
+ doneButtonRef: doneButtonRef,
148486
148493
  onClick: handleDone
148487
148494
  })));
148488
148495
  }
@@ -148632,7 +148639,7 @@ const require$$13$5 = _dll_prop_types;
148632
148639
  key: "render",
148633
148640
  value: function render() {
148634
148641
  var _classNames, _this = this, _classNames2;
148635
- var _this$props = this.props, classes = _this$props.classes, children = _this$props.children, value = _this$props.value, plugins = _this$props.plugins, onChange = _this$props.onChange, getFocusedValue = _this$props.getFocusedValue, onDone = _this$props.onDone, focusedNode = _this$props.focusedNode, autoWidth = _this$props.autoWidth, readOnly = _this$props.readOnly, disableScrollbar = _this$props.disableScrollbar, disableUnderline = _this$props.disableUnderline, pluginProps = _this$props.pluginProps, toolbarOpts = _this$props.toolbarOpts, onDataChange = _this$props.onDataChange, toolbarRef = _this$props.toolbarRef, focusToolbar = _this$props.focusToolbar, onToolbarFocus = _this$props.onToolbarFocus, onToolbarBlur = _this$props.onToolbarBlur;
148642
+ var _this$props = this.props, classes = _this$props.classes, children = _this$props.children, value = _this$props.value, plugins = _this$props.plugins, onChange = _this$props.onChange, getFocusedValue = _this$props.getFocusedValue, onDone = _this$props.onDone, focusedNode = _this$props.focusedNode, autoWidth = _this$props.autoWidth, readOnly = _this$props.readOnly, disableScrollbar = _this$props.disableScrollbar, disableUnderline = _this$props.disableUnderline, pluginProps = _this$props.pluginProps, toolbarOpts = _this$props.toolbarOpts, onDataChange = _this$props.onDataChange, toolbarRef = _this$props.toolbarRef, doneButtonRef = _this$props.doneButtonRef, focusToolbar = _this$props.focusToolbar, onToolbarFocus = _this$props.onToolbarFocus, onToolbarBlur = _this$props.onToolbarBlur;
148636
148643
  var inFocus = value.isFocused || focusedNode !== null && focusedNode !== undefined || focusToolbar;
148637
148644
  var holderNames = (0, _classnames["default"])(classes.editorHolder, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.editorInFocus, inFocus), (0, _defineProperty2["default"])(_classNames, classes.readOnly, readOnly), (0, _defineProperty2["default"])(_classNames, classes.disabledUnderline, disableUnderline), (0, _defineProperty2["default"])(_classNames, classes.disabledScrollbar, disableScrollbar), _classNames));
148638
148645
  var clonedChildren = children;
@@ -148663,6 +148670,7 @@ const require$$13$5 = _dll_prop_types;
148663
148670
  onDone: onDone,
148664
148671
  onDataChange: onDataChange,
148665
148672
  toolbarRef: toolbarRef,
148673
+ doneButtonRef: doneButtonRef,
148666
148674
  pluginProps: pluginProps,
148667
148675
  toolbarOpts: toolbarOpts
148668
148676
  }));
@@ -149323,7 +149331,9 @@ var buildPlugins = function buildPlugins(activePlugins, customPlugins, opts) {
149323
149331
  var mathPlugin = (0, _math["default"])(opts.math);
149324
149332
  var respAreaPlugin = opts.responseArea && opts.responseArea.type && (0, _respArea["default"])(opts.responseArea, (0, _compact["default"])([mathPlugin]));
149325
149333
  var languageCharactersPlugins = ((opts === null || opts === void 0 ? void 0 : opts.languageCharacters) || []).map(function (config) {
149326
- return (0, _characters["default"])(config);
149334
+ return (0, _characters["default"])(_objectSpread$4(_objectSpread$4({}, config), {}, {
149335
+ keyPadCharacterRef: opts.keyPadCharacterRef
149336
+ }));
149327
149337
  });
149328
149338
  var tablePlugins = [imagePlugin, mathPlugin, respAreaPlugin].concat((0, _toConsumableArray2$2["default"])(languageCharactersPlugins));
149329
149339
  if (opts.responseArea && opts.responseArea.type === 'math-templated') {
@@ -157899,6 +157909,7 @@ const require$$23 = _dll_classnames;
157899
157909
  }
157900
157910
  },
157901
157911
  languageCharacters: props.languageCharactersProps,
157912
+ keyPadCharacterRef: _this.keyPadCharacterRef,
157902
157913
  media: {
157903
157914
  focus: _this.focus,
157904
157915
  createChange: function createChange() {
@@ -158034,10 +158045,13 @@ const require$$23 = _dll_classnames;
158034
158045
  }
158035
158046
  });
158036
158047
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
158048
+ var _this$keyPadCharacter;
158037
158049
  log('[onBlur]');
158038
158050
  var relatedTarget = event.relatedTarget;
158039
158051
  var toolbarElement = _this.toolbarRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]")));
158040
- var isRawDoneButton = relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest('button[class*="RawDoneButton"]');
158052
+ var isRawDoneButton = _this.doneButtonRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.doneButtonRef.className, "\"]")));
158053
+ var isKeyPadCharacterButton = _this.keyPadCharacterRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat((_this$keyPadCharacter = _this.keyPadCharacterRef.current) === null || _this$keyPadCharacter === void 0 ? void 0 : _this$keyPadCharacter.className, "\"]")));
158054
+ _this.skipBlurHandling = isKeyPadCharacterButton ? true : false;
158041
158055
  if (toolbarElement && !isRawDoneButton) {
158042
158056
  _this.setState({
158043
158057
  focusToolbar: true
@@ -158046,10 +158060,12 @@ const require$$23 = _dll_classnames;
158046
158060
  var node = relatedTarget ? (0, _slateReact.findNode)(relatedTarget, _this.state.value) : null;
158047
158061
  log('[onBlur] node: ', node);
158048
158062
  return new Promise(function (resolve) {
158049
- _this.setState({
158050
- preBlurValue: _this.state.value,
158051
- focusedNode: !node ? null : node
158052
- }, _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this), resolve));
158063
+ if (!_this.skipBlurHandling) {
158064
+ _this.setState({
158065
+ preBlurValue: _this.state.value,
158066
+ focusedNode: !node ? null : node
158067
+ }, _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this), resolve));
158068
+ }
158053
158069
  _this.props.onBlur(event);
158054
158070
  });
158055
158071
  });
@@ -158343,6 +158359,7 @@ const require$$23 = _dll_classnames;
158343
158359
  open: false
158344
158360
  }
158345
158361
  };
158362
+ _this.keyPadCharacterRef = _react["default"].createRef();
158346
158363
  _this.toggleHtmlMode = _this.toggleHtmlMode.bind((0, _assertThisInitialized2["default"])(_this));
158347
158364
  _this.handleToolbarFocus = _this.handleToolbarFocus.bind((0, _assertThisInitialized2["default"])(_this));
158348
158365
  _this.handleToolbarBlur = _this.handleToolbarBlur.bind((0, _assertThisInitialized2["default"])(_this));
@@ -158499,6 +158516,11 @@ const require$$23 = _dll_classnames;
158499
158516
  _this4.toolbarRef = r;
158500
158517
  }
158501
158518
  },
158519
+ doneButtonRef: function doneButtonRef(r) {
158520
+ if (r) {
158521
+ _this4.doneButtonRef = r;
158522
+ }
158523
+ },
158502
158524
  value: value,
158503
158525
  focusToolbar: this.state.focusToolbar,
158504
158526
  onToolbarFocus: this.handleToolbarFocus,
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.22.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.22.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.23.1/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -127405,7 +127405,7 @@ const require$$10$x = _dll_classnames;
127405
127405
  key: "render",
127406
127406
  value: function render() {
127407
127407
  var latex = this.state.latex;
127408
- var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, maxResponseAreas = _this$props.maxResponseAreas;
127408
+ var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, maxResponseAreas = _this$props.maxResponseAreas;
127409
127409
  return _react["default"].createElement(PureToolbar, {
127410
127410
  autoFocus: autoFocus,
127411
127411
  classNames: classNames,
@@ -127415,6 +127415,7 @@ const require$$10$x = _dll_classnames;
127415
127415
  additionalKeys: additionalKeys,
127416
127416
  noDecimal: noDecimal,
127417
127417
  keypadMode: keypadMode,
127418
+ keyPadCharacterRef: keyPadCharacterRef,
127418
127419
  onChange: this.onChange,
127419
127420
  onDone: this.done,
127420
127421
  onFocus: onFocus,
@@ -127476,9 +127477,10 @@ const require$$10$x = _dll_classnames;
127476
127477
  (0, _createClass2["default"])(RawPureToolbar, [{
127477
127478
  key: "render",
127478
127479
  value: function render() {
127479
- var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127480
+ var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127480
127481
  return _react["default"].createElement("div", {
127481
- className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar)
127482
+ className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar),
127483
+ ref: keyPadCharacterRef
127482
127484
  }, _react["default"].createElement("div", null), _react["default"].createElement(_editorAndPad["default"], {
127483
127485
  autoFocus: autoFocus,
127484
127486
  keypadMode: keypadMode,
@@ -131220,10 +131222,11 @@ var _Check = _interopRequireDefault$1U(Check);
131220
131222
  var _styles$4 = styles$1K;
131221
131223
  var _propTypes$15 = _interopRequireDefault$1U(require$$5$O);
131222
131224
  var RawDoneButton = function RawDoneButton(_ref) {
131223
- var classes = _ref.classes, onClick = _ref.onClick;
131225
+ var classes = _ref.classes, onClick = _ref.onClick, doneButtonRef = _ref.doneButtonRef;
131224
131226
  return _react$1z["default"].createElement(_IconButton$2["default"], {
131225
131227
  "aria-label": "Done",
131226
131228
  className: classes.iconRoot,
131229
+ buttonRef: doneButtonRef,
131227
131230
  onClick: onClick,
131228
131231
  classes: {
131229
131232
  label: classes.label,
@@ -131401,7 +131404,7 @@ const require$$10$r = _dll_debug;
131401
131404
  };
131402
131405
  };
131403
131406
  var DefaultToolbar = function DefaultToolbar(_ref) {
131404
- var plugins = _ref.plugins, pluginProps = _ref.pluginProps, value = _ref.value, onChange = _ref.onChange, getFocusedValue = _ref.getFocusedValue, onDone = _ref.onDone, classes = _ref.classes, showDone = _ref.showDone, deletable = _ref.deletable, isHtmlMode = _ref.isHtmlMode, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
131407
+ var plugins = _ref.plugins, pluginProps = _ref.pluginProps, value = _ref.value, onChange = _ref.onChange, getFocusedValue = _ref.getFocusedValue, onDone = _ref.onDone, classes = _ref.classes, showDone = _ref.showDone, deletable = _ref.deletable, isHtmlMode = _ref.isHtmlMode, doneButtonRef = _ref.doneButtonRef, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
131405
131408
  pluginProps = _objectSpread({
131406
131409
  html: {
131407
131410
  disabled: true
@@ -131434,6 +131437,7 @@ const require$$10$r = _dll_debug;
131434
131437
  getFocusedValue: getFocusedValue
131435
131438
  }));
131436
131439
  })), showDone && !deletable && _react["default"].createElement(_doneButton.DoneButton, {
131440
+ doneButtonRef: doneButtonRef,
131437
131441
  onClick: onDone
131438
131442
  }));
131439
131443
  };
@@ -146334,6 +146338,7 @@ const require$$11$l = _dll_prop_types;
146334
146338
  }
146335
146339
  };
146336
146340
  var el = _react["default"].createElement(_mathToolbar.PureToolbar, {
146341
+ keyPadCharacterRef: opts.keyPadCharacterRef,
146337
146342
  autoFocus: true,
146338
146343
  noDecimal: true,
146339
146344
  hideInput: true,
@@ -146661,7 +146666,7 @@ const {debounce: require$$16$2} = _dll_lodash;
146661
146666
  key: "render",
146662
146667
  value: function render() {
146663
146668
  var _this2 = this, _classNames;
146664
- var _this$props3 = this.props, classes = _this$props3.classes, plugins = _this$props3.plugins, pluginProps = _this$props3.pluginProps, toolbarOpts = _this$props3.toolbarOpts, value = _this$props3.value, autoWidth = _this$props3.autoWidth, onChange = _this$props3.onChange, getFocusedValue = _this$props3.getFocusedValue, isFocused = _this$props3.isFocused, onDone = _this$props3.onDone, toolbarRef = _this$props3.toolbarRef, onBlur = _this$props3.onBlur, onFocus = _this$props3.onFocus;
146669
+ var _this$props3 = this.props, classes = _this$props3.classes, plugins = _this$props3.plugins, pluginProps = _this$props3.pluginProps, toolbarOpts = _this$props3.toolbarOpts, value = _this$props3.value, autoWidth = _this$props3.autoWidth, onChange = _this$props3.onChange, getFocusedValue = _this$props3.getFocusedValue, isFocused = _this$props3.isFocused, onDone = _this$props3.onDone, toolbarRef = _this$props3.toolbarRef, doneButtonRef = _this$props3.doneButtonRef, onBlur = _this$props3.onBlur, onFocus = _this$props3.onFocus;
146665
146670
  var node = (0, _utils.findSingleNode)(value);
146666
146671
  var parentNode = (0, _utils.findParentNode)(value, node);
146667
146672
  log(' --------------> [render] node: ', node);
@@ -146730,6 +146735,7 @@ const {debounce: require$$16$2} = _dll_lodash;
146730
146735
  deletable: deletable,
146731
146736
  isHtmlMode: toolbarOpts.isHtmlMode,
146732
146737
  onFocus: onFocus,
146738
+ doneButtonRef: doneButtonRef,
146733
146739
  onBlur: onBlur
146734
146740
  }), _react["default"].createElement("div", {
146735
146741
  className: classes.shared
@@ -146743,6 +146749,7 @@ const {debounce: require$$16$2} = _dll_lodash;
146743
146749
  root: classes.iconRoot
146744
146750
  }
146745
146751
  }, _react["default"].createElement(_Delete["default"], null)), customToolbarShowDone && _react["default"].createElement(_doneButton.DoneButton, {
146752
+ doneButtonRef: doneButtonRef,
146746
146753
  onClick: handleDone
146747
146754
  })));
146748
146755
  }
@@ -146892,7 +146899,7 @@ const require$$13$5 = _dll_prop_types;
146892
146899
  key: "render",
146893
146900
  value: function render() {
146894
146901
  var _classNames, _this = this, _classNames2;
146895
- var _this$props = this.props, classes = _this$props.classes, children = _this$props.children, value = _this$props.value, plugins = _this$props.plugins, onChange = _this$props.onChange, getFocusedValue = _this$props.getFocusedValue, onDone = _this$props.onDone, focusedNode = _this$props.focusedNode, autoWidth = _this$props.autoWidth, readOnly = _this$props.readOnly, disableScrollbar = _this$props.disableScrollbar, disableUnderline = _this$props.disableUnderline, pluginProps = _this$props.pluginProps, toolbarOpts = _this$props.toolbarOpts, onDataChange = _this$props.onDataChange, toolbarRef = _this$props.toolbarRef, focusToolbar = _this$props.focusToolbar, onToolbarFocus = _this$props.onToolbarFocus, onToolbarBlur = _this$props.onToolbarBlur;
146902
+ var _this$props = this.props, classes = _this$props.classes, children = _this$props.children, value = _this$props.value, plugins = _this$props.plugins, onChange = _this$props.onChange, getFocusedValue = _this$props.getFocusedValue, onDone = _this$props.onDone, focusedNode = _this$props.focusedNode, autoWidth = _this$props.autoWidth, readOnly = _this$props.readOnly, disableScrollbar = _this$props.disableScrollbar, disableUnderline = _this$props.disableUnderline, pluginProps = _this$props.pluginProps, toolbarOpts = _this$props.toolbarOpts, onDataChange = _this$props.onDataChange, toolbarRef = _this$props.toolbarRef, doneButtonRef = _this$props.doneButtonRef, focusToolbar = _this$props.focusToolbar, onToolbarFocus = _this$props.onToolbarFocus, onToolbarBlur = _this$props.onToolbarBlur;
146896
146903
  var inFocus = value.isFocused || focusedNode !== null && focusedNode !== undefined || focusToolbar;
146897
146904
  var holderNames = (0, _classnames["default"])(classes.editorHolder, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.editorInFocus, inFocus), (0, _defineProperty2["default"])(_classNames, classes.readOnly, readOnly), (0, _defineProperty2["default"])(_classNames, classes.disabledUnderline, disableUnderline), (0, _defineProperty2["default"])(_classNames, classes.disabledScrollbar, disableScrollbar), _classNames));
146898
146905
  var clonedChildren = children;
@@ -146923,6 +146930,7 @@ const require$$13$5 = _dll_prop_types;
146923
146930
  onDone: onDone,
146924
146931
  onDataChange: onDataChange,
146925
146932
  toolbarRef: toolbarRef,
146933
+ doneButtonRef: doneButtonRef,
146926
146934
  pluginProps: pluginProps,
146927
146935
  toolbarOpts: toolbarOpts
146928
146936
  }));
@@ -147583,7 +147591,9 @@ var buildPlugins = function buildPlugins(activePlugins, customPlugins, opts) {
147583
147591
  var mathPlugin = (0, _math["default"])(opts.math);
147584
147592
  var respAreaPlugin = opts.responseArea && opts.responseArea.type && (0, _respArea["default"])(opts.responseArea, (0, _compact["default"])([mathPlugin]));
147585
147593
  var languageCharactersPlugins = ((opts === null || opts === void 0 ? void 0 : opts.languageCharacters) || []).map(function (config) {
147586
- return (0, _characters["default"])(config);
147594
+ return (0, _characters["default"])(_objectSpread$4(_objectSpread$4({}, config), {}, {
147595
+ keyPadCharacterRef: opts.keyPadCharacterRef
147596
+ }));
147587
147597
  });
147588
147598
  var tablePlugins = [imagePlugin, mathPlugin, respAreaPlugin].concat((0, _toConsumableArray2$2["default"])(languageCharactersPlugins));
147589
147599
  if (opts.responseArea && opts.responseArea.type === 'math-templated') {
@@ -155964,6 +155974,7 @@ const require$$23 = _dll_classnames;
155964
155974
  }
155965
155975
  },
155966
155976
  languageCharacters: props.languageCharactersProps,
155977
+ keyPadCharacterRef: _this.keyPadCharacterRef,
155967
155978
  media: {
155968
155979
  focus: _this.focus,
155969
155980
  createChange: function createChange() {
@@ -156099,10 +156110,13 @@ const require$$23 = _dll_classnames;
156099
156110
  }
156100
156111
  });
156101
156112
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
156113
+ var _this$keyPadCharacter;
156102
156114
  log('[onBlur]');
156103
156115
  var relatedTarget = event.relatedTarget;
156104
156116
  var toolbarElement = _this.toolbarRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]")));
156105
- var isRawDoneButton = relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest('button[class*="RawDoneButton"]');
156117
+ var isRawDoneButton = _this.doneButtonRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.doneButtonRef.className, "\"]")));
156118
+ var isKeyPadCharacterButton = _this.keyPadCharacterRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat((_this$keyPadCharacter = _this.keyPadCharacterRef.current) === null || _this$keyPadCharacter === void 0 ? void 0 : _this$keyPadCharacter.className, "\"]")));
156119
+ _this.skipBlurHandling = isKeyPadCharacterButton ? true : false;
156106
156120
  if (toolbarElement && !isRawDoneButton) {
156107
156121
  _this.setState({
156108
156122
  focusToolbar: true
@@ -156111,10 +156125,12 @@ const require$$23 = _dll_classnames;
156111
156125
  var node = relatedTarget ? (0, _slateReact.findNode)(relatedTarget, _this.state.value) : null;
156112
156126
  log('[onBlur] node: ', node);
156113
156127
  return new Promise(function (resolve) {
156114
- _this.setState({
156115
- preBlurValue: _this.state.value,
156116
- focusedNode: !node ? null : node
156117
- }, _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this), resolve));
156128
+ if (!_this.skipBlurHandling) {
156129
+ _this.setState({
156130
+ preBlurValue: _this.state.value,
156131
+ focusedNode: !node ? null : node
156132
+ }, _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this), resolve));
156133
+ }
156118
156134
  _this.props.onBlur(event);
156119
156135
  });
156120
156136
  });
@@ -156408,6 +156424,7 @@ const require$$23 = _dll_classnames;
156408
156424
  open: false
156409
156425
  }
156410
156426
  };
156427
+ _this.keyPadCharacterRef = _react["default"].createRef();
156411
156428
  _this.toggleHtmlMode = _this.toggleHtmlMode.bind((0, _assertThisInitialized2["default"])(_this));
156412
156429
  _this.handleToolbarFocus = _this.handleToolbarFocus.bind((0, _assertThisInitialized2["default"])(_this));
156413
156430
  _this.handleToolbarBlur = _this.handleToolbarBlur.bind((0, _assertThisInitialized2["default"])(_this));
@@ -156564,6 +156581,11 @@ const require$$23 = _dll_classnames;
156564
156581
  _this4.toolbarRef = r;
156565
156582
  }
156566
156583
  },
156584
+ doneButtonRef: function doneButtonRef(r) {
156585
+ if (r) {
156586
+ _this4.doneButtonRef = r;
156587
+ }
156588
+ },
156567
156589
  value: value,
156568
156590
  focusToolbar: this.state.focusToolbar,
156569
156591
  onToolbarFocus: this.handleToolbarFocus,
@@ -4,7 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.22.1"
7
+ "version": "1.22.2"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.22.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.22.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.23.1/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -127405,7 +127405,7 @@ const require$$10$x = _dll_classnames;
127405
127405
  key: "render",
127406
127406
  value: function render() {
127407
127407
  var latex = this.state.latex;
127408
- var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, maxResponseAreas = _this$props.maxResponseAreas;
127408
+ var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, maxResponseAreas = _this$props.maxResponseAreas;
127409
127409
  return _react["default"].createElement(PureToolbar, {
127410
127410
  autoFocus: autoFocus,
127411
127411
  classNames: classNames,
@@ -127415,6 +127415,7 @@ const require$$10$x = _dll_classnames;
127415
127415
  additionalKeys: additionalKeys,
127416
127416
  noDecimal: noDecimal,
127417
127417
  keypadMode: keypadMode,
127418
+ keyPadCharacterRef: keyPadCharacterRef,
127418
127419
  onChange: this.onChange,
127419
127420
  onDone: this.done,
127420
127421
  onFocus: onFocus,
@@ -127476,9 +127477,10 @@ const require$$10$x = _dll_classnames;
127476
127477
  (0, _createClass2["default"])(RawPureToolbar, [{
127477
127478
  key: "render",
127478
127479
  value: function render() {
127479
- var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127480
+ var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127480
127481
  return _react["default"].createElement("div", {
127481
- className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar)
127482
+ className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar),
127483
+ ref: keyPadCharacterRef
127482
127484
  }, _react["default"].createElement("div", null), _react["default"].createElement(_editorAndPad["default"], {
127483
127485
  autoFocus: autoFocus,
127484
127486
  keypadMode: keypadMode,
@@ -131220,10 +131222,11 @@ var _Check = _interopRequireDefault$1U(Check);
131220
131222
  var _styles$4 = styles$1K;
131221
131223
  var _propTypes$15 = _interopRequireDefault$1U(require$$5$O);
131222
131224
  var RawDoneButton = function RawDoneButton(_ref) {
131223
- var classes = _ref.classes, onClick = _ref.onClick;
131225
+ var classes = _ref.classes, onClick = _ref.onClick, doneButtonRef = _ref.doneButtonRef;
131224
131226
  return _react$1z["default"].createElement(_IconButton$2["default"], {
131225
131227
  "aria-label": "Done",
131226
131228
  className: classes.iconRoot,
131229
+ buttonRef: doneButtonRef,
131227
131230
  onClick: onClick,
131228
131231
  classes: {
131229
131232
  label: classes.label,
@@ -131401,7 +131404,7 @@ const require$$10$r = _dll_debug;
131401
131404
  };
131402
131405
  };
131403
131406
  var DefaultToolbar = function DefaultToolbar(_ref) {
131404
- var plugins = _ref.plugins, pluginProps = _ref.pluginProps, value = _ref.value, onChange = _ref.onChange, getFocusedValue = _ref.getFocusedValue, onDone = _ref.onDone, classes = _ref.classes, showDone = _ref.showDone, deletable = _ref.deletable, isHtmlMode = _ref.isHtmlMode, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
131407
+ var plugins = _ref.plugins, pluginProps = _ref.pluginProps, value = _ref.value, onChange = _ref.onChange, getFocusedValue = _ref.getFocusedValue, onDone = _ref.onDone, classes = _ref.classes, showDone = _ref.showDone, deletable = _ref.deletable, isHtmlMode = _ref.isHtmlMode, doneButtonRef = _ref.doneButtonRef, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
131405
131408
  pluginProps = _objectSpread({
131406
131409
  html: {
131407
131410
  disabled: true
@@ -131434,6 +131437,7 @@ const require$$10$r = _dll_debug;
131434
131437
  getFocusedValue: getFocusedValue
131435
131438
  }));
131436
131439
  })), showDone && !deletable && _react["default"].createElement(_doneButton.DoneButton, {
131440
+ doneButtonRef: doneButtonRef,
131437
131441
  onClick: onDone
131438
131442
  }));
131439
131443
  };
@@ -146334,6 +146338,7 @@ const require$$11$l = _dll_prop_types;
146334
146338
  }
146335
146339
  };
146336
146340
  var el = _react["default"].createElement(_mathToolbar.PureToolbar, {
146341
+ keyPadCharacterRef: opts.keyPadCharacterRef,
146337
146342
  autoFocus: true,
146338
146343
  noDecimal: true,
146339
146344
  hideInput: true,
@@ -146661,7 +146666,7 @@ const {debounce: require$$16$2} = _dll_lodash;
146661
146666
  key: "render",
146662
146667
  value: function render() {
146663
146668
  var _this2 = this, _classNames;
146664
- var _this$props3 = this.props, classes = _this$props3.classes, plugins = _this$props3.plugins, pluginProps = _this$props3.pluginProps, toolbarOpts = _this$props3.toolbarOpts, value = _this$props3.value, autoWidth = _this$props3.autoWidth, onChange = _this$props3.onChange, getFocusedValue = _this$props3.getFocusedValue, isFocused = _this$props3.isFocused, onDone = _this$props3.onDone, toolbarRef = _this$props3.toolbarRef, onBlur = _this$props3.onBlur, onFocus = _this$props3.onFocus;
146669
+ var _this$props3 = this.props, classes = _this$props3.classes, plugins = _this$props3.plugins, pluginProps = _this$props3.pluginProps, toolbarOpts = _this$props3.toolbarOpts, value = _this$props3.value, autoWidth = _this$props3.autoWidth, onChange = _this$props3.onChange, getFocusedValue = _this$props3.getFocusedValue, isFocused = _this$props3.isFocused, onDone = _this$props3.onDone, toolbarRef = _this$props3.toolbarRef, doneButtonRef = _this$props3.doneButtonRef, onBlur = _this$props3.onBlur, onFocus = _this$props3.onFocus;
146665
146670
  var node = (0, _utils.findSingleNode)(value);
146666
146671
  var parentNode = (0, _utils.findParentNode)(value, node);
146667
146672
  log(' --------------> [render] node: ', node);
@@ -146730,6 +146735,7 @@ const {debounce: require$$16$2} = _dll_lodash;
146730
146735
  deletable: deletable,
146731
146736
  isHtmlMode: toolbarOpts.isHtmlMode,
146732
146737
  onFocus: onFocus,
146738
+ doneButtonRef: doneButtonRef,
146733
146739
  onBlur: onBlur
146734
146740
  }), _react["default"].createElement("div", {
146735
146741
  className: classes.shared
@@ -146743,6 +146749,7 @@ const {debounce: require$$16$2} = _dll_lodash;
146743
146749
  root: classes.iconRoot
146744
146750
  }
146745
146751
  }, _react["default"].createElement(_Delete["default"], null)), customToolbarShowDone && _react["default"].createElement(_doneButton.DoneButton, {
146752
+ doneButtonRef: doneButtonRef,
146746
146753
  onClick: handleDone
146747
146754
  })));
146748
146755
  }
@@ -146892,7 +146899,7 @@ const require$$13$5 = _dll_prop_types;
146892
146899
  key: "render",
146893
146900
  value: function render() {
146894
146901
  var _classNames, _this = this, _classNames2;
146895
- var _this$props = this.props, classes = _this$props.classes, children = _this$props.children, value = _this$props.value, plugins = _this$props.plugins, onChange = _this$props.onChange, getFocusedValue = _this$props.getFocusedValue, onDone = _this$props.onDone, focusedNode = _this$props.focusedNode, autoWidth = _this$props.autoWidth, readOnly = _this$props.readOnly, disableScrollbar = _this$props.disableScrollbar, disableUnderline = _this$props.disableUnderline, pluginProps = _this$props.pluginProps, toolbarOpts = _this$props.toolbarOpts, onDataChange = _this$props.onDataChange, toolbarRef = _this$props.toolbarRef, focusToolbar = _this$props.focusToolbar, onToolbarFocus = _this$props.onToolbarFocus, onToolbarBlur = _this$props.onToolbarBlur;
146902
+ var _this$props = this.props, classes = _this$props.classes, children = _this$props.children, value = _this$props.value, plugins = _this$props.plugins, onChange = _this$props.onChange, getFocusedValue = _this$props.getFocusedValue, onDone = _this$props.onDone, focusedNode = _this$props.focusedNode, autoWidth = _this$props.autoWidth, readOnly = _this$props.readOnly, disableScrollbar = _this$props.disableScrollbar, disableUnderline = _this$props.disableUnderline, pluginProps = _this$props.pluginProps, toolbarOpts = _this$props.toolbarOpts, onDataChange = _this$props.onDataChange, toolbarRef = _this$props.toolbarRef, doneButtonRef = _this$props.doneButtonRef, focusToolbar = _this$props.focusToolbar, onToolbarFocus = _this$props.onToolbarFocus, onToolbarBlur = _this$props.onToolbarBlur;
146896
146903
  var inFocus = value.isFocused || focusedNode !== null && focusedNode !== undefined || focusToolbar;
146897
146904
  var holderNames = (0, _classnames["default"])(classes.editorHolder, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.editorInFocus, inFocus), (0, _defineProperty2["default"])(_classNames, classes.readOnly, readOnly), (0, _defineProperty2["default"])(_classNames, classes.disabledUnderline, disableUnderline), (0, _defineProperty2["default"])(_classNames, classes.disabledScrollbar, disableScrollbar), _classNames));
146898
146905
  var clonedChildren = children;
@@ -146923,6 +146930,7 @@ const require$$13$5 = _dll_prop_types;
146923
146930
  onDone: onDone,
146924
146931
  onDataChange: onDataChange,
146925
146932
  toolbarRef: toolbarRef,
146933
+ doneButtonRef: doneButtonRef,
146926
146934
  pluginProps: pluginProps,
146927
146935
  toolbarOpts: toolbarOpts
146928
146936
  }));
@@ -147583,7 +147591,9 @@ var buildPlugins = function buildPlugins(activePlugins, customPlugins, opts) {
147583
147591
  var mathPlugin = (0, _math["default"])(opts.math);
147584
147592
  var respAreaPlugin = opts.responseArea && opts.responseArea.type && (0, _respArea["default"])(opts.responseArea, (0, _compact["default"])([mathPlugin]));
147585
147593
  var languageCharactersPlugins = ((opts === null || opts === void 0 ? void 0 : opts.languageCharacters) || []).map(function (config) {
147586
- return (0, _characters["default"])(config);
147594
+ return (0, _characters["default"])(_objectSpread$4(_objectSpread$4({}, config), {}, {
147595
+ keyPadCharacterRef: opts.keyPadCharacterRef
147596
+ }));
147587
147597
  });
147588
147598
  var tablePlugins = [imagePlugin, mathPlugin, respAreaPlugin].concat((0, _toConsumableArray2$2["default"])(languageCharactersPlugins));
147589
147599
  if (opts.responseArea && opts.responseArea.type === 'math-templated') {
@@ -155964,6 +155974,7 @@ const require$$23 = _dll_classnames;
155964
155974
  }
155965
155975
  },
155966
155976
  languageCharacters: props.languageCharactersProps,
155977
+ keyPadCharacterRef: _this.keyPadCharacterRef,
155967
155978
  media: {
155968
155979
  focus: _this.focus,
155969
155980
  createChange: function createChange() {
@@ -156099,10 +156110,13 @@ const require$$23 = _dll_classnames;
156099
156110
  }
156100
156111
  });
156101
156112
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
156113
+ var _this$keyPadCharacter;
156102
156114
  log('[onBlur]');
156103
156115
  var relatedTarget = event.relatedTarget;
156104
156116
  var toolbarElement = _this.toolbarRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]")));
156105
- var isRawDoneButton = relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest('button[class*="RawDoneButton"]');
156117
+ var isRawDoneButton = _this.doneButtonRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.doneButtonRef.className, "\"]")));
156118
+ var isKeyPadCharacterButton = _this.keyPadCharacterRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat((_this$keyPadCharacter = _this.keyPadCharacterRef.current) === null || _this$keyPadCharacter === void 0 ? void 0 : _this$keyPadCharacter.className, "\"]")));
156119
+ _this.skipBlurHandling = isKeyPadCharacterButton ? true : false;
156106
156120
  if (toolbarElement && !isRawDoneButton) {
156107
156121
  _this.setState({
156108
156122
  focusToolbar: true
@@ -156111,10 +156125,12 @@ const require$$23 = _dll_classnames;
156111
156125
  var node = relatedTarget ? (0, _slateReact.findNode)(relatedTarget, _this.state.value) : null;
156112
156126
  log('[onBlur] node: ', node);
156113
156127
  return new Promise(function (resolve) {
156114
- _this.setState({
156115
- preBlurValue: _this.state.value,
156116
- focusedNode: !node ? null : node
156117
- }, _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this), resolve));
156128
+ if (!_this.skipBlurHandling) {
156129
+ _this.setState({
156130
+ preBlurValue: _this.state.value,
156131
+ focusedNode: !node ? null : node
156132
+ }, _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this), resolve));
156133
+ }
156118
156134
  _this.props.onBlur(event);
156119
156135
  });
156120
156136
  });
@@ -156408,6 +156424,7 @@ const require$$23 = _dll_classnames;
156408
156424
  open: false
156409
156425
  }
156410
156426
  };
156427
+ _this.keyPadCharacterRef = _react["default"].createRef();
156411
156428
  _this.toggleHtmlMode = _this.toggleHtmlMode.bind((0, _assertThisInitialized2["default"])(_this));
156412
156429
  _this.handleToolbarFocus = _this.handleToolbarFocus.bind((0, _assertThisInitialized2["default"])(_this));
156413
156430
  _this.handleToolbarBlur = _this.handleToolbarBlur.bind((0, _assertThisInitialized2["default"])(_this));
@@ -156564,6 +156581,11 @@ const require$$23 = _dll_classnames;
156564
156581
  _this4.toolbarRef = r;
156565
156582
  }
156566
156583
  },
156584
+ doneButtonRef: function doneButtonRef(r) {
156585
+ if (r) {
156586
+ _this4.doneButtonRef = r;
156587
+ }
156588
+ },
156567
156589
  value: value,
156568
156590
  focusToolbar: this.state.focusToolbar,
156569
156591
  onToolbarFocus: this.handleToolbarFocus,
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@pie-element/complex-rubric",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "2.18.3-next.0+8ec0f71c6",
4
+ "version": "2.18.3-next.4+07d6e8560",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
- "@pie-element/multi-trait-rubric": "^3.18.3-next.0+8ec0f71c6",
11
- "@pie-element/rubric": "^3.18.3-next.0+8ec0f71c6",
10
+ "@pie-element/multi-trait-rubric": "^3.18.3-next.4+07d6e8560",
11
+ "@pie-element/rubric": "^3.18.3-next.4+07d6e8560",
12
12
  "@pie-framework/pie-player-events": "^0.1.0",
13
13
  "classnames": "^2.2.5",
14
14
  "debug": "^4.1.1",
15
15
  "lodash": "^4.17.11",
16
16
  "prop-types": "^15.7.2"
17
17
  },
18
- "gitHead": "8ec0f71c62b7453d7f644422a71c0e71dd3b14d8",
18
+ "gitHead": "07d6e8560ddfe25f95dfbafc2d3155b93eb85404",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },