@zzish/math-rich-input 0.1.22 → 0.1.24

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/dist/index.js CHANGED
@@ -22768,7 +22768,12 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22768
22768
  });
22769
22769
 
22770
22770
  _defineProperty(_assertThisInitialized(_this2), "handleFocus", function (event) {
22771
- // console.log("handleFocus")
22771
+ var onFocus = _this2.props.onFocus;
22772
+
22773
+ if (onFocus != null) {
22774
+ onFocus();
22775
+ }
22776
+
22772
22777
  try {
22773
22778
  _this2._setRangeParams(_this2.getOldRangeParams());
22774
22779
 
@@ -22781,6 +22786,12 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22781
22786
  });
22782
22787
 
22783
22788
  _defineProperty(_assertThisInitialized(_this2), "handleBlur", function (event) {
22789
+ var onBlur = _this2.props.onBlur;
22790
+
22791
+ if (onBlur != null) {
22792
+ onBlur();
22793
+ }
22794
+
22784
22795
  try {
22785
22796
  _this2.setState({
22786
22797
  hasFocus: false,
@@ -233,6 +233,136 @@
233
233
  .EquationEditorModal .slider.round:before {
234
234
  border-radius: 50%;
235
235
  }
236
+ /* Note that the top left position of the toolbar is set programatically in componentDidMount */
237
+
238
+ .Toolbar {
239
+ position: absolute;
240
+ z-index: 1;
241
+ display: flex;
242
+ height: 42px;
243
+ background-color: white;
244
+ border: 1px solid #d0d0d0;
245
+ border-radius: 5px;
246
+ box-shadow: 1px 1px 5px #a0a0a0;
247
+ animation: 0.5s fadeIn1;
248
+ animation-fill-mode: forwards;
249
+ }
250
+
251
+ @keyframes fadeIn1 {
252
+ 0% {
253
+ opacity: 0;
254
+ }
255
+ 100% {
256
+ opacity: 1;
257
+ }
258
+ }
259
+
260
+ .Toolbar-button {
261
+ font-family: sans-serif;
262
+ font-size: 16px;
263
+ width: 40px;
264
+ height: 36px;
265
+ background-color: white;
266
+ border-radius: 5px;
267
+ border: 0px;
268
+ padding: 1px;
269
+ margin: 2px;
270
+ }
271
+
272
+ .Toolbar-button:hover {
273
+ color: white;
274
+ background: #663676;
275
+ cursor: pointer;
276
+ }
277
+
278
+ .Toolbar-button:active {
279
+ background: #808080;
280
+ color: white;
281
+ cursor: pointer;
282
+ }
283
+
284
+ .TB-narrow {
285
+ width: 30px;
286
+ }
287
+
288
+ .TB-wide {
289
+ width: 46px;
290
+ }
291
+
292
+ .TB-selected {
293
+ background: #d0d0d0;
294
+ color: black;
295
+ cursor: pointer;
296
+ animation: 0.2s TB-fadeIn;
297
+ animation-fill-mode: forwards;
298
+ }
299
+
300
+ .TB-selected:hover {
301
+ color: white;
302
+ background: #663676;
303
+ cursor: pointer;
304
+ }
305
+
306
+ @keyframes TB-fadeIn {
307
+ 00% {
308
+ background: white;
309
+ }
310
+ 100% {
311
+ background: #d0d0d0;
312
+ }
313
+ }
314
+
315
+ /* Tooltip text */
316
+ .Toolbar-button .tooltiptext {
317
+ font-weight: normal;
318
+ visibility: hidden;
319
+ width: 100px;
320
+ background-color: #222;
321
+ color: #fff;
322
+ /*font-weight: bold;*/
323
+ font-size: 12px;
324
+ text-align: center;
325
+ padding: 4px 10px;
326
+ border-radius: 6px;
327
+
328
+ /* Position the tooltip text - see examples below! */
329
+ position: absolute;
330
+ z-index: 2;
331
+ top: -90%; /* Must leave a small gap between tooltip and button */
332
+ left: 50px;
333
+
334
+ /* transform: translate (50%,0%); */
335
+ }
336
+
337
+ /* Show the tooltip text when you mouse over the tooltip container */
338
+ .Toolbar-button:hover .tooltiptext {
339
+ animation: 0.8s fadeIn2;
340
+ animation-fill-mode: forwards;
341
+ visibility: visible;
342
+ /* width: 100px; */
343
+ /* top: -90%; */ /* Must leave a small gap between tooltip and button */
344
+ /* left: 20%; */
345
+ /* margin-left: -50px; */
346
+ }
347
+
348
+ @keyframes fadeIn2 {
349
+ 00% {
350
+ opacity: 0;
351
+ }
352
+ 70% {
353
+ opacity: 0;
354
+ }
355
+ 100% {
356
+ visibility: visible;
357
+ opacity: 0.9;
358
+ }
359
+ }
360
+
361
+ /* .tooltip {
362
+ position: relative;
363
+ display: inline-block;
364
+ border-bottom: 1px dotted black; /* If you want dots under the hoverable text
365
+ } */
236
366
  /* Note that the top left position of the accent bar is set programatically in componentDidMount */
237
367
 
238
368
  .AccentBar {
@@ -408,136 +538,6 @@
408
538
  animation: 0.4s fadeIn1;
409
539
  animation-fill-mode: forwards;
410
540
  }
411
- /* Note that the top left position of the toolbar is set programatically in componentDidMount */
412
-
413
- .Toolbar {
414
- position: absolute;
415
- z-index: 1;
416
- display: flex;
417
- height: 42px;
418
- background-color: white;
419
- border: 1px solid #d0d0d0;
420
- border-radius: 5px;
421
- box-shadow: 1px 1px 5px #a0a0a0;
422
- animation: 0.5s fadeIn1;
423
- animation-fill-mode: forwards;
424
- }
425
-
426
- @keyframes fadeIn1 {
427
- 0% {
428
- opacity: 0;
429
- }
430
- 100% {
431
- opacity: 1;
432
- }
433
- }
434
-
435
- .Toolbar-button {
436
- font-family: sans-serif;
437
- font-size: 16px;
438
- width: 40px;
439
- height: 36px;
440
- background-color: white;
441
- border-radius: 5px;
442
- border: 0px;
443
- padding: 1px;
444
- margin: 2px;
445
- }
446
-
447
- .Toolbar-button:hover {
448
- color: white;
449
- background: #663676;
450
- cursor: pointer;
451
- }
452
-
453
- .Toolbar-button:active {
454
- background: #808080;
455
- color: white;
456
- cursor: pointer;
457
- }
458
-
459
- .TB-narrow {
460
- width: 30px;
461
- }
462
-
463
- .TB-wide {
464
- width: 46px;
465
- }
466
-
467
- .TB-selected {
468
- background: #d0d0d0;
469
- color: black;
470
- cursor: pointer;
471
- animation: 0.2s TB-fadeIn;
472
- animation-fill-mode: forwards;
473
- }
474
-
475
- .TB-selected:hover {
476
- color: white;
477
- background: #663676;
478
- cursor: pointer;
479
- }
480
-
481
- @keyframes TB-fadeIn {
482
- 00% {
483
- background: white;
484
- }
485
- 100% {
486
- background: #d0d0d0;
487
- }
488
- }
489
-
490
- /* Tooltip text */
491
- .Toolbar-button .tooltiptext {
492
- font-weight: normal;
493
- visibility: hidden;
494
- width: 100px;
495
- background-color: #222;
496
- color: #fff;
497
- /*font-weight: bold;*/
498
- font-size: 12px;
499
- text-align: center;
500
- padding: 4px 10px;
501
- border-radius: 6px;
502
-
503
- /* Position the tooltip text - see examples below! */
504
- position: absolute;
505
- z-index: 2;
506
- top: -90%; /* Must leave a small gap between tooltip and button */
507
- left: 50px;
508
-
509
- /* transform: translate (50%,0%); */
510
- }
511
-
512
- /* Show the tooltip text when you mouse over the tooltip container */
513
- .Toolbar-button:hover .tooltiptext {
514
- animation: 0.8s fadeIn2;
515
- animation-fill-mode: forwards;
516
- visibility: visible;
517
- /* width: 100px; */
518
- /* top: -90%; */ /* Must leave a small gap between tooltip and button */
519
- /* left: 20%; */
520
- /* margin-left: -50px; */
521
- }
522
-
523
- @keyframes fadeIn2 {
524
- 00% {
525
- opacity: 0;
526
- }
527
- 70% {
528
- opacity: 0;
529
- }
530
- 100% {
531
- visibility: visible;
532
- opacity: 0.9;
533
- }
534
- }
535
-
536
- /* .tooltip {
537
- position: relative;
538
- display: inline-block;
539
- border-bottom: 1px dotted black; /* If you want dots under the hoverable text
540
- } */
541
541
  .EquationEditor {
542
542
  height: auto;
543
543
  text-align: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzish/math-rich-input",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "React component for user to enter rich text with embedded math equations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1815,7 +1815,10 @@ export default class MathRichInput extends React.Component {
1815
1815
  };
1816
1816
 
1817
1817
  handleFocus = (event) => {
1818
- // console.log("handleFocus")
1818
+ const { onFocus } = this.props;
1819
+ if (onFocus != null) {
1820
+ onFocus();
1821
+ }
1819
1822
  try {
1820
1823
  this._setRangeParams(this.getOldRangeParams());
1821
1824
  this.setState({ hasFocus: true });
@@ -1825,6 +1828,10 @@ export default class MathRichInput extends React.Component {
1825
1828
  };
1826
1829
 
1827
1830
  handleBlur = (event) => {
1831
+ const { onBlur } = this.props;
1832
+ if (onBlur != null) {
1833
+ onBlur();
1834
+ }
1828
1835
  try {
1829
1836
  this.setState({ hasFocus: false, showAccentBar: false });
1830
1837
  } catch (error) {