@zzish/math-rich-input 0.1.15 → 0.1.17

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
@@ -21119,10 +21119,7 @@ function rawTextToHtml(katex, string, mimeType) {
21119
21119
 
21120
21120
  if (parseAsTex) string = string.replace(DOLLAR_SLASH_REG_EXP, TEMP_CHAR); // console.log("Modded string: "+string)
21121
21121
 
21122
- var stringElements = string.split(parseAsTex ? INLINE_TEX_REG_EXP : HTML_MATH_REG_EXP); // Insert small space at start of first element if it is an empty element
21123
-
21124
- if (stringElements[0] === "") // This means the original string stars with latex
21125
- stringElements[0] = "&#" + SMALL_SPACE$1.charCodeAt(0);
21122
+ var stringElements = string.split(parseAsTex ? INLINE_TEX_REG_EXP : HTML_MATH_REG_EXP);
21126
21123
 
21127
21124
  if (parseAsTex) {
21128
21125
  for (var i = 0; i < stringElements.length; i++) {
@@ -21134,8 +21131,11 @@ function rawTextToHtml(katex, string, mimeType) {
21134
21131
  for (var _i = 0; _i < stringElements.length; _i++) {
21135
21132
  stringElements[_i] = stringElements[_i].replace(P_TAG_REG_EXP, P_ELEMENT_SMALL_SPACE);
21136
21133
  }
21137
- }
21134
+ } // Insert small space at start of first element if it is an empty element
21138
21135
 
21136
+
21137
+ if (stringElements[0] === "") // This means the original string stars with latex
21138
+ stringElements[0] = "&#" + SMALL_SPACE$1.charCodeAt(0);
21139
21139
  if (stringElements.length === 1) return stringElements[0];
21140
21140
  var latexElements = string.match(parseAsTex ? INLINE_TEX_REG_EXP : HTML_MATH_REG_EXP);
21141
21141
  var result = [];
@@ -21469,8 +21469,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
21469
21469
  rangeParams: rangeParams
21470
21470
  });
21471
21471
 
21472
- if (_this2.undoHistory.length > MAX_HISTORY_LENGTH) _this2.undoHistory.shift();
21473
- _this2.value = value; // Call the parent handler to apply the changes
21472
+ if (_this2.undoHistory.length > MAX_HISTORY_LENGTH) _this2.undoHistory.shift(); // Call the parent handler to apply the changes
21474
21473
 
21475
21474
  _this2.onChangeCallback({
21476
21475
  value: value,
@@ -21481,10 +21480,6 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
21481
21480
  });
21482
21481
  });
21483
21482
 
21484
- _defineProperty(_assertThisInitialized(_this2), "getValue", function () {
21485
- return _this2.value;
21486
- });
21487
-
21488
21483
  _defineProperty(_assertThisInitialized(_this2), "initialiseHistory", function () {
21489
21484
  if (_this2.initialHistoryState == null) _this2.initialHistoryState = {
21490
21485
  value: _this2.props.value,
@@ -22834,8 +22829,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22834
22829
  superscript: false
22835
22830
  },
22836
22831
  keyPressed: ""
22837
- };
22838
- _this2.value = ""; // this.handleInput = this.handleInput.bind(this);
22832
+ }; // this.handleInput = this.handleInput.bind(this);
22839
22833
  // this.handleKeyDown = this.handleKeyDown.bind(this);
22840
22834
  // this.handleKeyUp = this.handleKeyUp.bind(this);
22841
22835
  // Remember the last key pressed
