vditor 3.11.2 → 3.11.3
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/README.md +11 -1
- package/dist/css/content-theme/ant-design.css +10 -0
- package/dist/css/content-theme/dark.css +10 -0
- package/dist/css/content-theme/light.css +13 -0
- package/dist/css/content-theme/wechat.css +10 -0
- package/dist/index.css +133 -4
- package/dist/index.js +587 -36
- package/dist/index.min.js +1 -1
- package/dist/js/i18n/ja_JP.js +2 -2
- package/dist/js/i18n/zh_TW.js +8 -8
- package/dist/js/lute/lute.min.js +75 -60
- package/dist/js/mermaid/mermaid.min.js +2027 -1047
- package/dist/js/wavedrom/LICENSE.WaveDrom +21 -0
- package/dist/js/wavedrom/wavedrom.min.js +9 -0
- package/dist/method.d.ts +2 -0
- package/dist/method.js +311 -6
- package/dist/method.min.js +1 -1
- package/dist/ts/constants.d.ts +4 -0
- package/dist/ts/markdown/adapterRender.d.ts +4 -0
- package/dist/ts/markdown/imageCaptionRender.d.ts +2 -0
- package/dist/ts/markdown/wavedromRender.d.ts +1 -0
- package/dist/ts/util/fixBrowserBehavior.d.ts +1 -0
- package/dist/types/index.d.ts +15 -0
- package/package.json +7 -4
- package/src/assets/less/_reset.less +103 -2
- package/src/assets/less/index.less +20 -0
- package/src/index.ts +3 -0
- package/src/method.ts +3 -0
- package/src/ts/constants.ts +5 -1
- package/src/ts/export/index.ts +2 -0
- package/src/ts/ir/index.ts +26 -0
- package/src/ts/ir/process.ts +24 -1
- package/src/ts/markdown/adapterRender.ts +4 -0
- package/src/ts/markdown/getHTML.ts +6 -3
- package/src/ts/markdown/imageCaptionRender.ts +175 -0
- package/src/ts/markdown/mermaidRender.ts +1 -1
- package/src/ts/markdown/previewRender.ts +7 -1
- package/src/ts/markdown/setLute.ts +3 -0
- package/src/ts/markdown/wavedromRender.ts +54 -0
- package/src/ts/preview/index.ts +5 -0
- package/src/ts/util/Options.ts +1 -1
- package/src/ts/util/fixBrowserBehavior.ts +91 -15
- package/src/ts/util/processCode.ts +3 -0
- package/src/ts/wysiwyg/afterRenderEvent.ts +2 -0
- package/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts +5 -1
- package/src/ts/wysiwyg/input.ts +5 -0
- package/src/ts/wysiwyg/setHeading.ts +110 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v3.11.
|
|
2
|
+
* Vditor v3.11.3 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
return /******/ (() => { // webpackBootstrap
|
|
38
38
|
/******/ var __webpack_modules__ = ({
|
|
39
39
|
|
|
40
|
-
/***/
|
|
40
|
+
/***/ 132:
|
|
41
41
|
/***/ ((module) => {
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -2196,6 +2196,8 @@ var mindmapRender = __webpack_require__(194);
|
|
|
2196
2196
|
var outlineRender = __webpack_require__(436);
|
|
2197
2197
|
// EXTERNAL MODULE: ./src/ts/markdown/plantumlRender.ts
|
|
2198
2198
|
var plantumlRender = __webpack_require__(229);
|
|
2199
|
+
// EXTERNAL MODULE: ./src/ts/markdown/wavedromRender.ts
|
|
2200
|
+
var wavedromRender = __webpack_require__(497);
|
|
2199
2201
|
// EXTERNAL MODULE: ./src/ts/constants.ts
|
|
2200
2202
|
var constants = __webpack_require__(145);
|
|
2201
2203
|
// EXTERNAL MODULE: ./src/ts/ui/setContentTheme.ts
|
|
@@ -2226,6 +2228,8 @@ var anchorRender = function (type) {
|
|
|
2226
2228
|
};
|
|
2227
2229
|
};
|
|
2228
2230
|
|
|
2231
|
+
// EXTERNAL MODULE: ./src/ts/markdown/imageCaptionRender.ts
|
|
2232
|
+
var imageCaptionRender = __webpack_require__(161);
|
|
2229
2233
|
// EXTERNAL MODULE: ./src/ts/markdown/setLute.ts
|
|
2230
2234
|
var setLute = __webpack_require__(214);
|
|
2231
2235
|
// EXTERNAL MODULE: ./src/ts/util/selection.ts
|
|
@@ -2386,6 +2390,8 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
2386
2390
|
|
|
2387
2391
|
|
|
2388
2392
|
|
|
2393
|
+
|
|
2394
|
+
|
|
2389
2395
|
|
|
2390
2396
|
|
|
2391
2397
|
|
|
@@ -2427,6 +2433,7 @@ var md2html = function (mdText, options) {
|
|
|
2427
2433
|
return (0,addScript/* addScript */.G)("".concat(mergedOptions.cdn, "/dist/js/lute/lute.min.js"), "vditorLuteScript").then(function () {
|
|
2428
2434
|
var lute = (0,setLute/* setLute */.X)({
|
|
2429
2435
|
autoSpace: mergedOptions.markdown.autoSpace,
|
|
2436
|
+
callout: mergedOptions.markdown.callout,
|
|
2430
2437
|
gfmAutoLink: mergedOptions.markdown.gfmAutoLink,
|
|
2431
2438
|
codeBlockPreview: mergedOptions.markdown.codeBlockPreview,
|
|
2432
2439
|
emojiSite: mergedOptions.emojiPath,
|
|
@@ -2443,6 +2450,8 @@ var md2html = function (mdText, options) {
|
|
|
2443
2450
|
mathBlockPreview: mergedOptions.markdown.mathBlockPreview,
|
|
2444
2451
|
paragraphBeginningSpace: mergedOptions.markdown.paragraphBeginningSpace,
|
|
2445
2452
|
sanitize: mergedOptions.markdown.sanitize,
|
|
2453
|
+
sub: mergedOptions.markdown.sub,
|
|
2454
|
+
sup: mergedOptions.markdown.sup,
|
|
2446
2455
|
toc: mergedOptions.markdown.toc,
|
|
2447
2456
|
});
|
|
2448
2457
|
if (options === null || options === void 0 ? void 0 : options.renderers) {
|
|
@@ -2453,7 +2462,7 @@ var md2html = function (mdText, options) {
|
|
|
2453
2462
|
});
|
|
2454
2463
|
}
|
|
2455
2464
|
lute.SetHeadingID(true);
|
|
2456
|
-
return lute.Md2HTML(mdText);
|
|
2465
|
+
return (0,imageCaptionRender/* renderImageCaptionHTML */.V)(lute.Md2HTML(mdText), mergedOptions.markdown.imageCaption);
|
|
2457
2466
|
});
|
|
2458
2467
|
};
|
|
2459
2468
|
var previewRender = function (previewElement, markdown, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2511,6 +2520,7 @@ var previewRender = function (previewElement, markdown, options) { return __awai
|
|
|
2511
2520
|
(0,markmapRender/* markmapRender */.K)(previewElement, mergedOptions.cdn);
|
|
2512
2521
|
(0,flowchartRender/* flowchartRender */.P)(previewElement, mergedOptions.cdn);
|
|
2513
2522
|
(0,graphvizRender/* graphvizRender */.v)(previewElement, mergedOptions.cdn);
|
|
2523
|
+
(0,wavedromRender/* wavedromRender */.F)(previewElement, mergedOptions.cdn);
|
|
2514
2524
|
(0,chartRender/* chartRender */.p)(previewElement, mergedOptions.cdn, mergedOptions.mode);
|
|
2515
2525
|
(0,mindmapRender/* mindmapRender */.P)(previewElement, mergedOptions.cdn, mergedOptions.mode);
|
|
2516
2526
|
(0,plantumlRender/* plantumlRender */.B)(previewElement, mergedOptions.cdn);
|
|
@@ -2569,6 +2579,7 @@ var setCodeTheme = __webpack_require__(580);
|
|
|
2569
2579
|
|
|
2570
2580
|
|
|
2571
2581
|
|
|
2582
|
+
|
|
2572
2583
|
|
|
2573
2584
|
|
|
2574
2585
|
var Vditor = /** @class */ (function () {
|
|
@@ -2582,6 +2593,8 @@ var Vditor = /** @class */ (function () {
|
|
|
2582
2593
|
Vditor.codeRender = codeRender/* codeRender */.O;
|
|
2583
2594
|
/** 对 graphviz 进行渲染 */
|
|
2584
2595
|
Vditor.graphvizRender = graphvizRender/* graphvizRender */.v;
|
|
2596
|
+
/** 对数字波形图进行渲染 */
|
|
2597
|
+
Vditor.wavedromRender = wavedromRender/* wavedromRender */.F;
|
|
2585
2598
|
/** 为 element 中的代码块进行高亮渲染 */
|
|
2586
2599
|
Vditor.highlightRender = highlightRender/* highlightRender */.s;
|
|
2587
2600
|
/** 对数学公式进行渲染 */
|
|
@@ -2633,7 +2646,7 @@ var Vditor = /** @class */ (function () {
|
|
|
2633
2646
|
/* harmony export */ "H": () => (/* binding */ _VDITOR_VERSION),
|
|
2634
2647
|
/* harmony export */ "g": () => (/* binding */ Constants)
|
|
2635
2648
|
/* harmony export */ });
|
|
2636
|
-
var _VDITOR_VERSION = "3.11.
|
|
2649
|
+
var _VDITOR_VERSION = "3.11.3";
|
|
2637
2650
|
|
|
2638
2651
|
var Constants = /** @class */ (function () {
|
|
2639
2652
|
function Constants() {
|
|
@@ -2677,17 +2690,19 @@ var Constants = /** @class */ (function () {
|
|
|
2677
2690
|
"stackoverflow-light", "tokyo-night-light", "vs", "xcode", "default"];
|
|
2678
2691
|
Constants.ALIAS_CODE_LANGUAGES = [
|
|
2679
2692
|
// 自定义
|
|
2680
|
-
"abc", "plantuml", "mermaid", "flowchart", "echarts", "mindmap", "graphviz", "math", "markmap", "smiles",
|
|
2693
|
+
"abc", "plantuml", "mermaid", "flowchart", "echarts", "mindmap", "graphviz", "wavedrom", "math", "markmap", "smiles",
|
|
2681
2694
|
// 别名
|
|
2682
2695
|
"js", "ts", "html", "toml", "c#", "bat"
|
|
2683
2696
|
];
|
|
2684
|
-
Constants.CDN = "https://unpkg.com/vditor@".concat("3.11.
|
|
2697
|
+
Constants.CDN = "https://unpkg.com/vditor@".concat("3.11.3");
|
|
2685
2698
|
Constants.MARKDOWN_OPTIONS = {
|
|
2686
2699
|
autoSpace: false,
|
|
2700
|
+
callout: true,
|
|
2687
2701
|
gfmAutoLink: true,
|
|
2688
2702
|
codeBlockPreview: true,
|
|
2689
2703
|
fixTermTypo: false,
|
|
2690
2704
|
footnotes: true,
|
|
2705
|
+
imageCaption: false,
|
|
2691
2706
|
linkBase: "",
|
|
2692
2707
|
linkPrefix: "",
|
|
2693
2708
|
listStyle: false,
|
|
@@ -2695,6 +2710,8 @@ var Constants = /** @class */ (function () {
|
|
|
2695
2710
|
mathBlockPreview: true,
|
|
2696
2711
|
paragraphBeginningSpace: false,
|
|
2697
2712
|
sanitize: true,
|
|
2713
|
+
sub: false,
|
|
2714
|
+
sup: false,
|
|
2698
2715
|
toc: false,
|
|
2699
2716
|
};
|
|
2700
2717
|
Constants.HLJS_OPTIONS = {
|
|
@@ -2816,6 +2833,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2816
2833
|
/* harmony export */ "chartRenderAdapter": () => (/* binding */ chartRenderAdapter),
|
|
2817
2834
|
/* harmony export */ "abcRenderAdapter": () => (/* binding */ abcRenderAdapter),
|
|
2818
2835
|
/* harmony export */ "graphvizRenderAdapter": () => (/* binding */ graphvizRenderAdapter),
|
|
2836
|
+
/* harmony export */ "wavedromRenderAdapter": () => (/* binding */ wavedromRenderAdapter),
|
|
2819
2837
|
/* harmony export */ "flowchartRenderAdapter": () => (/* binding */ flowchartRenderAdapter),
|
|
2820
2838
|
/* harmony export */ "plantumlRenderAdapter": () => (/* binding */ plantumlRenderAdapter)
|
|
2821
2839
|
/* harmony export */ });
|
|
@@ -2852,6 +2870,10 @@ var graphvizRenderAdapter = {
|
|
|
2852
2870
|
getCode: function (el) { return el.textContent; },
|
|
2853
2871
|
getElements: function (el) { return el.querySelectorAll(".language-graphviz"); },
|
|
2854
2872
|
};
|
|
2873
|
+
var wavedromRenderAdapter = {
|
|
2874
|
+
getCode: function (el) { return el.textContent; },
|
|
2875
|
+
getElements: function (el) { return el.querySelectorAll(".language-wavedrom"); },
|
|
2876
|
+
};
|
|
2855
2877
|
var flowchartRenderAdapter = {
|
|
2856
2878
|
getCode: function (el) { return el.textContent; },
|
|
2857
2879
|
getElements: function (el) { return el.querySelectorAll(".language-flowchart"); },
|
|
@@ -3213,6 +3235,179 @@ var highlightRender = function (hljsOption, element, cdn) {
|
|
|
3213
3235
|
};
|
|
3214
3236
|
|
|
3215
3237
|
|
|
3238
|
+
/***/ }),
|
|
3239
|
+
|
|
3240
|
+
/***/ 161:
|
|
3241
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3242
|
+
|
|
3243
|
+
"use strict";
|
|
3244
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3245
|
+
/* harmony export */ "W": () => (/* binding */ renderImageCaptions),
|
|
3246
|
+
/* harmony export */ "V": () => (/* binding */ renderImageCaptionHTML)
|
|
3247
|
+
/* harmony export */ });
|
|
3248
|
+
var getContentNodes = function (element, ignoreIRMarkers) {
|
|
3249
|
+
if (ignoreIRMarkers === void 0) { ignoreIRMarkers = false; }
|
|
3250
|
+
return Array.from(element.childNodes).filter(function (node) {
|
|
3251
|
+
if (node.nodeType === Node.COMMENT_NODE) {
|
|
3252
|
+
return false;
|
|
3253
|
+
}
|
|
3254
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
3255
|
+
return node.textContent.replace(/\u200b/g, "").trim() !== "";
|
|
3256
|
+
}
|
|
3257
|
+
if (!(node instanceof HTMLElement)) {
|
|
3258
|
+
return true;
|
|
3259
|
+
}
|
|
3260
|
+
if (node.tagName === "WBR") {
|
|
3261
|
+
return false;
|
|
3262
|
+
}
|
|
3263
|
+
return !ignoreIRMarkers || !node.classList.contains("vditor-ir__marker");
|
|
3264
|
+
});
|
|
3265
|
+
};
|
|
3266
|
+
var getWYSIWYGImage = function (paragraph) {
|
|
3267
|
+
var nodes = getContentNodes(paragraph);
|
|
3268
|
+
if (nodes.length !== 1 || !(nodes[0] instanceof HTMLElement)) {
|
|
3269
|
+
return undefined;
|
|
3270
|
+
}
|
|
3271
|
+
var container = nodes[0];
|
|
3272
|
+
if (container instanceof HTMLImageElement) {
|
|
3273
|
+
return {
|
|
3274
|
+
container: container,
|
|
3275
|
+
image: container,
|
|
3276
|
+
};
|
|
3277
|
+
}
|
|
3278
|
+
if (container instanceof HTMLAnchorElement) {
|
|
3279
|
+
var linkNodes = getContentNodes(container);
|
|
3280
|
+
if (linkNodes.length === 1 && linkNodes[0] instanceof HTMLImageElement) {
|
|
3281
|
+
return {
|
|
3282
|
+
container: container,
|
|
3283
|
+
image: linkNodes[0],
|
|
3284
|
+
};
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
return undefined;
|
|
3288
|
+
};
|
|
3289
|
+
var getIRImage = function (paragraph) {
|
|
3290
|
+
var nodes = getContentNodes(paragraph);
|
|
3291
|
+
if (nodes.length !== 1 || !(nodes[0] instanceof HTMLElement)) {
|
|
3292
|
+
return undefined;
|
|
3293
|
+
}
|
|
3294
|
+
var imageNode = nodes[0];
|
|
3295
|
+
if (imageNode.getAttribute("data-type") === "a") {
|
|
3296
|
+
var linkNodes = getContentNodes(imageNode, true);
|
|
3297
|
+
if (linkNodes.length !== 1 || !(linkNodes[0] instanceof HTMLElement)) {
|
|
3298
|
+
return undefined;
|
|
3299
|
+
}
|
|
3300
|
+
imageNode = linkNodes[0];
|
|
3301
|
+
}
|
|
3302
|
+
if (imageNode.getAttribute("data-type") !== "img") {
|
|
3303
|
+
return undefined;
|
|
3304
|
+
}
|
|
3305
|
+
var image = imageNode.querySelector(":scope > img");
|
|
3306
|
+
var titleMarker = imageNode.querySelector(":scope > .vditor-ir__marker--title");
|
|
3307
|
+
if (!(image instanceof HTMLImageElement) || !titleMarker) {
|
|
3308
|
+
return undefined;
|
|
3309
|
+
}
|
|
3310
|
+
var markerText = titleMarker.textContent.trim();
|
|
3311
|
+
var closeMarker = markerText[0] === "(" ? ")" : markerText[0];
|
|
3312
|
+
if (markerText.length < 2 || !["\"", "'", "("].includes(markerText[0]) ||
|
|
3313
|
+
markerText[markerText.length - 1] !== closeMarker) {
|
|
3314
|
+
return undefined;
|
|
3315
|
+
}
|
|
3316
|
+
return {
|
|
3317
|
+
caption: markerText.slice(1, -1).trim(),
|
|
3318
|
+
container: imageNode,
|
|
3319
|
+
image: image,
|
|
3320
|
+
};
|
|
3321
|
+
};
|
|
3322
|
+
var unwrapWYSIWYGCaptions = function (element) {
|
|
3323
|
+
element.querySelectorAll("span.vditor-image[data-image-caption]").forEach(function (wrapper) {
|
|
3324
|
+
while (wrapper.firstChild) {
|
|
3325
|
+
wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
|
|
3326
|
+
}
|
|
3327
|
+
wrapper.remove();
|
|
3328
|
+
});
|
|
3329
|
+
};
|
|
3330
|
+
var resetIRCaptions = function (element) {
|
|
3331
|
+
element.querySelectorAll(".vditor-image[data-image-caption]").forEach(function (imageNode) {
|
|
3332
|
+
imageNode.classList.remove("vditor-image");
|
|
3333
|
+
imageNode.removeAttribute("data-image-caption");
|
|
3334
|
+
});
|
|
3335
|
+
};
|
|
3336
|
+
var renderPreviewCaptions = function (element) {
|
|
3337
|
+
element.querySelectorAll("p").forEach(function (paragraph) {
|
|
3338
|
+
var _a;
|
|
3339
|
+
var imageData = getWYSIWYGImage(paragraph);
|
|
3340
|
+
var caption = (_a = imageData === null || imageData === void 0 ? void 0 : imageData.image.getAttribute("title")) === null || _a === void 0 ? void 0 : _a.trim();
|
|
3341
|
+
if (!imageData || !caption) {
|
|
3342
|
+
return;
|
|
3343
|
+
}
|
|
3344
|
+
var figure = document.createElement("figure");
|
|
3345
|
+
Array.from(paragraph.attributes).forEach(function (attribute) {
|
|
3346
|
+
figure.setAttribute(attribute.name, attribute.value);
|
|
3347
|
+
});
|
|
3348
|
+
figure.classList.add("vditor-image");
|
|
3349
|
+
var figcaption = document.createElement("figcaption");
|
|
3350
|
+
figcaption.textContent = caption;
|
|
3351
|
+
figure.append(imageData.container, figcaption);
|
|
3352
|
+
paragraph.replaceWith(figure);
|
|
3353
|
+
});
|
|
3354
|
+
};
|
|
3355
|
+
var renderWYSIWYGCaptions = function (element) {
|
|
3356
|
+
element.querySelectorAll("p").forEach(function (paragraph) {
|
|
3357
|
+
var _a;
|
|
3358
|
+
var imageData = getWYSIWYGImage(paragraph);
|
|
3359
|
+
var caption = (_a = imageData === null || imageData === void 0 ? void 0 : imageData.image.getAttribute("title")) === null || _a === void 0 ? void 0 : _a.trim();
|
|
3360
|
+
if (!imageData || !caption) {
|
|
3361
|
+
return;
|
|
3362
|
+
}
|
|
3363
|
+
var wrapper = document.createElement("span");
|
|
3364
|
+
wrapper.className = "vditor-image";
|
|
3365
|
+
wrapper.setAttribute("data-image-caption", caption);
|
|
3366
|
+
imageData.container.replaceWith(wrapper);
|
|
3367
|
+
wrapper.append(imageData.container);
|
|
3368
|
+
});
|
|
3369
|
+
};
|
|
3370
|
+
var renderIRCaptions = function (element) {
|
|
3371
|
+
element.querySelectorAll("p").forEach(function (paragraph) {
|
|
3372
|
+
var imageData = getIRImage(paragraph);
|
|
3373
|
+
if (!(imageData === null || imageData === void 0 ? void 0 : imageData.caption)) {
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3376
|
+
imageData.container.classList.add("vditor-image");
|
|
3377
|
+
imageData.container.setAttribute("data-image-caption", imageData.caption);
|
|
3378
|
+
});
|
|
3379
|
+
};
|
|
3380
|
+
var renderImageCaptions = function (element, mode, enable) {
|
|
3381
|
+
if (mode === "wysiwyg") {
|
|
3382
|
+
unwrapWYSIWYGCaptions(element);
|
|
3383
|
+
}
|
|
3384
|
+
else if (mode === "ir") {
|
|
3385
|
+
resetIRCaptions(element);
|
|
3386
|
+
}
|
|
3387
|
+
if (!enable) {
|
|
3388
|
+
return;
|
|
3389
|
+
}
|
|
3390
|
+
if (mode === "preview") {
|
|
3391
|
+
renderPreviewCaptions(element);
|
|
3392
|
+
}
|
|
3393
|
+
else if (mode === "wysiwyg") {
|
|
3394
|
+
renderWYSIWYGCaptions(element);
|
|
3395
|
+
}
|
|
3396
|
+
else {
|
|
3397
|
+
renderIRCaptions(element);
|
|
3398
|
+
}
|
|
3399
|
+
};
|
|
3400
|
+
var renderImageCaptionHTML = function (html, enable) {
|
|
3401
|
+
if (!enable) {
|
|
3402
|
+
return html;
|
|
3403
|
+
}
|
|
3404
|
+
var container = document.createElement("div");
|
|
3405
|
+
container.innerHTML = html;
|
|
3406
|
+
renderImageCaptions(container, "preview", true);
|
|
3407
|
+
return container.innerHTML;
|
|
3408
|
+
};
|
|
3409
|
+
|
|
3410
|
+
|
|
3216
3411
|
/***/ }),
|
|
3217
3412
|
|
|
3218
3413
|
/***/ 11:
|
|
@@ -3600,7 +3795,7 @@ var mermaidRender = function (element, cdn, theme) {
|
|
|
3600
3795
|
if (mermaidElements.length === 0) {
|
|
3601
3796
|
return;
|
|
3602
3797
|
}
|
|
3603
|
-
(0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)("".concat(cdn, "/dist/js/mermaid/mermaid.min.js?v=11.
|
|
3798
|
+
(0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)("".concat(cdn, "/dist/js/mermaid/mermaid.min.js?v=11.16.1"), "vditorMermaidScript").then(function () {
|
|
3604
3799
|
var config = {
|
|
3605
3800
|
securityLevel: "loose",
|
|
3606
3801
|
altFontFamily: "sans-serif",
|
|
@@ -3939,6 +4134,7 @@ var setLute = function (options) {
|
|
|
3939
4134
|
lute.SetHeadingAnchor(options.headingAnchor);
|
|
3940
4135
|
lute.SetInlineMathAllowDigitAfterOpenMarker(options.inlineMathDigit);
|
|
3941
4136
|
lute.SetAutoSpace(options.autoSpace);
|
|
4137
|
+
lute.SetCallout(options.callout);
|
|
3942
4138
|
lute.SetToC(options.toc);
|
|
3943
4139
|
lute.SetFootnotes(options.footnotes);
|
|
3944
4140
|
lute.SetFixTermTypo(options.fixTermTypo);
|
|
@@ -3954,10 +4150,121 @@ var setLute = function (options) {
|
|
|
3954
4150
|
if (options.lazyLoadImage) {
|
|
3955
4151
|
lute.SetImageLazyLoading(options.lazyLoadImage);
|
|
3956
4152
|
}
|
|
4153
|
+
lute.SetSup(options.sup);
|
|
4154
|
+
lute.SetSub(options.sub);
|
|
3957
4155
|
return lute;
|
|
3958
4156
|
};
|
|
3959
4157
|
|
|
3960
4158
|
|
|
4159
|
+
/***/ }),
|
|
4160
|
+
|
|
4161
|
+
/***/ 497:
|
|
4162
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4163
|
+
|
|
4164
|
+
"use strict";
|
|
4165
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4166
|
+
/* harmony export */ "F": () => (/* binding */ wavedromRender)
|
|
4167
|
+
/* harmony export */ });
|
|
4168
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(145);
|
|
4169
|
+
/* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(413);
|
|
4170
|
+
/* harmony import */ var _util_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(494);
|
|
4171
|
+
/* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(840);
|
|
4172
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4173
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4174
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4175
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4176
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
4177
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
4178
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
4179
|
+
});
|
|
4180
|
+
};
|
|
4181
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
4182
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
4183
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
4184
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
4185
|
+
function step(op) {
|
|
4186
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
4187
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
4188
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
4189
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
4190
|
+
switch (op[0]) {
|
|
4191
|
+
case 0: case 1: t = op; break;
|
|
4192
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
4193
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
4194
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
4195
|
+
default:
|
|
4196
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
4197
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
4198
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
4199
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
4200
|
+
if (t[2]) _.ops.pop();
|
|
4201
|
+
_.trys.pop(); continue;
|
|
4202
|
+
}
|
|
4203
|
+
op = body.call(thisArg, _);
|
|
4204
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
4205
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
4206
|
+
}
|
|
4207
|
+
};
|
|
4208
|
+
|
|
4209
|
+
|
|
4210
|
+
|
|
4211
|
+
|
|
4212
|
+
var wavedromIndex = 0;
|
|
4213
|
+
var wavedromRender = function (element, cdn) {
|
|
4214
|
+
if (element === void 0) { element = document; }
|
|
4215
|
+
if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
|
|
4216
|
+
var wavedromElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.wavedromRenderAdapter.getElements(element);
|
|
4217
|
+
if (wavedromElements.length === 0) {
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4220
|
+
(0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)("".concat(cdn, "/dist/js/wavedrom/wavedrom.min.js?v=3.6.2"), "vditorWavedromScript").then(function () {
|
|
4221
|
+
wavedromElements.forEach(function (item) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4222
|
+
var code, renderElement, source, error_1, message, lineBreak;
|
|
4223
|
+
return __generator(this, function (_a) {
|
|
4224
|
+
switch (_a.label) {
|
|
4225
|
+
case 0:
|
|
4226
|
+
if (item.parentElement.classList.contains("vditor-wysiwyg__pre") ||
|
|
4227
|
+
item.parentElement.classList.contains("vditor-ir__marker--pre")) {
|
|
4228
|
+
return [2 /*return*/];
|
|
4229
|
+
}
|
|
4230
|
+
code = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.wavedromRenderAdapter.getCode(item);
|
|
4231
|
+
if (item.getAttribute("data-processed") === "true" || code.trim() === "") {
|
|
4232
|
+
return [2 /*return*/];
|
|
4233
|
+
}
|
|
4234
|
+
renderElement = item;
|
|
4235
|
+
if (item.tagName === "CODE") {
|
|
4236
|
+
renderElement = document.createElement("div");
|
|
4237
|
+
Array.from(item.attributes).forEach(function (attribute) {
|
|
4238
|
+
renderElement.setAttribute(attribute.name, attribute.value);
|
|
4239
|
+
});
|
|
4240
|
+
item.replaceWith(renderElement);
|
|
4241
|
+
}
|
|
4242
|
+
_a.label = 1;
|
|
4243
|
+
case 1:
|
|
4244
|
+
_a.trys.push([1, 3, , 4]);
|
|
4245
|
+
return [4 /*yield*/, (0,_util_function__WEBPACK_IMPORTED_MODULE_3__/* .looseJsonParse */ .Qf)(code)];
|
|
4246
|
+
case 2:
|
|
4247
|
+
source = _a.sent();
|
|
4248
|
+
wavedrom.renderWaveElement(wavedromIndex, source, renderElement, wavedrom.waveSkin, false);
|
|
4249
|
+
wavedromIndex++;
|
|
4250
|
+
return [3 /*break*/, 4];
|
|
4251
|
+
case 3:
|
|
4252
|
+
error_1 = _a.sent();
|
|
4253
|
+
message = error_1 instanceof Error ? error_1.message : String(error_1);
|
|
4254
|
+
lineBreak = document.createElement("br");
|
|
4255
|
+
renderElement.replaceChildren(document.createTextNode("wavedrom render error:"), lineBreak, document.createTextNode(message));
|
|
4256
|
+
renderElement.classList.add("vditor-reset--error");
|
|
4257
|
+
return [3 /*break*/, 4];
|
|
4258
|
+
case 4:
|
|
4259
|
+
renderElement.setAttribute("data-processed", "true");
|
|
4260
|
+
return [2 /*return*/];
|
|
4261
|
+
}
|
|
4262
|
+
});
|
|
4263
|
+
}); });
|
|
4264
|
+
});
|
|
4265
|
+
};
|
|
4266
|
+
|
|
4267
|
+
|
|
3961
4268
|
/***/ }),
|
|
3962
4269
|
|
|
3963
4270
|
/***/ 190:
|
|
@@ -4975,6 +5282,8 @@ var DevTools = /** @class */ (function () {
|
|
|
4975
5282
|
}());
|
|
4976
5283
|
|
|
4977
5284
|
|
|
5285
|
+
// EXTERNAL MODULE: ./src/ts/markdown/imageCaptionRender.ts
|
|
5286
|
+
var imageCaptionRender = __webpack_require__(161);
|
|
4978
5287
|
// EXTERNAL MODULE: ./src/ts/util/compatibility.ts
|
|
4979
5288
|
var compatibility = __webpack_require__(410);
|
|
4980
5289
|
;// CONCATENATED MODULE: ./src/ts/toolbar/setToolbar.ts
|
|
@@ -5129,6 +5438,8 @@ var mindmapRender = __webpack_require__(194);
|
|
|
5129
5438
|
var plantumlRender = __webpack_require__(229);
|
|
5130
5439
|
// EXTERNAL MODULE: ./src/ts/markdown/SMILESRender.ts
|
|
5131
5440
|
var SMILESRender = __webpack_require__(825);
|
|
5441
|
+
// EXTERNAL MODULE: ./src/ts/markdown/wavedromRender.ts
|
|
5442
|
+
var wavedromRender = __webpack_require__(497);
|
|
5132
5443
|
;// CONCATENATED MODULE: ./src/ts/util/processCode.ts
|
|
5133
5444
|
|
|
5134
5445
|
|
|
@@ -5142,6 +5453,7 @@ var SMILESRender = __webpack_require__(825);
|
|
|
5142
5453
|
|
|
5143
5454
|
|
|
5144
5455
|
|
|
5456
|
+
|
|
5145
5457
|
var processPasteCode = function (html, text, type) {
|
|
5146
5458
|
if (type === void 0) { type = "sv"; }
|
|
5147
5459
|
var tempElement = document.createElement("div");
|
|
@@ -5221,6 +5533,9 @@ var processCodeRender = function (previewPanel, vditor) {
|
|
|
5221
5533
|
else if (language === "graphviz") {
|
|
5222
5534
|
(0,graphvizRender/* graphvizRender */.v)(previewPanel, vditor.options.cdn);
|
|
5223
5535
|
}
|
|
5536
|
+
else if (language === "wavedrom") {
|
|
5537
|
+
(0,wavedromRender/* wavedromRender */.F)(previewPanel, vditor.options.cdn);
|
|
5538
|
+
}
|
|
5224
5539
|
else if (language === "math") {
|
|
5225
5540
|
(0,mathRender/* mathRender */.H)(previewPanel, { cdn: vditor.options.cdn, math: vditor.options.preview.math });
|
|
5226
5541
|
}
|
|
@@ -6545,12 +6860,14 @@ var highlightToolbarIR = function (vditor) {
|
|
|
6545
6860
|
;// CONCATENATED MODULE: ./src/ts/wysiwyg/afterRenderEvent.ts
|
|
6546
6861
|
|
|
6547
6862
|
|
|
6863
|
+
|
|
6548
6864
|
var afterRenderEvent = function (vditor, options) {
|
|
6549
6865
|
if (options === void 0) { options = {
|
|
6550
6866
|
enableAddUndoStack: true,
|
|
6551
6867
|
enableHint: false,
|
|
6552
6868
|
enableInput: true,
|
|
6553
6869
|
}; }
|
|
6870
|
+
(0,imageCaptionRender/* renderImageCaptions */.W)(vditor.wysiwyg.element, "wysiwyg", vditor.options.preview.markdown.imageCaption);
|
|
6554
6871
|
if (options.enableHint) {
|
|
6555
6872
|
vditor.hint.render(vditor);
|
|
6556
6873
|
}
|
|
@@ -6709,6 +7026,84 @@ var modifyPre = function (vditor, range) {
|
|
|
6709
7026
|
|
|
6710
7027
|
|
|
6711
7028
|
|
|
7029
|
+
var createBlockElement = function (element, tagName) {
|
|
7030
|
+
var blockElement = element.ownerDocument.createElement(tagName);
|
|
7031
|
+
blockElement.setAttribute("data-block", "0");
|
|
7032
|
+
return blockElement;
|
|
7033
|
+
};
|
|
7034
|
+
var replaceBlockElement = function (element, tagName) {
|
|
7035
|
+
var blockElement = createBlockElement(element, tagName);
|
|
7036
|
+
while (element.firstChild) {
|
|
7037
|
+
blockElement.appendChild(element.firstChild);
|
|
7038
|
+
}
|
|
7039
|
+
element.replaceWith(blockElement);
|
|
7040
|
+
return blockElement;
|
|
7041
|
+
};
|
|
7042
|
+
var isListItemBlock = function (node) {
|
|
7043
|
+
if (node.nodeType !== 1) {
|
|
7044
|
+
return false;
|
|
7045
|
+
}
|
|
7046
|
+
var element = node;
|
|
7047
|
+
return element.getAttribute("data-block") === "0" || element.tagName === "INPUT";
|
|
7048
|
+
};
|
|
7049
|
+
var getListItemInlineNodes = function (itemElement, wbrElement) {
|
|
7050
|
+
var _a, _b;
|
|
7051
|
+
var anchorNode = wbrElement;
|
|
7052
|
+
while (anchorNode.parentNode && !anchorNode.parentNode.isSameNode(itemElement)) {
|
|
7053
|
+
anchorNode = anchorNode.parentNode;
|
|
7054
|
+
}
|
|
7055
|
+
if (!((_a = anchorNode.parentNode) === null || _a === void 0 ? void 0 : _a.isSameNode(itemElement))) {
|
|
7056
|
+
return [];
|
|
7057
|
+
}
|
|
7058
|
+
var firstNode = anchorNode;
|
|
7059
|
+
var lastNode = anchorNode;
|
|
7060
|
+
while (firstNode.previousSibling && !isListItemBlock(firstNode.previousSibling)) {
|
|
7061
|
+
firstNode = firstNode.previousSibling;
|
|
7062
|
+
}
|
|
7063
|
+
while (lastNode.nextSibling && !isListItemBlock(lastNode.nextSibling)) {
|
|
7064
|
+
lastNode = lastNode.nextSibling;
|
|
7065
|
+
}
|
|
7066
|
+
// 任务列表的复选框和正文之间需要保留分隔空格。
|
|
7067
|
+
if (firstNode.previousSibling instanceof HTMLInputElement && firstNode.nodeType === 3) {
|
|
7068
|
+
var leadingWhitespace = (_b = firstNode.textContent.match(/^\s+/)) === null || _b === void 0 ? void 0 : _b[0];
|
|
7069
|
+
if (leadingWhitespace) {
|
|
7070
|
+
firstNode.textContent = firstNode.textContent.substring(leadingWhitespace.length);
|
|
7071
|
+
itemElement.insertBefore(itemElement.ownerDocument.createTextNode(leadingWhitespace), firstNode);
|
|
7072
|
+
}
|
|
7073
|
+
}
|
|
7074
|
+
var nodes = [];
|
|
7075
|
+
var node = firstNode;
|
|
7076
|
+
while (node) {
|
|
7077
|
+
nodes.push(node);
|
|
7078
|
+
if (node.isSameNode(lastNode)) {
|
|
7079
|
+
break;
|
|
7080
|
+
}
|
|
7081
|
+
node = node.nextSibling;
|
|
7082
|
+
}
|
|
7083
|
+
return nodes;
|
|
7084
|
+
};
|
|
7085
|
+
var setListItemHeading = function (itemElement, wbrElement, tagName) {
|
|
7086
|
+
var inlineNodes = getListItemInlineNodes(itemElement, wbrElement);
|
|
7087
|
+
if (inlineNodes.length === 0) {
|
|
7088
|
+
return false;
|
|
7089
|
+
}
|
|
7090
|
+
var headingElement = createBlockElement(itemElement, tagName);
|
|
7091
|
+
itemElement.insertBefore(headingElement, inlineNodes[0]);
|
|
7092
|
+
inlineNodes.forEach(function (node) {
|
|
7093
|
+
headingElement.appendChild(node);
|
|
7094
|
+
});
|
|
7095
|
+
if (headingElement.innerHTML.trim() === "<wbr>") {
|
|
7096
|
+
headingElement.appendChild(itemElement.ownerDocument.createElement("br"));
|
|
7097
|
+
}
|
|
7098
|
+
return true;
|
|
7099
|
+
};
|
|
7100
|
+
var unwrapBlockElement = function (element) {
|
|
7101
|
+
var fragment = element.ownerDocument.createDocumentFragment();
|
|
7102
|
+
while (element.firstChild) {
|
|
7103
|
+
fragment.appendChild(element.firstChild);
|
|
7104
|
+
}
|
|
7105
|
+
element.replaceWith(fragment);
|
|
7106
|
+
};
|
|
6712
7107
|
var setHeading = function (vditor, tagName) {
|
|
6713
7108
|
var range = (0,selection/* getEditorRange */.zh)(vditor);
|
|
6714
7109
|
var blockElement = (0,hasClosest/* hasClosestBlock */.F9)(range.startContainer);
|
|
@@ -6719,23 +7114,36 @@ var setHeading = function (vditor, tagName) {
|
|
|
6719
7114
|
blockElement = vditor.wysiwyg.element;
|
|
6720
7115
|
}
|
|
6721
7116
|
if (blockElement && !blockElement.classList.contains("vditor-wysiwyg__block")) {
|
|
6722
|
-
|
|
7117
|
+
var wbrElement = document.createElement("wbr");
|
|
7118
|
+
range.insertNode(wbrElement);
|
|
6723
7119
|
// Firefox 需要 trim https://github.com/Vanessa219/vditor/issues/207
|
|
6724
7120
|
if (blockElement.innerHTML.trim() === "<wbr>") {
|
|
6725
7121
|
// Firefox 光标对不齐 https://github.com/Vanessa219/vditor/issues/199 1
|
|
6726
7122
|
blockElement.innerHTML = "<wbr><br>";
|
|
6727
7123
|
}
|
|
6728
|
-
|
|
6729
|
-
|
|
7124
|
+
var itemElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(wbrElement, "LI");
|
|
7125
|
+
if (itemElement && blockElement.isSameNode(itemElement.parentElement)) {
|
|
7126
|
+
if (!setListItemHeading(itemElement, wbrElement, tagName)) {
|
|
7127
|
+
wbrElement.remove();
|
|
7128
|
+
return;
|
|
7129
|
+
}
|
|
7130
|
+
}
|
|
7131
|
+
else if (blockElement.tagName === "BLOCKQUOTE" || blockElement.classList.contains("vditor-reset")) {
|
|
7132
|
+
var headingElement = createBlockElement(blockElement, tagName);
|
|
7133
|
+
while (blockElement.firstChild) {
|
|
7134
|
+
headingElement.appendChild(blockElement.firstChild);
|
|
7135
|
+
}
|
|
7136
|
+
blockElement.appendChild(headingElement);
|
|
6730
7137
|
}
|
|
6731
7138
|
else {
|
|
6732
|
-
|
|
7139
|
+
replaceBlockElement(blockElement, tagName);
|
|
6733
7140
|
}
|
|
6734
7141
|
(0,selection/* setRangeByWbr */.ib)(vditor.wysiwyg.element, range);
|
|
6735
7142
|
renderToc(vditor);
|
|
6736
7143
|
}
|
|
6737
7144
|
};
|
|
6738
7145
|
var removeHeading = function (vditor) {
|
|
7146
|
+
var _a, _b;
|
|
6739
7147
|
var range = getSelection().getRangeAt(0);
|
|
6740
7148
|
var blockElement = (0,hasClosest/* hasClosestBlock */.F9)(range.startContainer);
|
|
6741
7149
|
if (!blockElement) {
|
|
@@ -6743,8 +7151,15 @@ var removeHeading = function (vditor) {
|
|
|
6743
7151
|
}
|
|
6744
7152
|
if (blockElement) {
|
|
6745
7153
|
range.insertNode(document.createElement("wbr"));
|
|
6746
|
-
blockElement.
|
|
7154
|
+
if (((_a = blockElement.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === "LI" &&
|
|
7155
|
+
((_b = blockElement.parentElement.parentElement) === null || _b === void 0 ? void 0 : _b.getAttribute("data-tight")) === "true") {
|
|
7156
|
+
unwrapBlockElement(blockElement);
|
|
7157
|
+
}
|
|
7158
|
+
else {
|
|
7159
|
+
replaceBlockElement(blockElement, "p");
|
|
7160
|
+
}
|
|
6747
7161
|
(0,selection/* setRangeByWbr */.ib)(vditor.wysiwyg.element, range);
|
|
7162
|
+
renderToc(vditor);
|
|
6748
7163
|
}
|
|
6749
7164
|
vditor.wysiwyg.popover.style.display = "none";
|
|
6750
7165
|
};
|
|
@@ -7113,6 +7528,7 @@ var removeBlockElement = function (vditor, event) {
|
|
|
7113
7528
|
|
|
7114
7529
|
|
|
7115
7530
|
|
|
7531
|
+
|
|
7116
7532
|
var highlightToolbarWYSIWYG = function (vditor) {
|
|
7117
7533
|
clearTimeout(vditor.wysiwyg.hlToolbarTimeoutId);
|
|
7118
7534
|
vditor.wysiwyg.hlToolbarTimeoutId = window.setTimeout(function () {
|
|
@@ -8080,6 +8496,7 @@ var genImagePopover = function (event, vditor) {
|
|
|
8080
8496
|
imgElement.setAttribute("src", inputElement.value);
|
|
8081
8497
|
imgElement.setAttribute("alt", alt.value);
|
|
8082
8498
|
imgElement.setAttribute("title", title.value);
|
|
8499
|
+
(0,imageCaptionRender/* renderImageCaptions */.W)(vditor.wysiwyg.element, "wysiwyg", vditor.options.preview.markdown.imageCaption);
|
|
8083
8500
|
if (typeof vditor.options.input === "function") {
|
|
8084
8501
|
vditor.options.input(getMarkdown(vditor));
|
|
8085
8502
|
}
|
|
@@ -8145,7 +8562,9 @@ var focusToElement = function (event, range) {
|
|
|
8145
8562
|
}
|
|
8146
8563
|
};
|
|
8147
8564
|
var customWysiwygToolbar = function (vditor, type) {
|
|
8148
|
-
vditor.options.customWysiwygToolbar
|
|
8565
|
+
if (vditor.options.customWysiwygToolbar) {
|
|
8566
|
+
vditor.options.customWysiwygToolbar(type, vditor.wysiwyg.popover);
|
|
8567
|
+
}
|
|
8149
8568
|
};
|
|
8150
8569
|
|
|
8151
8570
|
;// CONCATENATED MODULE: ./src/ts/util/highlightToolbar.ts
|
|
@@ -9633,6 +10052,7 @@ var input_input = function (vditor, range, event) {
|
|
|
9633
10052
|
}
|
|
9634
10053
|
var isWYSIWYGElement = blockElement.isEqualNode(vditor.wysiwyg.element);
|
|
9635
10054
|
var footnoteElement = (0,hasClosest/* hasClosestByAttribute */.a1)(blockElement, "data-type", "footnotes-block");
|
|
10055
|
+
var calloutElement = (0,hasClosest/* hasClosestByAttribute */.a1)(range.startContainer, "data-type", "callout");
|
|
9636
10056
|
if (!isWYSIWYGElement) {
|
|
9637
10057
|
// 列表需要到最顶层
|
|
9638
10058
|
var topListElement = (0,hasClosest/* getTopList */.O9)(range.startContainer);
|
|
@@ -9650,6 +10070,9 @@ var input_input = function (vditor, range, event) {
|
|
|
9650
10070
|
if (footnoteElement) {
|
|
9651
10071
|
blockElement = footnoteElement;
|
|
9652
10072
|
}
|
|
10073
|
+
if (calloutElement) {
|
|
10074
|
+
blockElement = calloutElement;
|
|
10075
|
+
}
|
|
9653
10076
|
html_1 = blockElement.outerHTML;
|
|
9654
10077
|
if (blockElement.tagName === "UL" || blockElement.tagName === "OL") {
|
|
9655
10078
|
// 如果为列表的话,需要把上下的列表都重绘
|
|
@@ -10223,8 +10646,39 @@ var execAfterRender = function (vditor, options) {
|
|
|
10223
10646
|
processAfterRender(vditor, options);
|
|
10224
10647
|
}
|
|
10225
10648
|
};
|
|
10649
|
+
var isEmptyListItem = function (liElement) {
|
|
10650
|
+
if (liElement.textContent.split(constants/* Constants.ZWSP */.g.ZWSP).join("").trim() !== "") {
|
|
10651
|
+
return false;
|
|
10652
|
+
}
|
|
10653
|
+
return !liElement.querySelector([
|
|
10654
|
+
"audio", "canvas", "embed", "hr", "iframe", "img", "object", "ol", "pre", "svg", "table", "ul", "video",
|
|
10655
|
+
"input:not([type='checkbox'])",
|
|
10656
|
+
].join(", "));
|
|
10657
|
+
};
|
|
10658
|
+
var exitEmptyListItem = function (liElement) {
|
|
10659
|
+
var listElement = liElement.parentElement;
|
|
10660
|
+
var listParent = listElement.parentElement;
|
|
10661
|
+
var paragraphElement = document.createElement("p");
|
|
10662
|
+
paragraphElement.setAttribute("data-block", "0");
|
|
10663
|
+
paragraphElement.innerHTML = "<wbr>";
|
|
10664
|
+
var trailingListElement;
|
|
10665
|
+
if (liElement.nextElementSibling) {
|
|
10666
|
+
trailingListElement = listElement.cloneNode(false);
|
|
10667
|
+
while (liElement.nextElementSibling) {
|
|
10668
|
+
trailingListElement.appendChild(liElement.nextElementSibling);
|
|
10669
|
+
}
|
|
10670
|
+
listParent.insertBefore(trailingListElement, listElement.nextSibling);
|
|
10671
|
+
}
|
|
10672
|
+
liElement.remove();
|
|
10673
|
+
if (listElement.childElementCount === 0) {
|
|
10674
|
+
listParent.replaceChild(paragraphElement, listElement);
|
|
10675
|
+
}
|
|
10676
|
+
else {
|
|
10677
|
+
listParent.insertBefore(paragraphElement, trailingListElement || listElement.nextSibling);
|
|
10678
|
+
}
|
|
10679
|
+
return paragraphElement;
|
|
10680
|
+
};
|
|
10226
10681
|
var fixList = function (range, vditor, pElement, event) {
|
|
10227
|
-
var _a;
|
|
10228
10682
|
var startContainer = range.startContainer;
|
|
10229
10683
|
var liElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "LI");
|
|
10230
10684
|
if (liElement) {
|
|
@@ -10241,6 +10695,26 @@ var fixList = function (range, vditor, pElement, event) {
|
|
|
10241
10695
|
event.preventDefault();
|
|
10242
10696
|
return true;
|
|
10243
10697
|
}
|
|
10698
|
+
// 嵌套列表末尾的空列表项回车后转为父列表项中的段落
|
|
10699
|
+
// https://github.com/Vanessa219/vditor/issues/939
|
|
10700
|
+
if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && !event.altKey && event.key === "Enter" && range.collapsed &&
|
|
10701
|
+
!liElement.nextElementSibling && liElement.parentElement.parentElement.tagName === "LI" &&
|
|
10702
|
+
isEmptyListItem(liElement)) {
|
|
10703
|
+
var paragraphElement = exitEmptyListItem(liElement);
|
|
10704
|
+
(0,selection/* setRangeByWbr */.ib)(paragraphElement, range);
|
|
10705
|
+
execAfterRender(vditor);
|
|
10706
|
+
event.preventDefault();
|
|
10707
|
+
return true;
|
|
10708
|
+
}
|
|
10709
|
+
// 空列表项删除标记后退出当前列表
|
|
10710
|
+
if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && !event.altKey && event.key === "Backspace" &&
|
|
10711
|
+
liElement.textContent.trim().replace(constants/* Constants.ZWSP */.g.ZWSP, "") === "" && range.toString() === "") {
|
|
10712
|
+
var paragraphElement = exitEmptyListItem(liElement);
|
|
10713
|
+
(0,selection/* setRangeByWbr */.ib)(paragraphElement, range);
|
|
10714
|
+
execAfterRender(vditor);
|
|
10715
|
+
event.preventDefault();
|
|
10716
|
+
return true;
|
|
10717
|
+
}
|
|
10244
10718
|
if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && !event.altKey && event.key === "Backspace" &&
|
|
10245
10719
|
!liElement.previousElementSibling && range.toString() === "" &&
|
|
10246
10720
|
(0,selection/* getSelectPosition */.im)(liElement, vditor[vditor.currentMode].element, range).start === 0) {
|
|
@@ -10257,19 +10731,6 @@ var fixList = function (range, vditor, pElement, event) {
|
|
|
10257
10731
|
event.preventDefault();
|
|
10258
10732
|
return true;
|
|
10259
10733
|
}
|
|
10260
|
-
// 空列表删除后与上一级段落对齐
|
|
10261
|
-
if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && !event.altKey && event.key === "Backspace" &&
|
|
10262
|
-
liElement.textContent.trim().replace(constants/* Constants.ZWSP */.g.ZWSP, "") === "" &&
|
|
10263
|
-
range.toString() === "" && ((_a = liElement.previousElementSibling) === null || _a === void 0 ? void 0 : _a.tagName) === "LI") {
|
|
10264
|
-
liElement.previousElementSibling.insertAdjacentText("beforeend", "\n\n");
|
|
10265
|
-
range.selectNodeContents(liElement.previousElementSibling);
|
|
10266
|
-
range.collapse(false);
|
|
10267
|
-
liElement.remove();
|
|
10268
|
-
(0,selection/* setRangeByWbr */.ib)(vditor[vditor.currentMode].element, range);
|
|
10269
|
-
execAfterRender(vditor);
|
|
10270
|
-
event.preventDefault();
|
|
10271
|
-
return true;
|
|
10272
|
-
}
|
|
10273
10734
|
if (!(0,compatibility/* isCtrl */.yl)(event) && !event.altKey && event.key === "Tab") {
|
|
10274
10735
|
// 光标位于第一/零字符时,tab 用于列表的缩进
|
|
10275
10736
|
var isFirst = false;
|
|
@@ -10765,9 +11226,30 @@ var fixCodeBlock = function (vditor, event, codeRenderElement, range) {
|
|
|
10765
11226
|
return false;
|
|
10766
11227
|
};
|
|
10767
11228
|
var fixBlockquote = function (vditor, range, event, pElement) {
|
|
11229
|
+
var _a;
|
|
10768
11230
|
var startContainer = range.startContainer;
|
|
10769
11231
|
var blockquoteElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "BLOCKQUOTE");
|
|
10770
11232
|
if (blockquoteElement && range.toString() === "") {
|
|
11233
|
+
if (pElement && event.key === "Enter" && !(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && !event.altKey &&
|
|
11234
|
+
pElement.parentElement.isSameNode(blockquoteElement) &&
|
|
11235
|
+
(0,hasClosest/* hasClosestByMatchTag */.lG)(blockquoteElement.parentElement, "LI") &&
|
|
11236
|
+
(range.collapsed || !range.cloneContents().firstElementChild) &&
|
|
11237
|
+
pElement.innerHTML.replace(constants/* Constants.ZWSP */.g.ZWSP, "") !== "\n" &&
|
|
11238
|
+
pElement.innerHTML.replace(constants/* Constants.ZWSP */.g.ZWSP, "") !== "") {
|
|
11239
|
+
// 列表内的引用由浏览器处理回车时会新建列表项 https://github.com/Vanessa219/vditor/issues/1925
|
|
11240
|
+
var trailingRange = range.cloneRange();
|
|
11241
|
+
trailingRange.setEnd(pElement, pElement.childNodes.length);
|
|
11242
|
+
var paragraphElement = document.createElement("p");
|
|
11243
|
+
paragraphElement.setAttribute("data-block", "0");
|
|
11244
|
+
paragraphElement.appendChild(trailingRange.extractContents());
|
|
11245
|
+
pElement.insertAdjacentElement("afterend", paragraphElement);
|
|
11246
|
+
range.setStart(paragraphElement, 0);
|
|
11247
|
+
range.collapse(true);
|
|
11248
|
+
(0,selection/* setSelectionFocus */.Hc)(range);
|
|
11249
|
+
execAfterRender(vditor);
|
|
11250
|
+
event.preventDefault();
|
|
11251
|
+
return true;
|
|
11252
|
+
}
|
|
10771
11253
|
if (event.key === "Backspace" && !(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && !event.altKey &&
|
|
10772
11254
|
(0,selection/* getSelectPosition */.im)(blockquoteElement, vditor[vditor.currentMode].element, range).start === 0) {
|
|
10773
11255
|
// Backspace: 光标位于引用中的第零个字符,仅删除引用标签
|
|
@@ -10814,9 +11296,15 @@ var fixBlockquote = function (vditor, range, event, pElement) {
|
|
|
10814
11296
|
event.preventDefault();
|
|
10815
11297
|
return true;
|
|
10816
11298
|
}
|
|
10817
|
-
|
|
11299
|
+
var itemElement = blockquoteElement.parentElement.tagName === "LI" ? blockquoteElement.parentElement : null;
|
|
11300
|
+
var afterBlockElement = !blockquoteElement.nextElementSibling && ((_a = itemElement === null || itemElement === void 0 ? void 0 : itemElement.nextElementSibling) === null || _a === void 0 ? void 0 : _a.tagName) === "LI" ?
|
|
11301
|
+
itemElement : blockquoteElement;
|
|
11302
|
+
if (insertAfterBlock(vditor, event, range, blockquoteElement, afterBlockElement)) {
|
|
10818
11303
|
return true;
|
|
10819
11304
|
}
|
|
11305
|
+
if (event.key === "ArrowUp" && itemElement && !blockquoteElement.previousElementSibling) {
|
|
11306
|
+
return false;
|
|
11307
|
+
}
|
|
10820
11308
|
if (insertBeforeBlock(vditor, event, range, blockquoteElement, blockquoteElement)) {
|
|
10821
11309
|
return true;
|
|
10822
11310
|
}
|
|
@@ -11031,6 +11519,11 @@ var paste = function (vditor, event, callback) { return fixBrowserBehavior_await
|
|
|
11031
11519
|
if (!entering) {
|
|
11032
11520
|
return ["", Lute.WalkContinue];
|
|
11033
11521
|
}
|
|
11522
|
+
var parent = node.__internal_object__.Parent;
|
|
11523
|
+
// 链接引用的目标地址由定义节点提供,不在引用位置重复渲染
|
|
11524
|
+
if (parent.Type === 33 && parent.LinkType === 3) {
|
|
11525
|
+
return ["", Lute.WalkContinue];
|
|
11526
|
+
}
|
|
11034
11527
|
if (vditor.options.upload.renderLinkDest) {
|
|
11035
11528
|
return vditor.options.upload.renderLinkDest(vditor, node, entering);
|
|
11036
11529
|
}
|
|
@@ -11350,6 +11843,7 @@ var templateObject_1;
|
|
|
11350
11843
|
|
|
11351
11844
|
|
|
11352
11845
|
|
|
11846
|
+
|
|
11353
11847
|
var processHint = function (vditor) {
|
|
11354
11848
|
var _a, _b;
|
|
11355
11849
|
vditor.hint.render(vditor);
|
|
@@ -11384,6 +11878,7 @@ var process_processAfterRender = function (vditor, options) {
|
|
|
11384
11878
|
enableHint: false,
|
|
11385
11879
|
enableInput: true,
|
|
11386
11880
|
}; }
|
|
11881
|
+
(0,imageCaptionRender/* renderImageCaptions */.W)(vditor.ir.element, "ir", vditor.options.preview.markdown.imageCaption);
|
|
11387
11882
|
if (options.enableHint) {
|
|
11388
11883
|
processHint(vditor);
|
|
11389
11884
|
}
|
|
@@ -11433,12 +11928,25 @@ var process_processHeading = function (vditor, value) {
|
|
|
11433
11928
|
var removeInline = function (range, vditor, type) {
|
|
11434
11929
|
var inlineElement = (0,hasClosest/* hasClosestByAttribute */.a1)(range.startContainer, "data-type", type);
|
|
11435
11930
|
if (inlineElement) {
|
|
11931
|
+
var keepSelection = !range.collapsed;
|
|
11436
11932
|
inlineElement.firstElementChild.remove();
|
|
11437
11933
|
inlineElement.lastElementChild.remove();
|
|
11934
|
+
if (keepSelection) {
|
|
11935
|
+
var endRange = range.cloneRange();
|
|
11936
|
+
endRange.collapse(false);
|
|
11937
|
+
endRange.insertNode(document.createElement("wbr"));
|
|
11938
|
+
}
|
|
11438
11939
|
range.insertNode(document.createElement("wbr"));
|
|
11439
11940
|
var tempElement = document.createElement("div");
|
|
11440
11941
|
tempElement.innerHTML = vditor.lute.SpinVditorIRDOM(inlineElement.outerHTML);
|
|
11441
11942
|
inlineElement.outerHTML = tempElement.firstElementChild.innerHTML.trim();
|
|
11943
|
+
if (keepSelection) {
|
|
11944
|
+
(0,selection/* setRangeByWbr */.ib)(vditor.ir.element, range);
|
|
11945
|
+
var endWbrElement = vditor.ir.element.querySelector("wbr");
|
|
11946
|
+
range.setEndBefore(endWbrElement);
|
|
11947
|
+
endWbrElement.remove();
|
|
11948
|
+
(0,selection/* setSelectionFocus */.Hc)(range);
|
|
11949
|
+
}
|
|
11442
11950
|
}
|
|
11443
11951
|
};
|
|
11444
11952
|
var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
|
|
@@ -11531,6 +12039,7 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
|
|
|
11531
12039
|
else if (commandName === "italic" || commandName === "bold" || commandName === "strike"
|
|
11532
12040
|
|| commandName === "inline-code" || commandName === "code" || commandName === "table") {
|
|
11533
12041
|
var html = void 0;
|
|
12042
|
+
var keepSelection = false;
|
|
11534
12043
|
if (range.toString() === "") {
|
|
11535
12044
|
html = "".concat(prefix, "<wbr>").concat(suffix);
|
|
11536
12045
|
}
|
|
@@ -11542,7 +12051,8 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
|
|
|
11542
12051
|
html = "".concat(prefix).concat(range.toString(), "<wbr>").concat(suffix);
|
|
11543
12052
|
}
|
|
11544
12053
|
else {
|
|
11545
|
-
html = "".concat(prefix).concat(range.toString()
|
|
12054
|
+
html = "".concat(prefix, "<wbr>").concat(range.toString(), "<wbr>").concat(suffix);
|
|
12055
|
+
keepSelection = true;
|
|
11546
12056
|
}
|
|
11547
12057
|
range.deleteContents();
|
|
11548
12058
|
}
|
|
@@ -11553,6 +12063,12 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
|
|
|
11553
12063
|
spanElement.innerHTML = html;
|
|
11554
12064
|
range.insertNode(spanElement);
|
|
11555
12065
|
input(vditor, range);
|
|
12066
|
+
if (keepSelection) {
|
|
12067
|
+
var endWbrElement = vditor.ir.element.querySelector("wbr");
|
|
12068
|
+
range.setEndBefore(endWbrElement);
|
|
12069
|
+
endWbrElement.remove();
|
|
12070
|
+
(0,selection/* setSelectionFocus */.Hc)(range);
|
|
12071
|
+
}
|
|
11556
12072
|
if (commandName === "table") {
|
|
11557
12073
|
range.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement);
|
|
11558
12074
|
(0,selection/* setSelectionFocus */.Hc)(range);
|
|
@@ -11902,6 +12418,27 @@ var Hint = /** @class */ (function () {
|
|
|
11902
12418
|
|
|
11903
12419
|
|
|
11904
12420
|
|
|
12421
|
+
|
|
12422
|
+
var getHeadingMarker = function (headingElement) {
|
|
12423
|
+
return Array.from(headingElement.children).find(function (item) { return item.getAttribute("data-type") === "heading-marker"; });
|
|
12424
|
+
};
|
|
12425
|
+
var restoreHeadingMarker = function (sourceHeading, copiedHeading) {
|
|
12426
|
+
if (!sourceHeading || !copiedHeading || sourceHeading.tagName !== copiedHeading.tagName ||
|
|
12427
|
+
sourceHeading.getAttribute("data-marker") !== copiedHeading.getAttribute("data-marker") ||
|
|
12428
|
+
copiedHeading.textContent.trim() === "" || getHeadingMarker(copiedHeading)) {
|
|
12429
|
+
return;
|
|
12430
|
+
}
|
|
12431
|
+
var markerElement = getHeadingMarker(sourceHeading);
|
|
12432
|
+
if (!markerElement) {
|
|
12433
|
+
return;
|
|
12434
|
+
}
|
|
12435
|
+
if (sourceHeading.firstElementChild === markerElement) {
|
|
12436
|
+
copiedHeading.insertBefore(markerElement.cloneNode(true), copiedHeading.firstChild);
|
|
12437
|
+
}
|
|
12438
|
+
else if (sourceHeading.lastElementChild === markerElement) {
|
|
12439
|
+
copiedHeading.appendChild(markerElement.cloneNode(true));
|
|
12440
|
+
}
|
|
12441
|
+
};
|
|
11905
12442
|
var IR = /** @class */ (function () {
|
|
11906
12443
|
function IR(vditor) {
|
|
11907
12444
|
this.composingLock = false;
|
|
@@ -11928,6 +12465,9 @@ var IR = /** @class */ (function () {
|
|
|
11928
12465
|
event.preventDefault();
|
|
11929
12466
|
var tempElement = document.createElement("div");
|
|
11930
12467
|
tempElement.appendChild(range.cloneContents());
|
|
12468
|
+
var copiedHeadings = tempElement.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
|
12469
|
+
restoreHeadingMarker((0,hasClosestByHeadings/* hasClosestByHeadings */.W)(range.startContainer), copiedHeadings.item(0));
|
|
12470
|
+
restoreHeadingMarker((0,hasClosestByHeadings/* hasClosestByHeadings */.W)(range.endContainer), copiedHeadings.item(copiedHeadings.length - 1));
|
|
11931
12471
|
event.clipboardData.setData("text/plain", vditor.lute.VditorIRDOM2Md(tempElement.innerHTML).trim());
|
|
11932
12472
|
event.clipboardData.setData("text/html", "");
|
|
11933
12473
|
};
|
|
@@ -12125,16 +12665,19 @@ var IR = /** @class */ (function () {
|
|
|
12125
12665
|
|
|
12126
12666
|
;// CONCATENATED MODULE: ./src/ts/markdown/getHTML.ts
|
|
12127
12667
|
|
|
12668
|
+
|
|
12128
12669
|
var getHTML = function (vditor) {
|
|
12670
|
+
var html = "";
|
|
12129
12671
|
if (vditor.currentMode === "sv") {
|
|
12130
|
-
|
|
12672
|
+
html = vditor.lute.Md2HTML(getMarkdown(vditor));
|
|
12131
12673
|
}
|
|
12132
12674
|
else if (vditor.currentMode === "wysiwyg") {
|
|
12133
|
-
|
|
12675
|
+
html = vditor.lute.VditorDOM2HTML(vditor.wysiwyg.element.innerHTML);
|
|
12134
12676
|
}
|
|
12135
12677
|
else if (vditor.currentMode === "ir") {
|
|
12136
|
-
|
|
12678
|
+
html = vditor.lute.VditorIRDOM2HTML(vditor.ir.element.innerHTML);
|
|
12137
12679
|
}
|
|
12680
|
+
return (0,imageCaptionRender/* renderImageCaptionHTML */.V)(html, vditor.options.preview.markdown.imageCaption);
|
|
12138
12681
|
};
|
|
12139
12682
|
|
|
12140
12683
|
// EXTERNAL MODULE: ./src/ts/markdown/setLute.ts
|
|
@@ -12209,6 +12752,8 @@ var mediaRender = __webpack_require__(280);
|
|
|
12209
12752
|
|
|
12210
12753
|
|
|
12211
12754
|
|
|
12755
|
+
|
|
12756
|
+
|
|
12212
12757
|
|
|
12213
12758
|
var Preview = /** @class */ (function () {
|
|
12214
12759
|
function Preview(vditor) {
|
|
@@ -12339,6 +12884,7 @@ var Preview = /** @class */ (function () {
|
|
|
12339
12884
|
}
|
|
12340
12885
|
if (value) {
|
|
12341
12886
|
this.previewElement.innerHTML = value;
|
|
12887
|
+
(0,imageCaptionRender/* renderImageCaptions */.W)(this.previewElement, "preview", vditor.options.preview.markdown.imageCaption);
|
|
12342
12888
|
return;
|
|
12343
12889
|
}
|
|
12344
12890
|
if (getMarkdown(vditor)
|
|
@@ -12390,6 +12936,7 @@ var Preview = /** @class */ (function () {
|
|
|
12390
12936
|
}, vditor.options.preview.delay);
|
|
12391
12937
|
};
|
|
12392
12938
|
Preview.prototype.afterRender = function (vditor, startTime) {
|
|
12939
|
+
(0,imageCaptionRender/* renderImageCaptions */.W)(this.previewElement, "preview", vditor.options.preview.markdown.imageCaption);
|
|
12393
12940
|
if (vditor.options.preview.parse) {
|
|
12394
12941
|
vditor.options.preview.parse(this.element);
|
|
12395
12942
|
}
|
|
@@ -12414,6 +12961,7 @@ var Preview = /** @class */ (function () {
|
|
|
12414
12961
|
(0,SMILESRender/* SMILESRender */.J)(vditor.preview.previewElement, vditor.options.cdn, vditor.options.theme);
|
|
12415
12962
|
(0,flowchartRender/* flowchartRender */.P)(vditor.preview.previewElement, vditor.options.cdn);
|
|
12416
12963
|
(0,graphvizRender/* graphvizRender */.v)(vditor.preview.previewElement, vditor.options.cdn);
|
|
12964
|
+
(0,wavedromRender/* wavedromRender */.F)(vditor.preview.previewElement, vditor.options.cdn);
|
|
12417
12965
|
(0,chartRender/* chartRender */.p)(vditor.preview.previewElement, vditor.options.cdn, vditor.options.theme);
|
|
12418
12966
|
(0,mindmapRender/* mindmapRender */.P)(vditor.preview.previewElement, vditor.options.cdn, vditor.options.theme);
|
|
12419
12967
|
(0,plantumlRender/* plantumlRender */.B)(vditor.preview.previewElement, vditor.options.cdn);
|
|
@@ -13112,7 +13660,7 @@ var exportPDF = function (vditor) {
|
|
|
13112
13660
|
vditor.tip.show(window.VditorI18n.generate, 3800);
|
|
13113
13661
|
var iframe = document.querySelector("#vditorExportIframe");
|
|
13114
13662
|
iframe.contentDocument.open();
|
|
13115
|
-
iframe.contentDocument.write("<link rel=\"stylesheet\" href=\"".concat(vditor.options.cdn, "/dist/index.css\"/>\n<script src=\"").concat(vditor.options.cdn, "/dist/method.min.js\"></script>\n<div id=\"preview\" style=\"width: 800px\"></div>\n<script>\nwindow.addEventListener(\"message\", (e) => {\n if(!e.data) {\n return;\n }\n Vditor.preview(document.getElementById('preview'), e.data, {\n cdn: \"").concat(vditor.options.cdn, "\",\n markdown: {\n theme: ").concat(JSON.stringify(vditor.options.preview.theme), "\n },\n hljs: {\n style: \"").concat(vditor.options.preview.hljs.style, "\"\n }\n });\n setTimeout(() => {\n window.print();\n }, 3600);\n}, false);\n</script>"));
|
|
13663
|
+
iframe.contentDocument.write("<link rel=\"stylesheet\" href=\"".concat(vditor.options.cdn, "/dist/index.css\"/>\n<script src=\"").concat(vditor.options.cdn, "/dist/method.min.js\"></script>\n<div id=\"preview\" style=\"width: 800px\"></div>\n<script>\nwindow.addEventListener(\"message\", (e) => {\n if(!e.data) {\n return;\n }\n Vditor.preview(document.getElementById('preview'), e.data, {\n cdn: \"").concat(vditor.options.cdn, "\",\n markdown: {\n callout: ").concat(JSON.stringify(vditor.options.preview.markdown.callout), ",\n theme: ").concat(JSON.stringify(vditor.options.preview.theme), "\n },\n hljs: {\n style: \"").concat(vditor.options.preview.hljs.style, "\"\n }\n });\n setTimeout(() => {\n window.print();\n }, 3600);\n}, false);\n</script>"));
|
|
13116
13664
|
iframe.contentDocument.close();
|
|
13117
13665
|
setTimeout(function () {
|
|
13118
13666
|
iframe.contentWindow.postMessage(getMarkdown(vditor), "*");
|
|
@@ -13120,7 +13668,7 @@ var exportPDF = function (vditor) {
|
|
|
13120
13668
|
};
|
|
13121
13669
|
var exportHTML = function (vditor) {
|
|
13122
13670
|
var content = getHTML(vditor);
|
|
13123
|
-
var html = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"".concat(vditor.options.cdn, "/dist/index.css\"/>\n<script src=\"").concat(vditor.options.cdn, "/dist/js/i18n/").concat(vditor.options.lang, ".js\"></script>\n<script src=\"").concat(vditor.options.cdn, "/dist/method.min.js\"></script></head>\n<body><div class=\"vditor-reset\" id=\"preview\">").concat(content, "</div>\n<script>\n const previewElement = document.getElementById('preview')\n Vditor.setContentTheme('").concat(vditor.options.preview.theme.current, "', '").concat(vditor.options.preview.theme.path, "');\n Vditor.codeRender(previewElement);\n Vditor.highlightRender(").concat(JSON.stringify(vditor.options.preview.hljs), ", previewElement, '").concat(vditor.options.cdn, "');\n Vditor.mathRender(previewElement, {\n cdn: '").concat(vditor.options.cdn, "',\n math: ").concat(JSON.stringify(vditor.options.preview.math), ",\n });\n Vditor.mermaidRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.SMILESRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.markmapRender(previewElement, '").concat(vditor.options.cdn, "');\n Vditor.flowchartRender(previewElement, '").concat(vditor.options.cdn, "');\n Vditor.graphvizRender(previewElement, '").concat(vditor.options.cdn, "');\n Vditor.chartRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.mindmapRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.abcRender(previewElement, '").concat(vditor.options.cdn, "');\n ").concat(vditor.options.preview.render.media.enable ? 'Vditor.mediaRender(previewElement);' : "", "\n Vditor.speechRender(previewElement);\n</script>\n<script src=\"").concat(vditor.options.cdn, "/dist/js/icons/").concat(vditor.options.icon, ".js\"></script></body></html>");
|
|
13671
|
+
var html = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"".concat(vditor.options.cdn, "/dist/index.css\"/>\n<script src=\"").concat(vditor.options.cdn, "/dist/js/i18n/").concat(vditor.options.lang, ".js\"></script>\n<script src=\"").concat(vditor.options.cdn, "/dist/method.min.js\"></script></head>\n<body><div class=\"vditor-reset\" id=\"preview\">").concat(content, "</div>\n<script>\n const previewElement = document.getElementById('preview')\n Vditor.setContentTheme('").concat(vditor.options.preview.theme.current, "', '").concat(vditor.options.preview.theme.path, "');\n Vditor.codeRender(previewElement);\n Vditor.highlightRender(").concat(JSON.stringify(vditor.options.preview.hljs), ", previewElement, '").concat(vditor.options.cdn, "');\n Vditor.mathRender(previewElement, {\n cdn: '").concat(vditor.options.cdn, "',\n math: ").concat(JSON.stringify(vditor.options.preview.math), ",\n });\n Vditor.mermaidRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.SMILESRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.markmapRender(previewElement, '").concat(vditor.options.cdn, "');\n Vditor.flowchartRender(previewElement, '").concat(vditor.options.cdn, "');\n Vditor.graphvizRender(previewElement, '").concat(vditor.options.cdn, "');\n Vditor.wavedromRender(previewElement, '").concat(vditor.options.cdn, "');\n Vditor.chartRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.mindmapRender(previewElement, '").concat(vditor.options.cdn, "', '").concat(vditor.options.theme, "');\n Vditor.abcRender(previewElement, '").concat(vditor.options.cdn, "');\n ").concat(vditor.options.preview.render.media.enable ? 'Vditor.mediaRender(previewElement);' : "", "\n Vditor.speechRender(previewElement);\n</script>\n<script src=\"").concat(vditor.options.cdn, "/dist/js/icons/").concat(vditor.options.icon, ".js\"></script></body></html>");
|
|
13124
13672
|
download(vditor, html, content.substr(0, 10) + ".html");
|
|
13125
13673
|
};
|
|
13126
13674
|
|
|
@@ -14244,7 +14792,7 @@ var Toolbar = /** @class */ (function () {
|
|
|
14244
14792
|
|
|
14245
14793
|
|
|
14246
14794
|
// EXTERNAL MODULE: ./node_modules/.pnpm/diff-match-patch@1.0.5/node_modules/diff-match-patch/index.js
|
|
14247
|
-
var diff_match_patch = __webpack_require__(
|
|
14795
|
+
var diff_match_patch = __webpack_require__(132);
|
|
14248
14796
|
;// CONCATENATED MODULE: ./src/ts/undo/index.ts
|
|
14249
14797
|
|
|
14250
14798
|
|
|
@@ -14778,7 +15326,7 @@ var Options = /** @class */ (function () {
|
|
|
14778
15326
|
hotkey: "⇧⌘H",
|
|
14779
15327
|
icon: '<svg><use xlink:href="#vditor-icon-line"></use></svg>',
|
|
14780
15328
|
name: "line",
|
|
14781
|
-
prefix: "
|
|
15329
|
+
prefix: "***",
|
|
14782
15330
|
tipPosition: "n",
|
|
14783
15331
|
},
|
|
14784
15332
|
{
|
|
@@ -15951,6 +16499,7 @@ var Vditor = /** @class */ (function (_super) {
|
|
|
15951
16499
|
"".concat(mergedOptions.cdn, "/dist/js/lute/lute.min.js"), "vditorLuteScript").then(function () {
|
|
15952
16500
|
_this.vditor.lute = (0,setLute/* setLute */.X)({
|
|
15953
16501
|
autoSpace: _this.vditor.options.preview.markdown.autoSpace,
|
|
16502
|
+
callout: _this.vditor.options.preview.markdown.callout,
|
|
15954
16503
|
gfmAutoLink: _this.vditor.options.preview.markdown.gfmAutoLink,
|
|
15955
16504
|
codeBlockPreview: _this.vditor.options.preview.markdown
|
|
15956
16505
|
.codeBlockPreview,
|
|
@@ -15969,6 +16518,8 @@ var Vditor = /** @class */ (function (_super) {
|
|
|
15969
16518
|
paragraphBeginningSpace: _this.vditor.options.preview.markdown
|
|
15970
16519
|
.paragraphBeginningSpace,
|
|
15971
16520
|
sanitize: _this.vditor.options.preview.markdown.sanitize,
|
|
16521
|
+
sub: _this.vditor.options.preview.markdown.sub,
|
|
16522
|
+
sup: _this.vditor.options.preview.markdown.sup,
|
|
15972
16523
|
toc: _this.vditor.options.preview.markdown.toc,
|
|
15973
16524
|
});
|
|
15974
16525
|
_this.vditor.preview = new Preview(_this.vditor);
|