@8btc/mditor 0.0.36 → 0.0.39
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.css +2 -2
- package/dist/index.js +19 -19
- package/dist/index.min.js +1 -1
- package/dist/js/mathjax/tex-svg-full.js +89129 -1
- package/dist/method.js +19 -19
- package/dist/method.min.js +1 -1
- package/dist/ts/markdown/mathRender.d.ts +0 -5
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/ts/markdown/mathContextMenu.ts +27 -17
- package/src/ts/markdown/mathRender.ts +12 -18
package/dist/index.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v0.0.
|
|
2
|
+
* Vditor v0.0.39 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
27
|
/*!
|
|
28
|
-
* Vditor v0.0.
|
|
28
|
+
* Vditor v0.0.39 - A markdown editor written in TypeScript.
|
|
29
29
|
*
|
|
30
30
|
* MIT License
|
|
31
31
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v0.0.
|
|
2
|
+
* Vditor v0.0.39 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -2923,7 +2923,7 @@ var Vditor = /** @class */ (function () {
|
|
|
2923
2923
|
/* harmony export */ "H": () => (/* binding */ _VDITOR_VERSION),
|
|
2924
2924
|
/* harmony export */ "g": () => (/* binding */ Constants)
|
|
2925
2925
|
/* harmony export */ });
|
|
2926
|
-
var _VDITOR_VERSION = "0.0.
|
|
2926
|
+
var _VDITOR_VERSION = "0.0.39";
|
|
2927
2927
|
|
|
2928
2928
|
var Constants = /** @class */ (function () {
|
|
2929
2929
|
function Constants() {
|
|
@@ -3225,7 +3225,7 @@ var Constants = /** @class */ (function () {
|
|
|
3225
3225
|
"c#",
|
|
3226
3226
|
"bat",
|
|
3227
3227
|
];
|
|
3228
|
-
Constants.CDN = "https://webcdn.wujieai.com/vditor@".concat("0.0.
|
|
3228
|
+
Constants.CDN = "https://webcdn.wujieai.com/vditor@".concat("0.0.39");
|
|
3229
3229
|
Constants.MARKDOWN_OPTIONS = {
|
|
3230
3230
|
autoSpace: false,
|
|
3231
3231
|
gfmAutoLink: true,
|
|
@@ -5171,8 +5171,8 @@ var MathContextMenu = /** @class */ (function () {
|
|
|
5171
5171
|
output: "mathml",
|
|
5172
5172
|
});
|
|
5173
5173
|
}
|
|
5174
|
-
else if ((_a = window.
|
|
5175
|
-
mml = window.
|
|
5174
|
+
else if ((_a = window.VditorMathJax) === null || _a === void 0 ? void 0 : _a.tex2mml) {
|
|
5175
|
+
mml = window.VditorMathJax.tex2mml(tex, {
|
|
5176
5176
|
display: display,
|
|
5177
5177
|
});
|
|
5178
5178
|
}
|
|
@@ -5233,14 +5233,14 @@ var MathContextMenu = /** @class */ (function () {
|
|
|
5233
5233
|
return __generator(this, function (_a) {
|
|
5234
5234
|
switch (_a.label) {
|
|
5235
5235
|
case 0:
|
|
5236
|
-
MJ = window.
|
|
5236
|
+
MJ = window.VditorMathJax;
|
|
5237
5237
|
if (MJ === null || MJ === void 0 ? void 0 : MJ.tex2svg) {
|
|
5238
5238
|
return [2 /*return*/, MJ];
|
|
5239
5239
|
}
|
|
5240
5240
|
return [4 /*yield*/, (0,_util_addScript__WEBPACK_IMPORTED_MODULE_0__/* .addScript */ .G)("/js/mathjax/tex-svg-full.js", "protyleMathJaxSvgScript")];
|
|
5241
5241
|
case 1:
|
|
5242
5242
|
_a.sent();
|
|
5243
|
-
return [2 /*return*/, window.
|
|
5243
|
+
return [2 /*return*/, window.VditorMathJax];
|
|
5244
5244
|
}
|
|
5245
5245
|
});
|
|
5246
5246
|
});
|
|
@@ -5488,7 +5488,7 @@ var mathRender = function (element, options) {
|
|
|
5488
5488
|
var defaultOptions = {
|
|
5489
5489
|
cdn: _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN,
|
|
5490
5490
|
math: {
|
|
5491
|
-
engine: "
|
|
5491
|
+
engine: "KaTeX",
|
|
5492
5492
|
inlineDigit: true,
|
|
5493
5493
|
macros: {},
|
|
5494
5494
|
},
|
|
@@ -5559,13 +5559,13 @@ var mathRender = function (element, options) {
|
|
|
5559
5559
|
};
|
|
5560
5560
|
next();
|
|
5561
5561
|
};
|
|
5562
|
-
if (!window.
|
|
5563
|
-
window.
|
|
5562
|
+
if (!window.VditorMathJax) {
|
|
5563
|
+
window.VditorMathJax = {
|
|
5564
5564
|
loader: {
|
|
5565
5565
|
paths: { mathjax: "".concat(options.cdn, "/dist/js/mathjax") },
|
|
5566
5566
|
},
|
|
5567
5567
|
startup: {
|
|
5568
|
-
typeset:
|
|
5568
|
+
typeset: false,
|
|
5569
5569
|
elements: element instanceof HTMLElement ? [element] : [],
|
|
5570
5570
|
},
|
|
5571
5571
|
tex: {
|
|
@@ -5573,7 +5573,7 @@ var mathRender = function (element, options) {
|
|
|
5573
5573
|
},
|
|
5574
5574
|
};
|
|
5575
5575
|
// https://github.com/Vanessa219/vditor/issues/1453 额外配置(packages、inlineMath、displayMath 等)由调用方通过 mathJaxOptions 传入
|
|
5576
|
-
Object.assign(window.
|
|
5576
|
+
Object.assign(window.VditorMathJax, options.math.mathJaxOptions);
|
|
5577
5577
|
}
|
|
5578
5578
|
(0,_util_addScript__WEBPACK_IMPORTED_MODULE_4__/* .addScriptSync */ .J)("".concat(options.cdn, "/dist/js/mathjax/tex-svg-full.js"), "protyleMathJaxScript");
|
|
5579
5579
|
var renderMath_1 = function (mathElement, next) {
|
|
@@ -5581,9 +5581,9 @@ var mathRender = function (element, options) {
|
|
|
5581
5581
|
var math = normalizeTex(rawText);
|
|
5582
5582
|
var inPreviewPre = mathElement.parentElement &&
|
|
5583
5583
|
mathElement.parentElement.tagName === "PRE";
|
|
5584
|
-
var mathOptions = window.
|
|
5584
|
+
var mathOptions = window.VditorMathJax.getMetricsFor(mathElement);
|
|
5585
5585
|
mathOptions.display = inPreviewPre || mathElement.tagName === "DIV";
|
|
5586
|
-
window.
|
|
5586
|
+
window.VditorMathJax.tex2svgPromise(math, mathOptions).then(function (node) {
|
|
5587
5587
|
mathElement.innerHTML = "";
|
|
5588
5588
|
mathElement.setAttribute("data-math", math);
|
|
5589
5589
|
mathElement.append(node);
|
|
@@ -5592,7 +5592,7 @@ var mathRender = function (element, options) {
|
|
|
5592
5592
|
pre.classList.add("vditor-wysiwyg__preview--math");
|
|
5593
5593
|
}
|
|
5594
5594
|
(0,_mathContextMenu__WEBPACK_IMPORTED_MODULE_2__/* .bindMathContextMenu */ .xX)(mathElement);
|
|
5595
|
-
var startup = window.
|
|
5595
|
+
var startup = window.VditorMathJax.startup;
|
|
5596
5596
|
var prevElements = startup.elements;
|
|
5597
5597
|
if (element instanceof HTMLElement) {
|
|
5598
5598
|
startup.elements = [element];
|
|
@@ -5614,10 +5614,10 @@ var mathRender = function (element, options) {
|
|
|
5614
5614
|
}
|
|
5615
5615
|
});
|
|
5616
5616
|
};
|
|
5617
|
-
window.
|
|
5618
|
-
if (window.
|
|
5619
|
-
window.
|
|
5620
|
-
window.
|
|
5617
|
+
window.VditorMathJax.startup.promise.then(function () {
|
|
5618
|
+
if (window.VditorMathJax.startup) {
|
|
5619
|
+
window.VditorMathJax.startup.typeset = true;
|
|
5620
|
+
window.VditorMathJax.startup.elements =
|
|
5621
5621
|
element instanceof HTMLElement ? [element] : [];
|
|
5622
5622
|
}
|
|
5623
5623
|
var chains = [];
|