@@ -22970,9 +22964,6 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22970
22964
  }, {
22971
22965
  key: "componentDidMount",
22972
22966
  value: function componentDidMount() {
22973
- var onRef = this.props.onRef;
22974
- onRef && onRef(this);
22975
-
22976
22967
  try {
22977
22968
  setupKatex();
22978
22969
  this.editableDiv.addEventListener("keydown", this.handleKeyDown);
@@ -22984,9 +22975,6 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22984
22975
  }, {
22985
22976
  key: "componentWillUnmount",
22986
22977
  value: function componentWillUnmount() {
22987
- var onRef = this.props.onRef;
22988
- onRef && onRef(undefined);
22989
-
22990
22978
  try {
22991
22979
  this.editableDiv.removeEventListener("keydown", this.handleKeyDown);
22992
22980
  this.editableDiv.removeEventListener("keyup", this.handleKeyUp);
@@ -22998,8 +22986,6 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
22998
22986
  key: "componentDidUpdate",
22999
22987
  value: function componentDidUpdate() {
23000
22988
  try {
23001
- // console.log("Component updated:")
23002
- // console.log(this.editableDiv.childNodes)
23003
22989
  if (this.rangeParamsToSetAfterComponentUpdate !== null && this.rangeParamsToSetAfterComponentUpdate !== undefined) {
23004
22990
  this._setRangeParams(this.rangeParamsToSetAfterComponentUpdate);
23005
22991
 
@@ -69,180 +69,160 @@
69
69
  padding: 2px;
70
70
  margin: 0px 2px;
71
71
  }
72
- /* Note that the top left position of the accent bar is set programatically in componentDidMount */
73
-
74
- .AccentBar {
75
- position: absolute;
76
- z-index: 1;
77
- width: 360px;
78
- background-color: #fff;
79
- border: 1px solid #d0d0d0;
80
- border-radius: 5px;
81
- box-shadow: 1px 1px 5px #a0a0a0;
82
- padding: 8px;
83
- animation: 0.4s fadeIn1;
84
- animation-fill-mode: forwards;
85
- }
86
-
87
- .AccentBar-compact {
88
- display: flex;
89
- position: absolute;
90
- z-index: 1;
91
- background-color: white;
92
- border: 1px solid #d0d0d0;
93
- border-radius: 5px;
94
- box-shadow: 1px 1px 5px #a0a0a0;
95
- padding: 5px;
96
- animation: 0.4s fadeIn1;
72
+ .EquationEditorModal-background {
73
+ position: fixed;
74
+ top: 0;
75
+ left: 0;
76
+ width: 100%;
77
+ height: 100%;
78
+ background: black;
79
+ z-index: 99;
80
+ animation: 0.3s shade;
97
81
  animation-fill-mode: forwards;
98
82
  }
99
83
 
100
- .AccentBar-outerContainer {
101
- overflow-y: scroll;
102
- border-radius: 5px;
84
+ @keyframes shade {
85
+ 00% {
86
+ opacity: 0;
87
+ }
88
+ 100% {
89
+ opacity: 0.6;
90
+ }
103
91
  }
104
92
 
105
- .AccentBar-innerContainer {
106
- height: 350px;
93
+ .EquationEditorModal {
94
+ background: white;
95
+ border: 1px solid #808080;
96
+ border-radius: 10px;
97
+ box-shadow: 0px 2px 5px 1px #a0a0a0;
98
+ position: fixed;
99
+ max-width: 500px;
100
+ width: 98%;
101
+ top: 50%;
102
+ left: 50%;
103
+ /* transform: translate(-50%,-50%); */
104
+ z-index: 100;
105
+ animation: 0.3s rise;
106
+ animation-fill-mode: forwards;
107
107
  }
108
108
 
109
- @keyframes fadeIn1 {
110
- 0% {
109
+ @keyframes rise {
110
+ 00% {
111
+ transform: translate(-50%, 100%);
111
112
  opacity: 0;
112
113
  }
113
114
  100% {
115
+ transform: translate(-50%, -50%);
114
116
  opacity: 1;
115
117
  }
116
118
  }
117
119
 
118
- .AccentBar .symbols-grid {
119
- display: grid;
120
- grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
121
- grid-auto-rows: minmax(min-content, max-content);
122
- grid-gap: 3px;
123
- }
124
-
125
- .AccentBar .insert-grid {
126
- padding: 5px;
120
+ .EquationEditorModal-mobile {
121
+ background: white;
122
+ border: 1px solid #808080;
123
+ border-radius: 10px;
124
+ box-shadow: 0px 2px 5px 1px #a0a0a0;
125
+ position: fixed;
126
+ max-width: 500px;
127
+ width: 99%;
128
+ top: 0%;
129
+ left: 50%;
130
+ transform: translate(-50%, 1px);
131
+ z-index: 100;
127
132
  }
128
133
 
129
- .AccentBar .type-a-letter {
130
- grid-column: 1/-1;
131
- color: #a0a0a0;
132
- font-family: sans-serif;
134
+ .EquationEditorModal .title {
135
+ display: flex;
136
+ justify-content: space-between;
133
137
  font-size: 14px;
134
- font-weight: bold;
135
- height: 36px;
136
- padding-top: 12px;
137
- padding-left: 20px;
138
- }
139
-
140
- .AccentBar-button {
141
- font-family: sans-serif;
142
- font-size: 17px;
143
- width: 40px;
144
- height: 36px;
145
- background: #f4f4f4;
146
- border-radius: 5px;
138
+ color: #404040;
139
+ text-align: left;
140
+ background: #e0e0e0;
147
141
  border: 0px;
148
- padding: 1px;
142
+ border-radius: 5px 5px 0px 0px;
143
+ padding: 15px;
144
+ margin: 0px;
149
145
  }
150
146
 
151
- .AB-compact {
147
+ .EquationEditorModal-mobile .title {
148
+ display: flex;
149
+ justify-content: space-between;
150
+ font-size: 14px;
151
+ color: #404040;
152
+ text-align: left;
153
+ background: #e0e0e0;
154
+ border: 0px;
155
+ border-radius: 5px 5px 0px 0px;
156
+ height: 30px;
157
+ padding: 15px;
152
158
  margin: 0px;
153
- background: white;
154
159
  }
155
160
 
156
- .AB-narrow {
157
- width: 36px;
161
+ .EquationEditorModal .expertModeSwitch .switch {
162
+ margin-left: 10px;
158
163
  }
159
164
 
160
- .AccentBar-button:hover {
161
- color: white;
162
- background: #663676;
163
- cursor: pointer;
164
- box-shadow: 1px 1px 3px #808080;
165
- animation: 2s grow;
166
- animation-fill-mode: forwards;
165
+ /* The switch - the box around the slider */
166
+ .EquationEditorModal .switch {
167
+ position: relative;
168
+ display: inline-block;
169
+ width: 35px;
170
+ height: 22px;
167
171
  }
168
172
 
169
- @keyframes grow {
170
- 00% {
171
- transform: scale(1);
172
- box-shadow: 0px 0px 0px #808080;
173
- }
174
- 10% {
175
- transform: scale(1.3);
176
- box-shadow: 1px 1px 3px #808080;
177
- }
178
- 90% {
179
- transform: scale(1.3);
180
- box-shadow: 1px 1px 3px #808080;
181
- }
182
- 100% {
183
- transform: scale(1.8);
184
- box-shadow: 1px 1px 3px #808080;
185
- }
173
+ /* Hide default HTML checkbox */
174
+ .EquationEditorModal .switch input {
175
+ opacity: 0;
176
+ width: 0;
177
+ height: 0;
186
178
  }
187
179
 
188
- .AccentBar-button:active {
189
- background: #808080;
190
- color: white;
180
+ /* The slider */
181
+ .EquationEditorModal .slider {
182
+ position: absolute;
191
183
  cursor: pointer;
184
+ top: 0;
185
+ left: 0;
186
+ right: 0;
187
+ bottom: 0;
188
+ background-color: #ccc;
189
+ -webkit-transition: 0.4s;
190
+ transition: 0.4s;
192
191
  }
193
192
 
194
- .AccentBar .tabBar {
195
- background: white;
196
- text-align: left;
197
- border: 0px;
198
- padding: 10px 0;
199
- }
200
-
201
- .AccentBar .tab {
202
- font-size: 14px;
203
- font-weight: bold;
204
- color: #404040;
205
- text-align: left;
206
- border: 0px;
207
- height: 30px;
208
- padding: 2px 5px 2px 5px;
209
- margin: 2px;
210
- border-bottom: 4px solid #d0d0d0;
193
+ .EquationEditorModal .slider:before {
194
+ position: absolute;
195
+ content: "";
196
+ height: 14px;
197
+ width: 14px;
198
+ left: 4px;
199
+ bottom: 4px;
200
+ background-color: white;
201
+ -webkit-transition: 0.4s;
202
+ transition: 0.4s;
211
203
  }
212
204
 
213
- .AccentBar .tab:hover {
214
- cursor: pointer;
205
+ .EquationEditorModal input:checked + .slider {
206
+ background-color: #663676;
215
207
  }
216
208
 
217
- .AccentBar .tab-selected {
218
- font-size: 14px;
219
- font-weight: bold;
220
- color: #404040;
221
- text-align: left;
222
- border: 0px;
223
- height: 30px;
224
- padding: 2px 5px 2px 5px;
225
- margin: 2px;
226
- border-bottom: 4px solid #663676;
209
+ .EquationEditorModal input:focus + .slider {
210
+ box-shadow: 0 0 1px #2196f3;
227
211
  }
228
212
 
229
- .AccentBar .section-label {
230
- grid-column: 1/-1;
231
- font-size: 13px;
232
- font-weight: bold;
233
- color: #663676;
234
- margin-top: 8px;
235
- margin-left: 8px;
236
- margin-bottom: 4px;
213
+ .EquationEditorModal input:checked + .slider:before {
214
+ -webkit-transform: translateX(13px);
215
+ -ms-transform: translateX(13px);
216
+ transform: translateX(13px);
237
217
  }
238
218
 
239
- .AccentBar .replace-section {
240
- min-height: 70px;
219
+ /* Rounded sliders */
220
+ .EquationEditorModal .slider.round {
221
+ border-radius: 18px;
241
222
  }
242
223
 
243
- .AccentBar .tabArea {
244
- animation: 0.4s fadeIn1;
245
- animation-fill-mode: forwards;
224
+ .EquationEditorModal .slider.round:before {
225
+ border-radius: 50%;
246
226
  }
247
227
  /* Note that the top left position of the toolbar is set programatically in componentDidMount */
248
228
 
@@ -374,160 +354,180 @@
374
354
  display: inline-block;
375
355
  border-bottom: 1px dotted black; /* If you want dots under the hoverable text
376
356
  } */
377
- .EquationEditorModal-background {
378
- position: fixed;
379
- top: 0;
380
- left: 0;
381
- width: 100%;
382
- height: 100%;
383
- background: black;
384
- z-index: 99;
385
- animation: 0.3s shade;
357
+ /* Note that the top left position of the accent bar is set programatically in componentDidMount */
358
+
359
+ .AccentBar {
360
+ position: absolute;
361
+ z-index: 1;
362
+ width: 360px;
363
+ background-color: #fff;
364
+ border: 1px solid #d0d0d0;
365
+ border-radius: 5px;
366
+ box-shadow: 1px 1px 5px #a0a0a0;
367
+ padding: 8px;
368
+ animation: 0.4s fadeIn1;
386
369
  animation-fill-mode: forwards;
387
370
  }
388
371
 
389
- @keyframes shade {
390
- 00% {
391
- opacity: 0;
392
- }
393
- 100% {
394
- opacity: 0.6;
395
- }
372
+ .AccentBar-compact {
373
+ display: flex;
374
+ position: absolute;
375
+ z-index: 1;
376
+ background-color: white;
377
+ border: 1px solid #d0d0d0;
378
+ border-radius: 5px;
379
+ box-shadow: 1px 1px 5px #a0a0a0;
380
+ padding: 5px;
381
+ animation: 0.4s fadeIn1;
382
+ animation-fill-mode: forwards;
396
383
  }
397
384
 
398
- .EquationEditorModal {
399
- background: white;
400
- border: 1px solid #808080;
401
- border-radius: 10px;
402
- box-shadow: 0px 2px 5px 1px #a0a0a0;
403
- position: fixed;
404
- max-width: 500px;
405
- width: 98%;
406
- top: 50%;
407
- left: 50%;
408
- /* transform: translate(-50%,-50%); */
409
- z-index: 100;
410
- animation: 0.3s rise;
411
- animation-fill-mode: forwards;
385
+ .AccentBar-outerContainer {
386
+ overflow-y: scroll;
387
+ border-radius: 5px;
412
388
  }
413
389
 
414
- @keyframes rise {
415
- 00% {
416
- transform: translate(-50%, 100%);
390
+ .AccentBar-innerContainer {
391
+ height: 350px;
392
+ }
393
+
394
+ @keyframes fadeIn1 {
395
+ 0% {
417
396
  opacity: 0;
418
397
  }
419
398
  100% {
420
- transform: translate(-50%, -50%);
421
399
  opacity: 1;
422
400
  }
423
401
  }
424
402
 
425
- .EquationEditorModal-mobile {
426
- background: white;
427
- border: 1px solid #808080;
428
- border-radius: 10px;
429
- box-shadow: 0px 2px 5px 1px #a0a0a0;
430
- position: fixed;
431
- max-width: 500px;
432
- width: 99%;
433
- top: 0%;
434
- left: 50%;
435
- transform: translate(-50%, 1px);
436
- z-index: 100;
403
+ .AccentBar .symbols-grid {
404
+ display: grid;
405
+ grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
406
+ grid-auto-rows: minmax(min-content, max-content);
407
+ grid-gap: 3px;
437
408
  }
438
409
 
439
- .EquationEditorModal .title {
440
- display: flex;
441
- justify-content: space-between;
442
- font-size: 14px;
443
- color: #404040;
444
- text-align: left;
445
- background: #e0e0e0;
446
- border: 0px;
447
- border-radius: 5px 5px 0px 0px;
448
- padding: 15px;
449
- margin: 0px;
410
+ .AccentBar .insert-grid {
411
+ padding: 5px;
450
412
  }
451
413
 
452
- .EquationEditorModal-mobile .title {
453
- display: flex;
454
- justify-content: space-between;
414
+ .AccentBar .type-a-letter {
415
+ grid-column: 1/-1;
416
+ color: #a0a0a0;
417
+ font-family: sans-serif;
455
418
  font-size: 14px;
456
- color: #404040;
457
- text-align: left;
458
- background: #e0e0e0;
419
+ font-weight: bold;
420
+ height: 36px;
421
+ padding-top: 12px;
422
+ padding-left: 20px;
423
+ }
424
+
425
+ .AccentBar-button {
426
+ font-family: sans-serif;
427
+ font-size: 17px;
428
+ width: 40px;
429
+ height: 36px;
430
+ background: #f4f4f4;
431
+ border-radius: 5px;
459
432
  border: 0px;
460
- border-radius: 5px 5px 0px 0px;
461
- height: 30px;
462
- padding: 15px;
433
+ padding: 1px;
434
+ }
435
+
436
+ .AB-compact {
463
437
  margin: 0px;
438
+ background: white;
464
439
  }
465
440
 
466
- .EquationEditorModal .expertModeSwitch .switch {
467
- margin-left: 10px;
441
+ .AB-narrow {
442
+ width: 36px;
468
443
  }
469
444
 
470
- /* The switch - the box around the slider */
471
- .EquationEditorModal .switch {
472
- position: relative;
473
- display: inline-block;
474
- width: 35px;
475
- height: 22px;
445
+ .AccentBar-button:hover {
446
+ color: white;
447
+ background: #663676;
448
+ cursor: pointer;
449
+ box-shadow: 1px 1px 3px #808080;
450
+ animation: 2s grow;
451
+ animation-fill-mode: forwards;
476
452
  }
477
453
 
478
- /* Hide default HTML checkbox */
479
- .EquationEditorModal .switch input {
480
- opacity: 0;
481
- width: 0;
482
- height: 0;
454
+ @keyframes grow {
455
+ 00% {
456
+ transform: scale(1);
457
+ box-shadow: 0px 0px 0px #808080;
458
+ }
459
+ 10% {
460
+ transform: scale(1.3);
461
+ box-shadow: 1px 1px 3px #808080;
462
+ }
463
+ 90% {
464
+ transform: scale(1.3);
465
+ box-shadow: 1px 1px 3px #808080;
466
+ }
467
+ 100% {
468
+ transform: scale(1.8);
469
+ box-shadow: 1px 1px 3px #808080;
470
+ }
483
471
  }
484
472
 
485
- /* The slider */
486
- .EquationEditorModal .slider {
487
- position: absolute;
473
+ .AccentBar-button:active {
474
+ background: #808080;
475
+ color: white;
488
476
  cursor: pointer;
489
- top: 0;
490
- left: 0;
491
- right: 0;
492
- bottom: 0;
493
- background-color: #ccc;
494
- -webkit-transition: 0.4s;
495
- transition: 0.4s;
496
477
  }
497
478
 
498
- .EquationEditorModal .slider:before {
499
- position: absolute;
500
- content: "";
501
- height: 14px;
502
- width: 14px;
503
- left: 4px;
504
- bottom: 4px;
505
- background-color: white;
506
- -webkit-transition: 0.4s;
507
- transition: 0.4s;
479
+ .AccentBar .tabBar {
480
+ background: white;
481
+ text-align: left;
482
+ border: 0px;
483
+ padding: 10px 0;
508
484
  }
509
485
 
510
- .EquationEditorModal input:checked + .slider {
511
- background-color: #663676;
486
+ .AccentBar .tab {
487
+ font-size: 14px;
488
+ font-weight: bold;
489
+ color: #404040;
490
+ text-align: left;
491
+ border: 0px;
492
+ height: 30px;
493
+ padding: 2px 5px 2px 5px;
494
+ margin: 2px;
495
+ border-bottom: 4px solid #d0d0d0;
512
496
  }
513
497
 
514
- .EquationEditorModal input:focus + .slider {
515
- box-shadow: 0 0 1px #2196f3;
498
+ .AccentBar .tab:hover {
499
+ cursor: pointer;
516
500
  }
517
501
 
518
- .EquationEditorModal input:checked + .slider:before {
519
- -webkit-transform: translateX(13px);
520
- -ms-transform: translateX(13px);
521
- transform: translateX(13px);
502
+ .AccentBar .tab-selected {
503
+ font-size: 14px;
504
+ font-weight: bold;
505
+ color: #404040;
506
+ text-align: left;
507
+ border: 0px;
508
+ height: 30px;
509
+ padding: 2px 5px 2px 5px;
510
+ margin: 2px;
511
+ border-bottom: 4px solid #663676;
522
512
  }
523
513
 
524
- /* Rounded sliders */
525
- .EquationEditorModal .slider.round {
526
- border-radius: 18px;
514
+ .AccentBar .section-label {
515
+ grid-column: 1/-1;
516
+ font-size: 13px;
517
+ font-weight: bold;
518
+ color: #663676;
519
+ margin-top: 8px;
520
+ margin-left: 8px;
521
+ margin-bottom: 4px;
527
522
  }
528
523
 
529
- .EquationEditorModal .slider.round:before {
530
- border-radius: 50%;
524
+ .AccentBar .replace-section {
525
+ min-height: 70px;
526
+ }
527
+
528
+ .AccentBar .tabArea {
529
+ animation: 0.4s fadeIn1;
530
+ animation-fill-mode: forwards;
531
531
  }
532
532
  .EquationEditor {
533
533
  height: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzish/math-rich-input",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "React component for user to enter rich text with embedded math equations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -70,7 +70,6 @@ export default class MathRichInput extends React.Component {
70
70
  },
71
71
  keyPressed: "",
72
72
  };
73
- this.value = "";
74
73
 
75
74
  // this.handleInput = this.handleInput.bind(this);
76
75
  // this.handleKeyDown = this.handleKeyDown.bind(this);
@@ -214,15 +213,10 @@ export default class MathRichInput extends React.Component {
214
213
  this.undoHistory.push({ value, mimeType, rangeParams });
215
214
  if (this.undoHistory.length > MAX_HISTORY_LENGTH) this.undoHistory.shift();
216
215
 
217
- this.value = value;
218
216
  // Call the parent handler to apply the changes
219
217
  this.onChangeCallback({ value, mimeType }, { isExpertMode, selectedTab });
220
218
  };
221
219
 
222
- getValue = () => {
223
- return this.value;
224
- };
225
-
226
220
  initialiseHistory = () => {
227
221
  if (this.initialHistoryState == null)
228
222
  this.initialHistoryState = {
@@ -1193,8 +1187,6 @@ export default class MathRichInput extends React.Component {
1193
1187
  };
1194
1188
 
1195
1189
  componentDidMount() {
1196
- const onRef = this.props.onRef;
1197
- onRef && onRef(this);
1198
1190
  try {
1199
1191
  setupKatex();
1200
1192
 
@@ -1206,8 +1198,6 @@ export default class MathRichInput extends React.Component {
1206
1198
  }
1207
1199
 
1208
1200
  componentWillUnmount() {
1209
- const onRef = this.props.onRef;
1210
- onRef && onRef(undefined);
1211
1201
  try {
1212
1202
  this.editableDiv.removeEventListener("keydown", this.handleKeyDown);
1213
1203
  this.editableDiv.removeEventListener("keyup", this.handleKeyUp);
@@ -1218,8 +1208,6 @@ export default class MathRichInput extends React.Component {
1218
1208
 
1219
1209
  componentDidUpdate() {
1220
1210
  try {
1221
- // console.log("Component updated:")
1222
- // console.log(this.editableDiv.childNodes)
1223
1211
  if (
1224
1212
  this.rangeParamsToSetAfterComponentUpdate !== null &&
1225
1213
  this.rangeParamsToSetAfterComponentUpdate !== undefined
@@ -497,10 +497,6 @@ export function rawTextToHtml(katex, string, mimeType) {
497
497
 
498
498
  const stringElements = string.split(parseAsTex ? INLINE_TEX_REG_EXP : HTML_MATH_REG_EXP);
499
499
 
500
- // Insert small space at start of first element if it is an empty element
501
- if (stringElements[0] === "") // This means the original string stars with latex
502
- stringElements[0] = "&#" + SMALL_SPACE.charCodeAt(0)
503
-
504
500
  if (parseAsTex) {
505
501
  for (let i = 0; i <stringElements.length; i++) {
506
502
  stringElements[i] = stringElements[i].replace(TEMP_CHAR_REG_EXP, "$")
@@ -511,6 +507,10 @@ export function rawTextToHtml(katex, string, mimeType) {
511
507
  for (let i = 0; i <stringElements.length; i++)
512
508
  stringElements[i] = stringElements[i].replace(P_TAG_REG_EXP, P_ELEMENT_SMALL_SPACE)
513
509
  }
510
+
511
+ // Insert small space at start of first element if it is an empty element
512
+ if (stringElements[0] === "") // This means the original string stars with latex
513
+ stringElements[0] = "&#" + SMALL_SPACE.charCodeAt(0)
514
514
 
515
515
  if (stringElements.length === 1)
516
516
  return stringElements[0]