@pie-lib/math-toolbar 1.11.31-next.135 → 1.11.31-next.1844
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.json +2 -847
- package/CHANGELOG.md +167 -130
- package/NEXT.CHANGELOG.json +1 -0
- package/lib/editor-and-pad.js +25 -103
- package/lib/editor-and-pad.js.map +1 -1
- package/lib/index.js +16 -4
- package/lib/index.js.map +1 -1
- package/lib/math-preview.js +38 -48
- package/lib/math-preview.js.map +1 -1
- package/lib/utils.js +21 -0
- package/lib/utils.js.map +1 -0
- package/package.json +7 -5
- package/src/__tests__/__snapshots__/editor-and-pad.test.js.snap +31 -0
- package/src/__tests__/__snapshots__/index.test.js.snap +30 -0
- package/src/__tests__/__snapshots__/math-preview.test.js.snap +23 -0
- package/src/__tests__/editor-and-pad.test.js +25 -0
- package/src/__tests__/index.test.js +28 -0
- package/src/__tests__/math-preview.test.js +31 -0
- package/src/editor-and-pad.jsx +21 -120
- package/src/index.jsx +12 -1
- package/src/math-preview.jsx +28 -48
- package/src/utils.js +11 -0
package/lib/math-preview.js
CHANGED
|
@@ -31,10 +31,20 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
31
31
|
|
|
32
32
|
var _mathInput = require("@pie-lib/math-input");
|
|
33
33
|
|
|
34
|
+
var _utils = require("./utils");
|
|
35
|
+
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
+
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
|
+
|
|
34
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); }; }
|
|
35
41
|
|
|
36
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; } }
|
|
37
43
|
|
|
44
|
+
var _mq$CommonMqStyles = _mathInput.mq.CommonMqStyles,
|
|
45
|
+
commonMqFontStyles = _mq$CommonMqStyles.commonMqFontStyles,
|
|
46
|
+
longdivStyles = _mq$CommonMqStyles.longdivStyles,
|
|
47
|
+
supsubStyles = _mq$CommonMqStyles.supsubStyles;
|
|
38
48
|
var log = (0, _debug["default"])('@pie-lib:math-toolbar:math-preview');
|
|
39
49
|
|
|
40
50
|
var RawMathPreview = /*#__PURE__*/function (_React$Component) {
|
|
@@ -48,6 +58,19 @@ var RawMathPreview = /*#__PURE__*/function (_React$Component) {
|
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
(0, _createClass2["default"])(RawMathPreview, [{
|
|
61
|
+
key: "componentDidMount",
|
|
62
|
+
value: function componentDidMount() {
|
|
63
|
+
(0, _utils.markFractionBaseSuperscripts)();
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "componentDidUpdate",
|
|
67
|
+
value: function componentDidUpdate(prevProps) {
|
|
68
|
+
// Re-run only if LaTeX changed
|
|
69
|
+
if (this.props.node.data.get('latex') !== prevProps.node.data.get('latex')) {
|
|
70
|
+
(0, _utils.markFractionBaseSuperscripts)();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
51
74
|
key: "render",
|
|
52
75
|
value: function render() {
|
|
53
76
|
log('[render] data: ', this.props.node.data);
|
|
@@ -83,26 +106,12 @@ exports.RawMathPreview = RawMathPreview;
|
|
|
83
106
|
|
|
84
107
|
var mp = function mp(theme) {
|
|
85
108
|
return {
|
|
86
|
-
root: {
|
|
109
|
+
root: _objectSpread(_objectSpread(_objectSpread({
|
|
87
110
|
display: 'inline-flex',
|
|
88
111
|
alignItems: 'center',
|
|
89
112
|
position: 'relative',
|
|
90
|
-
'& *':
|
|
91
|
-
|
|
92
|
-
'-webkit-font-smoothing': 'antialiased !important'
|
|
93
|
-
},
|
|
94
|
-
'& > .mq-math-mode > span > var': {
|
|
95
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
96
|
-
},
|
|
97
|
-
'& > .mq-math-mode span var': {
|
|
98
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
99
|
-
},
|
|
100
|
-
'& > .mq-math-mode .mq-nonSymbola': {
|
|
101
|
-
fontFamily: 'MJXZERO, MJXTEX-I !important'
|
|
102
|
-
},
|
|
103
|
-
'& > .mq-math-mode > span > var.mq-operator-name': {
|
|
104
|
-
fontFamily: 'MJXZERO, MJXTEX !important'
|
|
105
|
-
},
|
|
113
|
+
'& *': commonMqFontStyles
|
|
114
|
+
}, supsubStyles), longdivStyles), {}, {
|
|
106
115
|
'& > .mq-math-mode': {
|
|
107
116
|
border: 'solid 1px lightgrey'
|
|
108
117
|
},
|
|
@@ -132,23 +141,6 @@ var mp = function mp(theme) {
|
|
|
132
141
|
paddingBottom: '0 !important',
|
|
133
142
|
marginBottom: '-2px'
|
|
134
143
|
},
|
|
135
|
-
'& > .mq-math-mode sup.mq-nthroot': {
|
|
136
|
-
fontSize: '70.7% !important',
|
|
137
|
-
verticalAlign: '0.5em !important',
|
|
138
|
-
paddingRight: '0.15em'
|
|
139
|
-
},
|
|
140
|
-
'& > .mq-longdiv-inner': {
|
|
141
|
-
marginTop: '-1px',
|
|
142
|
-
marginLeft: '5px !important;',
|
|
143
|
-
'& > .mq-empty': {
|
|
144
|
-
padding: '0 !important',
|
|
145
|
-
marginLeft: '0px !important',
|
|
146
|
-
marginTop: '2px'
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
'& > .mq-math-mode .mq-longdiv': {
|
|
150
|
-
display: 'inline-flex !important'
|
|
151
|
-
},
|
|
152
144
|
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {
|
|
153
145
|
paddingTop: '6px !important',
|
|
154
146
|
paddingLeft: '4px !important'
|
|
@@ -156,9 +148,6 @@ var mp = function mp(theme) {
|
|
|
156
148
|
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
|
|
157
149
|
marginLeft: '0 !important'
|
|
158
150
|
},
|
|
159
|
-
'& > .mq-math-mode .mq-supsub': {
|
|
160
|
-
fontSize: '70.7% !important'
|
|
161
|
-
},
|
|
162
151
|
'& > .mq-math-mode .mq-overarrow': {
|
|
163
152
|
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
164
153
|
},
|
|
@@ -172,15 +161,6 @@ var mp = function mp(theme) {
|
|
|
172
161
|
marginTop: '-2px !important',
|
|
173
162
|
paddingTop: '5px !important'
|
|
174
163
|
},
|
|
175
|
-
'& > .mq-supsub ': {
|
|
176
|
-
fontSize: '70.7%'
|
|
177
|
-
},
|
|
178
|
-
'& > .mq-math-mode .mq-supsub.mq-sup-only': {
|
|
179
|
-
verticalAlign: '-0.1em !important',
|
|
180
|
-
'& .mq-sup': {
|
|
181
|
-
marginBottom: '0px !important'
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
164
|
'& .mq-overarrow-inner': {
|
|
185
165
|
paddingTop: '0 !important',
|
|
186
166
|
border: 'none !important'
|
|
@@ -199,9 +179,16 @@ var mp = function mp(theme) {
|
|
|
199
179
|
top: '-0.4em',
|
|
200
180
|
left: '-1px'
|
|
201
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.
|
|
202
189
|
'&:after': {
|
|
203
190
|
top: '0px !important',
|
|
204
|
-
position: 'absolute',
|
|
191
|
+
position: 'absolute !important',
|
|
205
192
|
right: '-2px'
|
|
206
193
|
},
|
|
207
194
|
'&.mq-empty:after': {
|
|
@@ -226,8 +213,11 @@ var mp = function mp(theme) {
|
|
|
226
213
|
},
|
|
227
214
|
'& .mq-parallelogram': {
|
|
228
215
|
lineHeight: 0.85
|
|
216
|
+
},
|
|
217
|
+
'& span[data-prime="true"]': {
|
|
218
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
229
219
|
}
|
|
230
|
-
},
|
|
220
|
+
}),
|
|
231
221
|
selected: {
|
|
232
222
|
border: "solid 1px ".concat(theme.palette.primary.main),
|
|
233
223
|
'& > .mq-math-mode': {
|
package/lib/math-preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/math-preview.jsx"],"names":["log","RawMathPreview","props","node","data","latex","get","classes","isSelected","onFocus","onBlur","root","selected","insideOverlay","React","Component","PropTypes","string","object","bool","func","mp","theme","display","alignItems","position","fontFamily","border","outline","boxShadow","borderRadius","paddingTop","verticalAlign","top","left","marginTop","padding","paddingBottom","marginBottom","fontSize","paddingRight","marginLeft","paddingLeft","borderTop","minWidth","lineHeight","right","palette","primary","main","bottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;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B;AAO/B,oBAAY;AACVZ,UAAAA,GAAG,EAAE,QADK;AAEVC,UAAAA,IAAI,EAAE;AAFI,SAPmB;AAW/B,mBAAW;AACTD,UAAAA,GAAG,EAAE,gBADI;AAETR,UAAAA,QAAQ,EAAE,UAFD;AAGTqB,UAAAA,KAAK,EAAE;AAHE,SAXoB;AAgB/B,4BAAoB;AAClBb,UAAAA,GAAG,EAAE;AADa;AAhBW,OA7G7B;AAiIJ,wCAAkC;AAChC,oBAAY;AACVA,UAAAA,GAAG,EAAE,QADK;AAEVa,UAAAA,KAAK,EAAE;AAFG;AADoB,OAjI9B;AAuIJ,qCAA+B;AAC7BvB,QAAAA,OAAO,EAAE;AADoB,OAvI3B;AA0IJ,oCAA8B;AAC5BA,QAAAA,OAAO,EAAE;AADmB,OA1I1B;AA6IJ,6BAAuB;AACrBoB,QAAAA,SAAS,EAAE,sBADU;AAErBZ,QAAAA,UAAU,EAAE;AAFS,OA7InB;AAiJJ,6BAAuB;AACrBc,QAAAA,UAAU,EAAE;AADS;AAjJnB,KADe;AAsJrBjC,IAAAA,QAAQ,EAAE;AACRe,MAAAA,MAAM,sBAAeL,KAAK,CAACyB,OAAN,CAAcC,OAAd,CAAsBC,IAArC,CADE;AAER,2BAAqB;AACnBtB,QAAAA,MAAM,EAAE;AADW;AAFb,KAtJW;AA4JrBd,IAAAA,aAAa,EAAE;AACbY,MAAAA,QAAQ,EAAE,UADG;AAEbyB,MAAAA,MAAM,EAAE,CAFK;AAGbhB,MAAAA,IAAI,EAAE,CAHO;AAIbY,MAAAA,KAAK,EAAE,CAJM;AAKbb,MAAAA,GAAG,EAAE;AALQ;AA5JM,GAAZ;AAAA,CAAX;;eAqKe,wBAAWZ,EAAX,EAAepB,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';\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 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 '& *': {\n fontFamily: 'MJXZERO, MJXTEX !important',\n '-webkit-font-smoothing': 'antialiased !important',\n },\n '& > .mq-math-mode > span > var': {\n fontFamily: 'MJXZERO, MJXTEX-I !important',\n },\n '& > .mq-math-mode span var': {\n fontFamily: 'MJXZERO, MJXTEX-I !important',\n },\n '& > .mq-math-mode .mq-nonSymbola': {\n fontFamily: 'MJXZERO, MJXTEX-I !important',\n },\n '& > .mq-math-mode > span > var.mq-operator-name': {\n fontFamily: 'MJXZERO, MJXTEX !important',\n },\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 sup.mq-nthroot': {\n fontSize: '70.7% !important',\n verticalAlign: '0.5em !important',\n paddingRight: '0.15em',\n },\n '& > .mq-longdiv-inner': {\n marginTop: '-1px',\n marginLeft: '5px !important;',\n\n '& > .mq-empty': {\n padding: '0 !important',\n marginLeft: '0px !important',\n marginTop: '2px',\n },\n },\n '& > .mq-math-mode .mq-longdiv': {\n display: 'inline-flex !important',\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-supsub': {\n fontSize: '70.7% !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 '& > .mq-supsub ': {\n fontSize: '70.7%',\n },\n\n '& > .mq-math-mode .mq-supsub.mq-sup-only': {\n verticalAlign: '-0.1em !important',\n\n '& .mq-sup': {\n marginBottom: '0px !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 '&:after': {\n top: '0px !important',\n position: 'absolute',\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 },\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,"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;AACD;AACF;;;W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AI,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"}
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.markFractionBaseSuperscripts = void 0;
|
|
7
|
+
|
|
8
|
+
var markFractionBaseSuperscripts = function markFractionBaseSuperscripts() {
|
|
9
|
+
document.querySelectorAll('.mq-supsub.mq-sup-only').forEach(function (supsub) {
|
|
10
|
+
var prev = supsub.previousElementSibling;
|
|
11
|
+
|
|
12
|
+
if (prev && prev.classList.contains('mq-non-leaf') && prev.querySelector('.mq-fraction')) {
|
|
13
|
+
supsub.classList.add('mq-after-fraction-group');
|
|
14
|
+
} else {
|
|
15
|
+
supsub.classList.remove('mq-after-fraction-group');
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.markFractionBaseSuperscripts = markFractionBaseSuperscripts;
|
|
21
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils.js"],"names":["markFractionBaseSuperscripts","document","querySelectorAll","forEach","supsub","prev","previousElementSibling","classList","contains","querySelector","add","remove"],"mappings":";;;;;;;AAAO,IAAMA,4BAA4B,GAAG,SAA/BA,4BAA+B,GAAM;AAChDC,EAAAA,QAAQ,CAACC,gBAAT,CAA0B,wBAA1B,EAAoDC,OAApD,CAA4D,UAACC,MAAD,EAAY;AACtE,QAAMC,IAAI,GAAGD,MAAM,CAACE,sBAApB;;AAEA,QAAID,IAAI,IAAIA,IAAI,CAACE,SAAL,CAAeC,QAAf,CAAwB,aAAxB,CAAR,IAAkDH,IAAI,CAACI,aAAL,CAAmB,cAAnB,CAAtD,EAA0F;AACxFL,MAAAA,MAAM,CAACG,SAAP,CAAiBG,GAAjB,CAAqB,yBAArB;AACD,KAFD,MAEO;AACLN,MAAAA,MAAM,CAACG,SAAP,CAAiBI,MAAjB,CAAwB,yBAAxB;AACD;AACF,GARD;AASD,CAVM","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"],"file":"utils.js"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.11.31-next.
|
|
6
|
+
"version": "1.11.31-next.1844+4ac095ca",
|
|
7
7
|
"description": "Math toolbar for editing math equations",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"math",
|
|
@@ -19,19 +19,21 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@material-ui/core": "^3.8.3",
|
|
21
21
|
"@material-ui/icons": "^3.0.2",
|
|
22
|
-
"@pie-lib/math-input": "^6.11.
|
|
22
|
+
"@pie-lib/math-input": "^6.11.5-next.1844+4ac095ca",
|
|
23
|
+
"@pie-lib/render-ui": "^4.15.10-next.1639+4ac095ca",
|
|
23
24
|
"classnames": "^2.2.6",
|
|
24
25
|
"debug": "^4.1.1",
|
|
25
26
|
"keycode": "^2.2.0",
|
|
26
|
-
"lodash": "^4.17.11"
|
|
27
|
+
"lodash": "^4.17.11",
|
|
28
|
+
"prop-types": "^15.7.2"
|
|
27
29
|
},
|
|
28
30
|
"peerDependencies": {
|
|
29
31
|
"react": "^16.8.1",
|
|
30
32
|
"react-dom": "^16.9.0"
|
|
31
33
|
},
|
|
32
34
|
"devDependencies": {
|
|
33
|
-
"@pie-lib/test-utils": "^0.2.
|
|
35
|
+
"@pie-lib/test-utils": "^0.2.34-next.1848+4ac095ca"
|
|
34
36
|
},
|
|
35
37
|
"scripts": {},
|
|
36
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4ac095ca931e5fe8f131f28f41dd61093bd55d98"
|
|
37
39
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`snapshot renders 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className=""
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className=""
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
className=""
|
|
12
|
+
>
|
|
13
|
+
<WithStyles(Input)
|
|
14
|
+
className=""
|
|
15
|
+
innerRef={[Function]}
|
|
16
|
+
onBlur={[Function]}
|
|
17
|
+
onChange={[Function]}
|
|
18
|
+
onFocus={[Function]}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<hr />
|
|
23
|
+
<HorizontalKeypad
|
|
24
|
+
additionalKeys={Array []}
|
|
25
|
+
className=""
|
|
26
|
+
mode="scientific"
|
|
27
|
+
noDecimal={false}
|
|
28
|
+
onClick={[Function]}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`snapshot renders with DONE button if hideDoneButton is not defined 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className=""
|
|
6
|
+
>
|
|
7
|
+
<div />
|
|
8
|
+
<WithStyles(EditorAndPad)
|
|
9
|
+
classNames={Object {}}
|
|
10
|
+
controlledKeypad={true}
|
|
11
|
+
showKeypad={true}
|
|
12
|
+
/>
|
|
13
|
+
<WithStyles(RawDoneButton)
|
|
14
|
+
hideBackground={false}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
exports[`snapshot renders without DONE button if hideDoneButton value is true 1`] = `
|
|
20
|
+
<div
|
|
21
|
+
className=""
|
|
22
|
+
>
|
|
23
|
+
<div />
|
|
24
|
+
<WithStyles(EditorAndPad)
|
|
25
|
+
classNames={Object {}}
|
|
26
|
+
controlledKeypad={true}
|
|
27
|
+
showKeypad={true}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`snapshot renders 1`] = `
|
|
4
|
+
<RawMathPreview
|
|
5
|
+
classes={
|
|
6
|
+
Object {
|
|
7
|
+
"insideOverlay": "RawMathPreview-insideOverlay-3",
|
|
8
|
+
"root": "RawMathPreview-root-1",
|
|
9
|
+
"selected": "RawMathPreview-selected-2",
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
isSelected={false}
|
|
13
|
+
node={
|
|
14
|
+
Object {
|
|
15
|
+
"data": Object {
|
|
16
|
+
"get": [MockFunction],
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
onBlur={[MockFunction]}
|
|
21
|
+
onFocus={[MockFunction]}
|
|
22
|
+
/>
|
|
23
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EditorAndPad } from '../editor-and-pad';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
describe('snapshot', () => {
|
|
6
|
+
let wrapper;
|
|
7
|
+
let onBlur = jest.fn();
|
|
8
|
+
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
wrapper = (extras) => {
|
|
11
|
+
const defaults = {
|
|
12
|
+
classes: {},
|
|
13
|
+
classNames: {},
|
|
14
|
+
onBlur,
|
|
15
|
+
};
|
|
16
|
+
const props = { ...defaults, ...extras };
|
|
17
|
+
|
|
18
|
+
return shallow(<EditorAndPad {...props} />);
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('renders', () => {
|
|
23
|
+
expect(wrapper()).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RawPureToolbar } from '../index';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
describe('snapshot', () => {
|
|
6
|
+
let wrapper;
|
|
7
|
+
|
|
8
|
+
beforeAll(() => {
|
|
9
|
+
wrapper = (extras) => {
|
|
10
|
+
const defaults = {
|
|
11
|
+
classes: {},
|
|
12
|
+
controlledKeypad: true,
|
|
13
|
+
showKeypad: true,
|
|
14
|
+
};
|
|
15
|
+
const props = { ...defaults, ...extras };
|
|
16
|
+
|
|
17
|
+
return shallow(<RawPureToolbar {...props} />);
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('renders with DONE button if hideDoneButton is not defined', () => {
|
|
22
|
+
expect(wrapper()).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('renders without DONE button if hideDoneButton value is true', () => {
|
|
26
|
+
expect(wrapper({ hideDoneButton: true })).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
import MathPreview from '../math-preview';
|
|
5
|
+
|
|
6
|
+
describe('snapshot', () => {
|
|
7
|
+
let wrapper;
|
|
8
|
+
|
|
9
|
+
beforeAll(() => {
|
|
10
|
+
wrapper = (extras) => {
|
|
11
|
+
const defaults = {
|
|
12
|
+
node: {
|
|
13
|
+
data: {
|
|
14
|
+
get: jest.fn().mockReturnValue('sqrt(5)'),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
classes: {},
|
|
18
|
+
isSelected: false,
|
|
19
|
+
onFocus: jest.fn(),
|
|
20
|
+
onBlur: jest.fn(),
|
|
21
|
+
};
|
|
22
|
+
const props = { ...defaults, ...extras };
|
|
23
|
+
|
|
24
|
+
return shallow(<MathPreview {...props} />);
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('renders', () => {
|
|
29
|
+
expect(wrapper()).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
});
|