@zzish/math-rich-input 0.1.20 → 0.1.22

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
@@ -22579,8 +22579,6 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22579
22579
  });
22580
22580
 
22581
22581
  _defineProperty(_assertThisInitialized(_this2), "handleToolbarButtonClick", function (event, buttonName) {
22582
- console.log("button name: ", buttonName);
22583
-
22584
22582
  try {
22585
22583
  if (buttonName === "Equation") {
22586
22584
  _this2.showEquationEditor(true);
@@ -23020,7 +23018,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
23020
23018
  onBlur: this.handleBlur,
23021
23019
  dangerouslySetInnerHTML: {
23022
23020
  __html: html
23023
- }
23021
+ },
23022
+ "data-placeholder": this.props.placeholder || ""
23024
23023
  }))), this.state.showEquationEditor && /*#__PURE__*/React__default['default'].createElement(EquationEditorModal, {
23025
23024
  ref: function ref(r) {
23026
23025
  return _this3.equationEditorModal = r;
@@ -38,6 +38,15 @@
38
38
  overflow: overlay;
39
39
  }
40
40
 
41
+ .MathRichInput:empty::before {
42
+ content: attr(data-placeholder);
43
+ color: #acb6c0;
44
+ font-size: 15px;
45
+ }
46
+ .MathRichInput:empty:focus::before {
47
+ content: "";
48
+ }
49
+
41
50
  .MathRichInput:focus {
42
51
  outline: 0;
43
52
  }
@@ -224,136 +233,6 @@
224
233
  .EquationEditorModal .slider.round:before {
225
234
  border-radius: 50%;
226
235
  }
227
- /* Note that the top left position of the toolbar is set programatically in componentDidMount */
228
-
229
- .Toolbar {
230
- position: absolute;
231
- z-index: 1;
232
- display: flex;
233
- height: 42px;
234
- background-color: white;
235
- border: 1px solid #d0d0d0;
236
- border-radius: 5px;
237
- box-shadow: 1px 1px 5px #a0a0a0;
238
- animation: 0.5s fadeIn1;
239
- animation-fill-mode: forwards;
240
- }
241
-
242
- @keyframes fadeIn1 {
243
- 0% {
244
- opacity: 0;
245
- }
246
- 100% {
247
- opacity: 1;
248
- }
249
- }
250
-
251
- .Toolbar-button {
252
- font-family: sans-serif;
253
- font-size: 16px;
254
- width: 40px;
255
- height: 36px;
256
- background-color: white;
257
- border-radius: 5px;
258
- border: 0px;
259
- padding: 1px;
260
- margin: 2px;
261
- }
262
-
263
- .Toolbar-button:hover {
264
- color: white;
265
- background: #663676;
266
- cursor: pointer;
267
- }
268
-
269
- .Toolbar-button:active {
270
- background: #808080;
271
- color: white;
272
- cursor: pointer;
273
- }
274
-
275
- .TB-narrow {
276
- width: 30px;
277
- }
278
-
279
- .TB-wide {
280
- width: 46px;
281
- }
282
-
283
- .TB-selected {
284
- background: #d0d0d0;
285
- color: black;
286
- cursor: pointer;
287
- animation: 0.2s TB-fadeIn;
288
- animation-fill-mode: forwards;
289
- }
290
-
291
- .TB-selected:hover {
292
- color: white;
293
- background: #663676;
294
- cursor: pointer;
295
- }
296
-
297
- @keyframes TB-fadeIn {
298
- 00% {
299
- background: white;
300
- }
301
- 100% {
302
- background: #d0d0d0;
303
- }
304
- }
305
-
306
- /* Tooltip text */
307
- .Toolbar-button .tooltiptext {
308
- font-weight: normal;
309
- visibility: hidden;
310
- width: 100px;
311
- background-color: #222;
312
- color: #fff;
313
- /*font-weight: bold;*/
314
- font-size: 12px;
315
- text-align: center;
316
- padding: 4px 10px;
317
- border-radius: 6px;
318
-
319
- /* Position the tooltip text - see examples below! */
320
- position: absolute;
321
- z-index: 2;
322
- top: -90%; /* Must leave a small gap between tooltip and button */
323
- left: 50px;
324
-
325
- /* transform: translate (50%,0%); */
326
- }
327
-
328
- /* Show the tooltip text when you mouse over the tooltip container */
329
- .Toolbar-button:hover .tooltiptext {
330
- animation: 0.8s fadeIn2;
331
- animation-fill-mode: forwards;
332
- visibility: visible;
333
- /* width: 100px; */
334
- /* top: -90%; */ /* Must leave a small gap between tooltip and button */
335
- /* left: 20%; */
336
- /* margin-left: -50px; */
337
- }
338
-
339
- @keyframes fadeIn2 {
340
- 00% {
341
- opacity: 0;
342
- }
343
- 70% {
344
- opacity: 0;
345
- }
346
- 100% {
347
- visibility: visible;
348
- opacity: 0.9;
349
- }
350
- }
351
-
352
- /* .tooltip {
353
- position: relative;
354
- display: inline-block;
355
- border-bottom: 1px dotted black; /* If you want dots under the hoverable text
356
- } */
357
236
  /* Note that the top left position of the accent bar is set programatically in componentDidMount */
358
237
 
359
238
  .AccentBar {
@@ -529,6 +408,136 @@
529
408
  animation: 0.4s fadeIn1;
530
409
  animation-fill-mode: forwards;
531
410
  }
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
+ } */
532
541
  .EquationEditor {
533
542
  height: auto;
534
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.20",
3
+ "version": "0.1.22",
4
4
  "description": "React component for user to enter rich text with embedded math equations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,6 +38,15 @@
38
38
  overflow: overlay;
39
39
  }
40
40
 
41
+ .MathRichInput:empty::before {
42
+ content: attr(data-placeholder);
43
+ color: #acb6c0;
44
+ font-size: 15px;
45
+ }
46
+ .MathRichInput:empty:focus::before {
47
+ content: "";
48
+ }
49
+
41
50
  .MathRichInput:focus {
42
51
  outline: 0;
43
52
  }
@@ -1534,7 +1534,6 @@ export default class MathRichInput extends React.Component {
1534
1534
  };
1535
1535
 
1536
1536
  handleToolbarButtonClick = (event, buttonName) => {
1537
- console.log("button name: ", buttonName);
1538
1537
  try {
1539
1538
  if (buttonName === "Equation") {
1540
1539
  this.showEquationEditor(true);
@@ -1890,6 +1889,7 @@ export default class MathRichInput extends React.Component {
1890
1889
  onFocus={this.handleFocus}
1891
1890
  onBlur={this.handleBlur}
1892
1891
  dangerouslySetInnerHTML={{ __html: html }}
1892
+ data-placeholder={this.props.placeholder || ""}
1893
1893
  ></span>
1894
1894
  </div>
1895
1895
  </div>