md-editor-v3 4.20.4 → 4.21.1
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 +52 -40
- package/lib/cjs/MdEditor.cjs +82 -28
- package/lib/cjs/chunks/config.cjs +2 -2
- package/lib/cjs/chunks/index.cjs +63 -29
- package/lib/cjs/chunks/index3.cjs +11 -11
- package/lib/cjs/index.cjs +38 -3
- package/lib/es/MdEditor.mjs +83 -29
- package/lib/es/chunks/config.mjs +2 -2
- package/lib/es/chunks/event-name.mjs +7 -7
- package/lib/es/chunks/index.mjs +65 -31
- package/lib/es/chunks/index3.mjs +13 -13
- package/lib/es/chunks/index4.mjs +1 -1
- package/lib/es/chunks/index5.mjs +4 -4
- package/lib/es/index.mjs +37 -1
- package/lib/style.css +2 -0
- package/lib/types/NormalFooterToolbar/NormalFooterToolbar.d.ts +13 -0
- package/lib/types/NormalFooterToolbar/index.d.ts +41 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/index.js +88 -54
- package/package.json +1 -9
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { defineComponent, createVNode, inject, ref, onMounted, reactive, compute
|
|
|
5
5
|
import { p as prefix, f as configOption, b as allToolbar, M as MinInputBoxWidth, d as allFooter } from "./chunks/config.mjs";
|
|
6
6
|
import { draggingScroll, linkTo, throttle } from "@vavt/util";
|
|
7
7
|
import { a as Dropdown, D as DropdownToolbar } from "./chunks/index2.mjs";
|
|
8
|
-
import { b as bus,
|
|
8
|
+
import { b as bus, C as CHANGE_FULL_SCREEN, E as ERROR_CATCHER, U as UPLOAD_IMAGE, O as OPEN_MODALS, R as REPLACE, a as CHANGE_CATALOG_VISIBLE, c as ON_SAVE, d as CTRL_SHIFT_Z, e as CTRL_Z, f as EVENT_LISTENER, T as TASK_STATE_CHANGED } from "./chunks/event-name.mjs";
|
|
9
9
|
import { a as appendHandler } from "./chunks/dom.mjs";
|
|
10
10
|
import { M as MdModal, I as Icon } from "./chunks/index4.mjs";
|
|
11
11
|
import { b as base642File } from "./chunks/index5.mjs";
|
|
@@ -419,7 +419,7 @@ const ClipModal = /* @__PURE__ */ defineComponent({
|
|
|
419
419
|
"height": "421px"
|
|
420
420
|
}, {
|
|
421
421
|
default: () => {
|
|
422
|
-
var _a2, _b;
|
|
422
|
+
var _a2, _b, _c;
|
|
423
423
|
return [createVNode("div", {
|
|
424
424
|
"class": `${prefix}-form-item ${prefix}-clip`
|
|
425
425
|
}, [createVNode("div", {
|
|
@@ -442,7 +442,10 @@ const ClipModal = /* @__PURE__ */ defineComponent({
|
|
|
442
442
|
"class": `${prefix}-clip-upload`,
|
|
443
443
|
"onClick": () => {
|
|
444
444
|
uploadRef.value.click();
|
|
445
|
-
}
|
|
445
|
+
},
|
|
446
|
+
"role": "button",
|
|
447
|
+
"tabindex": "0",
|
|
448
|
+
"aria-label": (_a2 = ult.value.imgTitleItem) == null ? void 0 : _a2.upload
|
|
446
449
|
}, [createVNode(Icon, {
|
|
447
450
|
"name": "upload"
|
|
448
451
|
}, null)])]), createVNode("div", {
|
|
@@ -462,14 +465,15 @@ const ClipModal = /* @__PURE__ */ defineComponent({
|
|
|
462
465
|
reset();
|
|
463
466
|
}
|
|
464
467
|
}
|
|
465
|
-
}, [((
|
|
468
|
+
}, [((_b = ult.value.clipModalTips) == null ? void 0 : _b.buttonUpload) || ((_c = ult.value.linkModalTips) == null ? void 0 : _c.buttonOK)])]), createVNode("input", {
|
|
466
469
|
"ref": uploadRef,
|
|
467
470
|
"accept": "image/*",
|
|
468
471
|
"type": "file",
|
|
469
472
|
"multiple": false,
|
|
470
473
|
"style": {
|
|
471
474
|
display: "none"
|
|
472
|
-
}
|
|
475
|
+
},
|
|
476
|
+
"aria-hidden": "true"
|
|
473
477
|
}, null)];
|
|
474
478
|
}
|
|
475
479
|
});
|
|
@@ -643,37 +647,50 @@ const ToolBar = /* @__PURE__ */ defineComponent({
|
|
|
643
647
|
"class": `${prefix}-menu`,
|
|
644
648
|
"onClick": () => {
|
|
645
649
|
visible.title = false;
|
|
646
|
-
}
|
|
650
|
+
},
|
|
651
|
+
"role": "menu"
|
|
647
652
|
}, [createVNode("li", {
|
|
648
653
|
"class": `${prefix}-menu-item ${prefix}-menu-item-title`,
|
|
649
654
|
"onClick": () => {
|
|
650
655
|
emitHandler("h1");
|
|
651
|
-
}
|
|
656
|
+
},
|
|
657
|
+
"role": "menuitem",
|
|
658
|
+
"tabindex": "0"
|
|
652
659
|
}, [(_i = ult.value.titleItem) == null ? void 0 : _i.h1]), createVNode("li", {
|
|
653
660
|
"class": `${prefix}-menu-item ${prefix}-menu-item-title`,
|
|
654
661
|
"onClick": () => {
|
|
655
662
|
emitHandler("h2");
|
|
656
|
-
}
|
|
663
|
+
},
|
|
664
|
+
"role": "menuitem",
|
|
665
|
+
"tabindex": "0"
|
|
657
666
|
}, [(_j = ult.value.titleItem) == null ? void 0 : _j.h2]), createVNode("li", {
|
|
658
667
|
"class": `${prefix}-menu-item ${prefix}-menu-item-title`,
|
|
659
668
|
"onClick": () => {
|
|
660
669
|
emitHandler("h3");
|
|
661
|
-
}
|
|
670
|
+
},
|
|
671
|
+
"role": "menuitem",
|
|
672
|
+
"tabindex": "0"
|
|
662
673
|
}, [(_k = ult.value.titleItem) == null ? void 0 : _k.h3]), createVNode("li", {
|
|
663
674
|
"class": `${prefix}-menu-item ${prefix}-menu-item-title`,
|
|
664
675
|
"onClick": () => {
|
|
665
676
|
emitHandler("h4");
|
|
666
|
-
}
|
|
677
|
+
},
|
|
678
|
+
"role": "menuitem",
|
|
679
|
+
"tabindex": "0"
|
|
667
680
|
}, [(_l = ult.value.titleItem) == null ? void 0 : _l.h4]), createVNode("li", {
|
|
668
681
|
"class": `${prefix}-menu-item ${prefix}-menu-item-title`,
|
|
669
682
|
"onClick": () => {
|
|
670
683
|
emitHandler("h5");
|
|
671
|
-
}
|
|
684
|
+
},
|
|
685
|
+
"role": "menuitem",
|
|
686
|
+
"tabindex": "0"
|
|
672
687
|
}, [(_m = ult.value.titleItem) == null ? void 0 : _m.h5]), createVNode("li", {
|
|
673
688
|
"class": `${prefix}-menu-item ${prefix}-menu-item-title`,
|
|
674
689
|
"onClick": () => {
|
|
675
690
|
emitHandler("h6");
|
|
676
|
-
}
|
|
691
|
+
},
|
|
692
|
+
"role": "menuitem",
|
|
693
|
+
"tabindex": "0"
|
|
677
694
|
}, [(_n = ult.value.titleItem) == null ? void 0 : _n.h6])])
|
|
678
695
|
}, {
|
|
679
696
|
default: () => {
|
|
@@ -829,23 +846,30 @@ const ToolBar = /* @__PURE__ */ defineComponent({
|
|
|
829
846
|
"class": `${prefix}-menu`,
|
|
830
847
|
"onClick": () => {
|
|
831
848
|
visible.title = false;
|
|
832
|
-
}
|
|
849
|
+
},
|
|
850
|
+
"role": "menu"
|
|
833
851
|
}, [createVNode("li", {
|
|
834
852
|
"class": `${prefix}-menu-item ${prefix}-menu-item-image`,
|
|
835
853
|
"onClick": () => {
|
|
836
854
|
modalData.type = "image";
|
|
837
855
|
modalData.linkVisible = true;
|
|
838
|
-
}
|
|
856
|
+
},
|
|
857
|
+
"role": "menuitem",
|
|
858
|
+
"tabindex": "0"
|
|
839
859
|
}, [(_I = ult.value.imgTitleItem) == null ? void 0 : _I.link]), createVNode("li", {
|
|
840
860
|
"class": `${prefix}-menu-item ${prefix}-menu-item-image`,
|
|
841
861
|
"onClick": () => {
|
|
842
862
|
uploadRef.value.click();
|
|
843
|
-
}
|
|
863
|
+
},
|
|
864
|
+
"role": "menuitem",
|
|
865
|
+
"tabindex": "0"
|
|
844
866
|
}, [(_J = ult.value.imgTitleItem) == null ? void 0 : _J.upload]), createVNode("li", {
|
|
845
867
|
"class": `${prefix}-menu-item ${prefix}-menu-item-image`,
|
|
846
868
|
"onClick": () => {
|
|
847
869
|
modalData.clipVisible = true;
|
|
848
|
-
}
|
|
870
|
+
},
|
|
871
|
+
"role": "menuitem",
|
|
872
|
+
"tabindex": "0"
|
|
849
873
|
}, [(_K = ult.value.imgTitleItem) == null ? void 0 : _K.clip2upload])])
|
|
850
874
|
}, {
|
|
851
875
|
default: () => {
|
|
@@ -1044,47 +1068,64 @@ const ToolBar = /* @__PURE__ */ defineComponent({
|
|
|
1044
1068
|
"class": `${prefix}-menu`,
|
|
1045
1069
|
"onClick": () => {
|
|
1046
1070
|
visible.mermaid = false;
|
|
1047
|
-
}
|
|
1071
|
+
},
|
|
1072
|
+
"role": "menu"
|
|
1048
1073
|
}, [createVNode("li", {
|
|
1049
1074
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1050
1075
|
"onClick": () => {
|
|
1051
1076
|
emitHandler("flow");
|
|
1052
|
-
}
|
|
1077
|
+
},
|
|
1078
|
+
"role": "menuitem",
|
|
1079
|
+
"tabindex": "0"
|
|
1053
1080
|
}, [(_fa = ult.value.mermaid) == null ? void 0 : _fa.flow]), createVNode("li", {
|
|
1054
1081
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1055
1082
|
"onClick": () => {
|
|
1056
1083
|
emitHandler("sequence");
|
|
1057
|
-
}
|
|
1084
|
+
},
|
|
1085
|
+
"role": "menuitem",
|
|
1086
|
+
"tabindex": "0"
|
|
1058
1087
|
}, [(_ga = ult.value.mermaid) == null ? void 0 : _ga.sequence]), createVNode("li", {
|
|
1059
1088
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1060
1089
|
"onClick": () => {
|
|
1061
1090
|
emitHandler("gantt");
|
|
1062
|
-
}
|
|
1091
|
+
},
|
|
1092
|
+
"role": "menuitem",
|
|
1093
|
+
"tabindex": "0"
|
|
1063
1094
|
}, [(_ha = ult.value.mermaid) == null ? void 0 : _ha.gantt]), createVNode("li", {
|
|
1064
1095
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1065
1096
|
"onClick": () => {
|
|
1066
1097
|
emitHandler("class");
|
|
1067
|
-
}
|
|
1098
|
+
},
|
|
1099
|
+
"role": "menuitem",
|
|
1100
|
+
"tabindex": "0"
|
|
1068
1101
|
}, [(_ia = ult.value.mermaid) == null ? void 0 : _ia.class]), createVNode("li", {
|
|
1069
1102
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1070
1103
|
"onClick": () => {
|
|
1071
1104
|
emitHandler("state");
|
|
1072
|
-
}
|
|
1105
|
+
},
|
|
1106
|
+
"role": "menuitem",
|
|
1107
|
+
"tabindex": "0"
|
|
1073
1108
|
}, [(_ja = ult.value.mermaid) == null ? void 0 : _ja.state]), createVNode("li", {
|
|
1074
1109
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1075
1110
|
"onClick": () => {
|
|
1076
1111
|
emitHandler("pie");
|
|
1077
|
-
}
|
|
1112
|
+
},
|
|
1113
|
+
"role": "menuitem",
|
|
1114
|
+
"tabindex": "0"
|
|
1078
1115
|
}, [(_ka = ult.value.mermaid) == null ? void 0 : _ka.pie]), createVNode("li", {
|
|
1079
1116
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1080
1117
|
"onClick": () => {
|
|
1081
1118
|
emitHandler("relationship");
|
|
1082
|
-
}
|
|
1119
|
+
},
|
|
1120
|
+
"role": "menuitem",
|
|
1121
|
+
"tabindex": "0"
|
|
1083
1122
|
}, [(_la = ult.value.mermaid) == null ? void 0 : _la.relationship]), createVNode("li", {
|
|
1084
1123
|
"class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
|
|
1085
1124
|
"onClick": () => {
|
|
1086
1125
|
emitHandler("journey");
|
|
1087
|
-
}
|
|
1126
|
+
},
|
|
1127
|
+
"role": "menuitem",
|
|
1128
|
+
"tabindex": "0"
|
|
1088
1129
|
}, [(_ma = ult.value.mermaid) == null ? void 0 : _ma.journey])]),
|
|
1089
1130
|
"key": "bar-mermaid"
|
|
1090
1131
|
}, {
|
|
@@ -1112,17 +1153,22 @@ const ToolBar = /* @__PURE__ */ defineComponent({
|
|
|
1112
1153
|
"class": `${prefix}-menu`,
|
|
1113
1154
|
"onClick": () => {
|
|
1114
1155
|
visible.katex = false;
|
|
1115
|
-
}
|
|
1156
|
+
},
|
|
1157
|
+
"role": "menu"
|
|
1116
1158
|
}, [createVNode("li", {
|
|
1117
1159
|
"class": `${prefix}-menu-item ${prefix}-menu-item-katex`,
|
|
1118
1160
|
"onClick": () => {
|
|
1119
1161
|
emitHandler("katexInline");
|
|
1120
|
-
}
|
|
1162
|
+
},
|
|
1163
|
+
"role": "menuitem",
|
|
1164
|
+
"tabindex": "0"
|
|
1121
1165
|
}, [(_na = ult.value.katex) == null ? void 0 : _na.inline]), createVNode("li", {
|
|
1122
1166
|
"class": `${prefix}-menu-item ${prefix}-menu-item-katex`,
|
|
1123
1167
|
"onClick": () => {
|
|
1124
1168
|
emitHandler("katexBlock");
|
|
1125
|
-
}
|
|
1169
|
+
},
|
|
1170
|
+
"role": "menuitem",
|
|
1171
|
+
"tabindex": "0"
|
|
1126
1172
|
}, [(_oa = ult.value.katex) == null ? void 0 : _oa.block])]),
|
|
1127
1173
|
"key": "bar-katex"
|
|
1128
1174
|
}, {
|
|
@@ -1186,6 +1232,7 @@ const ToolBar = /* @__PURE__ */ defineComponent({
|
|
|
1186
1232
|
immediate: true
|
|
1187
1233
|
});
|
|
1188
1234
|
return () => {
|
|
1235
|
+
var _a;
|
|
1189
1236
|
const LeftBar = splitedbar.value[0].map((barItem) => barRender(barItem));
|
|
1190
1237
|
const RightBar = splitedbar.value[1].map((barItem) => barRender(barItem));
|
|
1191
1238
|
return createVNode(Fragment, null, [props2.toolbars.length > 0 && createVNode("div", {
|
|
@@ -1199,7 +1246,14 @@ const ToolBar = /* @__PURE__ */ defineComponent({
|
|
|
1199
1246
|
"ref": toolbarLeftRef
|
|
1200
1247
|
}, [LeftBar]), createVNode("div", {
|
|
1201
1248
|
"class": `${prefix}-toolbar-right`
|
|
1202
|
-
}, [RightBar])])]), createVNode("
|
|
1249
|
+
}, [RightBar])])]), createVNode("label", {
|
|
1250
|
+
"for": `${wrapperId}_label`,
|
|
1251
|
+
"style": {
|
|
1252
|
+
display: "none"
|
|
1253
|
+
},
|
|
1254
|
+
"aria-label": (_a = ult.value.imgTitleItem) == null ? void 0 : _a.upload
|
|
1255
|
+
}, null), createVNode("input", {
|
|
1256
|
+
"id": `${wrapperId}_label`,
|
|
1203
1257
|
"ref": uploadRef,
|
|
1204
1258
|
"accept": "image/*",
|
|
1205
1259
|
"type": "file",
|
package/lib/es/chunks/config.mjs
CHANGED
|
@@ -71,7 +71,7 @@ const EVENT_LISTENER = "eventListener";
|
|
|
71
71
|
const TASK_STATE_CHANGED = "taskStateChanged";
|
|
72
72
|
export {
|
|
73
73
|
BUILD_FINISHED as B,
|
|
74
|
-
|
|
74
|
+
CHANGE_FULL_SCREEN as C,
|
|
75
75
|
ERROR_CATCHER as E,
|
|
76
76
|
FULL_SCREEN_CHANGED as F,
|
|
77
77
|
HTML_PREVIEW_CHANGED as H,
|
|
@@ -80,13 +80,13 @@ export {
|
|
|
80
80
|
REPLACE as R,
|
|
81
81
|
TASK_STATE_CHANGED as T,
|
|
82
82
|
UPLOAD_IMAGE as U,
|
|
83
|
-
|
|
83
|
+
CHANGE_CATALOG_VISIBLE as a,
|
|
84
84
|
bus as b,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
ON_SAVE as c,
|
|
86
|
+
CTRL_SHIFT_Z as d,
|
|
87
|
+
CTRL_Z as e,
|
|
88
|
+
EVENT_LISTENER as f,
|
|
89
|
+
CATALOG_CHANGED as g,
|
|
90
90
|
RERENDER as h,
|
|
91
91
|
PAGE_FULL_SCREEN_CHANGED as i,
|
|
92
92
|
PREVIEW_CHANGED as j,
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject, onMounted, watch, toRef, nextTick, shallowRef, ref, computed, onBeforeUnmount, defineComponent, createVNode, Fragment, reactive, provide } from "vue";
|
|
2
2
|
import { p as prefix, f as configOption, g as codeCss, s as staticTextDefault, b as allToolbar, d as allFooter } from "./config.mjs";
|
|
3
|
-
import { b as bus,
|
|
3
|
+
import { b as bus, g as CATALOG_CHANGED, P as PUSH_CATALOG, h as RERENDER, B as BUILD_FINISHED, T as TASK_STATE_CHANGED, c as ON_SAVE, E as ERROR_CATCHER, U as UPLOAD_IMAGE, a as CHANGE_CATALOG_VISIBLE, i as PAGE_FULL_SCREEN_CHANGED, F as FULL_SCREEN_CHANGED, j as PREVIEW_CHANGED, k as PREVIEW_ONLY_CHANGED, H as HTML_PREVIEW_CHANGED, l as CATALOG_VISIBLE_CHANGED, R as REPLACE, C as CHANGE_FULL_SCREEN, f as EVENT_LISTENER } from "./event-name.mjs";
|
|
4
4
|
import { a as appendHandler, u as updateHandler, z as zoomMermaid } from "./dom.mjs";
|
|
5
5
|
import { debounce, randomId, deepMerge, deepClone } from "@vavt/util";
|
|
6
6
|
import mediumZoom from "medium-zoom";
|
|
@@ -9,7 +9,7 @@ import mdit from "markdown-it";
|
|
|
9
9
|
import ImageFiguresPlugin from "markdown-it-image-figures";
|
|
10
10
|
import SubPlugin from "markdown-it-sub";
|
|
11
11
|
import SupPlugin from "markdown-it-sup";
|
|
12
|
-
import {
|
|
12
|
+
import { g as generateCodeRowNumber, a as getNextId } from "./index5.mjs";
|
|
13
13
|
import { LRUCache } from "lru-cache";
|
|
14
14
|
function _mergeNamespaces(n, m) {
|
|
15
15
|
for (var i = 0; i < m.length; i++) {
|
|
@@ -130,7 +130,7 @@ const useHighlight = (props) => {
|
|
|
130
130
|
watch(
|
|
131
131
|
() => highlight.value.css,
|
|
132
132
|
() => {
|
|
133
|
-
if (props.noHighlight ||
|
|
133
|
+
if (props.noHighlight || configOption.editorExtensions.highlight.instance) {
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
updateHandler("link", {
|
|
@@ -656,15 +656,19 @@ const codetabs = (md, _opts) => {
|
|
|
656
656
|
};
|
|
657
657
|
tokens[idx].info = tokens[idx].info.replace(mandatoryRe, "");
|
|
658
658
|
const codeRendered = defaultRender(tokens, idx, options, env, slf);
|
|
659
|
-
return
|
|
660
|
-
<${
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
<
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
659
|
+
return `
|
|
660
|
+
<${tagContainer2} ${slf.renderAttrs(tmpToken2)}>
|
|
661
|
+
<${tagHeader2} class="${prefix}-code-head">
|
|
662
|
+
<div class="${prefix}-code-flag"><span></span><span></span><span></span></div>
|
|
663
|
+
<div class="${prefix}-code-action">
|
|
664
|
+
<span class="${prefix}-code-lang">${tokens[idx].info.trim()}</span>
|
|
665
|
+
<span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}>${copyBtnHtml}</span>
|
|
666
|
+
${tagContainer2 === "details" ? collapseTips : ""}
|
|
667
|
+
</div>
|
|
668
|
+
</${tagHeader2}>
|
|
669
|
+
${codeRendered}
|
|
670
|
+
</${tagContainer2}>
|
|
671
|
+
`;
|
|
668
672
|
}
|
|
669
673
|
let token, group, tab, checked, labels = "", pres = "", langs = "";
|
|
670
674
|
const { open, tagContainer, tagHeader } = getTagType(tokens[idx]);
|
|
@@ -683,26 +687,56 @@ const codetabs = (md, _opts) => {
|
|
|
683
687
|
token.hidden = true;
|
|
684
688
|
const className = `${prefix}-codetab-${_opts.editorId}-${idx}-${i - idx}`;
|
|
685
689
|
checked = i - idx > 0 ? "" : "checked";
|
|
686
|
-
labels +=
|
|
687
|
-
|
|
688
|
-
<
|
|
690
|
+
labels += `
|
|
691
|
+
<li>
|
|
692
|
+
<input
|
|
693
|
+
type="radio"
|
|
694
|
+
id="label-${prefix}-codetab-label-1-${_opts.editorId}-${idx}-${i - idx}"
|
|
695
|
+
name="${prefix}-codetab-label-${_opts.editorId}-${idx}"
|
|
696
|
+
class="${className}"
|
|
697
|
+
${checked}
|
|
698
|
+
>
|
|
699
|
+
<label
|
|
700
|
+
for="label-${prefix}-codetab-label-1-${_opts.editorId}-${idx}-${i - idx}"
|
|
701
|
+
onclick="this.getRootNode().querySelectorAll('.${className}').forEach(e => e.click())"
|
|
702
|
+
>
|
|
703
|
+
${tab || getLangName(token)}
|
|
704
|
+
</label>
|
|
689
705
|
</li>`;
|
|
690
|
-
pres +=
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
<
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
+
pres += `
|
|
707
|
+
<div role="tabpanel">
|
|
708
|
+
<input
|
|
709
|
+
type="radio"
|
|
710
|
+
name="${prefix}-codetab-pre-${_opts.editorId}-${idx}"
|
|
711
|
+
class="${className}"
|
|
712
|
+
${checked}
|
|
713
|
+
role="presentation">
|
|
714
|
+
${defaultRender(tokens, i, options, env, slf)}
|
|
715
|
+
</div>`;
|
|
716
|
+
langs += `
|
|
717
|
+
<input
|
|
718
|
+
type="radio"
|
|
719
|
+
name="${prefix}-codetab-lang-${_opts.editorId}-${idx}"
|
|
720
|
+
class="${className}"
|
|
721
|
+
${checked}
|
|
722
|
+
role="presentation">
|
|
723
|
+
<span class=${prefix}-code-lang role="note">${getLangName(token)}</span>`;
|
|
724
|
+
}
|
|
725
|
+
return `
|
|
726
|
+
<${tagContainer} ${slf.renderAttrs(tmpToken)}>
|
|
727
|
+
<${tagHeader} class="${prefix}-code-head">
|
|
728
|
+
<div class="${prefix}-code-flag">
|
|
729
|
+
<ul class="${prefix}-codetab-label" role="tablist">${labels}</ul>
|
|
730
|
+
</div>
|
|
731
|
+
<div class="${prefix}-code-action">
|
|
732
|
+
<span class="${prefix}-codetab-lang">${langs}</span>
|
|
733
|
+
<span class="${prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}>${copyBtnHtml}</span>
|
|
734
|
+
${tagContainer === "details" ? collapseTips : ""}
|
|
735
|
+
</div>
|
|
736
|
+
</${tagHeader}>
|
|
737
|
+
${pres}
|
|
738
|
+
</${tagContainer}>
|
|
739
|
+
`;
|
|
706
740
|
};
|
|
707
741
|
md.renderer.rules.fence = fenceGroup;
|
|
708
742
|
md.renderer.rules.code_block = fenceGroup;
|
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, inject, createVNode, reactive, shallowRef, ref, provide, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
|
2
2
|
import { p as prefix } from "./config.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { b as bus,
|
|
3
|
+
import { c as getRelativeTop } from "./index5.mjs";
|
|
4
|
+
import { b as bus, g as CATALOG_CHANGED, P as PUSH_CATALOG } from "./event-name.mjs";
|
|
5
5
|
import { debounce, createSmoothScroll } from "@vavt/util";
|
|
6
6
|
const DATA_LINE_SELECTOR = `.${prefix}-preview > [data-line]`;
|
|
7
7
|
const getComputedStyleNum = (ele, key) => {
|
|
@@ -509,6 +509,15 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
509
509
|
const scrollHandler = () => {
|
|
510
510
|
findActiveHeading(state.list);
|
|
511
511
|
};
|
|
512
|
+
const catalogChangedHandler = (_list) => {
|
|
513
|
+
var _a, _b;
|
|
514
|
+
const scrollElement = getScrollElement();
|
|
515
|
+
scrollElementRef.value = scrollElement;
|
|
516
|
+
scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
|
|
517
|
+
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
518
|
+
findActiveHeading(_list);
|
|
519
|
+
(_b = scrollContainerRef.value) == null ? void 0 : _b.addEventListener("scroll", scrollHandler);
|
|
520
|
+
};
|
|
512
521
|
watch(() => activeItem.value, (nVal) => {
|
|
513
522
|
const activeHeading = nVal ? {
|
|
514
523
|
...nVal
|
|
@@ -521,24 +530,15 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
521
530
|
});
|
|
522
531
|
onMounted(() => {
|
|
523
532
|
rootNodeRef.value = catalogRef.value.getRootNode();
|
|
524
|
-
let scrollElement = getScrollElement();
|
|
525
|
-
scrollElementRef.value = scrollElement;
|
|
526
533
|
bus.on(editorId, {
|
|
527
534
|
name: CATALOG_CHANGED,
|
|
528
|
-
callback:
|
|
529
|
-
var _a, _b;
|
|
530
|
-
scrollElement = getScrollElement();
|
|
531
|
-
scrollElementRef.value = scrollElement;
|
|
532
|
-
scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
|
|
533
|
-
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
534
|
-
findActiveHeading(_list);
|
|
535
|
-
(_b = scrollContainerRef.value) == null ? void 0 : _b.addEventListener("scroll", scrollHandler);
|
|
536
|
-
}
|
|
535
|
+
callback: catalogChangedHandler
|
|
537
536
|
});
|
|
538
537
|
bus.emit(editorId, PUSH_CATALOG);
|
|
539
538
|
});
|
|
540
539
|
onBeforeUnmount(() => {
|
|
541
540
|
var _a;
|
|
541
|
+
bus.remove(editorId, CATALOG_CHANGED, catalogChangedHandler);
|
|
542
542
|
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
543
543
|
});
|
|
544
544
|
return () => createVNode("div", {
|
package/lib/es/chunks/index4.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { defineComponent, createVNode, inject, h, ref, shallowRef, reactive, com
|
|
|
2
2
|
import { p as prefix, f as configOption } from "./config.mjs";
|
|
3
3
|
import { g as getSlot } from "./vue-tsx.mjs";
|
|
4
4
|
import { k as keyMove } from "./dom.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { d as getZIndexIncrement } from "./index5.mjs";
|
|
6
6
|
const Icon$1 = /* @__PURE__ */ defineComponent({
|
|
7
7
|
props: {
|
|
8
8
|
name: {
|
package/lib/es/chunks/index5.mjs
CHANGED
|
@@ -50,9 +50,9 @@ const getZIndexIncrement = /* @__PURE__ */ (() => {
|
|
|
50
50
|
};
|
|
51
51
|
})();
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
getNextId as a,
|
|
54
54
|
base642File as b,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
getRelativeTop as c,
|
|
56
|
+
getZIndexIncrement as d,
|
|
57
|
+
generateCodeRowNumber as g
|
|
58
58
|
};
|
package/lib/es/index.mjs
CHANGED
|
@@ -5,8 +5,43 @@ import { D } from "./chunks/index2.mjs";
|
|
|
5
5
|
import { default as default4 } from "./ModalToolbar.mjs";
|
|
6
6
|
import { M as M2 } from "./chunks/index3.mjs";
|
|
7
7
|
import { M as M3 } from "./chunks/index4.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { defineComponent, createVNode } from "vue";
|
|
9
|
+
import { g as getSlot } from "./chunks/vue-tsx.mjs";
|
|
10
|
+
import { p as prefix } from "./chunks/config.mjs";
|
|
9
11
|
import { d, b, c, e, i, a } from "./chunks/config.mjs";
|
|
12
|
+
import { en_US, zh_CN } from "./config.mjs";
|
|
13
|
+
const props = {
|
|
14
|
+
onClick: {
|
|
15
|
+
type: Function
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const NormalFooterToolbar = /* @__PURE__ */ defineComponent({
|
|
19
|
+
name: "NormalFooterToolbar",
|
|
20
|
+
props,
|
|
21
|
+
emits: ["onClick"],
|
|
22
|
+
setup(props2, ctx) {
|
|
23
|
+
return () => {
|
|
24
|
+
const Children = getSlot({
|
|
25
|
+
props: props2,
|
|
26
|
+
ctx
|
|
27
|
+
});
|
|
28
|
+
return createVNode("div", {
|
|
29
|
+
"class": `${prefix}-footer-item`,
|
|
30
|
+
"onClick": (e2) => {
|
|
31
|
+
if (props2.onClick instanceof Function) {
|
|
32
|
+
props2.onClick(e2);
|
|
33
|
+
} else {
|
|
34
|
+
ctx.emit("onClick", e2);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, [Children]);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
NormalFooterToolbar.install = (app) => {
|
|
42
|
+
app.component(NormalFooterToolbar.name, NormalFooterToolbar);
|
|
43
|
+
return app;
|
|
44
|
+
};
|
|
10
45
|
export {
|
|
11
46
|
D as DropdownToolbar,
|
|
12
47
|
M2 as MdCatalog,
|
|
@@ -14,6 +49,7 @@ export {
|
|
|
14
49
|
M3 as MdModal,
|
|
15
50
|
M as MdPreview,
|
|
16
51
|
default4 as ModalToolbar,
|
|
52
|
+
NormalFooterToolbar,
|
|
17
53
|
default3 as NormalToolbar,
|
|
18
54
|
S as StrIcon,
|
|
19
55
|
d as allFooter,
|
package/lib/style.css
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
onClick: {
|
|
4
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
5
|
+
};
|
|
6
|
+
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
7
|
+
onClick: {
|
|
8
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
9
|
+
};
|
|
10
|
+
}>> & {
|
|
11
|
+
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
12
|
+
}, {}, {}>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
|
|
4
|
+
onClick: {
|
|
5
|
+
type: import("vue").PropType<(e: MouseEvent) => void>;
|
|
6
|
+
};
|
|
7
|
+
}>> & {
|
|
8
|
+
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
9
|
+
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
onClick: {
|
|
11
|
+
type: import("vue").PropType<(e: MouseEvent) => void>;
|
|
12
|
+
};
|
|
13
|
+
}>> & {
|
|
14
|
+
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
15
|
+
}, {}, true, {}, {}, {
|
|
16
|
+
P: {};
|
|
17
|
+
B: {};
|
|
18
|
+
D: {};
|
|
19
|
+
C: {};
|
|
20
|
+
M: {};
|
|
21
|
+
Defaults: {};
|
|
22
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
onClick: {
|
|
24
|
+
type: import("vue").PropType<(e: MouseEvent) => void>;
|
|
25
|
+
};
|
|
26
|
+
}>> & {
|
|
27
|
+
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
28
|
+
}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {}>;
|
|
29
|
+
__isFragment?: undefined;
|
|
30
|
+
__isTeleport?: undefined;
|
|
31
|
+
__isSuspense?: undefined;
|
|
32
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
33
|
+
onClick: {
|
|
34
|
+
type: import("vue").PropType<(e: MouseEvent) => void>;
|
|
35
|
+
};
|
|
36
|
+
}>> & {
|
|
37
|
+
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", {}, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
39
|
+
install: (app: App) => App;
|
|
40
|
+
};
|
|
41
|
+
export default _default;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export { default as ModalToolbar } from './ModalToolbar';
|
|
|
6
6
|
export { default as MdCatalog } from './MdCatalog';
|
|
7
7
|
export { default as MdModal } from './MdEditor/components/Modal';
|
|
8
8
|
export { default as StrIcon } from './MdEditor/components/Icon/Str';
|
|
9
|
+
export { default as NormalFooterToolbar } from './NormalFooterToolbar';
|
|
9
10
|
export * from './config';
|
|
10
11
|
export * from './MdEditor/type';
|