@pie-element/complex-rubric 2.10.6 → 2.11.1-next.14
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 +11 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +2 -2
- package/module/configure.js +201 -104
- package/module/element.js +201 -104
- package/module/index.html +1 -1
- package/module/manifest.json +2 -2
- package/module/print.html +1 -1
- package/module/print.js +201 -104
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [2.11.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric@2.10.6...@pie-element/complex-rubric@2.11.0) (2024-05-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-3736, PD-3734, PD-2488 ([3c44f06](https://github.com/pie-framework/pie-elements/commit/3c44f06d96e609246acde257a8223dc16192c2c4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.10.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric@2.10.5...@pie-element/complex-rubric@2.10.6) (2024-05-27)
|
|
7
18
|
|
|
8
19
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [2.2.22](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric-configure@2.2.21...@pie-element/complex-rubric-configure@2.2.22) (2024-05-27)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/complex-rubric-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.2.21](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric-configure@2.2.20...@pie-element/complex-rubric-configure@2.2.21) (2024-05-27)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/complex-rubric-configure
|
package/configure/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/complex-rubric-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.22",
|
|
5
5
|
"description": "Complex Rubric authoring view",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"author": "Pie Framework Authors",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
|
-
"@pie-element/multi-trait-rubric": "^3.
|
|
12
|
-
"@pie-element/rubric": "^3.
|
|
11
|
+
"@pie-element/multi-trait-rubric": "^3.11.0",
|
|
12
|
+
"@pie-element/rubric": "^3.11.0",
|
|
13
13
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
14
14
|
"@pie-lib/config-ui": "^11.9.25-next.0",
|
|
15
15
|
"@pie-lib/editable-html": "^11.1.2-next.0",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [2.10.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric-controller@2.9.6...@pie-element/complex-rubric-controller@2.10.0) (2024-05-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update pie-lib/pie-toolbox PD-3736, PD-3734, PD-2488 ([3c44f06](https://github.com/pie-framework/pie-elements/commit/3c44f06d96e609246acde257a8223dc16192c2c4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.9.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric-controller@2.9.5...@pie-element/complex-rubric-controller@2.9.6) (2024-05-27)
|
|
7
18
|
|
|
8
19
|
|
package/controller/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/complex-rubric-controller",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.10.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@pie-lib/pie-toolbox": "1.
|
|
10
|
+
"@pie-lib/pie-toolbox": "1.20.1",
|
|
11
11
|
"lodash": "^4.17.15"
|
|
12
12
|
},
|
|
13
13
|
"author": "",
|
package/module/configure.js
CHANGED
|
@@ -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.
|
|
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.13.0/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.12.0/module/index.js";
|
|
4
4
|
function _mergeNamespaces(n, m) {
|
|
@@ -43834,7 +43834,7 @@ var _interopRequireDefault$3t = interopRequireDefault.exports;
|
|
|
43834
43834
|
Object.defineProperty(color, "__esModule", {
|
|
43835
43835
|
value: true
|
|
43836
43836
|
});
|
|
43837
|
-
color.v = color.text = color.secondaryText = color.secondaryLight = color.secondaryDark = color.secondaryBackground = color.secondary = color.primaryText = color.primaryLight = color.primaryDark = color.primary = color.missing = color.incorrectSecondary = color.incorrect = color.disabled = color.defaults = color.correctSecondary = color.correct = color.background = void 0;
|
|
43837
|
+
color.v = color.text = color.secondaryText = color.secondaryLight = color.secondaryDark = color.secondaryBackground = color.secondary = color.primaryText = color.primaryLight = color.primaryDark = color.primary = color.missing = color.incorrectSecondary = color.incorrect = color.disabledSecondary = color.disabled = color.defaults = color.correctSecondary = color.correct = color.background = void 0;
|
|
43838
43838
|
var _green = _interopRequireDefault$3t(green$1);
|
|
43839
43839
|
var _orange = _interopRequireDefault$3t(orange$1);
|
|
43840
43840
|
var _pink = _interopRequireDefault$3t(pink$1);
|
|
@@ -43843,6 +43843,7 @@ var _red = _interopRequireDefault$3t(red$1);
|
|
|
43843
43843
|
var defaults$2 = {
|
|
43844
43844
|
TEXT: 'black',
|
|
43845
43845
|
DISABLED: 'grey',
|
|
43846
|
+
DISABLED_SECONDARY: '#ABABAB',
|
|
43846
43847
|
CORRECT: _green["default"][500],
|
|
43847
43848
|
CORRECT_SECONDARY: _green["default"][50],
|
|
43848
43849
|
INCORRECT: _orange["default"][500],
|
|
@@ -43881,6 +43882,10 @@ var disabled = function disabled() {
|
|
|
43881
43882
|
return pv('disabled', defaults$2.DISABLED);
|
|
43882
43883
|
};
|
|
43883
43884
|
color.disabled = disabled;
|
|
43885
|
+
var disabledSecondary = function disabledSecondary() {
|
|
43886
|
+
return pv('disabled-secondary', defaults$2.DISABLED_SECONDARY);
|
|
43887
|
+
};
|
|
43888
|
+
color.disabledSecondary = disabledSecondary;
|
|
43884
43889
|
var correct = function correct() {
|
|
43885
43890
|
return pv('correct', defaults$2.CORRECT);
|
|
43886
43891
|
};
|
|
@@ -136945,16 +136950,160 @@ const require$$11$v = _dll_pie_framework__mathquill;
|
|
|
136945
136950
|
var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
136946
136951
|
return string.replace(WHITESPACE_REGEX, '');
|
|
136947
136952
|
}
|
|
136953
|
+
function countBraces(latex) {
|
|
136954
|
+
var count = 0;
|
|
136955
|
+
for (var i = 0; i < (latex || '').length; i++) {
|
|
136956
|
+
if (latex[i] === '{') {
|
|
136957
|
+
count++;
|
|
136958
|
+
}
|
|
136959
|
+
}
|
|
136960
|
+
return count;
|
|
136961
|
+
}
|
|
136948
136962
|
var Static = (function (_React$Component) {
|
|
136949
136963
|
(0, _inherits2["default"])(Static, _React$Component);
|
|
136950
136964
|
var _super = _createSuper(Static);
|
|
136951
|
-
function Static() {
|
|
136965
|
+
function Static(props) {
|
|
136952
136966
|
var _this;
|
|
136953
136967
|
(0, _classCallCheck2["default"])(this, Static);
|
|
136954
|
-
|
|
136955
|
-
|
|
136956
|
-
|
|
136957
|
-
|
|
136968
|
+
_this = _super.call(this, props);
|
|
136969
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "createLiveRegion", function () {
|
|
136970
|
+
_this.liveRegion = document.createElement('div');
|
|
136971
|
+
_this.liveRegion.style.position = 'absolute';
|
|
136972
|
+
_this.liveRegion.style.width = '1px';
|
|
136973
|
+
_this.liveRegion.style.height = '1px';
|
|
136974
|
+
_this.liveRegion.style.marginTop = '-1px';
|
|
136975
|
+
_this.liveRegion.style.clip = 'rect(1px, 1px, 1px, 1px)';
|
|
136976
|
+
_this.liveRegion.style.overflow = 'hidden';
|
|
136977
|
+
_this.liveRegion.setAttribute('aria-live', 'polite');
|
|
136978
|
+
_this.liveRegion.setAttribute('aria-atomic', 'true');
|
|
136979
|
+
document.body.appendChild(_this.liveRegion);
|
|
136980
|
+
});
|
|
136981
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "addEventListeners", function () {
|
|
136982
|
+
var input = _this.inputRef.current;
|
|
136983
|
+
if (input) {
|
|
136984
|
+
input.addEventListener('keydown', _this.handleKeyDown);
|
|
136985
|
+
input.addEventListener('click', _this.handleMathKeyboardClick);
|
|
136986
|
+
}
|
|
136987
|
+
});
|
|
136988
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "removeEventListeners", function () {
|
|
136989
|
+
var input = _this.inputRef.current;
|
|
136990
|
+
if (input) {
|
|
136991
|
+
input.removeEventListener('keydown', _this.handleKeyDown);
|
|
136992
|
+
input.removeEventListener('click', _this.handleMathKeyboardClick);
|
|
136993
|
+
}
|
|
136994
|
+
});
|
|
136995
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "removeLiveRegion", function () {
|
|
136996
|
+
if (_this.liveRegion) {
|
|
136997
|
+
document.body.removeChild(_this.liveRegion);
|
|
136998
|
+
_this.liveRegion = null;
|
|
136999
|
+
}
|
|
137000
|
+
});
|
|
137001
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyDown", function (event) {
|
|
137002
|
+
if ((event === null || event === void 0 ? void 0 : event.key) === 'Backspace' || (event === null || event === void 0 ? void 0 : event.key) === 'Delete') {
|
|
137003
|
+
_this.setState({
|
|
137004
|
+
isDeleteKeyPressed: true
|
|
137005
|
+
});
|
|
137006
|
+
}
|
|
137007
|
+
_this.setState({
|
|
137008
|
+
inputSource: 'keyboard'
|
|
137009
|
+
});
|
|
137010
|
+
});
|
|
137011
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMathKeyboardClick", function () {
|
|
137012
|
+
_this.setState({
|
|
137013
|
+
inputSource: 'mathKeyboard'
|
|
137014
|
+
});
|
|
137015
|
+
});
|
|
137016
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onInputEdit", function (field) {
|
|
137017
|
+
if (!_this.mathField) {
|
|
137018
|
+
return;
|
|
137019
|
+
}
|
|
137020
|
+
var name = _this.props.getFieldName(field, _this.mathField.innerFields);
|
|
137021
|
+
if (_this.props.onSubFieldChange) {
|
|
137022
|
+
var _this$inputRef;
|
|
137023
|
+
var regexMatch = field.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
137024
|
+
if ((_this$inputRef = _this.inputRef) !== null && _this$inputRef !== void 0 && _this$inputRef.current && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
|
|
137025
|
+
try {
|
|
137026
|
+
field.__controller.cursor.insLeftOf(field.__controller.cursor.parent[-1].parent);
|
|
137027
|
+
field.el().dispatchEvent(new KeyboardEvent('keydown', {
|
|
137028
|
+
keyCode: 8
|
|
137029
|
+
}));
|
|
137030
|
+
} catch (e) {
|
|
137031
|
+
console.error(e.toString());
|
|
137032
|
+
}
|
|
137033
|
+
} else {
|
|
137034
|
+
_this.props.onSubFieldChange(name, field.latex());
|
|
137035
|
+
}
|
|
137036
|
+
}
|
|
137037
|
+
_this.announceLatexConversion(field.latex());
|
|
137038
|
+
});
|
|
137039
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "announceLatexConversion", function (newLatex) {
|
|
137040
|
+
if (!_this.state) {
|
|
137041
|
+
console.error('State is not initialized');
|
|
137042
|
+
return;
|
|
137043
|
+
}
|
|
137044
|
+
var _this$state = _this.state, previousLatex = _this$state.previousLatex, inputSource = _this$state.inputSource, isDeleteKeyPressed = _this$state.isDeleteKeyPressed;
|
|
137045
|
+
var announcement = 'Converted to math symbol';
|
|
137046
|
+
if (inputSource === 'keyboard' && !isDeleteKeyPressed) {
|
|
137047
|
+
var newBraces = countBraces(newLatex);
|
|
137048
|
+
var oldBraces = countBraces(previousLatex);
|
|
137049
|
+
if (newBraces > oldBraces) {
|
|
137050
|
+
_this.announceMessage(announcement);
|
|
137051
|
+
} else {
|
|
137052
|
+
try {
|
|
137053
|
+
_this.mathField.parseLatex(previousLatex);
|
|
137054
|
+
_this.mathField.parseLatex(newLatex);
|
|
137055
|
+
if (newLatex == previousLatex) {
|
|
137056
|
+
_this.announceMessage(announcement);
|
|
137057
|
+
}
|
|
137058
|
+
} catch (e) {
|
|
137059
|
+
console.warn('Error parsing latex:', e.message);
|
|
137060
|
+
console.warn(e);
|
|
137061
|
+
}
|
|
137062
|
+
}
|
|
137063
|
+
}
|
|
137064
|
+
_this.setState({
|
|
137065
|
+
previousLatex: newLatex,
|
|
137066
|
+
isDeleteKeyPressed: false
|
|
137067
|
+
});
|
|
137068
|
+
});
|
|
137069
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "announceMessage", function (message) {
|
|
137070
|
+
_this.setState({
|
|
137071
|
+
previousLatex: ''
|
|
137072
|
+
});
|
|
137073
|
+
if (_this.liveRegion) {
|
|
137074
|
+
_this.liveRegion.textContent = message;
|
|
137075
|
+
setTimeout(function () {
|
|
137076
|
+
_this.liveRegion.textContent = '';
|
|
137077
|
+
}, 500);
|
|
137078
|
+
}
|
|
137079
|
+
});
|
|
137080
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "update", function () {
|
|
137081
|
+
if (!MQ) {
|
|
137082
|
+
throw new Error('MQ is not defined - but component has mounted?');
|
|
137083
|
+
}
|
|
137084
|
+
if (!_this.mathField) {
|
|
137085
|
+
var _this$inputRef2;
|
|
137086
|
+
_this.mathField = MQ.StaticMath((_this$inputRef2 = _this.inputRef) === null || _this$inputRef2 === void 0 ? void 0 : _this$inputRef2.current, {
|
|
137087
|
+
handlers: {
|
|
137088
|
+
edit: _this.onInputEdit.bind((0, _assertThisInitialized2["default"])(_this))
|
|
137089
|
+
}
|
|
137090
|
+
});
|
|
137091
|
+
}
|
|
137092
|
+
try {
|
|
137093
|
+
_this.mathField.parseLatex(_this.props.latex);
|
|
137094
|
+
_this.mathField.latex(_this.props.latex);
|
|
137095
|
+
} catch (e) {
|
|
137096
|
+
_this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
137097
|
+
}
|
|
137098
|
+
});
|
|
137099
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "blur", function () {
|
|
137100
|
+
log('blur mathfield');
|
|
137101
|
+
_this.mathField.blur();
|
|
137102
|
+
});
|
|
137103
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "focus", function () {
|
|
137104
|
+
log('focus mathfield...');
|
|
137105
|
+
_this.mathField.focus();
|
|
137106
|
+
});
|
|
136958
137107
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function (e) {
|
|
136959
137108
|
try {
|
|
136960
137109
|
var rootBlock = e.target.parentElement.nextSibling;
|
|
@@ -136977,6 +137126,13 @@ const require$$11$v = _dll_pie_framework__mathquill;
|
|
|
136977
137126
|
console.error('error finding root block', err.message);
|
|
136978
137127
|
}
|
|
136979
137128
|
});
|
|
137129
|
+
_this.state = {
|
|
137130
|
+
announcement: '',
|
|
137131
|
+
previousLatex: '',
|
|
137132
|
+
inputSource: null,
|
|
137133
|
+
isDeleteKeyPressed: false
|
|
137134
|
+
};
|
|
137135
|
+
_this.inputRef = _react["default"].createRef();
|
|
136980
137136
|
return _this;
|
|
136981
137137
|
}
|
|
136982
137138
|
(0, _createClass2["default"])(Static, [{
|
|
@@ -136984,6 +137140,8 @@ const require$$11$v = _dll_pie_framework__mathquill;
|
|
|
136984
137140
|
value: function componentDidMount() {
|
|
136985
137141
|
this.update();
|
|
136986
137142
|
(0, _updateSpans.updateSpans)();
|
|
137143
|
+
this.createLiveRegion();
|
|
137144
|
+
this.addEventListeners();
|
|
136987
137145
|
}
|
|
136988
137146
|
}, {
|
|
136989
137147
|
key: "componentDidUpdate",
|
|
@@ -136992,59 +137150,10 @@ const require$$11$v = _dll_pie_framework__mathquill;
|
|
|
136992
137150
|
(0, _updateSpans.updateSpans)();
|
|
136993
137151
|
}
|
|
136994
137152
|
}, {
|
|
136995
|
-
key: "
|
|
136996
|
-
value: function
|
|
136997
|
-
|
|
136998
|
-
|
|
136999
|
-
}
|
|
137000
|
-
var name = this.props.getFieldName(field, this.mathField.innerFields);
|
|
137001
|
-
if (this.props.onSubFieldChange) {
|
|
137002
|
-
var regexMatch = field.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
137003
|
-
if (this.input && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
|
|
137004
|
-
try {
|
|
137005
|
-
field.__controller.cursor.insLeftOf(field.__controller.cursor.parent[-1].parent);
|
|
137006
|
-
field.el().dispatchEvent(new KeyboardEvent('keydown', {
|
|
137007
|
-
keyCode: 8
|
|
137008
|
-
}));
|
|
137009
|
-
} catch (e) {
|
|
137010
|
-
console.error(e.toString());
|
|
137011
|
-
}
|
|
137012
|
-
} else {
|
|
137013
|
-
this.props.onSubFieldChange(name, field.latex());
|
|
137014
|
-
}
|
|
137015
|
-
}
|
|
137016
|
-
}
|
|
137017
|
-
}, {
|
|
137018
|
-
key: "update",
|
|
137019
|
-
value: function update() {
|
|
137020
|
-
if (!MQ) {
|
|
137021
|
-
throw new Error('MQ is not defined - but component has mounted?');
|
|
137022
|
-
}
|
|
137023
|
-
if (!this.mathField) {
|
|
137024
|
-
this.mathField = MQ.StaticMath(this.input, {
|
|
137025
|
-
handlers: {
|
|
137026
|
-
edit: this.onInputEdit.bind(this)
|
|
137027
|
-
}
|
|
137028
|
-
});
|
|
137029
|
-
}
|
|
137030
|
-
try {
|
|
137031
|
-
this.mathField.parseLatex(this.props.latex);
|
|
137032
|
-
this.mathField.latex(this.props.latex);
|
|
137033
|
-
} catch (e) {
|
|
137034
|
-
this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
137035
|
-
}
|
|
137036
|
-
}
|
|
137037
|
-
}, {
|
|
137038
|
-
key: "blur",
|
|
137039
|
-
value: function blur() {
|
|
137040
|
-
log('blur mathfield');
|
|
137041
|
-
this.mathField.blur();
|
|
137042
|
-
}
|
|
137043
|
-
}, {
|
|
137044
|
-
key: "focus",
|
|
137045
|
-
value: function focus() {
|
|
137046
|
-
log('focus mathfield...');
|
|
137047
|
-
this.mathField.focus();
|
|
137153
|
+
key: "componentWillUnmount",
|
|
137154
|
+
value: function componentWillUnmount() {
|
|
137155
|
+
this.removeLiveRegion();
|
|
137156
|
+
this.removeEventListeners();
|
|
137048
137157
|
}
|
|
137049
137158
|
}, {
|
|
137050
137159
|
key: "shouldComponentUpdate",
|
|
@@ -137065,15 +137174,12 @@ const require$$11$v = _dll_pie_framework__mathquill;
|
|
|
137065
137174
|
}, {
|
|
137066
137175
|
key: "render",
|
|
137067
137176
|
value: function render() {
|
|
137068
|
-
var _this2 = this;
|
|
137069
137177
|
var _this$props = this.props, onBlur = _this$props.onBlur, className = _this$props.className;
|
|
137070
137178
|
return _react["default"].createElement("span", {
|
|
137071
137179
|
className: className,
|
|
137072
137180
|
onFocus: this.onFocus,
|
|
137073
137181
|
onBlur: onBlur,
|
|
137074
|
-
ref:
|
|
137075
|
-
return _this2.input = r;
|
|
137076
|
-
}
|
|
137182
|
+
ref: this.inputRef
|
|
137077
137183
|
});
|
|
137078
137184
|
}
|
|
137079
137185
|
}]);
|
|
@@ -144984,50 +145090,41 @@ const require$$8$e = _dll_prop_types;
|
|
|
144984
145090
|
node: _propTypes["default"].object
|
|
144985
145091
|
};
|
|
144986
145092
|
core.normalizeNode = function (node) {
|
|
144987
|
-
|
|
144988
|
-
|
|
144989
|
-
|
|
144990
|
-
|
|
144991
|
-
|
|
144992
|
-
|
|
144993
|
-
|
|
144994
|
-
|
|
144995
|
-
|
|
144996
|
-
|
|
144997
|
-
|
|
144998
|
-
|
|
144999
|
-
|
|
145000
|
-
|
|
145093
|
+
var addNodeBeforeArray = [];
|
|
145094
|
+
if (node.object !== 'document') return;
|
|
145095
|
+
node.findDescendant(function (d) {
|
|
145096
|
+
if (d.type === 'table') {
|
|
145097
|
+
var tablePath = node.getPath(d.key);
|
|
145098
|
+
var prevNode = node.getPreviousNode(tablePath);
|
|
145099
|
+
var nextNode = node.getNextNode(tablePath);
|
|
145100
|
+
if (!prevNode || !nextNode) {
|
|
145101
|
+
addNodeBeforeArray.push({
|
|
145102
|
+
node: d,
|
|
145103
|
+
prevNode: prevNode,
|
|
145104
|
+
nextNode: nextNode
|
|
145105
|
+
});
|
|
145106
|
+
}
|
|
145107
|
+
}
|
|
145001
145108
|
});
|
|
145002
|
-
if (
|
|
145003
|
-
shouldAddTextAfterNode = true;
|
|
145004
|
-
}
|
|
145005
|
-
if (!shouldAddTextAfterNode) {
|
|
145109
|
+
if (!addNodeBeforeArray.length) {
|
|
145006
145110
|
return;
|
|
145007
145111
|
}
|
|
145008
145112
|
return function (change) {
|
|
145009
|
-
|
|
145010
|
-
|
|
145011
|
-
|
|
145012
|
-
|
|
145013
|
-
|
|
145014
|
-
|
|
145015
|
-
|
|
145016
|
-
|
|
145017
|
-
|
|
145018
|
-
|
|
145019
|
-
|
|
145020
|
-
|
|
145021
|
-
|
|
145022
|
-
|
|
145023
|
-
|
|
145024
|
-
data: _objectSpread(_objectSpread({}, tableJSON.data), {}, {
|
|
145025
|
-
newTable: true
|
|
145026
|
-
})
|
|
145027
|
-
}));
|
|
145028
|
-
moveFocusToBeginningOfTable(change);
|
|
145029
|
-
});
|
|
145030
|
-
}
|
|
145113
|
+
var newBlock = {
|
|
145114
|
+
object: 'block',
|
|
145115
|
+
type: 'div'
|
|
145116
|
+
};
|
|
145117
|
+
addNodeBeforeArray.forEach(function (n) {
|
|
145118
|
+
var tablePath = change.value.document.getPath(n.node.key).toJSON();
|
|
145119
|
+
var indexToAdd = tablePath.splice(-1)[0];
|
|
145120
|
+
if (!n.prevNode) {
|
|
145121
|
+
change.insertNodeByPath(tablePath, indexToAdd, newBlock);
|
|
145122
|
+
return;
|
|
145123
|
+
}
|
|
145124
|
+
if (!n.nextNode) {
|
|
145125
|
+
change.insertNodeByPath(tablePath, indexToAdd + 1, newBlock);
|
|
145126
|
+
}
|
|
145127
|
+
});
|
|
145031
145128
|
};
|
|
145032
145129
|
};
|
|
145033
145130
|
core.renderNode = Node;
|
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.
|
|
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.13.0/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -37774,16 +37774,160 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37774
37774
|
var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
37775
37775
|
return string.replace(WHITESPACE_REGEX, '');
|
|
37776
37776
|
}
|
|
37777
|
+
function countBraces(latex) {
|
|
37778
|
+
var count = 0;
|
|
37779
|
+
for (var i = 0; i < (latex || '').length; i++) {
|
|
37780
|
+
if (latex[i] === '{') {
|
|
37781
|
+
count++;
|
|
37782
|
+
}
|
|
37783
|
+
}
|
|
37784
|
+
return count;
|
|
37785
|
+
}
|
|
37777
37786
|
var Static = (function (_React$Component) {
|
|
37778
37787
|
(0, _inherits2["default"])(Static, _React$Component);
|
|
37779
37788
|
var _super = _createSuper(Static);
|
|
37780
|
-
function Static() {
|
|
37789
|
+
function Static(props) {
|
|
37781
37790
|
var _this;
|
|
37782
37791
|
(0, _classCallCheck2["default"])(this, Static);
|
|
37783
|
-
|
|
37784
|
-
|
|
37785
|
-
|
|
37786
|
-
|
|
37792
|
+
_this = _super.call(this, props);
|
|
37793
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "createLiveRegion", function () {
|
|
37794
|
+
_this.liveRegion = document.createElement('div');
|
|
37795
|
+
_this.liveRegion.style.position = 'absolute';
|
|
37796
|
+
_this.liveRegion.style.width = '1px';
|
|
37797
|
+
_this.liveRegion.style.height = '1px';
|
|
37798
|
+
_this.liveRegion.style.marginTop = '-1px';
|
|
37799
|
+
_this.liveRegion.style.clip = 'rect(1px, 1px, 1px, 1px)';
|
|
37800
|
+
_this.liveRegion.style.overflow = 'hidden';
|
|
37801
|
+
_this.liveRegion.setAttribute('aria-live', 'polite');
|
|
37802
|
+
_this.liveRegion.setAttribute('aria-atomic', 'true');
|
|
37803
|
+
document.body.appendChild(_this.liveRegion);
|
|
37804
|
+
});
|
|
37805
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "addEventListeners", function () {
|
|
37806
|
+
var input = _this.inputRef.current;
|
|
37807
|
+
if (input) {
|
|
37808
|
+
input.addEventListener('keydown', _this.handleKeyDown);
|
|
37809
|
+
input.addEventListener('click', _this.handleMathKeyboardClick);
|
|
37810
|
+
}
|
|
37811
|
+
});
|
|
37812
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "removeEventListeners", function () {
|
|
37813
|
+
var input = _this.inputRef.current;
|
|
37814
|
+
if (input) {
|
|
37815
|
+
input.removeEventListener('keydown', _this.handleKeyDown);
|
|
37816
|
+
input.removeEventListener('click', _this.handleMathKeyboardClick);
|
|
37817
|
+
}
|
|
37818
|
+
});
|
|
37819
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "removeLiveRegion", function () {
|
|
37820
|
+
if (_this.liveRegion) {
|
|
37821
|
+
document.body.removeChild(_this.liveRegion);
|
|
37822
|
+
_this.liveRegion = null;
|
|
37823
|
+
}
|
|
37824
|
+
});
|
|
37825
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyDown", function (event) {
|
|
37826
|
+
if ((event === null || event === void 0 ? void 0 : event.key) === 'Backspace' || (event === null || event === void 0 ? void 0 : event.key) === 'Delete') {
|
|
37827
|
+
_this.setState({
|
|
37828
|
+
isDeleteKeyPressed: true
|
|
37829
|
+
});
|
|
37830
|
+
}
|
|
37831
|
+
_this.setState({
|
|
37832
|
+
inputSource: 'keyboard'
|
|
37833
|
+
});
|
|
37834
|
+
});
|
|
37835
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMathKeyboardClick", function () {
|
|
37836
|
+
_this.setState({
|
|
37837
|
+
inputSource: 'mathKeyboard'
|
|
37838
|
+
});
|
|
37839
|
+
});
|
|
37840
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onInputEdit", function (field) {
|
|
37841
|
+
if (!_this.mathField) {
|
|
37842
|
+
return;
|
|
37843
|
+
}
|
|
37844
|
+
var name = _this.props.getFieldName(field, _this.mathField.innerFields);
|
|
37845
|
+
if (_this.props.onSubFieldChange) {
|
|
37846
|
+
var _this$inputRef;
|
|
37847
|
+
var regexMatch = field.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
37848
|
+
if ((_this$inputRef = _this.inputRef) !== null && _this$inputRef !== void 0 && _this$inputRef.current && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
|
|
37849
|
+
try {
|
|
37850
|
+
field.__controller.cursor.insLeftOf(field.__controller.cursor.parent[-1].parent);
|
|
37851
|
+
field.el().dispatchEvent(new KeyboardEvent('keydown', {
|
|
37852
|
+
keyCode: 8
|
|
37853
|
+
}));
|
|
37854
|
+
} catch (e) {
|
|
37855
|
+
console.error(e.toString());
|
|
37856
|
+
}
|
|
37857
|
+
} else {
|
|
37858
|
+
_this.props.onSubFieldChange(name, field.latex());
|
|
37859
|
+
}
|
|
37860
|
+
}
|
|
37861
|
+
_this.announceLatexConversion(field.latex());
|
|
37862
|
+
});
|
|
37863
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "announceLatexConversion", function (newLatex) {
|
|
37864
|
+
if (!_this.state) {
|
|
37865
|
+
console.error('State is not initialized');
|
|
37866
|
+
return;
|
|
37867
|
+
}
|
|
37868
|
+
var _this$state = _this.state, previousLatex = _this$state.previousLatex, inputSource = _this$state.inputSource, isDeleteKeyPressed = _this$state.isDeleteKeyPressed;
|
|
37869
|
+
var announcement = 'Converted to math symbol';
|
|
37870
|
+
if (inputSource === 'keyboard' && !isDeleteKeyPressed) {
|
|
37871
|
+
var newBraces = countBraces(newLatex);
|
|
37872
|
+
var oldBraces = countBraces(previousLatex);
|
|
37873
|
+
if (newBraces > oldBraces) {
|
|
37874
|
+
_this.announceMessage(announcement);
|
|
37875
|
+
} else {
|
|
37876
|
+
try {
|
|
37877
|
+
_this.mathField.parseLatex(previousLatex);
|
|
37878
|
+
_this.mathField.parseLatex(newLatex);
|
|
37879
|
+
if (newLatex == previousLatex) {
|
|
37880
|
+
_this.announceMessage(announcement);
|
|
37881
|
+
}
|
|
37882
|
+
} catch (e) {
|
|
37883
|
+
console.warn('Error parsing latex:', e.message);
|
|
37884
|
+
console.warn(e);
|
|
37885
|
+
}
|
|
37886
|
+
}
|
|
37887
|
+
}
|
|
37888
|
+
_this.setState({
|
|
37889
|
+
previousLatex: newLatex,
|
|
37890
|
+
isDeleteKeyPressed: false
|
|
37891
|
+
});
|
|
37892
|
+
});
|
|
37893
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "announceMessage", function (message) {
|
|
37894
|
+
_this.setState({
|
|
37895
|
+
previousLatex: ''
|
|
37896
|
+
});
|
|
37897
|
+
if (_this.liveRegion) {
|
|
37898
|
+
_this.liveRegion.textContent = message;
|
|
37899
|
+
setTimeout(function () {
|
|
37900
|
+
_this.liveRegion.textContent = '';
|
|
37901
|
+
}, 500);
|
|
37902
|
+
}
|
|
37903
|
+
});
|
|
37904
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "update", function () {
|
|
37905
|
+
if (!MQ) {
|
|
37906
|
+
throw new Error('MQ is not defined - but component has mounted?');
|
|
37907
|
+
}
|
|
37908
|
+
if (!_this.mathField) {
|
|
37909
|
+
var _this$inputRef2;
|
|
37910
|
+
_this.mathField = MQ.StaticMath((_this$inputRef2 = _this.inputRef) === null || _this$inputRef2 === void 0 ? void 0 : _this$inputRef2.current, {
|
|
37911
|
+
handlers: {
|
|
37912
|
+
edit: _this.onInputEdit.bind((0, _assertThisInitialized2["default"])(_this))
|
|
37913
|
+
}
|
|
37914
|
+
});
|
|
37915
|
+
}
|
|
37916
|
+
try {
|
|
37917
|
+
_this.mathField.parseLatex(_this.props.latex);
|
|
37918
|
+
_this.mathField.latex(_this.props.latex);
|
|
37919
|
+
} catch (e) {
|
|
37920
|
+
_this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
37921
|
+
}
|
|
37922
|
+
});
|
|
37923
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "blur", function () {
|
|
37924
|
+
log('blur mathfield');
|
|
37925
|
+
_this.mathField.blur();
|
|
37926
|
+
});
|
|
37927
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "focus", function () {
|
|
37928
|
+
log('focus mathfield...');
|
|
37929
|
+
_this.mathField.focus();
|
|
37930
|
+
});
|
|
37787
37931
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function (e) {
|
|
37788
37932
|
try {
|
|
37789
37933
|
var rootBlock = e.target.parentElement.nextSibling;
|
|
@@ -37806,6 +37950,13 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37806
37950
|
console.error('error finding root block', err.message);
|
|
37807
37951
|
}
|
|
37808
37952
|
});
|
|
37953
|
+
_this.state = {
|
|
37954
|
+
announcement: '',
|
|
37955
|
+
previousLatex: '',
|
|
37956
|
+
inputSource: null,
|
|
37957
|
+
isDeleteKeyPressed: false
|
|
37958
|
+
};
|
|
37959
|
+
_this.inputRef = _react["default"].createRef();
|
|
37809
37960
|
return _this;
|
|
37810
37961
|
}
|
|
37811
37962
|
(0, _createClass2["default"])(Static, [{
|
|
@@ -37813,6 +37964,8 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37813
37964
|
value: function componentDidMount() {
|
|
37814
37965
|
this.update();
|
|
37815
37966
|
(0, _updateSpans.updateSpans)();
|
|
37967
|
+
this.createLiveRegion();
|
|
37968
|
+
this.addEventListeners();
|
|
37816
37969
|
}
|
|
37817
37970
|
}, {
|
|
37818
37971
|
key: "componentDidUpdate",
|
|
@@ -37821,59 +37974,10 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37821
37974
|
(0, _updateSpans.updateSpans)();
|
|
37822
37975
|
}
|
|
37823
37976
|
}, {
|
|
37824
|
-
key: "
|
|
37825
|
-
value: function
|
|
37826
|
-
|
|
37827
|
-
|
|
37828
|
-
}
|
|
37829
|
-
var name = this.props.getFieldName(field, this.mathField.innerFields);
|
|
37830
|
-
if (this.props.onSubFieldChange) {
|
|
37831
|
-
var regexMatch = field.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
37832
|
-
if (this.input && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
|
|
37833
|
-
try {
|
|
37834
|
-
field.__controller.cursor.insLeftOf(field.__controller.cursor.parent[-1].parent);
|
|
37835
|
-
field.el().dispatchEvent(new KeyboardEvent('keydown', {
|
|
37836
|
-
keyCode: 8
|
|
37837
|
-
}));
|
|
37838
|
-
} catch (e) {
|
|
37839
|
-
console.error(e.toString());
|
|
37840
|
-
}
|
|
37841
|
-
} else {
|
|
37842
|
-
this.props.onSubFieldChange(name, field.latex());
|
|
37843
|
-
}
|
|
37844
|
-
}
|
|
37845
|
-
}
|
|
37846
|
-
}, {
|
|
37847
|
-
key: "update",
|
|
37848
|
-
value: function update() {
|
|
37849
|
-
if (!MQ) {
|
|
37850
|
-
throw new Error('MQ is not defined - but component has mounted?');
|
|
37851
|
-
}
|
|
37852
|
-
if (!this.mathField) {
|
|
37853
|
-
this.mathField = MQ.StaticMath(this.input, {
|
|
37854
|
-
handlers: {
|
|
37855
|
-
edit: this.onInputEdit.bind(this)
|
|
37856
|
-
}
|
|
37857
|
-
});
|
|
37858
|
-
}
|
|
37859
|
-
try {
|
|
37860
|
-
this.mathField.parseLatex(this.props.latex);
|
|
37861
|
-
this.mathField.latex(this.props.latex);
|
|
37862
|
-
} catch (e) {
|
|
37863
|
-
this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
37864
|
-
}
|
|
37865
|
-
}
|
|
37866
|
-
}, {
|
|
37867
|
-
key: "blur",
|
|
37868
|
-
value: function blur() {
|
|
37869
|
-
log('blur mathfield');
|
|
37870
|
-
this.mathField.blur();
|
|
37871
|
-
}
|
|
37872
|
-
}, {
|
|
37873
|
-
key: "focus",
|
|
37874
|
-
value: function focus() {
|
|
37875
|
-
log('focus mathfield...');
|
|
37876
|
-
this.mathField.focus();
|
|
37977
|
+
key: "componentWillUnmount",
|
|
37978
|
+
value: function componentWillUnmount() {
|
|
37979
|
+
this.removeLiveRegion();
|
|
37980
|
+
this.removeEventListeners();
|
|
37877
37981
|
}
|
|
37878
37982
|
}, {
|
|
37879
37983
|
key: "shouldComponentUpdate",
|
|
@@ -37894,15 +37998,12 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37894
37998
|
}, {
|
|
37895
37999
|
key: "render",
|
|
37896
38000
|
value: function render() {
|
|
37897
|
-
var _this2 = this;
|
|
37898
38001
|
var _this$props = this.props, onBlur = _this$props.onBlur, className = _this$props.className;
|
|
37899
38002
|
return _react["default"].createElement("span", {
|
|
37900
38003
|
className: className,
|
|
37901
38004
|
onFocus: this.onFocus,
|
|
37902
38005
|
onBlur: onBlur,
|
|
37903
|
-
ref:
|
|
37904
|
-
return _this2.input = r;
|
|
37905
|
-
}
|
|
38006
|
+
ref: this.inputRef
|
|
37906
38007
|
});
|
|
37907
38008
|
}
|
|
37908
38009
|
}]);
|
|
@@ -66377,7 +66478,7 @@ var _interopRequireDefault$2p = interopRequireDefault.exports;
|
|
|
66377
66478
|
Object.defineProperty(color, "__esModule", {
|
|
66378
66479
|
value: true
|
|
66379
66480
|
});
|
|
66380
|
-
color.v = color.text = color.secondaryText = color.secondaryLight = color.secondaryDark = color.secondaryBackground = color.secondary = color.primaryText = color.primaryLight = color.primaryDark = color.primary = color.missing = color.incorrectSecondary = color.incorrect = color.disabled = color.defaults = color.correctSecondary = color.correct = color.background = void 0;
|
|
66481
|
+
color.v = color.text = color.secondaryText = color.secondaryLight = color.secondaryDark = color.secondaryBackground = color.secondary = color.primaryText = color.primaryLight = color.primaryDark = color.primary = color.missing = color.incorrectSecondary = color.incorrect = color.disabledSecondary = color.disabled = color.defaults = color.correctSecondary = color.correct = color.background = void 0;
|
|
66381
66482
|
var _green = _interopRequireDefault$2p(green$1);
|
|
66382
66483
|
var _orange = _interopRequireDefault$2p(orange$1);
|
|
66383
66484
|
var _pink = _interopRequireDefault$2p(pink$1);
|
|
@@ -66386,6 +66487,7 @@ var _red = _interopRequireDefault$2p(red$1);
|
|
|
66386
66487
|
var defaults = {
|
|
66387
66488
|
TEXT: 'black',
|
|
66388
66489
|
DISABLED: 'grey',
|
|
66490
|
+
DISABLED_SECONDARY: '#ABABAB',
|
|
66389
66491
|
CORRECT: _green["default"][500],
|
|
66390
66492
|
CORRECT_SECONDARY: _green["default"][50],
|
|
66391
66493
|
INCORRECT: _orange["default"][500],
|
|
@@ -66424,6 +66526,10 @@ var disabled = function disabled() {
|
|
|
66424
66526
|
return pv('disabled', defaults.DISABLED);
|
|
66425
66527
|
};
|
|
66426
66528
|
color.disabled = disabled;
|
|
66529
|
+
var disabledSecondary = function disabledSecondary() {
|
|
66530
|
+
return pv('disabled-secondary', defaults.DISABLED_SECONDARY);
|
|
66531
|
+
};
|
|
66532
|
+
color.disabledSecondary = disabledSecondary;
|
|
66427
66533
|
var correct = function correct() {
|
|
66428
66534
|
return pv('correct', defaults.CORRECT);
|
|
66429
66535
|
};
|
|
@@ -135175,50 +135281,41 @@ const require$$8$f = _dll_prop_types;
|
|
|
135175
135281
|
node: _propTypes["default"].object
|
|
135176
135282
|
};
|
|
135177
135283
|
core.normalizeNode = function (node) {
|
|
135178
|
-
|
|
135179
|
-
|
|
135180
|
-
|
|
135181
|
-
|
|
135182
|
-
|
|
135183
|
-
|
|
135184
|
-
|
|
135185
|
-
|
|
135186
|
-
|
|
135187
|
-
|
|
135188
|
-
|
|
135189
|
-
|
|
135190
|
-
|
|
135191
|
-
|
|
135284
|
+
var addNodeBeforeArray = [];
|
|
135285
|
+
if (node.object !== 'document') return;
|
|
135286
|
+
node.findDescendant(function (d) {
|
|
135287
|
+
if (d.type === 'table') {
|
|
135288
|
+
var tablePath = node.getPath(d.key);
|
|
135289
|
+
var prevNode = node.getPreviousNode(tablePath);
|
|
135290
|
+
var nextNode = node.getNextNode(tablePath);
|
|
135291
|
+
if (!prevNode || !nextNode) {
|
|
135292
|
+
addNodeBeforeArray.push({
|
|
135293
|
+
node: d,
|
|
135294
|
+
prevNode: prevNode,
|
|
135295
|
+
nextNode: nextNode
|
|
135296
|
+
});
|
|
135297
|
+
}
|
|
135298
|
+
}
|
|
135192
135299
|
});
|
|
135193
|
-
if (
|
|
135194
|
-
shouldAddTextAfterNode = true;
|
|
135195
|
-
}
|
|
135196
|
-
if (!shouldAddTextAfterNode) {
|
|
135300
|
+
if (!addNodeBeforeArray.length) {
|
|
135197
135301
|
return;
|
|
135198
135302
|
}
|
|
135199
135303
|
return function (change) {
|
|
135200
|
-
|
|
135201
|
-
|
|
135202
|
-
|
|
135203
|
-
|
|
135204
|
-
|
|
135205
|
-
|
|
135206
|
-
|
|
135207
|
-
|
|
135208
|
-
|
|
135209
|
-
|
|
135210
|
-
|
|
135211
|
-
|
|
135212
|
-
|
|
135213
|
-
|
|
135214
|
-
|
|
135215
|
-
data: _objectSpread(_objectSpread({}, tableJSON.data), {}, {
|
|
135216
|
-
newTable: true
|
|
135217
|
-
})
|
|
135218
|
-
}));
|
|
135219
|
-
moveFocusToBeginningOfTable(change);
|
|
135220
|
-
});
|
|
135221
|
-
}
|
|
135304
|
+
var newBlock = {
|
|
135305
|
+
object: 'block',
|
|
135306
|
+
type: 'div'
|
|
135307
|
+
};
|
|
135308
|
+
addNodeBeforeArray.forEach(function (n) {
|
|
135309
|
+
var tablePath = change.value.document.getPath(n.node.key).toJSON();
|
|
135310
|
+
var indexToAdd = tablePath.splice(-1)[0];
|
|
135311
|
+
if (!n.prevNode) {
|
|
135312
|
+
change.insertNodeByPath(tablePath, indexToAdd, newBlock);
|
|
135313
|
+
return;
|
|
135314
|
+
}
|
|
135315
|
+
if (!n.nextNode) {
|
|
135316
|
+
change.insertNodeByPath(tablePath, indexToAdd + 1, newBlock);
|
|
135317
|
+
}
|
|
135318
|
+
});
|
|
135222
135319
|
};
|
|
135223
135320
|
};
|
|
135224
135321
|
core.renderNode = Node;
|
package/module/index.html
CHANGED
package/module/manifest.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/complex-rubric",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"modules": [
|
|
5
5
|
{
|
|
6
6
|
"name": "@pie-lib/pie-toolbox-math-rendering-module",
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.13.0"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"name": "@pie-lib/pie-toolbox-module",
|
package/module/print.html
CHANGED
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.
|
|
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.13.0/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.12.0/module/index.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -37774,16 +37774,160 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37774
37774
|
var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
37775
37775
|
return string.replace(WHITESPACE_REGEX, '');
|
|
37776
37776
|
}
|
|
37777
|
+
function countBraces(latex) {
|
|
37778
|
+
var count = 0;
|
|
37779
|
+
for (var i = 0; i < (latex || '').length; i++) {
|
|
37780
|
+
if (latex[i] === '{') {
|
|
37781
|
+
count++;
|
|
37782
|
+
}
|
|
37783
|
+
}
|
|
37784
|
+
return count;
|
|
37785
|
+
}
|
|
37777
37786
|
var Static = (function (_React$Component) {
|
|
37778
37787
|
(0, _inherits2["default"])(Static, _React$Component);
|
|
37779
37788
|
var _super = _createSuper(Static);
|
|
37780
|
-
function Static() {
|
|
37789
|
+
function Static(props) {
|
|
37781
37790
|
var _this;
|
|
37782
37791
|
(0, _classCallCheck2["default"])(this, Static);
|
|
37783
|
-
|
|
37784
|
-
|
|
37785
|
-
|
|
37786
|
-
|
|
37792
|
+
_this = _super.call(this, props);
|
|
37793
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "createLiveRegion", function () {
|
|
37794
|
+
_this.liveRegion = document.createElement('div');
|
|
37795
|
+
_this.liveRegion.style.position = 'absolute';
|
|
37796
|
+
_this.liveRegion.style.width = '1px';
|
|
37797
|
+
_this.liveRegion.style.height = '1px';
|
|
37798
|
+
_this.liveRegion.style.marginTop = '-1px';
|
|
37799
|
+
_this.liveRegion.style.clip = 'rect(1px, 1px, 1px, 1px)';
|
|
37800
|
+
_this.liveRegion.style.overflow = 'hidden';
|
|
37801
|
+
_this.liveRegion.setAttribute('aria-live', 'polite');
|
|
37802
|
+
_this.liveRegion.setAttribute('aria-atomic', 'true');
|
|
37803
|
+
document.body.appendChild(_this.liveRegion);
|
|
37804
|
+
});
|
|
37805
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "addEventListeners", function () {
|
|
37806
|
+
var input = _this.inputRef.current;
|
|
37807
|
+
if (input) {
|
|
37808
|
+
input.addEventListener('keydown', _this.handleKeyDown);
|
|
37809
|
+
input.addEventListener('click', _this.handleMathKeyboardClick);
|
|
37810
|
+
}
|
|
37811
|
+
});
|
|
37812
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "removeEventListeners", function () {
|
|
37813
|
+
var input = _this.inputRef.current;
|
|
37814
|
+
if (input) {
|
|
37815
|
+
input.removeEventListener('keydown', _this.handleKeyDown);
|
|
37816
|
+
input.removeEventListener('click', _this.handleMathKeyboardClick);
|
|
37817
|
+
}
|
|
37818
|
+
});
|
|
37819
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "removeLiveRegion", function () {
|
|
37820
|
+
if (_this.liveRegion) {
|
|
37821
|
+
document.body.removeChild(_this.liveRegion);
|
|
37822
|
+
_this.liveRegion = null;
|
|
37823
|
+
}
|
|
37824
|
+
});
|
|
37825
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyDown", function (event) {
|
|
37826
|
+
if ((event === null || event === void 0 ? void 0 : event.key) === 'Backspace' || (event === null || event === void 0 ? void 0 : event.key) === 'Delete') {
|
|
37827
|
+
_this.setState({
|
|
37828
|
+
isDeleteKeyPressed: true
|
|
37829
|
+
});
|
|
37830
|
+
}
|
|
37831
|
+
_this.setState({
|
|
37832
|
+
inputSource: 'keyboard'
|
|
37833
|
+
});
|
|
37834
|
+
});
|
|
37835
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMathKeyboardClick", function () {
|
|
37836
|
+
_this.setState({
|
|
37837
|
+
inputSource: 'mathKeyboard'
|
|
37838
|
+
});
|
|
37839
|
+
});
|
|
37840
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onInputEdit", function (field) {
|
|
37841
|
+
if (!_this.mathField) {
|
|
37842
|
+
return;
|
|
37843
|
+
}
|
|
37844
|
+
var name = _this.props.getFieldName(field, _this.mathField.innerFields);
|
|
37845
|
+
if (_this.props.onSubFieldChange) {
|
|
37846
|
+
var _this$inputRef;
|
|
37847
|
+
var regexMatch = field.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
37848
|
+
if ((_this$inputRef = _this.inputRef) !== null && _this$inputRef !== void 0 && _this$inputRef.current && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
|
|
37849
|
+
try {
|
|
37850
|
+
field.__controller.cursor.insLeftOf(field.__controller.cursor.parent[-1].parent);
|
|
37851
|
+
field.el().dispatchEvent(new KeyboardEvent('keydown', {
|
|
37852
|
+
keyCode: 8
|
|
37853
|
+
}));
|
|
37854
|
+
} catch (e) {
|
|
37855
|
+
console.error(e.toString());
|
|
37856
|
+
}
|
|
37857
|
+
} else {
|
|
37858
|
+
_this.props.onSubFieldChange(name, field.latex());
|
|
37859
|
+
}
|
|
37860
|
+
}
|
|
37861
|
+
_this.announceLatexConversion(field.latex());
|
|
37862
|
+
});
|
|
37863
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "announceLatexConversion", function (newLatex) {
|
|
37864
|
+
if (!_this.state) {
|
|
37865
|
+
console.error('State is not initialized');
|
|
37866
|
+
return;
|
|
37867
|
+
}
|
|
37868
|
+
var _this$state = _this.state, previousLatex = _this$state.previousLatex, inputSource = _this$state.inputSource, isDeleteKeyPressed = _this$state.isDeleteKeyPressed;
|
|
37869
|
+
var announcement = 'Converted to math symbol';
|
|
37870
|
+
if (inputSource === 'keyboard' && !isDeleteKeyPressed) {
|
|
37871
|
+
var newBraces = countBraces(newLatex);
|
|
37872
|
+
var oldBraces = countBraces(previousLatex);
|
|
37873
|
+
if (newBraces > oldBraces) {
|
|
37874
|
+
_this.announceMessage(announcement);
|
|
37875
|
+
} else {
|
|
37876
|
+
try {
|
|
37877
|
+
_this.mathField.parseLatex(previousLatex);
|
|
37878
|
+
_this.mathField.parseLatex(newLatex);
|
|
37879
|
+
if (newLatex == previousLatex) {
|
|
37880
|
+
_this.announceMessage(announcement);
|
|
37881
|
+
}
|
|
37882
|
+
} catch (e) {
|
|
37883
|
+
console.warn('Error parsing latex:', e.message);
|
|
37884
|
+
console.warn(e);
|
|
37885
|
+
}
|
|
37886
|
+
}
|
|
37887
|
+
}
|
|
37888
|
+
_this.setState({
|
|
37889
|
+
previousLatex: newLatex,
|
|
37890
|
+
isDeleteKeyPressed: false
|
|
37891
|
+
});
|
|
37892
|
+
});
|
|
37893
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "announceMessage", function (message) {
|
|
37894
|
+
_this.setState({
|
|
37895
|
+
previousLatex: ''
|
|
37896
|
+
});
|
|
37897
|
+
if (_this.liveRegion) {
|
|
37898
|
+
_this.liveRegion.textContent = message;
|
|
37899
|
+
setTimeout(function () {
|
|
37900
|
+
_this.liveRegion.textContent = '';
|
|
37901
|
+
}, 500);
|
|
37902
|
+
}
|
|
37903
|
+
});
|
|
37904
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "update", function () {
|
|
37905
|
+
if (!MQ) {
|
|
37906
|
+
throw new Error('MQ is not defined - but component has mounted?');
|
|
37907
|
+
}
|
|
37908
|
+
if (!_this.mathField) {
|
|
37909
|
+
var _this$inputRef2;
|
|
37910
|
+
_this.mathField = MQ.StaticMath((_this$inputRef2 = _this.inputRef) === null || _this$inputRef2 === void 0 ? void 0 : _this$inputRef2.current, {
|
|
37911
|
+
handlers: {
|
|
37912
|
+
edit: _this.onInputEdit.bind((0, _assertThisInitialized2["default"])(_this))
|
|
37913
|
+
}
|
|
37914
|
+
});
|
|
37915
|
+
}
|
|
37916
|
+
try {
|
|
37917
|
+
_this.mathField.parseLatex(_this.props.latex);
|
|
37918
|
+
_this.mathField.latex(_this.props.latex);
|
|
37919
|
+
} catch (e) {
|
|
37920
|
+
_this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
37921
|
+
}
|
|
37922
|
+
});
|
|
37923
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "blur", function () {
|
|
37924
|
+
log('blur mathfield');
|
|
37925
|
+
_this.mathField.blur();
|
|
37926
|
+
});
|
|
37927
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "focus", function () {
|
|
37928
|
+
log('focus mathfield...');
|
|
37929
|
+
_this.mathField.focus();
|
|
37930
|
+
});
|
|
37787
37931
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function (e) {
|
|
37788
37932
|
try {
|
|
37789
37933
|
var rootBlock = e.target.parentElement.nextSibling;
|
|
@@ -37806,6 +37950,13 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37806
37950
|
console.error('error finding root block', err.message);
|
|
37807
37951
|
}
|
|
37808
37952
|
});
|
|
37953
|
+
_this.state = {
|
|
37954
|
+
announcement: '',
|
|
37955
|
+
previousLatex: '',
|
|
37956
|
+
inputSource: null,
|
|
37957
|
+
isDeleteKeyPressed: false
|
|
37958
|
+
};
|
|
37959
|
+
_this.inputRef = _react["default"].createRef();
|
|
37809
37960
|
return _this;
|
|
37810
37961
|
}
|
|
37811
37962
|
(0, _createClass2["default"])(Static, [{
|
|
@@ -37813,6 +37964,8 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37813
37964
|
value: function componentDidMount() {
|
|
37814
37965
|
this.update();
|
|
37815
37966
|
(0, _updateSpans.updateSpans)();
|
|
37967
|
+
this.createLiveRegion();
|
|
37968
|
+
this.addEventListeners();
|
|
37816
37969
|
}
|
|
37817
37970
|
}, {
|
|
37818
37971
|
key: "componentDidUpdate",
|
|
@@ -37821,59 +37974,10 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37821
37974
|
(0, _updateSpans.updateSpans)();
|
|
37822
37975
|
}
|
|
37823
37976
|
}, {
|
|
37824
|
-
key: "
|
|
37825
|
-
value: function
|
|
37826
|
-
|
|
37827
|
-
|
|
37828
|
-
}
|
|
37829
|
-
var name = this.props.getFieldName(field, this.mathField.innerFields);
|
|
37830
|
-
if (this.props.onSubFieldChange) {
|
|
37831
|
-
var regexMatch = field.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
37832
|
-
if (this.input && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
|
|
37833
|
-
try {
|
|
37834
|
-
field.__controller.cursor.insLeftOf(field.__controller.cursor.parent[-1].parent);
|
|
37835
|
-
field.el().dispatchEvent(new KeyboardEvent('keydown', {
|
|
37836
|
-
keyCode: 8
|
|
37837
|
-
}));
|
|
37838
|
-
} catch (e) {
|
|
37839
|
-
console.error(e.toString());
|
|
37840
|
-
}
|
|
37841
|
-
} else {
|
|
37842
|
-
this.props.onSubFieldChange(name, field.latex());
|
|
37843
|
-
}
|
|
37844
|
-
}
|
|
37845
|
-
}
|
|
37846
|
-
}, {
|
|
37847
|
-
key: "update",
|
|
37848
|
-
value: function update() {
|
|
37849
|
-
if (!MQ) {
|
|
37850
|
-
throw new Error('MQ is not defined - but component has mounted?');
|
|
37851
|
-
}
|
|
37852
|
-
if (!this.mathField) {
|
|
37853
|
-
this.mathField = MQ.StaticMath(this.input, {
|
|
37854
|
-
handlers: {
|
|
37855
|
-
edit: this.onInputEdit.bind(this)
|
|
37856
|
-
}
|
|
37857
|
-
});
|
|
37858
|
-
}
|
|
37859
|
-
try {
|
|
37860
|
-
this.mathField.parseLatex(this.props.latex);
|
|
37861
|
-
this.mathField.latex(this.props.latex);
|
|
37862
|
-
} catch (e) {
|
|
37863
|
-
this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
37864
|
-
}
|
|
37865
|
-
}
|
|
37866
|
-
}, {
|
|
37867
|
-
key: "blur",
|
|
37868
|
-
value: function blur() {
|
|
37869
|
-
log('blur mathfield');
|
|
37870
|
-
this.mathField.blur();
|
|
37871
|
-
}
|
|
37872
|
-
}, {
|
|
37873
|
-
key: "focus",
|
|
37874
|
-
value: function focus() {
|
|
37875
|
-
log('focus mathfield...');
|
|
37876
|
-
this.mathField.focus();
|
|
37977
|
+
key: "componentWillUnmount",
|
|
37978
|
+
value: function componentWillUnmount() {
|
|
37979
|
+
this.removeLiveRegion();
|
|
37980
|
+
this.removeEventListeners();
|
|
37877
37981
|
}
|
|
37878
37982
|
}, {
|
|
37879
37983
|
key: "shouldComponentUpdate",
|
|
@@ -37894,15 +37998,12 @@ const require$$11$x = _dll_pie_framework__mathquill;
|
|
|
37894
37998
|
}, {
|
|
37895
37999
|
key: "render",
|
|
37896
38000
|
value: function render() {
|
|
37897
|
-
var _this2 = this;
|
|
37898
38001
|
var _this$props = this.props, onBlur = _this$props.onBlur, className = _this$props.className;
|
|
37899
38002
|
return _react["default"].createElement("span", {
|
|
37900
38003
|
className: className,
|
|
37901
38004
|
onFocus: this.onFocus,
|
|
37902
38005
|
onBlur: onBlur,
|
|
37903
|
-
ref:
|
|
37904
|
-
return _this2.input = r;
|
|
37905
|
-
}
|
|
38006
|
+
ref: this.inputRef
|
|
37906
38007
|
});
|
|
37907
38008
|
}
|
|
37908
38009
|
}]);
|
|
@@ -66377,7 +66478,7 @@ var _interopRequireDefault$2p = interopRequireDefault.exports;
|
|
|
66377
66478
|
Object.defineProperty(color, "__esModule", {
|
|
66378
66479
|
value: true
|
|
66379
66480
|
});
|
|
66380
|
-
color.v = color.text = color.secondaryText = color.secondaryLight = color.secondaryDark = color.secondaryBackground = color.secondary = color.primaryText = color.primaryLight = color.primaryDark = color.primary = color.missing = color.incorrectSecondary = color.incorrect = color.disabled = color.defaults = color.correctSecondary = color.correct = color.background = void 0;
|
|
66481
|
+
color.v = color.text = color.secondaryText = color.secondaryLight = color.secondaryDark = color.secondaryBackground = color.secondary = color.primaryText = color.primaryLight = color.primaryDark = color.primary = color.missing = color.incorrectSecondary = color.incorrect = color.disabledSecondary = color.disabled = color.defaults = color.correctSecondary = color.correct = color.background = void 0;
|
|
66381
66482
|
var _green = _interopRequireDefault$2p(green$1);
|
|
66382
66483
|
var _orange = _interopRequireDefault$2p(orange$1);
|
|
66383
66484
|
var _pink = _interopRequireDefault$2p(pink$1);
|
|
@@ -66386,6 +66487,7 @@ var _red = _interopRequireDefault$2p(red$1);
|
|
|
66386
66487
|
var defaults = {
|
|
66387
66488
|
TEXT: 'black',
|
|
66388
66489
|
DISABLED: 'grey',
|
|
66490
|
+
DISABLED_SECONDARY: '#ABABAB',
|
|
66389
66491
|
CORRECT: _green["default"][500],
|
|
66390
66492
|
CORRECT_SECONDARY: _green["default"][50],
|
|
66391
66493
|
INCORRECT: _orange["default"][500],
|
|
@@ -66424,6 +66526,10 @@ var disabled = function disabled() {
|
|
|
66424
66526
|
return pv('disabled', defaults.DISABLED);
|
|
66425
66527
|
};
|
|
66426
66528
|
color.disabled = disabled;
|
|
66529
|
+
var disabledSecondary = function disabledSecondary() {
|
|
66530
|
+
return pv('disabled-secondary', defaults.DISABLED_SECONDARY);
|
|
66531
|
+
};
|
|
66532
|
+
color.disabledSecondary = disabledSecondary;
|
|
66427
66533
|
var correct = function correct() {
|
|
66428
66534
|
return pv('correct', defaults.CORRECT);
|
|
66429
66535
|
};
|
|
@@ -135175,50 +135281,41 @@ const require$$8$f = _dll_prop_types;
|
|
|
135175
135281
|
node: _propTypes["default"].object
|
|
135176
135282
|
};
|
|
135177
135283
|
core.normalizeNode = function (node) {
|
|
135178
|
-
|
|
135179
|
-
|
|
135180
|
-
|
|
135181
|
-
|
|
135182
|
-
|
|
135183
|
-
|
|
135184
|
-
|
|
135185
|
-
|
|
135186
|
-
|
|
135187
|
-
|
|
135188
|
-
|
|
135189
|
-
|
|
135190
|
-
|
|
135191
|
-
|
|
135284
|
+
var addNodeBeforeArray = [];
|
|
135285
|
+
if (node.object !== 'document') return;
|
|
135286
|
+
node.findDescendant(function (d) {
|
|
135287
|
+
if (d.type === 'table') {
|
|
135288
|
+
var tablePath = node.getPath(d.key);
|
|
135289
|
+
var prevNode = node.getPreviousNode(tablePath);
|
|
135290
|
+
var nextNode = node.getNextNode(tablePath);
|
|
135291
|
+
if (!prevNode || !nextNode) {
|
|
135292
|
+
addNodeBeforeArray.push({
|
|
135293
|
+
node: d,
|
|
135294
|
+
prevNode: prevNode,
|
|
135295
|
+
nextNode: nextNode
|
|
135296
|
+
});
|
|
135297
|
+
}
|
|
135298
|
+
}
|
|
135192
135299
|
});
|
|
135193
|
-
if (
|
|
135194
|
-
shouldAddTextAfterNode = true;
|
|
135195
|
-
}
|
|
135196
|
-
if (!shouldAddTextAfterNode) {
|
|
135300
|
+
if (!addNodeBeforeArray.length) {
|
|
135197
135301
|
return;
|
|
135198
135302
|
}
|
|
135199
135303
|
return function (change) {
|
|
135200
|
-
|
|
135201
|
-
|
|
135202
|
-
|
|
135203
|
-
|
|
135204
|
-
|
|
135205
|
-
|
|
135206
|
-
|
|
135207
|
-
|
|
135208
|
-
|
|
135209
|
-
|
|
135210
|
-
|
|
135211
|
-
|
|
135212
|
-
|
|
135213
|
-
|
|
135214
|
-
|
|
135215
|
-
data: _objectSpread(_objectSpread({}, tableJSON.data), {}, {
|
|
135216
|
-
newTable: true
|
|
135217
|
-
})
|
|
135218
|
-
}));
|
|
135219
|
-
moveFocusToBeginningOfTable(change);
|
|
135220
|
-
});
|
|
135221
|
-
}
|
|
135304
|
+
var newBlock = {
|
|
135305
|
+
object: 'block',
|
|
135306
|
+
type: 'div'
|
|
135307
|
+
};
|
|
135308
|
+
addNodeBeforeArray.forEach(function (n) {
|
|
135309
|
+
var tablePath = change.value.document.getPath(n.node.key).toJSON();
|
|
135310
|
+
var indexToAdd = tablePath.splice(-1)[0];
|
|
135311
|
+
if (!n.prevNode) {
|
|
135312
|
+
change.insertNodeByPath(tablePath, indexToAdd, newBlock);
|
|
135313
|
+
return;
|
|
135314
|
+
}
|
|
135315
|
+
if (!n.nextNode) {
|
|
135316
|
+
change.insertNodeByPath(tablePath, indexToAdd + 1, newBlock);
|
|
135317
|
+
}
|
|
135318
|
+
});
|
|
135222
135319
|
};
|
|
135223
135320
|
};
|
|
135224
135321
|
core.renderNode = Node;
|
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.
|
|
4
|
+
"version": "2.11.1-next.14+5684f4f62",
|
|
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.
|
|
11
|
-
"@pie-element/rubric": "^3.
|
|
10
|
+
"@pie-element/multi-trait-rubric": "^3.11.1-next.14+5684f4f62",
|
|
11
|
+
"@pie-element/rubric": "^3.11.1-next.14+5684f4f62",
|
|
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": "
|
|
18
|
+
"gitHead": "5684f4f62514a113e675718a8ae76613004883bf",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|