@pie-lib/math-toolbar 1.31.2-next.0 → 1.32.0-mui-update.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -15
- package/lib/done-button.js +34 -51
- package/lib/done-button.js.map +1 -1
- package/lib/editor-and-pad.js +265 -330
- package/lib/editor-and-pad.js.map +1 -1
- package/lib/index.js +64 -109
- package/lib/index.js.map +1 -1
- package/lib/math-preview.js +138 -185
- package/lib/math-preview.js.map +1 -1
- package/lib/utils.js +1 -5
- package/lib/utils.js.map +1 -1
- package/package.json +11 -9
- package/src/done-button.jsx +27 -33
- package/src/editor-and-pad.jsx +215 -229
- package/src/index.jsx +11 -14
- package/src/math-preview.jsx +124 -139
package/lib/math-preview.js
CHANGED
|
@@ -1,63 +1,156 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.RawMathPreview = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _react = _interopRequireDefault(require("react"));
|
|
23
|
-
|
|
24
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
25
|
-
|
|
26
15
|
var _debug = _interopRequireDefault(require("debug"));
|
|
27
|
-
|
|
28
|
-
var _styles = require("@material-ui/core/styles");
|
|
29
|
-
|
|
16
|
+
var _styles = require("@mui/material/styles");
|
|
30
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
18
|
var _mathInput = require("@pie-lib/math-input");
|
|
33
|
-
|
|
34
19
|
var _utils = require("./utils");
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _objectSpread(
|
|
39
|
-
|
|
40
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
|
-
|
|
42
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
-
|
|
20
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
44
24
|
var _mq$CommonMqStyles = _mathInput.mq.CommonMqStyles,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
commonMqFontStyles = _mq$CommonMqStyles.commonMqFontStyles,
|
|
26
|
+
longdivStyles = _mq$CommonMqStyles.longdivStyles,
|
|
27
|
+
supsubStyles = _mq$CommonMqStyles.supsubStyles;
|
|
48
28
|
var log = (0, _debug["default"])('@pie-lib:math-toolbar:math-preview');
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
29
|
+
var MathPreviewContainer = (0, _styles.styled)('div')(function (_ref) {
|
|
30
|
+
var theme = _ref.theme,
|
|
31
|
+
isSelected = _ref.isSelected;
|
|
32
|
+
return _objectSpread(_objectSpread(_objectSpread({
|
|
33
|
+
display: 'inline-flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
position: 'relative',
|
|
36
|
+
'& *': commonMqFontStyles
|
|
37
|
+
}, supsubStyles), longdivStyles), {}, {
|
|
38
|
+
'& > .mq-math-mode': {
|
|
39
|
+
border: isSelected ? 'solid 0px lightgrey' : 'solid 1px lightgrey'
|
|
40
|
+
},
|
|
41
|
+
'& > .mq-focused': {
|
|
42
|
+
outline: 'none',
|
|
43
|
+
boxShadow: 'none',
|
|
44
|
+
border: 'solid 1px black',
|
|
45
|
+
borderRadius: '0px'
|
|
46
|
+
},
|
|
47
|
+
'& > .mq-math-mode .mq-root-block': {
|
|
48
|
+
paddingTop: '7px !important'
|
|
49
|
+
},
|
|
50
|
+
'& > .mq-math-mode .mq-overarc ': {
|
|
51
|
+
paddingTop: '0.45em !important'
|
|
52
|
+
},
|
|
53
|
+
'& > .mq-math-mode .mq-sqrt-prefix': {
|
|
54
|
+
verticalAlign: 'baseline !important',
|
|
55
|
+
top: '1px !important',
|
|
56
|
+
left: '-0.1em !important'
|
|
57
|
+
},
|
|
58
|
+
'& > .mq-math-mode .mq-denominator': {
|
|
59
|
+
marginTop: '-5px !important',
|
|
60
|
+
padding: '0.5em 0.1em 0.1em !important'
|
|
61
|
+
},
|
|
62
|
+
'& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {
|
|
63
|
+
padding: '0 0.1em !important',
|
|
64
|
+
paddingBottom: '0 !important',
|
|
65
|
+
marginBottom: '-2px'
|
|
66
|
+
},
|
|
67
|
+
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {
|
|
68
|
+
paddingTop: '6px !important',
|
|
69
|
+
paddingLeft: '4px !important'
|
|
70
|
+
},
|
|
71
|
+
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
|
|
72
|
+
marginLeft: '0 !important'
|
|
73
|
+
},
|
|
74
|
+
'& > .mq-math-mode .mq-overarrow': {
|
|
75
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
76
|
+
},
|
|
77
|
+
'& > .mq-math-mode .mq-paren': {
|
|
78
|
+
verticalAlign: 'top !important',
|
|
79
|
+
padding: '1px 0.1em !important'
|
|
80
|
+
},
|
|
81
|
+
'& > .mq-math-mode .mq-sqrt-stem': {
|
|
82
|
+
borderTop: '0.07em solid',
|
|
83
|
+
marginLeft: '-1.5px',
|
|
84
|
+
marginTop: '-2px !important',
|
|
85
|
+
paddingTop: '5px !important'
|
|
86
|
+
},
|
|
87
|
+
'& .mq-overarrow-inner': {
|
|
88
|
+
paddingTop: '0 !important',
|
|
89
|
+
border: 'none !important'
|
|
90
|
+
},
|
|
91
|
+
'& .mq-editable-field .mq-cursor': {
|
|
92
|
+
marginTop: '-15px !important'
|
|
93
|
+
},
|
|
94
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
95
|
+
top: '7.5px',
|
|
96
|
+
marginTop: '0px',
|
|
97
|
+
minWidth: '1.23em',
|
|
98
|
+
'& *': {
|
|
99
|
+
lineHeight: '1 !important'
|
|
100
|
+
},
|
|
101
|
+
'&:before': {
|
|
102
|
+
top: '-0.4em',
|
|
103
|
+
left: '-1px'
|
|
104
|
+
},
|
|
105
|
+
'&:after': {
|
|
106
|
+
top: '0px !important',
|
|
107
|
+
position: 'absolute !important',
|
|
108
|
+
right: '-2px'
|
|
109
|
+
},
|
|
110
|
+
'&.mq-empty:after': {
|
|
111
|
+
top: '-0.45em'
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
'& .mq-overarrow.mq-arrow-right': {
|
|
115
|
+
'&:before': {
|
|
116
|
+
top: '-0.4em',
|
|
117
|
+
right: '-1px'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
'& .mq-overarrow-inner-right': {
|
|
121
|
+
display: 'none !important'
|
|
122
|
+
},
|
|
123
|
+
'& .mq-overarrow-inner-left': {
|
|
124
|
+
display: 'none !important'
|
|
125
|
+
},
|
|
126
|
+
'& .mq-longdiv-inner': {
|
|
127
|
+
borderTop: '1px solid !important',
|
|
128
|
+
paddingTop: '1.5px !important'
|
|
129
|
+
},
|
|
130
|
+
'& .mq-parallelogram': {
|
|
131
|
+
lineHeight: 0.85
|
|
132
|
+
},
|
|
133
|
+
'& span[data-prime="true"]': {
|
|
134
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
135
|
+
}
|
|
136
|
+
}, isSelected && {
|
|
137
|
+
border: "solid 1px ".concat(theme.palette.primary.main)
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
var InsideOverlay = (0, _styles.styled)('span')({
|
|
141
|
+
position: 'absolute',
|
|
142
|
+
bottom: 0,
|
|
143
|
+
left: 0,
|
|
144
|
+
right: 0,
|
|
145
|
+
top: 0
|
|
146
|
+
});
|
|
147
|
+
var RawMathPreview = exports.RawMathPreview = /*#__PURE__*/function (_React$Component) {
|
|
55
148
|
function RawMathPreview() {
|
|
56
149
|
(0, _classCallCheck2["default"])(this, RawMathPreview);
|
|
57
|
-
return
|
|
150
|
+
return _callSuper(this, RawMathPreview, arguments);
|
|
58
151
|
}
|
|
59
|
-
|
|
60
|
-
(0, _createClass2["default"])(RawMathPreview, [{
|
|
152
|
+
(0, _inherits2["default"])(RawMathPreview, _React$Component);
|
|
153
|
+
return (0, _createClass2["default"])(RawMathPreview, [{
|
|
61
154
|
key: "componentDidMount",
|
|
62
155
|
value: function componentDidMount() {
|
|
63
156
|
(0, _utils.markFractionBaseSuperscripts)();
|
|
@@ -76,165 +169,25 @@ var RawMathPreview = /*#__PURE__*/function (_React$Component) {
|
|
|
76
169
|
log('[render] data: ', this.props.node.data);
|
|
77
170
|
var latex = this.props.node.data.get('latex');
|
|
78
171
|
var _this$props = this.props,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, ' ', /*#__PURE__*/_react["default"].createElement("span", {
|
|
86
|
-
className: classes.insideOverlay
|
|
87
|
-
}), /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
|
|
172
|
+
isSelected = _this$props.isSelected,
|
|
173
|
+
onFocus = _this$props.onFocus,
|
|
174
|
+
onBlur = _this$props.onBlur;
|
|
175
|
+
return /*#__PURE__*/_react["default"].createElement(MathPreviewContainer, {
|
|
176
|
+
isSelected: isSelected
|
|
177
|
+
}, ' ', /*#__PURE__*/_react["default"].createElement(InsideOverlay, null), /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
|
|
88
178
|
latex: latex,
|
|
89
179
|
onFocus: onFocus,
|
|
90
180
|
onBlur: onBlur
|
|
91
181
|
}));
|
|
92
182
|
}
|
|
93
183
|
}]);
|
|
94
|
-
return RawMathPreview;
|
|
95
184
|
}(_react["default"].Component);
|
|
96
|
-
|
|
97
|
-
exports.RawMathPreview = RawMathPreview;
|
|
98
185
|
(0, _defineProperty2["default"])(RawMathPreview, "propTypes", {
|
|
99
186
|
latex: _propTypes["default"].string,
|
|
100
187
|
node: _propTypes["default"].object,
|
|
101
|
-
classes: _propTypes["default"].object,
|
|
102
188
|
isSelected: _propTypes["default"].bool,
|
|
103
189
|
onFocus: _propTypes["default"].func,
|
|
104
190
|
onBlur: _propTypes["default"].func
|
|
105
191
|
});
|
|
106
|
-
|
|
107
|
-
var mp = function mp(theme) {
|
|
108
|
-
return {
|
|
109
|
-
root: _objectSpread(_objectSpread(_objectSpread({
|
|
110
|
-
display: 'inline-flex',
|
|
111
|
-
alignItems: 'center',
|
|
112
|
-
position: 'relative',
|
|
113
|
-
'& *': commonMqFontStyles
|
|
114
|
-
}, supsubStyles), longdivStyles), {}, {
|
|
115
|
-
'& > .mq-math-mode': {
|
|
116
|
-
border: 'solid 1px lightgrey'
|
|
117
|
-
},
|
|
118
|
-
'& > .mq-focused': {
|
|
119
|
-
outline: 'none',
|
|
120
|
-
boxShadow: 'none',
|
|
121
|
-
border: 'solid 1px black',
|
|
122
|
-
borderRadius: '0px'
|
|
123
|
-
},
|
|
124
|
-
'& > .mq-math-mode .mq-root-block': {
|
|
125
|
-
paddingTop: '7px !important'
|
|
126
|
-
},
|
|
127
|
-
'& > .mq-math-mode .mq-overarc ': {
|
|
128
|
-
paddingTop: '0.45em !important'
|
|
129
|
-
},
|
|
130
|
-
'& > .mq-math-mode .mq-sqrt-prefix': {
|
|
131
|
-
verticalAlign: 'baseline !important',
|
|
132
|
-
top: '1px !important',
|
|
133
|
-
left: '-0.1em !important'
|
|
134
|
-
},
|
|
135
|
-
'& > .mq-math-mode .mq-denominator': {
|
|
136
|
-
marginTop: '-5px !important',
|
|
137
|
-
padding: '0.5em 0.1em 0.1em !important'
|
|
138
|
-
},
|
|
139
|
-
'& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {
|
|
140
|
-
padding: '0 0.1em !important',
|
|
141
|
-
paddingBottom: '0 !important',
|
|
142
|
-
marginBottom: '-2px'
|
|
143
|
-
},
|
|
144
|
-
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {
|
|
145
|
-
paddingTop: '6px !important',
|
|
146
|
-
paddingLeft: '4px !important'
|
|
147
|
-
},
|
|
148
|
-
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
|
|
149
|
-
marginLeft: '0 !important'
|
|
150
|
-
},
|
|
151
|
-
'& > .mq-math-mode .mq-overarrow': {
|
|
152
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
153
|
-
},
|
|
154
|
-
'& > .mq-math-mode .mq-paren': {
|
|
155
|
-
verticalAlign: 'top !important',
|
|
156
|
-
padding: '1px 0.1em !important'
|
|
157
|
-
},
|
|
158
|
-
'& > .mq-math-mode .mq-sqrt-stem': {
|
|
159
|
-
borderTop: '0.07em solid',
|
|
160
|
-
marginLeft: '-1.5px',
|
|
161
|
-
marginTop: '-2px !important',
|
|
162
|
-
paddingTop: '5px !important'
|
|
163
|
-
},
|
|
164
|
-
'& .mq-overarrow-inner': {
|
|
165
|
-
paddingTop: '0 !important',
|
|
166
|
-
border: 'none !important'
|
|
167
|
-
},
|
|
168
|
-
'& .mq-editable-field .mq-cursor': {
|
|
169
|
-
marginTop: '-15px !important'
|
|
170
|
-
},
|
|
171
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
172
|
-
top: '7.5px',
|
|
173
|
-
marginTop: '0px',
|
|
174
|
-
minWidth: '1.23em',
|
|
175
|
-
'& *': {
|
|
176
|
-
lineHeight: '1 !important'
|
|
177
|
-
},
|
|
178
|
-
'&:before': {
|
|
179
|
-
top: '-0.4em',
|
|
180
|
-
left: '-1px'
|
|
181
|
-
},
|
|
182
|
-
// NOTE: This workaround adds `!important` to enforce the correct positioning and styling
|
|
183
|
-
// of `.mq-overarrow.mq-arrow-both` elements in MathQuill. This ensures consistent display
|
|
184
|
-
// regardless of the order in which MathQuill is initialized on our websites.
|
|
185
|
-
//
|
|
186
|
-
// In the future, investigate why MathQuill scripts and styles are being initialized
|
|
187
|
-
// more than once and address the root cause to prevent potential conflicts and ensure
|
|
188
|
-
// optimal performance.
|
|
189
|
-
'&:after': {
|
|
190
|
-
top: '0px !important',
|
|
191
|
-
position: 'absolute !important',
|
|
192
|
-
right: '-2px'
|
|
193
|
-
},
|
|
194
|
-
'&.mq-empty:after': {
|
|
195
|
-
top: '-0.45em'
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
'& .mq-overarrow.mq-arrow-right': {
|
|
199
|
-
'&:before': {
|
|
200
|
-
top: '-0.4em',
|
|
201
|
-
right: '-1px'
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
'& .mq-overarrow-inner-right': {
|
|
205
|
-
display: 'none !important'
|
|
206
|
-
},
|
|
207
|
-
'& .mq-overarrow-inner-left': {
|
|
208
|
-
display: 'none !important'
|
|
209
|
-
},
|
|
210
|
-
'& .mq-longdiv-inner': {
|
|
211
|
-
borderTop: '1px solid !important',
|
|
212
|
-
paddingTop: '1.5px !important'
|
|
213
|
-
},
|
|
214
|
-
'& .mq-parallelogram': {
|
|
215
|
-
lineHeight: 0.85
|
|
216
|
-
},
|
|
217
|
-
'& span[data-prime="true"]': {
|
|
218
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
219
|
-
}
|
|
220
|
-
}),
|
|
221
|
-
selected: {
|
|
222
|
-
border: "solid 1px ".concat(theme.palette.primary.main),
|
|
223
|
-
'& > .mq-math-mode': {
|
|
224
|
-
border: 'solid 0px lightgrey'
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
insideOverlay: {
|
|
228
|
-
position: 'absolute',
|
|
229
|
-
bottom: 0,
|
|
230
|
-
left: 0,
|
|
231
|
-
right: 0,
|
|
232
|
-
top: 0
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
var _default = (0, _styles.withStyles)(mp)(RawMathPreview);
|
|
238
|
-
|
|
239
|
-
exports["default"] = _default;
|
|
192
|
+
var _default = exports["default"] = RawMathPreview;
|
|
240
193
|
//# sourceMappingURL=math-preview.js.map
|
package/lib/math-preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/math-preview.jsx"],"names":["mq","CommonMqStyles","commonMqFontStyles","longdivStyles","supsubStyles","log","RawMathPreview","prevProps","props","node","data","get","latex","classes","isSelected","onFocus","onBlur","root","selected","insideOverlay","React","Component","PropTypes","string","object","bool","func","mp","theme","display","alignItems","position","border","outline","boxShadow","borderRadius","paddingTop","verticalAlign","top","left","marginTop","padding","paddingBottom","marginBottom","paddingLeft","marginLeft","fontFamily","borderTop","minWidth","lineHeight","right","palette","primary","main","bottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,yBAA4DA,cAAGC,cAA/D;AAAA,IAAQC,kBAAR,sBAAQA,kBAAR;AAAA,IAA4BC,aAA5B,sBAA4BA,aAA5B;AAAA,IAA2CC,YAA3C,sBAA2CA,YAA3C;AAEA,IAAMC,GAAG,GAAG,uBAAM,oCAAN,CAAZ;;IAEaC,c;;;;;;;;;;;;WAUX,6BAAoB;AAClB;AACD;;;WAED,4BAAmBC,SAAnB,EAA8B;AAC5B;AACA,UAAI,KAAKC,KAAL,CAAWC,IAAX,CAAgBC,IAAhB,CAAqBC,GAArB,CAAyB,OAAzB,MAAsCJ,SAAS,CAACE,IAAV,CAAeC,IAAf,CAAoBC,GAApB,CAAwB,OAAxB,CAA1C,EAA4E;AAC1E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Gbf,MAAAA,IAAI,EAAE,CAHO;AAIbW,MAAAA,KAAK,EAAE,CAJM;AAKbZ,MAAAA,GAAG,EAAE;AALQ;AA1HM,GAAZ;AAAA,CAAX;;eAmIe,wBAAWX,EAAX,EAAerB,cAAf,C","sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport { mq } from '@pie-lib/math-input';\nimport { markFractionBaseSuperscripts } from './utils';\n\nconst { commonMqFontStyles, longdivStyles, supsubStyles } = mq.CommonMqStyles;\n\nconst log = debug('@pie-lib:math-toolbar:math-preview');\n\nexport class RawMathPreview extends React.Component {\n static propTypes = {\n latex: PropTypes.string,\n node: PropTypes.object,\n classes: PropTypes.object,\n isSelected: PropTypes.bool,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n };\n\n componentDidMount() {\n markFractionBaseSuperscripts();\n }\n\n componentDidUpdate(prevProps) {\n // Re-run only if LaTeX changed\n if (this.props.node.data.get('latex') !== prevProps.node.data.get('latex')) {\n markFractionBaseSuperscripts();\n }\n }\n\n render() {\n log('[render] data: ', this.props.node.data);\n const latex = this.props.node.data.get('latex');\n const { classes, isSelected, onFocus, onBlur } = this.props;\n return (\n <div className={classNames(classes.root, isSelected && classes.selected)}>\n {' '}\n <span className={classes.insideOverlay} />\n <mq.Static latex={latex} onFocus={onFocus} onBlur={onBlur} />\n </div>\n );\n }\n}\n\nconst mp = (theme) => ({\n root: {\n display: 'inline-flex',\n alignItems: 'center',\n position: 'relative',\n '& *': commonMqFontStyles,\n ...supsubStyles,\n ...longdivStyles,\n '& > .mq-math-mode': {\n border: 'solid 1px lightgrey',\n },\n '& > .mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: 'solid 1px black',\n borderRadius: '0px',\n },\n '& > .mq-math-mode .mq-root-block': {\n paddingTop: '7px !important',\n },\n '& > .mq-math-mode .mq-overarc ': {\n paddingTop: '0.45em !important',\n },\n '& > .mq-math-mode .mq-sqrt-prefix': {\n verticalAlign: 'baseline !important',\n top: '1px !important',\n left: '-0.1em !important',\n },\n '& > .mq-math-mode .mq-denominator': {\n marginTop: '-5px !important',\n padding: '0.5em 0.1em 0.1em !important',\n },\n '& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {\n padding: '0 0.1em !important',\n paddingBottom: '0 !important',\n marginBottom: '-2px',\n },\n '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {\n paddingTop: '6px !important',\n paddingLeft: '4px !important',\n },\n '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {\n marginLeft: '0 !important',\n },\n '& > .mq-math-mode .mq-overarrow': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n '& > .mq-math-mode .mq-paren': {\n verticalAlign: 'top !important',\n padding: '1px 0.1em !important',\n },\n\n '& > .mq-math-mode .mq-sqrt-stem': {\n borderTop: '0.07em solid',\n marginLeft: '-1.5px',\n marginTop: '-2px !important',\n paddingTop: '5px !important',\n },\n\n '& .mq-overarrow-inner': {\n paddingTop: '0 !important',\n border: 'none !important',\n },\n '& .mq-editable-field .mq-cursor': {\n marginTop: '-15px !important',\n },\n '& .mq-overarrow.mq-arrow-both': {\n top: '7.5px',\n marginTop: '0px',\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important',\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px',\n },\n // NOTE: This workaround adds `!important` to enforce the correct positioning and styling\n // of `.mq-overarrow.mq-arrow-both` elements in MathQuill. This ensures consistent display\n // regardless of the order in which MathQuill is initialized on our websites.\n //\n // In the future, investigate why MathQuill scripts and styles are being initialized\n // more than once and address the root cause to prevent potential conflicts and ensure\n // optimal performance.\n '&:after': {\n top: '0px !important',\n position: 'absolute !important',\n right: '-2px',\n },\n '&.mq-empty:after': {\n top: '-0.45em',\n },\n },\n '& .mq-overarrow.mq-arrow-right': {\n '&:before': {\n top: '-0.4em',\n right: '-1px',\n },\n },\n '& .mq-overarrow-inner-right': {\n display: 'none !important',\n },\n '& .mq-overarrow-inner-left': {\n display: 'none !important',\n },\n '& .mq-longdiv-inner': {\n borderTop: '1px solid !important',\n paddingTop: '1.5px !important',\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85,\n },\n '& span[data-prime=\"true\"]': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n },\n selected: {\n border: `solid 1px ${theme.palette.primary.main}`,\n '& > .mq-math-mode': {\n border: 'solid 0px lightgrey',\n },\n },\n insideOverlay: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n top: 0,\n },\n});\n\nexport default withStyles(mp)(RawMathPreview);\n"],"file":"math-preview.js"}
|
|
1
|
+
{"version":3,"file":"math-preview.js","names":["_react","_interopRequireDefault","require","_debug","_styles","_propTypes","_mathInput","_utils","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","ownKeys","r","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_mq$CommonMqStyles","mq","CommonMqStyles","commonMqFontStyles","longdivStyles","supsubStyles","log","debug","MathPreviewContainer","styled","_ref","theme","isSelected","display","alignItems","position","border","outline","boxShadow","borderRadius","paddingTop","verticalAlign","top","left","marginTop","padding","paddingBottom","marginBottom","paddingLeft","marginLeft","fontFamily","borderTop","minWidth","lineHeight","right","concat","palette","primary","main","InsideOverlay","bottom","RawMathPreview","exports","_React$Component","_classCallCheck2","_inherits2","_createClass2","key","value","componentDidMount","markFractionBaseSuperscripts","componentDidUpdate","prevProps","props","node","data","get","render","latex","_this$props","onFocus","onBlur","createElement","Static","React","Component","PropTypes","string","object","bool","func","_default"],"sources":["../src/math-preview.jsx"],"sourcesContent":["import React from 'react';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\nimport { mq } from '@pie-lib/math-input';\nimport { markFractionBaseSuperscripts } from './utils';\n\nconst { commonMqFontStyles, longdivStyles, supsubStyles } = mq.CommonMqStyles;\n\nconst log = debug('@pie-lib:math-toolbar:math-preview');\n\nconst MathPreviewContainer = styled('div')(({ theme, isSelected }) => ({\n display: 'inline-flex',\n alignItems: 'center',\n position: 'relative',\n '& *': commonMqFontStyles,\n ...supsubStyles,\n ...longdivStyles,\n '& > .mq-math-mode': {\n border: isSelected ? 'solid 0px lightgrey' : 'solid 1px lightgrey',\n },\n '& > .mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: 'solid 1px black',\n borderRadius: '0px',\n },\n '& > .mq-math-mode .mq-root-block': {\n paddingTop: '7px !important',\n },\n '& > .mq-math-mode .mq-overarc ': {\n paddingTop: '0.45em !important',\n },\n '& > .mq-math-mode .mq-sqrt-prefix': {\n verticalAlign: 'baseline !important',\n top: '1px !important',\n left: '-0.1em !important',\n },\n '& > .mq-math-mode .mq-denominator': {\n marginTop: '-5px !important',\n padding: '0.5em 0.1em 0.1em !important',\n },\n '& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {\n padding: '0 0.1em !important',\n paddingBottom: '0 !important',\n marginBottom: '-2px',\n },\n '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {\n paddingTop: '6px !important',\n paddingLeft: '4px !important',\n },\n '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {\n marginLeft: '0 !important',\n },\n '& > .mq-math-mode .mq-overarrow': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n '& > .mq-math-mode .mq-paren': {\n verticalAlign: 'top !important',\n padding: '1px 0.1em !important',\n },\n '& > .mq-math-mode .mq-sqrt-stem': {\n borderTop: '0.07em solid',\n marginLeft: '-1.5px',\n marginTop: '-2px !important',\n paddingTop: '5px !important',\n },\n '& .mq-overarrow-inner': {\n paddingTop: '0 !important',\n border: 'none !important',\n },\n '& .mq-editable-field .mq-cursor': {\n marginTop: '-15px !important',\n },\n '& .mq-overarrow.mq-arrow-both': {\n top: '7.5px',\n marginTop: '0px',\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important',\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px',\n },\n '&:after': {\n top: '0px !important',\n position: 'absolute !important',\n right: '-2px',\n },\n '&.mq-empty:after': {\n top: '-0.45em',\n },\n },\n '& .mq-overarrow.mq-arrow-right': {\n '&:before': {\n top: '-0.4em',\n right: '-1px',\n },\n },\n '& .mq-overarrow-inner-right': {\n display: 'none !important',\n },\n '& .mq-overarrow-inner-left': {\n display: 'none !important',\n },\n '& .mq-longdiv-inner': {\n borderTop: '1px solid !important',\n paddingTop: '1.5px !important',\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85,\n },\n '& span[data-prime=\"true\"]': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n ...(isSelected && {\n border: `solid 1px ${theme.palette.primary.main}`,\n }),\n}));\n\nconst InsideOverlay = styled('span')({\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n top: 0,\n});\n\nexport class RawMathPreview extends React.Component {\n static propTypes = {\n latex: PropTypes.string,\n node: PropTypes.object,\n isSelected: PropTypes.bool,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n };\n\n componentDidMount() {\n markFractionBaseSuperscripts();\n }\n\n componentDidUpdate(prevProps) {\n // Re-run only if LaTeX changed\n if (this.props.node.data.get('latex') !== prevProps.node.data.get('latex')) {\n markFractionBaseSuperscripts();\n }\n }\n\n render() {\n log('[render] data: ', this.props.node.data);\n const latex = this.props.node.data.get('latex');\n const { isSelected, onFocus, onBlur } = this.props;\n return (\n <MathPreviewContainer isSelected={isSelected}>\n {' '}\n <InsideOverlay />\n <mq.Static latex={latex} onFocus={onFocus} onBlur={onBlur} />\n </MathPreviewContainer>\n );\n }\n}\n\nexport default RawMathPreview;\n"],"mappings":";;;;;;;;;;;;;AAAA,I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C,QAAA,GAAA7B,OAAA,cA2BYD,cAAc","ignoreList":[]}
|
package/lib/utils.js
CHANGED
|
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.markFractionBaseSuperscripts = void 0;
|
|
7
|
-
|
|
8
|
-
var markFractionBaseSuperscripts = function markFractionBaseSuperscripts() {
|
|
7
|
+
var markFractionBaseSuperscripts = exports.markFractionBaseSuperscripts = function markFractionBaseSuperscripts() {
|
|
9
8
|
document.querySelectorAll('.mq-supsub.mq-sup-only').forEach(function (supsub) {
|
|
10
9
|
var prev = supsub.previousElementSibling;
|
|
11
|
-
|
|
12
10
|
if (prev && prev.classList.contains('mq-non-leaf') && prev.querySelector('.mq-fraction')) {
|
|
13
11
|
supsub.classList.add('mq-after-fraction-group');
|
|
14
12
|
} else {
|
|
@@ -16,6 +14,4 @@ var markFractionBaseSuperscripts = function markFractionBaseSuperscripts() {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
};
|
|
19
|
-
|
|
20
|
-
exports.markFractionBaseSuperscripts = markFractionBaseSuperscripts;
|
|
21
17
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["markFractionBaseSuperscripts","exports","document","querySelectorAll","forEach","supsub","prev","previousElementSibling","classList","contains","querySelector","add","remove"],"sources":["../src/utils.js"],"sourcesContent":["export const markFractionBaseSuperscripts = () => {\n document.querySelectorAll('.mq-supsub.mq-sup-only').forEach((supsub) => {\n const prev = supsub.previousElementSibling;\n\n if (prev && prev.classList.contains('mq-non-leaf') && prev.querySelector('.mq-fraction')) {\n supsub.classList.add('mq-after-fraction-group');\n } else {\n supsub.classList.remove('mq-after-fraction-group');\n }\n });\n};\n"],"mappings":";;;;;;AAAO,IAAMA,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAG,SAA/BA,4BAA4BA,CAAA,EAAS;EAChDE,QAAQ,CAACC,gBAAgB,CAAC,wBAAwB,CAAC,CAACC,OAAO,CAAC,UAACC,MAAM,EAAK;IACtE,IAAMC,IAAI,GAAGD,MAAM,CAACE,sBAAsB;IAE1C,IAAID,IAAI,IAAIA,IAAI,CAACE,SAAS,CAACC,QAAQ,CAAC,aAAa,CAAC,IAAIH,IAAI,CAACI,aAAa,CAAC,cAAc,CAAC,EAAE;MACxFL,MAAM,CAACG,SAAS,CAACG,GAAG,CAAC,yBAAyB,CAAC;IACjD,CAAC,MAAM;MACLN,MAAM,CAACG,SAAS,CAACI,MAAM,CAAC,yBAAyB,CAAC;IACpD;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.32.0-mui-update.0",
|
|
7
7
|
"description": "Math toolbar for editing math equations",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"math",
|
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
20
|
+
"@emotion/react": "^11.14.0",
|
|
21
|
+
"@emotion/style": "^0.8.0",
|
|
22
|
+
"@mui/icons-material": "^7.3.4",
|
|
23
|
+
"@mui/material": "^7.3.4",
|
|
24
|
+
"@pie-lib/math-input": "^6.32.0-mui-update.0",
|
|
25
|
+
"@pie-lib/render-ui": "^4.36.0-mui-update.0",
|
|
24
26
|
"classnames": "^2.2.6",
|
|
25
27
|
"debug": "^4.1.1",
|
|
26
28
|
"keycode": "^2.2.0",
|
|
@@ -28,12 +30,12 @@
|
|
|
28
30
|
"prop-types": "^15.7.2"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
|
-
"react": "^
|
|
32
|
-
"react-dom": "^
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"react-dom": "^18.2.0"
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
35
|
-
"@pie-lib/test-utils": "^0.
|
|
37
|
+
"@pie-lib/test-utils": "^0.23.0-mui-update.0"
|
|
36
38
|
},
|
|
37
39
|
"scripts": {},
|
|
38
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "2e0222bda045f46b504640a972d43787e68288c4"
|
|
39
41
|
}
|
package/src/done-button.jsx
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import IconButton from '@material
|
|
4
|
-
import Check from '@
|
|
5
|
-
import {
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
|
+
import Check from '@mui/icons-material/Check';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import classNames from 'classnames';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const StyledIconButton = styled(IconButton)(({ theme, hideBackground }) => ({
|
|
9
|
+
verticalAlign: 'top',
|
|
10
|
+
width: '28px',
|
|
11
|
+
height: '28px',
|
|
12
|
+
color: '#00bb00',
|
|
13
|
+
...(hideBackground && {
|
|
14
|
+
backgroundColor: theme.palette.common.white,
|
|
15
|
+
'&:hover': {
|
|
16
|
+
backgroundColor: theme.palette.grey[200],
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
'& .MuiIconButton-label': {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: '2px',
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
export const RawDoneButton = ({ onClick, hideBackground }) => (
|
|
26
|
+
<StyledIconButton
|
|
11
27
|
aria-label="Done"
|
|
12
|
-
className={classes.iconRoot}
|
|
13
28
|
onClick={onClick}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
root: classNames(classes.iconRoot, { [classes.hideBackground]: hideBackground }),
|
|
17
|
-
}}
|
|
29
|
+
hideBackground={hideBackground}
|
|
30
|
+
size="large"
|
|
18
31
|
>
|
|
19
32
|
<Check />
|
|
20
|
-
</
|
|
33
|
+
</StyledIconButton>
|
|
21
34
|
);
|
|
22
35
|
|
|
23
36
|
RawDoneButton.propTypes = {
|
|
24
|
-
classes: PropTypes.object.isRequired,
|
|
25
37
|
onClick: PropTypes.func,
|
|
38
|
+
hideBackground: PropTypes.bool,
|
|
26
39
|
};
|
|
27
40
|
|
|
28
|
-
const
|
|
29
|
-
iconRoot: {
|
|
30
|
-
verticalAlign: 'top',
|
|
31
|
-
width: '28px',
|
|
32
|
-
height: '28px',
|
|
33
|
-
color: '#00bb00',
|
|
34
|
-
},
|
|
35
|
-
hideBackground: {
|
|
36
|
-
backgroundColor: theme.palette.common.white,
|
|
37
|
-
|
|
38
|
-
'&:hover': {
|
|
39
|
-
backgroundColor: theme.palette.grey[200],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
label: {
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
top: '2px',
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
export const DoneButton = withStyles(styles)(RawDoneButton);
|
|
41
|
+
export const DoneButton = RawDoneButton;
|