artalk 2.5.4 → 2.5.5
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/Artalk.es.js +47 -21
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.js +1 -1
- package/dist/ArtalkLite.es.js +16 -16
- package/dist/ArtalkLite.iife.js +1 -1
- package/dist/ArtalkLite.js +1 -1
- package/dist/types/artalk-config.d.ts +3 -3
- package/package.json +3 -3
- package/src/defaults.ts +1 -1
- package/src/editor/submit.ts +4 -4
- package/src/lib/utils.ts +2 -1
- package/types/artalk-config.d.ts +3 -3
package/dist/Artalk.es.js
CHANGED
|
@@ -136,7 +136,8 @@ function onImagesLoaded($container, event) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
function getGravatarURL(ctx, emailMD5) {
|
|
139
|
-
|
|
139
|
+
const { mirror, params } = ctx.conf.gravatar;
|
|
140
|
+
return `${mirror.replace(/\/$/, "")}/${emailMD5}?${params.replace(/^\?/, "")}`;
|
|
140
141
|
}
|
|
141
142
|
function versionCompare(a, b) {
|
|
142
143
|
const pa = a.split(".");
|
|
@@ -732,10 +733,34 @@ function findClosingBracket(str, b) {
|
|
|
732
733
|
}
|
|
733
734
|
return -1;
|
|
734
735
|
}
|
|
735
|
-
function
|
|
736
|
-
if (opt
|
|
736
|
+
function checkDeprecations(opt, callback) {
|
|
737
|
+
if (!opt || opt.silent) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
if (callback) {
|
|
741
|
+
console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async");
|
|
742
|
+
}
|
|
743
|
+
if (opt.sanitize || opt.sanitizer) {
|
|
737
744
|
console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
|
|
738
745
|
}
|
|
746
|
+
if (opt.highlight || opt.langPrefix !== "language-") {
|
|
747
|
+
console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.");
|
|
748
|
+
}
|
|
749
|
+
if (opt.mangle) {
|
|
750
|
+
console.warn("marked(): mangle parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-mangle.");
|
|
751
|
+
}
|
|
752
|
+
if (opt.baseUrl) {
|
|
753
|
+
console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.");
|
|
754
|
+
}
|
|
755
|
+
if (opt.smartypants) {
|
|
756
|
+
console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.");
|
|
757
|
+
}
|
|
758
|
+
if (opt.xhtml) {
|
|
759
|
+
console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.");
|
|
760
|
+
}
|
|
761
|
+
if (opt.headerIds || opt.headerPrefix) {
|
|
762
|
+
console.warn("marked(): headerIds and headerPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-gfm-heading-id.");
|
|
763
|
+
}
|
|
739
764
|
}
|
|
740
765
|
function repeatString(pattern, count) {
|
|
741
766
|
if (count < 1) {
|
|
@@ -1025,6 +1050,7 @@ class Tokenizer {
|
|
|
1025
1050
|
if (cap) {
|
|
1026
1051
|
const token = {
|
|
1027
1052
|
type: "html",
|
|
1053
|
+
block: true,
|
|
1028
1054
|
raw: cap[0],
|
|
1029
1055
|
pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
|
|
1030
1056
|
text: cap[0]
|
|
@@ -1163,6 +1189,7 @@ class Tokenizer {
|
|
|
1163
1189
|
raw: cap[0],
|
|
1164
1190
|
inLink: this.lexer.state.inLink,
|
|
1165
1191
|
inRawBlock: this.lexer.state.inRawBlock,
|
|
1192
|
+
block: false,
|
|
1166
1193
|
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
|
|
1167
1194
|
};
|
|
1168
1195
|
}
|
|
@@ -1929,7 +1956,7 @@ class Renderer {
|
|
|
1929
1956
|
${quote}</blockquote>
|
|
1930
1957
|
`;
|
|
1931
1958
|
}
|
|
1932
|
-
html(html) {
|
|
1959
|
+
html(html, block2) {
|
|
1933
1960
|
return html;
|
|
1934
1961
|
}
|
|
1935
1962
|
/**
|
|
@@ -2264,7 +2291,7 @@ class Parser {
|
|
|
2264
2291
|
continue;
|
|
2265
2292
|
}
|
|
2266
2293
|
case "html": {
|
|
2267
|
-
out += this.renderer.html(token.text);
|
|
2294
|
+
out += this.renderer.html(token.text, token.block);
|
|
2268
2295
|
continue;
|
|
2269
2296
|
}
|
|
2270
2297
|
case "paragraph": {
|
|
@@ -2424,7 +2451,7 @@ function parseMarkdown(lexer, parser2) {
|
|
|
2424
2451
|
if (typeof src !== "string") {
|
|
2425
2452
|
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
2426
2453
|
}
|
|
2427
|
-
|
|
2454
|
+
checkDeprecations(opt, callback);
|
|
2428
2455
|
if (opt.hooks) {
|
|
2429
2456
|
opt.hooks.options = opt;
|
|
2430
2457
|
}
|
|
@@ -2695,6 +2722,9 @@ marked$1.parseInline;
|
|
|
2695
2722
|
Parser.parse;
|
|
2696
2723
|
Lexer.lex;
|
|
2697
2724
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2725
|
+
function getDefaultExportFromCjs(x) {
|
|
2726
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2727
|
+
}
|
|
2698
2728
|
var escapes = {
|
|
2699
2729
|
"&": "&",
|
|
2700
2730
|
"<": "<",
|
|
@@ -3084,15 +3114,8 @@ function insane(html, options, strict) {
|
|
|
3084
3114
|
}
|
|
3085
3115
|
insane.defaults = defaults$1;
|
|
3086
3116
|
var insane_1 = insane;
|
|
3087
|
-
|
|
3088
|
-
var hanabi$1 = {
|
|
3089
|
-
get exports() {
|
|
3090
|
-
return hanabiExports;
|
|
3091
|
-
},
|
|
3092
|
-
set exports(v) {
|
|
3093
|
-
hanabiExports = v;
|
|
3094
|
-
}
|
|
3095
|
-
};
|
|
3117
|
+
const insane$1 = /* @__PURE__ */ getDefaultExportFromCjs(insane_1);
|
|
3118
|
+
var hanabi$1 = { exports: {} };
|
|
3096
3119
|
(function(module, exports) {
|
|
3097
3120
|
(function(global2, factory) {
|
|
3098
3121
|
module.exports = factory();
|
|
@@ -3148,7 +3171,8 @@ var hanabi$1 = {
|
|
|
3148
3171
|
return index;
|
|
3149
3172
|
});
|
|
3150
3173
|
})(hanabi$1);
|
|
3151
|
-
|
|
3174
|
+
var hanabiExports = hanabi$1.exports;
|
|
3175
|
+
const hanabi = /* @__PURE__ */ getDefaultExportFromCjs(hanabiExports);
|
|
3152
3176
|
let instance;
|
|
3153
3177
|
function getInstance() {
|
|
3154
3178
|
return instance;
|
|
@@ -3201,7 +3225,7 @@ function marked(ctx, src) {
|
|
|
3201
3225
|
if (!markedContent) {
|
|
3202
3226
|
markedContent = src.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g, (_, code) => `<pre><code>${hanabi(code)}</code></pre>`).replace(/!\[(.*?)\]\((.*?)\)/g, (_, alt, imgSrc) => `<img src="${imgSrc}" alt="${alt}" />`).replace(/\[(.*?)\]\((.*?)\)/g, (_, text, link) => `<a href="${link}" target="_blank">${text}</a>`).replace(/\n/g, "<br>");
|
|
3203
3227
|
}
|
|
3204
|
-
let dest =
|
|
3228
|
+
let dest = insane$1(markedContent, {
|
|
3205
3229
|
allowedClasses: {},
|
|
3206
3230
|
// @refer CVE-2018-8495
|
|
3207
3231
|
// @link https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-8495
|
|
@@ -3472,7 +3496,7 @@ function t(key, args = {}) {
|
|
|
3472
3496
|
str = str.replace(/\{\s*(\w+?)\s*\}/g, (_, token) => args[token] || "");
|
|
3473
3497
|
return str;
|
|
3474
3498
|
}
|
|
3475
|
-
const version = "2.5.
|
|
3499
|
+
const version = "2.5.5";
|
|
3476
3500
|
class User {
|
|
3477
3501
|
constructor() {
|
|
3478
3502
|
__publicField(this, "ctx");
|
|
@@ -5000,8 +5024,8 @@ const defaults = {
|
|
|
5000
5024
|
countEl: "#ArtalkCount",
|
|
5001
5025
|
pvEl: "#ArtalkPV",
|
|
5002
5026
|
gravatar: {
|
|
5003
|
-
|
|
5004
|
-
|
|
5027
|
+
mirror: "https://cravatar.cn/avatar/",
|
|
5028
|
+
params: "d=mp&s=240"
|
|
5005
5029
|
},
|
|
5006
5030
|
pagination: {
|
|
5007
5031
|
pageSize: 20,
|
|
@@ -7695,10 +7719,12 @@ function Do(m) {
|
|
|
7695
7719
|
} catch (err) {
|
|
7696
7720
|
console.error(err);
|
|
7697
7721
|
m.editor.showNotify(`${m.editor.$t("commentFail")},${err.msg || String(err)}`, "e");
|
|
7722
|
+
return;
|
|
7723
|
+
} finally {
|
|
7724
|
+
m.editor.hideLoading();
|
|
7698
7725
|
}
|
|
7699
7726
|
m.editor.reset();
|
|
7700
7727
|
m.editor.ctx.trigger("editor-submitted");
|
|
7701
|
-
m.editor.hideLoading();
|
|
7702
7728
|
});
|
|
7703
7729
|
}
|
|
7704
7730
|
function getSubmitAddParams(m) {
|