@zzish/math-rich-input 0.1.25 → 0.1.26

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.
@@ -78,136 +78,6 @@
78
78
  padding: 2px;
79
79
  margin: 0px 2px;
80
80
  }
81
- /* Note that the top left position of the toolbar is set programatically in componentDidMount */
82
-
83
- .Toolbar {
84
- position: absolute;
85
- z-index: 1;
86
- display: flex;
87
- height: 42px;
88
- background-color: white;
89
- border: 1px solid #d0d0d0;
90
- border-radius: 5px;
91
- box-shadow: 1px 1px 5px #a0a0a0;
92
- animation: 0.5s fadeIn1;
93
- animation-fill-mode: forwards;
94
- }
95
-
96
- @keyframes fadeIn1 {
97
- 0% {
98
- opacity: 0;
99
- }
100
- 100% {
101
- opacity: 1;
102
- }
103
- }
104
-
105
- .Toolbar-button {
106
- font-family: sans-serif;
107
- font-size: 16px;
108
- width: 40px;
109
- height: 36px;
110
- background-color: white;
111
- border-radius: 5px;
112
- border: 0px;
113
- padding: 1px;
114
- margin: 2px;
115
- }
116
-
117
- .Toolbar-button:hover {
118
- color: white;
119
- background: #663676;
120
- cursor: pointer;
121
- }
122
-
123
- .Toolbar-button:active {
124
- background: #808080;
125
- color: white;
126
- cursor: pointer;
127
- }
128
-
129
- .TB-narrow {
130
- width: 30px;
131
- }
132
-
133
- .TB-wide {
134
- width: 46px;
135
- }
136
-
137
- .TB-selected {
138
- background: #d0d0d0;
139
- color: black;
140
- cursor: pointer;
141
- animation: 0.2s TB-fadeIn;
142
- animation-fill-mode: forwards;
143
- }
144
-
145
- .TB-selected:hover {
146
- color: white;
147
- background: #663676;
148
- cursor: pointer;
149
- }
150
-
151
- @keyframes TB-fadeIn {
152
- 00% {
153
- background: white;
154
- }
155
- 100% {
156
- background: #d0d0d0;
157
- }
158
- }
159
-
160
- /* Tooltip text */
161
- .Toolbar-button .tooltiptext {
162
- font-weight: normal;
163
- visibility: hidden;
164
- width: 100px;
165
- background-color: #222;
166
- color: #fff;
167
- /*font-weight: bold;*/
168
- font-size: 12px;
169
- text-align: center;
170
- padding: 4px 10px;
171
- border-radius: 6px;
172
-
173
- /* Position the tooltip text - see examples below! */
174
- position: absolute;
175
- z-index: 2;
176
- top: -90%; /* Must leave a small gap between tooltip and button */
177
- left: 50px;
178
-
179
- /* transform: translate (50%,0%); */
180
- }
181
-
182
- /* Show the tooltip text when you mouse over the tooltip container */
183
- .Toolbar-button:hover .tooltiptext {
184
- animation: 0.8s fadeIn2;
185
- animation-fill-mode: forwards;
186
- visibility: visible;
187
- /* width: 100px; */
188
- /* top: -90%; */ /* Must leave a small gap between tooltip and button */
189
- /* left: 20%; */
190
- /* margin-left: -50px; */
191
- }
192
-
193
- @keyframes fadeIn2 {
194
- 00% {
195
- opacity: 0;
196
- }
197
- 70% {
198
- opacity: 0;
199
- }
200
- 100% {
201
- visibility: visible;
202
- opacity: 0.9;
203
- }
204
- }
205
-
206
- /* .tooltip {
207
- position: relative;
208
- display: inline-block;
209
- border-bottom: 1px dotted black; /* If you want dots under the hoverable text
210
- } */
211
81
  .EquationEditorModal-background {
212
82
  position: fixed;
213
83
  top: 0;
@@ -363,6 +233,136 @@
363
233
  .EquationEditorModal .slider.round:before {
364
234
  border-radius: 50%;
365
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
+ } */
366
366
  /* Note that the top left position of the accent bar is set programatically in componentDidMount */
367
367
 
368
368
  .AccentBar {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzish/math-rich-input",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "React component for user to enter rich text with embedded math equations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -677,9 +677,8 @@ export default class MathRichInput extends React.Component {
677
677
  new_offset = 0;
678
678
  }
679
679
 
680
- if (new_index === -1 || new_offset === -1) {
681
- return;
682
- } else {
680
+ if (new_index === -1 || new_offset === -1) return;
681
+ else {
683
682
  let new_rangeParams = {
684
683
  startNodeIndex: new_index,
685
684
  startOffset: new_offset,
@@ -691,16 +690,6 @@ export default class MathRichInput extends React.Component {
691
690
  this._setRangeParams(new_rangeParams);
692
691
  e.preventDefault();
693
692
  }
694
-
695
- let new_rangeParams = {
696
- startNodeIndex: new_index,
697
- startOffset: new_offset,
698
- endNodeIndex: new_index,
699
- endOffset: new_offset,
700
- };
701
- this._setRangeParams(new_rangeParams);
702
-
703
- e.preventDefault();
704
693
  };
705
694
 
706
695
  handleKeyDownArrowRight = (e) => {