@zzish/math-rich-input 0.1.36 → 0.1.38
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 +9 -3
- package/dist/math-rich-input.css +155 -155
- package/package.json +1 -1
- package/src/mathRichInputHelper.js +8 -2
- package/src/mimeTypeHelper.js +1 -1
package/dist/index.js
CHANGED
|
@@ -20539,7 +20539,7 @@ var MIME_TYPE_HTML$2 = 'text/html';
|
|
|
20539
20539
|
var MIME_TYPE_TEX$2 = 'application/x-tex';
|
|
20540
20540
|
var MIME_TYPE_ZZISH_HTML_MATH$2 = 'application/x-zzish-html-math';
|
|
20541
20541
|
var LATEX_COMMAND_REG_EXP = /\\[a-zA-Z]/g;
|
|
20542
|
-
var HTML_CODES_REG_EXP = /&(#36|quot|apos|lt|gt|amp);/;
|
|
20542
|
+
var HTML_CODES_REG_EXP = /&(#36|quot|apos|lt|gt|amp|#44|#58|#124);/;
|
|
20543
20543
|
var HTML_TAGS_REG_EXP = /<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE).*?>|<(a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video).*?<\/\2>/i;
|
|
20544
20544
|
var HTML_MATH_TAGS_REC_EXP = /<math>/i;
|
|
20545
20545
|
var WORDS_REG_EXP = /^[a-zA-Z]*[,."';:?!]*$/i;
|
|
@@ -20892,11 +20892,14 @@ function encodeToHtml(text) {
|
|
|
20892
20892
|
text = text.replace(/'/g, "'");
|
|
20893
20893
|
text = text.replace(/"/g, """);
|
|
20894
20894
|
text = text.replace(/\$/g, "$");
|
|
20895
|
+
text = text.replace(/,/g, ",");
|
|
20896
|
+
text = text.replace(/:/g, ":");
|
|
20897
|
+
text = text.replace(/\|/g, "|");
|
|
20895
20898
|
return text;
|
|
20896
20899
|
}
|
|
20897
20900
|
|
|
20898
20901
|
var decodeFromHtml = function () {
|
|
20899
|
-
var translate_re = /&(#36|quot|apos|lt|gt|amp);/g,
|
|
20902
|
+
var translate_re = /&(#36|quot|apos|lt|gt|amp|#44|#58|#124);/g,
|
|
20900
20903
|
translate = {
|
|
20901
20904
|
// 'nbsp': String.fromCharCode(160),
|
|
20902
20905
|
'#36': '$',
|
|
@@ -20904,7 +20907,10 @@ var decodeFromHtml = function () {
|
|
|
20904
20907
|
'apos': '\'',
|
|
20905
20908
|
'lt': '<',
|
|
20906
20909
|
'gt': '>',
|
|
20907
|
-
'amp': '&'
|
|
20910
|
+
'amp': '&',
|
|
20911
|
+
'#44': ',',
|
|
20912
|
+
'#58': ':',
|
|
20913
|
+
'#124': '|'
|
|
20908
20914
|
},
|
|
20909
20915
|
translator = function translator($0, $1) {
|
|
20910
20916
|
return translate[$1];
|
package/dist/math-rich-input.css
CHANGED
|
@@ -208,6 +208,161 @@
|
|
|
208
208
|
display: inline-block;
|
|
209
209
|
border-bottom: 1px dotted black; /* If you want dots under the hoverable text
|
|
210
210
|
} */
|
|
211
|
+
.EquationEditorModal-background {
|
|
212
|
+
position: fixed;
|
|
213
|
+
top: 0;
|
|
214
|
+
left: 0;
|
|
215
|
+
width: 100%;
|
|
216
|
+
height: 100%;
|
|
217
|
+
background: black;
|
|
218
|
+
z-index: 99;
|
|
219
|
+
animation: 0.3s shade;
|
|
220
|
+
animation-fill-mode: forwards;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@keyframes shade {
|
|
224
|
+
00% {
|
|
225
|
+
opacity: 0;
|
|
226
|
+
}
|
|
227
|
+
100% {
|
|
228
|
+
opacity: 0.6;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.EquationEditorModal {
|
|
233
|
+
background: white;
|
|
234
|
+
border: 1px solid #808080;
|
|
235
|
+
border-radius: 10px;
|
|
236
|
+
box-shadow: 0px 2px 5px 1px #a0a0a0;
|
|
237
|
+
position: fixed;
|
|
238
|
+
max-width: 500px;
|
|
239
|
+
width: 98%;
|
|
240
|
+
top: 50%;
|
|
241
|
+
left: 50%;
|
|
242
|
+
/* transform: translate(-50%,-50%); */
|
|
243
|
+
z-index: 100;
|
|
244
|
+
animation: 0.3s rise;
|
|
245
|
+
animation-fill-mode: forwards;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@keyframes rise {
|
|
249
|
+
00% {
|
|
250
|
+
transform: translate(-50%, 100%);
|
|
251
|
+
opacity: 0;
|
|
252
|
+
}
|
|
253
|
+
100% {
|
|
254
|
+
transform: translate(-50%, -50%);
|
|
255
|
+
opacity: 1;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.EquationEditorModal-mobile {
|
|
260
|
+
background: white;
|
|
261
|
+
border: 1px solid #808080;
|
|
262
|
+
border-radius: 10px;
|
|
263
|
+
box-shadow: 0px 2px 5px 1px #a0a0a0;
|
|
264
|
+
position: fixed;
|
|
265
|
+
max-width: 500px;
|
|
266
|
+
width: 99%;
|
|
267
|
+
top: 0%;
|
|
268
|
+
left: 50%;
|
|
269
|
+
transform: translate(-50%, 1px);
|
|
270
|
+
z-index: 100;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.EquationEditorModal .title {
|
|
274
|
+
display: flex;
|
|
275
|
+
justify-content: space-between;
|
|
276
|
+
font-size: 14px;
|
|
277
|
+
color: #404040;
|
|
278
|
+
text-align: left;
|
|
279
|
+
background: #e0e0e0;
|
|
280
|
+
border: 0px;
|
|
281
|
+
border-radius: 5px 5px 0px 0px;
|
|
282
|
+
padding: 15px;
|
|
283
|
+
margin: 0px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.EquationEditorModal-mobile .title {
|
|
287
|
+
display: flex;
|
|
288
|
+
justify-content: space-between;
|
|
289
|
+
font-size: 14px;
|
|
290
|
+
color: #404040;
|
|
291
|
+
text-align: left;
|
|
292
|
+
background: #e0e0e0;
|
|
293
|
+
border: 0px;
|
|
294
|
+
border-radius: 5px 5px 0px 0px;
|
|
295
|
+
height: 30px;
|
|
296
|
+
padding: 15px;
|
|
297
|
+
margin: 0px;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.EquationEditorModal .expertModeSwitch .switch {
|
|
301
|
+
margin-left: 10px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/* The switch - the box around the slider */
|
|
305
|
+
.EquationEditorModal .switch {
|
|
306
|
+
position: relative;
|
|
307
|
+
display: inline-block;
|
|
308
|
+
width: 35px;
|
|
309
|
+
height: 22px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Hide default HTML checkbox */
|
|
313
|
+
.EquationEditorModal .switch input {
|
|
314
|
+
opacity: 0;
|
|
315
|
+
width: 0;
|
|
316
|
+
height: 0;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* The slider */
|
|
320
|
+
.EquationEditorModal .slider {
|
|
321
|
+
position: absolute;
|
|
322
|
+
cursor: pointer;
|
|
323
|
+
top: 0;
|
|
324
|
+
left: 0;
|
|
325
|
+
right: 0;
|
|
326
|
+
bottom: 0;
|
|
327
|
+
background-color: #ccc;
|
|
328
|
+
-webkit-transition: 0.4s;
|
|
329
|
+
transition: 0.4s;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.EquationEditorModal .slider:before {
|
|
333
|
+
position: absolute;
|
|
334
|
+
content: "";
|
|
335
|
+
height: 14px;
|
|
336
|
+
width: 14px;
|
|
337
|
+
left: 4px;
|
|
338
|
+
bottom: 4px;
|
|
339
|
+
background-color: white;
|
|
340
|
+
-webkit-transition: 0.4s;
|
|
341
|
+
transition: 0.4s;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.EquationEditorModal input:checked + .slider {
|
|
345
|
+
background-color: #663676;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.EquationEditorModal input:focus + .slider {
|
|
349
|
+
box-shadow: 0 0 1px #2196f3;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.EquationEditorModal input:checked + .slider:before {
|
|
353
|
+
-webkit-transform: translateX(13px);
|
|
354
|
+
-ms-transform: translateX(13px);
|
|
355
|
+
transform: translateX(13px);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* Rounded sliders */
|
|
359
|
+
.EquationEditorModal .slider.round {
|
|
360
|
+
border-radius: 18px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.EquationEditorModal .slider.round:before {
|
|
364
|
+
border-radius: 50%;
|
|
365
|
+
}
|
|
211
366
|
/* Note that the top left position of the accent bar is set programatically in componentDidMount */
|
|
212
367
|
|
|
213
368
|
.AccentBar {
|
|
@@ -383,161 +538,6 @@
|
|
|
383
538
|
animation: 0.4s fadeIn1;
|
|
384
539
|
animation-fill-mode: forwards;
|
|
385
540
|
}
|
|
386
|
-
.EquationEditorModal-background {
|
|
387
|
-
position: fixed;
|
|
388
|
-
top: 0;
|
|
389
|
-
left: 0;
|
|
390
|
-
width: 100%;
|
|
391
|
-
height: 100%;
|
|
392
|
-
background: black;
|
|
393
|
-
z-index: 99;
|
|
394
|
-
animation: 0.3s shade;
|
|
395
|
-
animation-fill-mode: forwards;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
@keyframes shade {
|
|
399
|
-
00% {
|
|
400
|
-
opacity: 0;
|
|
401
|
-
}
|
|
402
|
-
100% {
|
|
403
|
-
opacity: 0.6;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
.EquationEditorModal {
|
|
408
|
-
background: white;
|
|
409
|
-
border: 1px solid #808080;
|
|
410
|
-
border-radius: 10px;
|
|
411
|
-
box-shadow: 0px 2px 5px 1px #a0a0a0;
|
|
412
|
-
position: fixed;
|
|
413
|
-
max-width: 500px;
|
|
414
|
-
width: 98%;
|
|
415
|
-
top: 50%;
|
|
416
|
-
left: 50%;
|
|
417
|
-
/* transform: translate(-50%,-50%); */
|
|
418
|
-
z-index: 100;
|
|
419
|
-
animation: 0.3s rise;
|
|
420
|
-
animation-fill-mode: forwards;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
@keyframes rise {
|
|
424
|
-
00% {
|
|
425
|
-
transform: translate(-50%, 100%);
|
|
426
|
-
opacity: 0;
|
|
427
|
-
}
|
|
428
|
-
100% {
|
|
429
|
-
transform: translate(-50%, -50%);
|
|
430
|
-
opacity: 1;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.EquationEditorModal-mobile {
|
|
435
|
-
background: white;
|
|
436
|
-
border: 1px solid #808080;
|
|
437
|
-
border-radius: 10px;
|
|
438
|
-
box-shadow: 0px 2px 5px 1px #a0a0a0;
|
|
439
|
-
position: fixed;
|
|
440
|
-
max-width: 500px;
|
|
441
|
-
width: 99%;
|
|
442
|
-
top: 0%;
|
|
443
|
-
left: 50%;
|
|
444
|
-
transform: translate(-50%, 1px);
|
|
445
|
-
z-index: 100;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.EquationEditorModal .title {
|
|
449
|
-
display: flex;
|
|
450
|
-
justify-content: space-between;
|
|
451
|
-
font-size: 14px;
|
|
452
|
-
color: #404040;
|
|
453
|
-
text-align: left;
|
|
454
|
-
background: #e0e0e0;
|
|
455
|
-
border: 0px;
|
|
456
|
-
border-radius: 5px 5px 0px 0px;
|
|
457
|
-
padding: 15px;
|
|
458
|
-
margin: 0px;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
.EquationEditorModal-mobile .title {
|
|
462
|
-
display: flex;
|
|
463
|
-
justify-content: space-between;
|
|
464
|
-
font-size: 14px;
|
|
465
|
-
color: #404040;
|
|
466
|
-
text-align: left;
|
|
467
|
-
background: #e0e0e0;
|
|
468
|
-
border: 0px;
|
|
469
|
-
border-radius: 5px 5px 0px 0px;
|
|
470
|
-
height: 30px;
|
|
471
|
-
padding: 15px;
|
|
472
|
-
margin: 0px;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
.EquationEditorModal .expertModeSwitch .switch {
|
|
476
|
-
margin-left: 10px;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/* The switch - the box around the slider */
|
|
480
|
-
.EquationEditorModal .switch {
|
|
481
|
-
position: relative;
|
|
482
|
-
display: inline-block;
|
|
483
|
-
width: 35px;
|
|
484
|
-
height: 22px;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
/* Hide default HTML checkbox */
|
|
488
|
-
.EquationEditorModal .switch input {
|
|
489
|
-
opacity: 0;
|
|
490
|
-
width: 0;
|
|
491
|
-
height: 0;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/* The slider */
|
|
495
|
-
.EquationEditorModal .slider {
|
|
496
|
-
position: absolute;
|
|
497
|
-
cursor: pointer;
|
|
498
|
-
top: 0;
|
|
499
|
-
left: 0;
|
|
500
|
-
right: 0;
|
|
501
|
-
bottom: 0;
|
|
502
|
-
background-color: #ccc;
|
|
503
|
-
-webkit-transition: 0.4s;
|
|
504
|
-
transition: 0.4s;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
.EquationEditorModal .slider:before {
|
|
508
|
-
position: absolute;
|
|
509
|
-
content: "";
|
|
510
|
-
height: 14px;
|
|
511
|
-
width: 14px;
|
|
512
|
-
left: 4px;
|
|
513
|
-
bottom: 4px;
|
|
514
|
-
background-color: white;
|
|
515
|
-
-webkit-transition: 0.4s;
|
|
516
|
-
transition: 0.4s;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
.EquationEditorModal input:checked + .slider {
|
|
520
|
-
background-color: #663676;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
.EquationEditorModal input:focus + .slider {
|
|
524
|
-
box-shadow: 0 0 1px #2196f3;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.EquationEditorModal input:checked + .slider:before {
|
|
528
|
-
-webkit-transform: translateX(13px);
|
|
529
|
-
-ms-transform: translateX(13px);
|
|
530
|
-
transform: translateX(13px);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
/* Rounded sliders */
|
|
534
|
-
.EquationEditorModal .slider.round {
|
|
535
|
-
border-radius: 18px;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
.EquationEditorModal .slider.round:before {
|
|
539
|
-
border-radius: 50%;
|
|
540
|
-
}
|
|
541
541
|
.EquationEditor {
|
|
542
542
|
height: auto;
|
|
543
543
|
text-align: center;
|
package/package.json
CHANGED
|
@@ -245,11 +245,14 @@ function encodeToHtml(text) {
|
|
|
245
245
|
text = text.replace(/'/g,"'")
|
|
246
246
|
text = text.replace(/"/g,""")
|
|
247
247
|
text = text.replace(/\$/g,"$")
|
|
248
|
+
text = text.replace(/,/g,",")
|
|
249
|
+
text = text.replace(/:/g,":")
|
|
250
|
+
text = text.replace(/\|/g,"|")
|
|
248
251
|
return text
|
|
249
252
|
}
|
|
250
253
|
|
|
251
254
|
var decodeFromHtml = (function() {
|
|
252
|
-
var translate_re = /&(#36|quot|apos|lt|gt|amp);/g,
|
|
255
|
+
var translate_re = /&(#36|quot|apos|lt|gt|amp|#44|#58|#124);/g,
|
|
253
256
|
translate = {
|
|
254
257
|
// 'nbsp': String.fromCharCode(160),
|
|
255
258
|
'#36': '$',
|
|
@@ -257,7 +260,10 @@ var decodeFromHtml = (function() {
|
|
|
257
260
|
'apos': '\'',
|
|
258
261
|
'lt' : '<',
|
|
259
262
|
'gt' : '>',
|
|
260
|
-
'amp' : '&'
|
|
263
|
+
'amp' : '&',
|
|
264
|
+
'#44' : ',',
|
|
265
|
+
'#58' : ':',
|
|
266
|
+
'#124' : '|'
|
|
261
267
|
},
|
|
262
268
|
translator = function($0, $1) {
|
|
263
269
|
return translate[$1];
|
package/src/mimeTypeHelper.js
CHANGED
|
@@ -9,7 +9,7 @@ export const MIME_TYPE_ZZISH_HTML_MATH = 'application/x-zzish-html-math';
|
|
|
9
9
|
|
|
10
10
|
const LATEX_COMMAND_REG_EXP = /\\[a-zA-Z]/g;
|
|
11
11
|
|
|
12
|
-
const HTML_CODES_REG_EXP = /&(#36|quot|apos|lt|gt|amp);/;
|
|
12
|
+
const HTML_CODES_REG_EXP = /&(#36|quot|apos|lt|gt|amp|#44|#58|#124);/;
|
|
13
13
|
const HTML_TAGS_REG_EXP =
|
|
14
14
|
/<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE).*?>|<(a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video).*?<\/\2>/i;
|
|
15
15
|
const HTML_MATH_TAGS_REC_EXP = /<math>/i;
|