@subiz/widget-v4 4.0.89 → 4.0.91
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/compiled_src/chatbox/Event.js +3 -4
- package/compiled_src/chatbox/TextMessage.js +110 -9
- package/compiled_src/chatbox/Widget.js +11 -10
- package/dist/0b82fa7e5c3b07b40a44.png +1 -0
- package/dist/0f4af006e38ee8b93633.png +1 -0
- package/dist/132.js +84 -302
- package/dist/178.js +341 -174
- package/dist/17f00e48d38.132.js +1 -0
- package/dist/17f00e48d38.178.js +1 -0
- package/dist/{1833a09e682.213.js → 17f00e48d38.213.js} +1 -1
- package/dist/{1833a09e682.335.js → 17f00e48d38.335.js} +1 -1
- package/dist/17f00e48d38.362.js +1 -0
- package/dist/17f00e48d38.441.js +1 -0
- package/dist/{1833a09e682.605.js → 17f00e48d38.605.js} +0 -0
- package/dist/17f00e48d38.678.js +1 -0
- package/dist/17f00e48d38.782.js +1 -0
- package/dist/17f00e48d38.app.js +1 -0
- package/dist/{1833a09e682.index.html → 17f00e48d38.index.html} +3 -7
- package/dist/{1833a09e682.library.html → 17f00e48d38.library.html} +3 -7
- package/dist/17f00e48d38.library.js +1 -0
- package/dist/{1833a09e682.preview.html → 17f00e48d38.preview.html} +1 -1
- package/dist/17f00e48d38.preview.js +1 -0
- package/dist/17f00e48d38.screenshoot.js +1 -0
- package/dist/1ea1c6cd21d25176810c.png +1 -0
- package/dist/213.js +1 -28
- package/dist/292d42404e1b03398f61.png +1 -0
- package/dist/312d376370831b7bea83.png +1 -0
- package/dist/313d1bfc1cf776d1aefe.png +1 -0
- package/dist/335.js +2 -2
- package/dist/362.js +71 -21
- package/dist/441.js +100 -202
- package/dist/4aa58bb7a66bb44975aa.png +1 -0
- package/dist/56ce063bc6c81adb7322.png +1 -0
- package/dist/678.js +70 -20
- package/dist/6a411166ef5cc79e0714.png +1 -0
- package/dist/6faf403782fefacc1649.png +1 -0
- package/dist/782.js +118 -21
- package/dist/79dca33c68fab79c067f.png +1 -0
- package/dist/82da1578fa84f9debaeb.png +1 -0
- package/dist/8b8e0f0824743974b282.png +1 -0
- package/dist/8d551390d81e39130a3c.png +1 -0
- package/dist/9fc61b9479877ebdb6c7.png +1 -0
- package/dist/HASH +1 -1
- package/dist/a165d31dcb3dc90f1057.png +1 -0
- package/dist/a98d4a5698812c4426b3.png +1 -0
- package/dist/c41606bf9d1b604e46d5.png +1 -0
- package/dist/ce1f7450ce6c1aacd330.png +1 -0
- package/dist/cf8c01e88f4770a6e3e5.png +1 -0
- package/dist/dfbcfeab1d5622a737e2.png +1 -0
- package/dist/e4893ed8c2f7b8329919.png +1 -0
- package/dist/ec2ab4eb4ef73d186186.png +1 -0
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +174 -208
- package/package.json +5 -5
- package/src/chatbox/Event.js +3 -4
- package/src/chatbox/TextMessage.js +88 -15
- package/src/chatbox/Widget.js +10 -9
- package/dist/1833a09e682.132.js +0 -1
- package/dist/1833a09e682.178.js +0 -1
- package/dist/1833a09e682.362.js +0 -1
- package/dist/1833a09e682.441.js +0 -1
- package/dist/1833a09e682.678.js +0 -1
- package/dist/1833a09e682.782.js +0 -1
- package/dist/1833a09e682.app.js +0 -1
- package/dist/1833a09e682.library.js +0 -1
- package/dist/1833a09e682.preview.js +0 -1
- package/dist/1833a09e682.screenshoot.js +0 -1
package/dist/441.js
CHANGED
|
@@ -37,7 +37,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
37
37
|
|
|
38
38
|
function getDefaults() {
|
|
39
39
|
return {
|
|
40
|
-
async: false,
|
|
41
40
|
baseUrl: null,
|
|
42
41
|
breaks: false,
|
|
43
42
|
extensions: null,
|
|
@@ -97,9 +96,6 @@ function escape(html, encode) {
|
|
|
97
96
|
|
|
98
97
|
const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
99
98
|
|
|
100
|
-
/**
|
|
101
|
-
* @param {string} html
|
|
102
|
-
*/
|
|
103
99
|
function unescape(html) {
|
|
104
100
|
// explicitly match decimal, hex, and named HTML entities
|
|
105
101
|
return html.replace(unescapeTest, (_, n) => {
|
|
@@ -115,13 +111,8 @@ function unescape(html) {
|
|
|
115
111
|
}
|
|
116
112
|
|
|
117
113
|
const caret = /(^|[^\[])\^/g;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @param {string | RegExp} regex
|
|
121
|
-
* @param {string} opt
|
|
122
|
-
*/
|
|
123
114
|
function edit(regex, opt) {
|
|
124
|
-
regex =
|
|
115
|
+
regex = regex.source || regex;
|
|
125
116
|
opt = opt || '';
|
|
126
117
|
const obj = {
|
|
127
118
|
replace: (name, val) => {
|
|
@@ -139,12 +130,6 @@ function edit(regex, opt) {
|
|
|
139
130
|
|
|
140
131
|
const nonWordAndColonTest = /[^\w:]/g;
|
|
141
132
|
const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @param {boolean} sanitize
|
|
145
|
-
* @param {string} base
|
|
146
|
-
* @param {string} href
|
|
147
|
-
*/
|
|
148
133
|
function cleanUrl(sanitize, base, href) {
|
|
149
134
|
if (sanitize) {
|
|
150
135
|
let prot;
|
|
@@ -175,10 +160,6 @@ const justDomain = /^[^:]+:\/*[^/]*$/;
|
|
|
175
160
|
const protocol = /^([^:]+:)[\s\S]*$/;
|
|
176
161
|
const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
|
|
177
162
|
|
|
178
|
-
/**
|
|
179
|
-
* @param {string} base
|
|
180
|
-
* @param {string} href
|
|
181
|
-
*/
|
|
182
163
|
function resolveUrl(base, href) {
|
|
183
164
|
if (!baseUrls[' ' + base]) {
|
|
184
165
|
// we can ignore everything in base after the last slash of its path component,
|
|
@@ -263,14 +244,9 @@ function splitCells(tableRow, count) {
|
|
|
263
244
|
return cells;
|
|
264
245
|
}
|
|
265
246
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
*
|
|
270
|
-
* @param {string} str
|
|
271
|
-
* @param {string} c
|
|
272
|
-
* @param {boolean} invert Remove suffix of non-c chars instead. Default falsey.
|
|
273
|
-
*/
|
|
247
|
+
// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
|
|
248
|
+
// /c*$/ is vulnerable to REDOS.
|
|
249
|
+
// invert: Remove suffix of non-c chars instead. Default falsey.
|
|
274
250
|
function rtrim(str, c, invert) {
|
|
275
251
|
const l = str.length;
|
|
276
252
|
if (l === 0) {
|
|
@@ -292,7 +268,7 @@ function rtrim(str, c, invert) {
|
|
|
292
268
|
}
|
|
293
269
|
}
|
|
294
270
|
|
|
295
|
-
return str.
|
|
271
|
+
return str.substr(0, l - suffLen);
|
|
296
272
|
}
|
|
297
273
|
|
|
298
274
|
function findClosingBracket(str, b) {
|
|
@@ -324,10 +300,6 @@ function checkSanitizeDeprecation(opt) {
|
|
|
324
300
|
}
|
|
325
301
|
|
|
326
302
|
// copied from https://stackoverflow.com/a/5450113/806777
|
|
327
|
-
/**
|
|
328
|
-
* @param {string} pattern
|
|
329
|
-
* @param {number} count
|
|
330
|
-
*/
|
|
331
303
|
function repeatString(pattern, count) {
|
|
332
304
|
if (count < 1) {
|
|
333
305
|
return '';
|
|
@@ -356,18 +328,19 @@ function outputLink(cap, link, raw, lexer) {
|
|
|
356
328
|
href,
|
|
357
329
|
title,
|
|
358
330
|
text,
|
|
359
|
-
tokens: lexer.inlineTokens(text)
|
|
331
|
+
tokens: lexer.inlineTokens(text, [])
|
|
360
332
|
};
|
|
361
333
|
lexer.state.inLink = false;
|
|
362
334
|
return token;
|
|
335
|
+
} else {
|
|
336
|
+
return {
|
|
337
|
+
type: 'image',
|
|
338
|
+
raw,
|
|
339
|
+
href,
|
|
340
|
+
title,
|
|
341
|
+
text: escape(text)
|
|
342
|
+
};
|
|
363
343
|
}
|
|
364
|
-
return {
|
|
365
|
-
type: 'image',
|
|
366
|
-
raw,
|
|
367
|
-
href,
|
|
368
|
-
title,
|
|
369
|
-
text: escape(text)
|
|
370
|
-
};
|
|
371
344
|
}
|
|
372
345
|
|
|
373
346
|
function indentCodeCompensation(raw, text) {
|
|
@@ -462,13 +435,15 @@ class Tokenizer {
|
|
|
462
435
|
}
|
|
463
436
|
}
|
|
464
437
|
|
|
465
|
-
|
|
438
|
+
const token = {
|
|
466
439
|
type: 'heading',
|
|
467
440
|
raw: cap[0],
|
|
468
441
|
depth: cap[1].length,
|
|
469
|
-
text,
|
|
470
|
-
tokens:
|
|
442
|
+
text: text,
|
|
443
|
+
tokens: []
|
|
471
444
|
};
|
|
445
|
+
this.lexer.inline(token.text, token.tokens);
|
|
446
|
+
return token;
|
|
472
447
|
}
|
|
473
448
|
}
|
|
474
449
|
|
|
@@ -485,7 +460,7 @@ class Tokenizer {
|
|
|
485
460
|
blockquote(src) {
|
|
486
461
|
const cap = this.rules.block.blockquote.exec(src);
|
|
487
462
|
if (cap) {
|
|
488
|
-
const text = cap[0].replace(/^ *>
|
|
463
|
+
const text = cap[0].replace(/^ *> ?/gm, '');
|
|
489
464
|
|
|
490
465
|
return {
|
|
491
466
|
type: 'blockquote',
|
|
@@ -521,7 +496,7 @@ class Tokenizer {
|
|
|
521
496
|
}
|
|
522
497
|
|
|
523
498
|
// Get next list item
|
|
524
|
-
const itemRegex = new RegExp(`^( {0,3}${bull})((?:
|
|
499
|
+
const itemRegex = new RegExp(`^( {0,3}${bull})((?: [^\\n]*)?(?:\\n|$))`);
|
|
525
500
|
|
|
526
501
|
// Check if current bullet point can start a new List Item
|
|
527
502
|
while (src) {
|
|
@@ -559,10 +534,7 @@ class Tokenizer {
|
|
|
559
534
|
}
|
|
560
535
|
|
|
561
536
|
if (!endEarly) {
|
|
562
|
-
const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])
|
|
563
|
-
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
|
564
|
-
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
|
565
|
-
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
|
537
|
+
const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])`);
|
|
566
538
|
|
|
567
539
|
// Check if following lines should be included in List Item
|
|
568
540
|
while (src) {
|
|
@@ -574,26 +546,11 @@ class Tokenizer {
|
|
|
574
546
|
line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
|
|
575
547
|
}
|
|
576
548
|
|
|
577
|
-
// End list item if found code fences
|
|
578
|
-
if (fencesBeginRegex.test(line)) {
|
|
579
|
-
break;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
// End list item if found start of new heading
|
|
583
|
-
if (headingBeginRegex.test(line)) {
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
549
|
// End list item if found start of new bullet
|
|
588
550
|
if (nextBulletRegex.test(line)) {
|
|
589
551
|
break;
|
|
590
552
|
}
|
|
591
553
|
|
|
592
|
-
// Horizontal rule found
|
|
593
|
-
if (hrRegex.test(src)) {
|
|
594
|
-
break;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
554
|
if (line.search(/[^ ]/) >= indent || !line.trim()) { // Dedent if possible
|
|
598
555
|
itemContents += '\n' + line.slice(indent);
|
|
599
556
|
} else if (!blankLine) { // Until blank line, item doesn't need indentation
|
|
@@ -631,7 +588,7 @@ class Tokenizer {
|
|
|
631
588
|
|
|
632
589
|
list.items.push({
|
|
633
590
|
type: 'list_item',
|
|
634
|
-
raw,
|
|
591
|
+
raw: raw,
|
|
635
592
|
task: !!istask,
|
|
636
593
|
checked: ischecked,
|
|
637
594
|
loose: false,
|
|
@@ -690,10 +647,10 @@ class Tokenizer {
|
|
|
690
647
|
text: cap[0]
|
|
691
648
|
};
|
|
692
649
|
if (this.options.sanitize) {
|
|
693
|
-
const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
|
|
694
650
|
token.type = 'paragraph';
|
|
695
|
-
token.text =
|
|
696
|
-
token.tokens =
|
|
651
|
+
token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
|
|
652
|
+
token.tokens = [];
|
|
653
|
+
this.lexer.inline(token.text, token.tokens);
|
|
697
654
|
}
|
|
698
655
|
return token;
|
|
699
656
|
}
|
|
@@ -751,7 +708,8 @@ class Tokenizer {
|
|
|
751
708
|
// header child tokens
|
|
752
709
|
l = item.header.length;
|
|
753
710
|
for (j = 0; j < l; j++) {
|
|
754
|
-
item.header[j].tokens =
|
|
711
|
+
item.header[j].tokens = [];
|
|
712
|
+
this.lexer.inlineTokens(item.header[j].text, item.header[j].tokens);
|
|
755
713
|
}
|
|
756
714
|
|
|
757
715
|
// cell child tokens
|
|
@@ -759,7 +717,8 @@ class Tokenizer {
|
|
|
759
717
|
for (j = 0; j < l; j++) {
|
|
760
718
|
row = item.rows[j];
|
|
761
719
|
for (k = 0; k < row.length; k++) {
|
|
762
|
-
row[k].tokens =
|
|
720
|
+
row[k].tokens = [];
|
|
721
|
+
this.lexer.inlineTokens(row[k].text, row[k].tokens);
|
|
763
722
|
}
|
|
764
723
|
}
|
|
765
724
|
|
|
@@ -771,40 +730,45 @@ class Tokenizer {
|
|
|
771
730
|
lheading(src) {
|
|
772
731
|
const cap = this.rules.block.lheading.exec(src);
|
|
773
732
|
if (cap) {
|
|
774
|
-
|
|
733
|
+
const token = {
|
|
775
734
|
type: 'heading',
|
|
776
735
|
raw: cap[0],
|
|
777
736
|
depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
|
778
737
|
text: cap[1],
|
|
779
|
-
tokens:
|
|
738
|
+
tokens: []
|
|
780
739
|
};
|
|
740
|
+
this.lexer.inline(token.text, token.tokens);
|
|
741
|
+
return token;
|
|
781
742
|
}
|
|
782
743
|
}
|
|
783
744
|
|
|
784
745
|
paragraph(src) {
|
|
785
746
|
const cap = this.rules.block.paragraph.exec(src);
|
|
786
747
|
if (cap) {
|
|
787
|
-
const
|
|
788
|
-
? cap[1].slice(0, -1)
|
|
789
|
-
: cap[1];
|
|
790
|
-
return {
|
|
748
|
+
const token = {
|
|
791
749
|
type: 'paragraph',
|
|
792
750
|
raw: cap[0],
|
|
793
|
-
text
|
|
794
|
-
|
|
751
|
+
text: cap[1].charAt(cap[1].length - 1) === '\n'
|
|
752
|
+
? cap[1].slice(0, -1)
|
|
753
|
+
: cap[1],
|
|
754
|
+
tokens: []
|
|
795
755
|
};
|
|
756
|
+
this.lexer.inline(token.text, token.tokens);
|
|
757
|
+
return token;
|
|
796
758
|
}
|
|
797
759
|
}
|
|
798
760
|
|
|
799
761
|
text(src) {
|
|
800
762
|
const cap = this.rules.block.text.exec(src);
|
|
801
763
|
if (cap) {
|
|
802
|
-
|
|
764
|
+
const token = {
|
|
803
765
|
type: 'text',
|
|
804
766
|
raw: cap[0],
|
|
805
767
|
text: cap[0],
|
|
806
|
-
tokens:
|
|
768
|
+
tokens: []
|
|
807
769
|
};
|
|
770
|
+
this.lexer.inline(token.text, token.tokens);
|
|
771
|
+
return token;
|
|
808
772
|
}
|
|
809
773
|
}
|
|
810
774
|
|
|
@@ -973,7 +937,7 @@ class Tokenizer {
|
|
|
973
937
|
type: 'em',
|
|
974
938
|
raw: src.slice(0, lLength + match.index + rLength + 1),
|
|
975
939
|
text,
|
|
976
|
-
tokens: this.lexer.inlineTokens(text)
|
|
940
|
+
tokens: this.lexer.inlineTokens(text, [])
|
|
977
941
|
};
|
|
978
942
|
}
|
|
979
943
|
|
|
@@ -983,7 +947,7 @@ class Tokenizer {
|
|
|
983
947
|
type: 'strong',
|
|
984
948
|
raw: src.slice(0, lLength + match.index + rLength + 1),
|
|
985
949
|
text,
|
|
986
|
-
tokens: this.lexer.inlineTokens(text)
|
|
950
|
+
tokens: this.lexer.inlineTokens(text, [])
|
|
987
951
|
};
|
|
988
952
|
}
|
|
989
953
|
}
|
|
@@ -1024,7 +988,7 @@ class Tokenizer {
|
|
|
1024
988
|
type: 'del',
|
|
1025
989
|
raw: cap[0],
|
|
1026
990
|
text: cap[2],
|
|
1027
|
-
tokens: this.lexer.inlineTokens(cap[2])
|
|
991
|
+
tokens: this.lexer.inlineTokens(cap[2], [])
|
|
1028
992
|
};
|
|
1029
993
|
}
|
|
1030
994
|
}
|
|
@@ -1119,10 +1083,10 @@ const block = {
|
|
|
1119
1083
|
newline: /^(?: *(?:\n|$))+/,
|
|
1120
1084
|
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
1121
1085
|
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
1122
|
-
hr: /^ {0,3}((?:-
|
|
1086
|
+
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
|
|
1123
1087
|
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
|
1124
1088
|
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
|
1125
|
-
list: /^( {0,3}bull)(
|
|
1089
|
+
list: /^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,
|
|
1126
1090
|
html: '^ {0,3}(?:' // optional indentation
|
|
1127
1091
|
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
1128
1092
|
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
|
@@ -1276,9 +1240,9 @@ const inline = {
|
|
|
1276
1240
|
emStrong: {
|
|
1277
1241
|
lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
|
|
1278
1242
|
// (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
|
|
1279
|
-
//
|
|
1280
|
-
rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[
|
|
1281
|
-
rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[
|
|
1243
|
+
// () Skip orphan delim inside strong (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
|
|
1244
|
+
rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
|
|
1245
|
+
rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
|
|
1282
1246
|
},
|
|
1283
1247
|
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
1284
1248
|
br: /^( {2,}|\\)\n(?!\s*$)/,
|
|
@@ -1411,7 +1375,6 @@ inline.breaks = merge({}, inline.gfm, {
|
|
|
1411
1375
|
|
|
1412
1376
|
/**
|
|
1413
1377
|
* smartypants text replacement
|
|
1414
|
-
* @param {string} text
|
|
1415
1378
|
*/
|
|
1416
1379
|
function smartypants(text) {
|
|
1417
1380
|
return text
|
|
@@ -1433,7 +1396,6 @@ function smartypants(text) {
|
|
|
1433
1396
|
|
|
1434
1397
|
/**
|
|
1435
1398
|
* mangle email addresses
|
|
1436
|
-
* @param {string} text
|
|
1437
1399
|
*/
|
|
1438
1400
|
function mangle(text) {
|
|
1439
1401
|
let out = '',
|
|
@@ -1521,7 +1483,8 @@ class Lexer {
|
|
|
1521
1483
|
*/
|
|
1522
1484
|
lex(src) {
|
|
1523
1485
|
src = src
|
|
1524
|
-
.replace(/\r\n|\r/g, '\n')
|
|
1486
|
+
.replace(/\r\n|\r/g, '\n')
|
|
1487
|
+
.replace(/\t/g, ' ');
|
|
1525
1488
|
|
|
1526
1489
|
this.blockTokens(src, this.tokens);
|
|
1527
1490
|
|
|
@@ -1538,13 +1501,8 @@ class Lexer {
|
|
|
1538
1501
|
*/
|
|
1539
1502
|
blockTokens(src, tokens = []) {
|
|
1540
1503
|
if (this.options.pedantic) {
|
|
1541
|
-
src = src.replace(
|
|
1542
|
-
} else {
|
|
1543
|
-
src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
|
|
1544
|
-
return leading + ' '.repeat(tabs.length);
|
|
1545
|
-
});
|
|
1504
|
+
src = src.replace(/^ +$/gm, '');
|
|
1546
1505
|
}
|
|
1547
|
-
|
|
1548
1506
|
let token, lastToken, cutSrc, lastParagraphClipped;
|
|
1549
1507
|
|
|
1550
1508
|
while (src) {
|
|
@@ -1722,9 +1680,8 @@ class Lexer {
|
|
|
1722
1680
|
return tokens;
|
|
1723
1681
|
}
|
|
1724
1682
|
|
|
1725
|
-
inline(src, tokens
|
|
1683
|
+
inline(src, tokens) {
|
|
1726
1684
|
this.inlineQueue.push({ src, tokens });
|
|
1727
|
-
return tokens;
|
|
1728
1685
|
}
|
|
1729
1686
|
|
|
1730
1687
|
/**
|
|
@@ -1941,31 +1898,29 @@ class Renderer {
|
|
|
1941
1898
|
+ '</code></pre>\n';
|
|
1942
1899
|
}
|
|
1943
1900
|
|
|
1944
|
-
/**
|
|
1945
|
-
* @param {string} quote
|
|
1946
|
-
*/
|
|
1947
1901
|
blockquote(quote) {
|
|
1948
|
-
return
|
|
1902
|
+
return '<blockquote>\n' + quote + '</blockquote>\n';
|
|
1949
1903
|
}
|
|
1950
1904
|
|
|
1951
1905
|
html(html) {
|
|
1952
1906
|
return html;
|
|
1953
1907
|
}
|
|
1954
1908
|
|
|
1955
|
-
/**
|
|
1956
|
-
* @param {string} text
|
|
1957
|
-
* @param {string} level
|
|
1958
|
-
* @param {string} raw
|
|
1959
|
-
* @param {any} slugger
|
|
1960
|
-
*/
|
|
1961
1909
|
heading(text, level, raw, slugger) {
|
|
1962
1910
|
if (this.options.headerIds) {
|
|
1963
|
-
|
|
1964
|
-
|
|
1911
|
+
return '<h'
|
|
1912
|
+
+ level
|
|
1913
|
+
+ ' id="'
|
|
1914
|
+
+ this.options.headerPrefix
|
|
1915
|
+
+ slugger.slug(raw)
|
|
1916
|
+
+ '">'
|
|
1917
|
+
+ text
|
|
1918
|
+
+ '</h'
|
|
1919
|
+
+ level
|
|
1920
|
+
+ '>\n';
|
|
1965
1921
|
}
|
|
1966
|
-
|
|
1967
1922
|
// ignore IDs
|
|
1968
|
-
return
|
|
1923
|
+
return '<h' + level + '>' + text + '</h' + level + '>\n';
|
|
1969
1924
|
}
|
|
1970
1925
|
|
|
1971
1926
|
hr() {
|
|
@@ -1978,11 +1933,8 @@ class Renderer {
|
|
|
1978
1933
|
return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
|
|
1979
1934
|
}
|
|
1980
1935
|
|
|
1981
|
-
/**
|
|
1982
|
-
* @param {string} text
|
|
1983
|
-
*/
|
|
1984
1936
|
listitem(text) {
|
|
1985
|
-
return
|
|
1937
|
+
return '<li>' + text + '</li>\n';
|
|
1986
1938
|
}
|
|
1987
1939
|
|
|
1988
1940
|
checkbox(checked) {
|
|
@@ -1993,19 +1945,12 @@ class Renderer {
|
|
|
1993
1945
|
+ '> ';
|
|
1994
1946
|
}
|
|
1995
1947
|
|
|
1996
|
-
/**
|
|
1997
|
-
* @param {string} text
|
|
1998
|
-
*/
|
|
1999
1948
|
paragraph(text) {
|
|
2000
|
-
return
|
|
1949
|
+
return '<p>' + text + '</p>\n';
|
|
2001
1950
|
}
|
|
2002
1951
|
|
|
2003
|
-
/**
|
|
2004
|
-
* @param {string} header
|
|
2005
|
-
* @param {string} body
|
|
2006
|
-
*/
|
|
2007
1952
|
table(header, body) {
|
|
2008
|
-
if (body) body =
|
|
1953
|
+
if (body) body = '<tbody>' + body + '</tbody>';
|
|
2009
1954
|
|
|
2010
1955
|
return '<table>\n'
|
|
2011
1956
|
+ '<thead>\n'
|
|
@@ -2015,59 +1960,39 @@ class Renderer {
|
|
|
2015
1960
|
+ '</table>\n';
|
|
2016
1961
|
}
|
|
2017
1962
|
|
|
2018
|
-
/**
|
|
2019
|
-
* @param {string} content
|
|
2020
|
-
*/
|
|
2021
1963
|
tablerow(content) {
|
|
2022
|
-
return
|
|
1964
|
+
return '<tr>\n' + content + '</tr>\n';
|
|
2023
1965
|
}
|
|
2024
1966
|
|
|
2025
1967
|
tablecell(content, flags) {
|
|
2026
1968
|
const type = flags.header ? 'th' : 'td';
|
|
2027
1969
|
const tag = flags.align
|
|
2028
|
-
?
|
|
2029
|
-
:
|
|
2030
|
-
return tag + content +
|
|
1970
|
+
? '<' + type + ' align="' + flags.align + '">'
|
|
1971
|
+
: '<' + type + '>';
|
|
1972
|
+
return tag + content + '</' + type + '>\n';
|
|
2031
1973
|
}
|
|
2032
1974
|
|
|
2033
|
-
|
|
2034
|
-
* span level renderer
|
|
2035
|
-
* @param {string} text
|
|
2036
|
-
*/
|
|
1975
|
+
// span level renderer
|
|
2037
1976
|
strong(text) {
|
|
2038
|
-
return
|
|
1977
|
+
return '<strong>' + text + '</strong>';
|
|
2039
1978
|
}
|
|
2040
1979
|
|
|
2041
|
-
/**
|
|
2042
|
-
* @param {string} text
|
|
2043
|
-
*/
|
|
2044
1980
|
em(text) {
|
|
2045
|
-
return
|
|
1981
|
+
return '<em>' + text + '</em>';
|
|
2046
1982
|
}
|
|
2047
1983
|
|
|
2048
|
-
/**
|
|
2049
|
-
* @param {string} text
|
|
2050
|
-
*/
|
|
2051
1984
|
codespan(text) {
|
|
2052
|
-
return
|
|
1985
|
+
return '<code>' + text + '</code>';
|
|
2053
1986
|
}
|
|
2054
1987
|
|
|
2055
1988
|
br() {
|
|
2056
1989
|
return this.options.xhtml ? '<br/>' : '<br>';
|
|
2057
1990
|
}
|
|
2058
1991
|
|
|
2059
|
-
/**
|
|
2060
|
-
* @param {string} text
|
|
2061
|
-
*/
|
|
2062
1992
|
del(text) {
|
|
2063
|
-
return
|
|
1993
|
+
return '<del>' + text + '</del>';
|
|
2064
1994
|
}
|
|
2065
1995
|
|
|
2066
|
-
/**
|
|
2067
|
-
* @param {string} href
|
|
2068
|
-
* @param {string} title
|
|
2069
|
-
* @param {string} text
|
|
2070
|
-
*/
|
|
2071
1996
|
link(href, title, text) {
|
|
2072
1997
|
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
2073
1998
|
if (href === null) {
|
|
@@ -2081,20 +2006,15 @@ class Renderer {
|
|
|
2081
2006
|
return out;
|
|
2082
2007
|
}
|
|
2083
2008
|
|
|
2084
|
-
/**
|
|
2085
|
-
* @param {string} href
|
|
2086
|
-
* @param {string} title
|
|
2087
|
-
* @param {string} text
|
|
2088
|
-
*/
|
|
2089
2009
|
image(href, title, text) {
|
|
2090
2010
|
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
2091
2011
|
if (href === null) {
|
|
2092
2012
|
return text;
|
|
2093
2013
|
}
|
|
2094
2014
|
|
|
2095
|
-
let out =
|
|
2015
|
+
let out = '<img src="' + href + '" alt="' + text + '"';
|
|
2096
2016
|
if (title) {
|
|
2097
|
-
out +=
|
|
2017
|
+
out += ' title="' + title + '"';
|
|
2098
2018
|
}
|
|
2099
2019
|
out += this.options.xhtml ? '/>' : '>';
|
|
2100
2020
|
return out;
|
|
@@ -2156,9 +2076,6 @@ class Slugger {
|
|
|
2156
2076
|
this.seen = {};
|
|
2157
2077
|
}
|
|
2158
2078
|
|
|
2159
|
-
/**
|
|
2160
|
-
* @param {string} value
|
|
2161
|
-
*/
|
|
2162
2079
|
serialize(value) {
|
|
2163
2080
|
return value
|
|
2164
2081
|
.toLowerCase()
|
|
@@ -2172,8 +2089,6 @@ class Slugger {
|
|
|
2172
2089
|
|
|
2173
2090
|
/**
|
|
2174
2091
|
* Finds the next safe (unique) slug to use
|
|
2175
|
-
* @param {string} originalSlug
|
|
2176
|
-
* @param {boolean} isDryRun
|
|
2177
2092
|
*/
|
|
2178
2093
|
getNextSafeSlug(originalSlug, isDryRun) {
|
|
2179
2094
|
let slug = originalSlug;
|
|
@@ -2194,9 +2109,8 @@ class Slugger {
|
|
|
2194
2109
|
|
|
2195
2110
|
/**
|
|
2196
2111
|
* Convert string to unique id
|
|
2197
|
-
* @param {object}
|
|
2198
|
-
* @param {boolean}
|
|
2199
|
-
* updating the internal accumulator.
|
|
2112
|
+
* @param {object} options
|
|
2113
|
+
* @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator.
|
|
2200
2114
|
*/
|
|
2201
2115
|
slug(value, options = {}) {
|
|
2202
2116
|
const slug = this.serialize(value);
|
|
@@ -2573,31 +2487,20 @@ function marked(src, opt, callback) {
|
|
|
2573
2487
|
return;
|
|
2574
2488
|
}
|
|
2575
2489
|
|
|
2576
|
-
function onError(e) {
|
|
2577
|
-
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
2578
|
-
if (opt.silent) {
|
|
2579
|
-
return '<p>An error occurred:</p><pre>'
|
|
2580
|
-
+ escape(e.message + '', true)
|
|
2581
|
-
+ '</pre>';
|
|
2582
|
-
}
|
|
2583
|
-
throw e;
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
2490
|
try {
|
|
2587
2491
|
const tokens = Lexer.lex(src, opt);
|
|
2588
2492
|
if (opt.walkTokens) {
|
|
2589
|
-
if (opt.async) {
|
|
2590
|
-
return Promise.all(marked.walkTokens(tokens, opt.walkTokens))
|
|
2591
|
-
.then(() => {
|
|
2592
|
-
return Parser.parse(tokens, opt);
|
|
2593
|
-
})
|
|
2594
|
-
.catch(onError);
|
|
2595
|
-
}
|
|
2596
2493
|
marked.walkTokens(tokens, opt.walkTokens);
|
|
2597
2494
|
}
|
|
2598
2495
|
return Parser.parse(tokens, opt);
|
|
2599
2496
|
} catch (e) {
|
|
2600
|
-
|
|
2497
|
+
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
2498
|
+
if (opt.silent) {
|
|
2499
|
+
return '<p>An error occurred:</p><pre>'
|
|
2500
|
+
+ escape(e.message + '', true)
|
|
2501
|
+
+ '</pre>';
|
|
2502
|
+
}
|
|
2503
|
+
throw e;
|
|
2601
2504
|
}
|
|
2602
2505
|
}
|
|
2603
2506
|
|
|
@@ -2715,12 +2618,10 @@ marked.use = function(...args) {
|
|
|
2715
2618
|
if (pack.walkTokens) {
|
|
2716
2619
|
const walkTokens = marked.defaults.walkTokens;
|
|
2717
2620
|
opts.walkTokens = function(token) {
|
|
2718
|
-
|
|
2719
|
-
values.push(pack.walkTokens.call(this, token));
|
|
2621
|
+
pack.walkTokens.call(this, token);
|
|
2720
2622
|
if (walkTokens) {
|
|
2721
|
-
|
|
2623
|
+
walkTokens.call(this, token);
|
|
2722
2624
|
}
|
|
2723
|
-
return values;
|
|
2724
2625
|
};
|
|
2725
2626
|
}
|
|
2726
2627
|
|
|
@@ -2737,42 +2638,39 @@ marked.use = function(...args) {
|
|
|
2737
2638
|
*/
|
|
2738
2639
|
|
|
2739
2640
|
marked.walkTokens = function(tokens, callback) {
|
|
2740
|
-
let values = [];
|
|
2741
2641
|
for (const token of tokens) {
|
|
2742
|
-
|
|
2642
|
+
callback.call(marked, token);
|
|
2743
2643
|
switch (token.type) {
|
|
2744
2644
|
case 'table': {
|
|
2745
2645
|
for (const cell of token.header) {
|
|
2746
|
-
|
|
2646
|
+
marked.walkTokens(cell.tokens, callback);
|
|
2747
2647
|
}
|
|
2748
2648
|
for (const row of token.rows) {
|
|
2749
2649
|
for (const cell of row) {
|
|
2750
|
-
|
|
2650
|
+
marked.walkTokens(cell.tokens, callback);
|
|
2751
2651
|
}
|
|
2752
2652
|
}
|
|
2753
2653
|
break;
|
|
2754
2654
|
}
|
|
2755
2655
|
case 'list': {
|
|
2756
|
-
|
|
2656
|
+
marked.walkTokens(token.items, callback);
|
|
2757
2657
|
break;
|
|
2758
2658
|
}
|
|
2759
2659
|
default: {
|
|
2760
2660
|
if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) { // Walk any extensions
|
|
2761
2661
|
marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
|
|
2762
|
-
|
|
2662
|
+
marked.walkTokens(token[childTokens], callback);
|
|
2763
2663
|
});
|
|
2764
2664
|
} else if (token.tokens) {
|
|
2765
|
-
|
|
2665
|
+
marked.walkTokens(token.tokens, callback);
|
|
2766
2666
|
}
|
|
2767
2667
|
}
|
|
2768
2668
|
}
|
|
2769
2669
|
}
|
|
2770
|
-
return values;
|
|
2771
2670
|
};
|
|
2772
2671
|
|
|
2773
2672
|
/**
|
|
2774
2673
|
* Parse Inline
|
|
2775
|
-
* @param {string} src
|
|
2776
2674
|
*/
|
|
2777
2675
|
marked.parseInline = function(src, opt) {
|
|
2778
2676
|
// throw error in case of non string input
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = __webpack_public_path__ + "assets/img/emoji/messenger/sub_25.490_45.098.3dfbc08.png";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = __webpack_public_path__ + "assets/img/emoji/messenger/sub_60.784_27.451.46b54e5.png";
|