md-editor-v3 2.3.0 → 2.4.0-beta.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 +24 -7
- package/lib/MdEditor/Editor.d.ts +6 -0
- package/lib/MdEditor/config.d.ts +2 -2
- package/lib/MdEditor/index.d.ts +12 -0
- package/lib/MdEditor/type.d.ts +2 -1
- package/lib/md-editor-v3.es.js +115 -70
- package/lib/md-editor-v3.umd.js +53 -51
- package/lib/style.css +1 -1
- package/package.json +4 -8
package/lib/md-editor-v3.es.js
CHANGED
|
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { onMounted, onBeforeUnmount, provide, computed, reactive, watch, ref, defineComponent, createVNode, cloneVNode, nextTick, inject, Fragment, toRef, isVNode } from "vue";
|
|
21
|
-
const prefix = "md";
|
|
22
|
-
const iconfontUrl = "https://at.alicdn.com/t/
|
|
21
|
+
const prefix = "md-editor";
|
|
22
|
+
const iconfontUrl = "https://at.alicdn.com/t/c/font_2605852_4cjr7o5jo0f.js";
|
|
23
23
|
const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
|
|
24
24
|
const highlightUrl = `${cdnBase}/highlight.js/11.5.1/highlight.min.js`;
|
|
25
25
|
const prettierUrl = {
|
|
@@ -43,6 +43,7 @@ const allToolbar = [
|
|
|
43
43
|
"quote",
|
|
44
44
|
"unorderedList",
|
|
45
45
|
"orderedList",
|
|
46
|
+
"task",
|
|
46
47
|
"-",
|
|
47
48
|
"codeRow",
|
|
48
49
|
"code",
|
|
@@ -78,6 +79,7 @@ const staticTextDefault = {
|
|
|
78
79
|
quote: "\u5F15\u7528",
|
|
79
80
|
unorderedList: "\u65E0\u5E8F\u5217\u8868",
|
|
80
81
|
orderedList: "\u6709\u5E8F\u5217\u8868",
|
|
82
|
+
task: "\u4EFB\u52A1\u5217\u8868",
|
|
81
83
|
codeRow: "\u884C\u5185\u4EE3\u7801",
|
|
82
84
|
code: "\u5757\u7EA7\u4EE3\u7801",
|
|
83
85
|
link: "\u94FE\u63A5",
|
|
@@ -114,7 +116,7 @@ const staticTextDefault = {
|
|
|
114
116
|
descLable: "\u94FE\u63A5\u63CF\u8FF0\uFF1A",
|
|
115
117
|
descLablePlaceHolder: "\u8BF7\u8F93\u5165\u63CF\u8FF0...",
|
|
116
118
|
urlLable: "\u94FE\u63A5\u5730\u5740\uFF1A",
|
|
117
|
-
|
|
119
|
+
urlLablePlaceHolder: "\u8BF7\u8F93\u5165\u94FE\u63A5...",
|
|
118
120
|
buttonOK: "\u786E\u5B9A"
|
|
119
121
|
},
|
|
120
122
|
clipModalTips: {
|
|
@@ -157,6 +159,7 @@ const staticTextDefault = {
|
|
|
157
159
|
quote: "quote",
|
|
158
160
|
unorderedList: "unordered list",
|
|
159
161
|
orderedList: "ordered list",
|
|
162
|
+
task: "task list",
|
|
160
163
|
codeRow: "inline code",
|
|
161
164
|
code: "block-level code",
|
|
162
165
|
link: "link",
|
|
@@ -193,7 +196,7 @@ const staticTextDefault = {
|
|
|
193
196
|
descLable: "Desc:",
|
|
194
197
|
descLablePlaceHolder: "Enter a description...",
|
|
195
198
|
urlLable: "Link:",
|
|
196
|
-
|
|
199
|
+
urlLablePlaceHolder: "Enter a link...",
|
|
197
200
|
buttonOK: "OK"
|
|
198
201
|
},
|
|
199
202
|
clipModalTips: {
|
|
@@ -1257,7 +1260,7 @@ var Modal = defineComponent({
|
|
|
1257
1260
|
"class": `${prefix}-icon`,
|
|
1258
1261
|
"aria-hidden": "true"
|
|
1259
1262
|
}, [createVNode("use", {
|
|
1260
|
-
"xlink:href": `#icon-${props.isFullscreen ? "suoxiao" : "fangda"}`
|
|
1263
|
+
"xlink:href": `#md-editor-icon-${props.isFullscreen ? "suoxiao" : "fangda"}`
|
|
1261
1264
|
}, null)])]), createVNode("div", {
|
|
1262
1265
|
"class": `${prefix}-modal-close`,
|
|
1263
1266
|
"onClick": (e) => {
|
|
@@ -1268,7 +1271,7 @@ var Modal = defineComponent({
|
|
|
1268
1271
|
"class": `${prefix}-icon`,
|
|
1269
1272
|
"aria-hidden": "true"
|
|
1270
1273
|
}, [createVNode("use", {
|
|
1271
|
-
"xlink:href": "#icon-close"
|
|
1274
|
+
"xlink:href": "#md-editor-icon-close"
|
|
1272
1275
|
}, null)])])])])]);
|
|
1273
1276
|
};
|
|
1274
1277
|
}
|
|
@@ -1352,7 +1355,7 @@ var LinkModal = defineComponent({
|
|
|
1352
1355
|
"class": `${prefix}-lable`,
|
|
1353
1356
|
"for": `link-url-${editorId}`
|
|
1354
1357
|
}, [(_c = ult.value.linkModalTips) == null ? void 0 : _c.urlLable]), createVNode("input", {
|
|
1355
|
-
"placeholder": (_d = ult.value.linkModalTips) == null ? void 0 : _d.
|
|
1358
|
+
"placeholder": (_d = ult.value.linkModalTips) == null ? void 0 : _d.urlLablePlaceHolder,
|
|
1356
1359
|
"class": `${prefix}-input`,
|
|
1357
1360
|
"id": `link-url-${editorId}`,
|
|
1358
1361
|
"type": "text",
|
|
@@ -1496,7 +1499,7 @@ var ClipModal = defineComponent({
|
|
|
1496
1499
|
"class": `${prefix}-icon`,
|
|
1497
1500
|
"aria-hidden": "true"
|
|
1498
1501
|
}, [createVNode("use", {
|
|
1499
|
-
"xlink:href": "#icon-delete"
|
|
1502
|
+
"xlink:href": "#md-editor-icon-delete"
|
|
1500
1503
|
}, null)])])]) : createVNode("div", {
|
|
1501
1504
|
"class": `${prefix}-clip-upload`,
|
|
1502
1505
|
"onClick": () => {
|
|
@@ -1506,7 +1509,7 @@ var ClipModal = defineComponent({
|
|
|
1506
1509
|
"class": `${prefix}-icon`,
|
|
1507
1510
|
"aria-hidden": "true"
|
|
1508
1511
|
}, [createVNode("use", {
|
|
1509
|
-
"xlink:href": "#icon-upload"
|
|
1512
|
+
"xlink:href": "#md-editor-icon-upload"
|
|
1510
1513
|
}, null)])])]), createVNode("div", {
|
|
1511
1514
|
"class": `${prefix}-clip-preview`
|
|
1512
1515
|
}, [createVNode("div", {
|
|
@@ -1707,6 +1710,9 @@ const toolbarProps = () => ({
|
|
|
1707
1710
|
},
|
|
1708
1711
|
defToolbars: {
|
|
1709
1712
|
type: Object
|
|
1713
|
+
},
|
|
1714
|
+
noUploadImg: {
|
|
1715
|
+
type: Boolean
|
|
1710
1716
|
}
|
|
1711
1717
|
});
|
|
1712
1718
|
var ToolBar = defineComponent({
|
|
@@ -1761,7 +1767,7 @@ var ToolBar = defineComponent({
|
|
|
1761
1767
|
uploadRef.value.addEventListener("change", uploadHandler);
|
|
1762
1768
|
});
|
|
1763
1769
|
const barRender = (barItem) => {
|
|
1764
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O;
|
|
1770
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
|
|
1765
1771
|
if (allToolbar.includes(barItem)) {
|
|
1766
1772
|
switch (barItem) {
|
|
1767
1773
|
case "-": {
|
|
@@ -1778,7 +1784,7 @@ var ToolBar = defineComponent({
|
|
|
1778
1784
|
"class": `${prefix}-icon`,
|
|
1779
1785
|
"aria-hidden": "true"
|
|
1780
1786
|
}, [createVNode("use", {
|
|
1781
|
-
"xlink:href": "#icon-bold"
|
|
1787
|
+
"xlink:href": "#md-editor-icon-bold"
|
|
1782
1788
|
}, null)])]);
|
|
1783
1789
|
}
|
|
1784
1790
|
case "underline": {
|
|
@@ -1792,7 +1798,7 @@ var ToolBar = defineComponent({
|
|
|
1792
1798
|
"class": `${prefix}-icon`,
|
|
1793
1799
|
"aria-hidden": "true"
|
|
1794
1800
|
}, [createVNode("use", {
|
|
1795
|
-
"xlink:href": "#icon-underline"
|
|
1801
|
+
"xlink:href": "#md-editor-icon-underline"
|
|
1796
1802
|
}, null)])]);
|
|
1797
1803
|
}
|
|
1798
1804
|
case "italic": {
|
|
@@ -1806,7 +1812,7 @@ var ToolBar = defineComponent({
|
|
|
1806
1812
|
"class": `${prefix}-icon`,
|
|
1807
1813
|
"aria-hidden": "true"
|
|
1808
1814
|
}, [createVNode("use", {
|
|
1809
|
-
"xlink:href": "#icon-italic"
|
|
1815
|
+
"xlink:href": "#md-editor-icon-italic"
|
|
1810
1816
|
}, null)])]);
|
|
1811
1817
|
}
|
|
1812
1818
|
case "strikeThrough": {
|
|
@@ -1820,7 +1826,7 @@ var ToolBar = defineComponent({
|
|
|
1820
1826
|
"class": `${prefix}-icon`,
|
|
1821
1827
|
"aria-hidden": "true"
|
|
1822
1828
|
}, [createVNode("use", {
|
|
1823
|
-
"xlink:href": "#icon-strike-through"
|
|
1829
|
+
"xlink:href": "#md-editor-icon-strike-through"
|
|
1824
1830
|
}, null)])]);
|
|
1825
1831
|
}
|
|
1826
1832
|
case "title": {
|
|
@@ -1876,7 +1882,7 @@ var ToolBar = defineComponent({
|
|
|
1876
1882
|
"class": `${prefix}-icon`,
|
|
1877
1883
|
"aria-hidden": "true"
|
|
1878
1884
|
}, [createVNode("use", {
|
|
1879
|
-
"xlink:href": "#icon-title"
|
|
1885
|
+
"xlink:href": "#md-editor-icon-title"
|
|
1880
1886
|
}, null)])])];
|
|
1881
1887
|
}
|
|
1882
1888
|
});
|
|
@@ -1892,7 +1898,7 @@ var ToolBar = defineComponent({
|
|
|
1892
1898
|
"class": `${prefix}-icon`,
|
|
1893
1899
|
"aria-hidden": "true"
|
|
1894
1900
|
}, [createVNode("use", {
|
|
1895
|
-
"xlink:href": "#icon-sub"
|
|
1901
|
+
"xlink:href": "#md-editor-icon-sub"
|
|
1896
1902
|
}, null)])]);
|
|
1897
1903
|
}
|
|
1898
1904
|
case "sup": {
|
|
@@ -1906,7 +1912,7 @@ var ToolBar = defineComponent({
|
|
|
1906
1912
|
"class": `${prefix}-icon`,
|
|
1907
1913
|
"aria-hidden": "true"
|
|
1908
1914
|
}, [createVNode("use", {
|
|
1909
|
-
"xlink:href": "#icon-sup"
|
|
1915
|
+
"xlink:href": "#md-editor-icon-sup"
|
|
1910
1916
|
}, null)])]);
|
|
1911
1917
|
}
|
|
1912
1918
|
case "quote": {
|
|
@@ -1920,7 +1926,7 @@ var ToolBar = defineComponent({
|
|
|
1920
1926
|
"class": `${prefix}-icon`,
|
|
1921
1927
|
"aria-hidden": "true"
|
|
1922
1928
|
}, [createVNode("use", {
|
|
1923
|
-
"xlink:href": "#icon-quote"
|
|
1929
|
+
"xlink:href": "#md-editor-icon-quote"
|
|
1924
1930
|
}, null)])]);
|
|
1925
1931
|
}
|
|
1926
1932
|
case "unorderedList": {
|
|
@@ -1934,7 +1940,7 @@ var ToolBar = defineComponent({
|
|
|
1934
1940
|
"class": `${prefix}-icon`,
|
|
1935
1941
|
"aria-hidden": "true"
|
|
1936
1942
|
}, [createVNode("use", {
|
|
1937
|
-
"xlink:href": "#icon-unordered-list"
|
|
1943
|
+
"xlink:href": "#md-editor-icon-unordered-list"
|
|
1938
1944
|
}, null)])]);
|
|
1939
1945
|
}
|
|
1940
1946
|
case "orderedList": {
|
|
@@ -1948,13 +1954,27 @@ var ToolBar = defineComponent({
|
|
|
1948
1954
|
"class": `${prefix}-icon`,
|
|
1949
1955
|
"aria-hidden": "true"
|
|
1950
1956
|
}, [createVNode("use", {
|
|
1951
|
-
"xlink:href": "#icon-ordered-list"
|
|
1957
|
+
"xlink:href": "#md-editor-icon-ordered-list"
|
|
1958
|
+
}, null)])]);
|
|
1959
|
+
}
|
|
1960
|
+
case "task": {
|
|
1961
|
+
return createVNode("div", {
|
|
1962
|
+
"class": `${prefix}-toolbar-item`,
|
|
1963
|
+
"title": (_p = ult.value.toolbarTips) == null ? void 0 : _p.task,
|
|
1964
|
+
"onClick": () => {
|
|
1965
|
+
emitHandler("task");
|
|
1966
|
+
}
|
|
1967
|
+
}, [createVNode("svg", {
|
|
1968
|
+
"class": `${prefix}-icon`,
|
|
1969
|
+
"aria-hidden": "true"
|
|
1970
|
+
}, [createVNode("use", {
|
|
1971
|
+
"xlink:href": "#md-editor-icon-task"
|
|
1952
1972
|
}, null)])]);
|
|
1953
1973
|
}
|
|
1954
1974
|
case "codeRow": {
|
|
1955
1975
|
return createVNode("div", {
|
|
1956
1976
|
"class": `${prefix}-toolbar-item`,
|
|
1957
|
-
"title": (
|
|
1977
|
+
"title": (_q = ult.value.toolbarTips) == null ? void 0 : _q.codeRow,
|
|
1958
1978
|
"onClick": () => {
|
|
1959
1979
|
emitHandler("codeRow");
|
|
1960
1980
|
}
|
|
@@ -1962,13 +1982,13 @@ var ToolBar = defineComponent({
|
|
|
1962
1982
|
"class": `${prefix}-icon`,
|
|
1963
1983
|
"aria-hidden": "true"
|
|
1964
1984
|
}, [createVNode("use", {
|
|
1965
|
-
"xlink:href": "#icon-code-row"
|
|
1985
|
+
"xlink:href": "#md-editor-icon-code-row"
|
|
1966
1986
|
}, null)])]);
|
|
1967
1987
|
}
|
|
1968
1988
|
case "code": {
|
|
1969
1989
|
return createVNode("div", {
|
|
1970
1990
|
"class": `${prefix}-toolbar-item`,
|
|
1971
|
-
"title": (
|
|
1991
|
+
"title": (_r = ult.value.toolbarTips) == null ? void 0 : _r.code,
|
|
1972
1992
|
"onClick": () => {
|
|
1973
1993
|
emitHandler("code");
|
|
1974
1994
|
}
|
|
@@ -1976,13 +1996,13 @@ var ToolBar = defineComponent({
|
|
|
1976
1996
|
"class": `${prefix}-icon`,
|
|
1977
1997
|
"aria-hidden": "true"
|
|
1978
1998
|
}, [createVNode("use", {
|
|
1979
|
-
"xlink:href": "#icon-code"
|
|
1999
|
+
"xlink:href": "#md-editor-icon-code"
|
|
1980
2000
|
}, null)])]);
|
|
1981
2001
|
}
|
|
1982
2002
|
case "link": {
|
|
1983
2003
|
return createVNode("div", {
|
|
1984
2004
|
"class": `${prefix}-toolbar-item`,
|
|
1985
|
-
"title": (
|
|
2005
|
+
"title": (_s = ult.value.toolbarTips) == null ? void 0 : _s.link,
|
|
1986
2006
|
"onClick": () => {
|
|
1987
2007
|
modalData.type = "link";
|
|
1988
2008
|
modalData.linkVisible = true;
|
|
@@ -1991,11 +2011,23 @@ var ToolBar = defineComponent({
|
|
|
1991
2011
|
"class": `${prefix}-icon`,
|
|
1992
2012
|
"aria-hidden": "true"
|
|
1993
2013
|
}, [createVNode("use", {
|
|
1994
|
-
"xlink:href": "#icon-link"
|
|
2014
|
+
"xlink:href": "#md-editor-icon-link"
|
|
1995
2015
|
}, null)])]);
|
|
1996
2016
|
}
|
|
1997
2017
|
case "image": {
|
|
1998
|
-
return createVNode(
|
|
2018
|
+
return props.noUploadImg ? createVNode("div", {
|
|
2019
|
+
"class": `${prefix}-toolbar-item`,
|
|
2020
|
+
"title": (_t = ult.value.toolbarTips) == null ? void 0 : _t.image,
|
|
2021
|
+
"onClick": () => {
|
|
2022
|
+
modalData.type = "image";
|
|
2023
|
+
modalData.linkVisible = true;
|
|
2024
|
+
}
|
|
2025
|
+
}, [createVNode("svg", {
|
|
2026
|
+
"class": `${prefix}-icon`,
|
|
2027
|
+
"aria-hidden": "true"
|
|
2028
|
+
}, [createVNode("use", {
|
|
2029
|
+
"xlink:href": "#md-editor-icon-image"
|
|
2030
|
+
}, null)])]) : createVNode(Dropdown, {
|
|
1999
2031
|
"relative": `#${wrapperId}`,
|
|
2000
2032
|
"visible": visible.image,
|
|
2001
2033
|
"onChange": (v) => {
|
|
@@ -2012,17 +2044,17 @@ var ToolBar = defineComponent({
|
|
|
2012
2044
|
modalData.type = "image";
|
|
2013
2045
|
modalData.linkVisible = true;
|
|
2014
2046
|
}
|
|
2015
|
-
}, [(
|
|
2047
|
+
}, [(_u = ult.value.imgTitleItem) == null ? void 0 : _u.link]), createVNode("li", {
|
|
2016
2048
|
"class": `${prefix}-menu-item`,
|
|
2017
2049
|
"onClick": () => {
|
|
2018
2050
|
uploadRef.value.click();
|
|
2019
2051
|
}
|
|
2020
|
-
}, [(
|
|
2052
|
+
}, [(_v = ult.value.imgTitleItem) == null ? void 0 : _v.upload]), createVNode("li", {
|
|
2021
2053
|
"class": `${prefix}-menu-item`,
|
|
2022
2054
|
"onClick": () => {
|
|
2023
2055
|
modalData.clipVisible = true;
|
|
2024
2056
|
}
|
|
2025
|
-
}, [(
|
|
2057
|
+
}, [(_w = ult.value.imgTitleItem) == null ? void 0 : _w.clip2upload])])
|
|
2026
2058
|
}, {
|
|
2027
2059
|
default: () => {
|
|
2028
2060
|
var _a2;
|
|
@@ -2033,7 +2065,7 @@ var ToolBar = defineComponent({
|
|
|
2033
2065
|
"class": `${prefix}-icon`,
|
|
2034
2066
|
"aria-hidden": "true"
|
|
2035
2067
|
}, [createVNode("use", {
|
|
2036
|
-
"xlink:href": "#icon-image"
|
|
2068
|
+
"xlink:href": "#md-editor-icon-image"
|
|
2037
2069
|
}, null)])])];
|
|
2038
2070
|
}
|
|
2039
2071
|
});
|
|
@@ -2064,7 +2096,7 @@ var ToolBar = defineComponent({
|
|
|
2064
2096
|
"class": `${prefix}-icon`,
|
|
2065
2097
|
"aria-hidden": "true"
|
|
2066
2098
|
}, [createVNode("use", {
|
|
2067
|
-
"xlink:href": "#icon-table"
|
|
2099
|
+
"xlink:href": "#md-editor-icon-table"
|
|
2068
2100
|
}, null)])])];
|
|
2069
2101
|
}
|
|
2070
2102
|
});
|
|
@@ -2072,7 +2104,7 @@ var ToolBar = defineComponent({
|
|
|
2072
2104
|
case "revoke": {
|
|
2073
2105
|
return createVNode("div", {
|
|
2074
2106
|
"class": `${prefix}-toolbar-item`,
|
|
2075
|
-
"title": (
|
|
2107
|
+
"title": (_x = ult.value.toolbarTips) == null ? void 0 : _x.revoke,
|
|
2076
2108
|
"onClick": () => {
|
|
2077
2109
|
bus.emit(editorId, "ctrlZ");
|
|
2078
2110
|
}
|
|
@@ -2080,13 +2112,13 @@ var ToolBar = defineComponent({
|
|
|
2080
2112
|
"class": `${prefix}-icon`,
|
|
2081
2113
|
"aria-hidden": "true"
|
|
2082
2114
|
}, [createVNode("use", {
|
|
2083
|
-
"xlink:href": "#icon-revoke"
|
|
2115
|
+
"xlink:href": "#md-editor-icon-revoke"
|
|
2084
2116
|
}, null)])]);
|
|
2085
2117
|
}
|
|
2086
2118
|
case "next": {
|
|
2087
2119
|
return createVNode("div", {
|
|
2088
2120
|
"class": `${prefix}-toolbar-item`,
|
|
2089
|
-
"title": (
|
|
2121
|
+
"title": (_y = ult.value.toolbarTips) == null ? void 0 : _y.next,
|
|
2090
2122
|
"onClick": () => {
|
|
2091
2123
|
bus.emit(editorId, "ctrlShiftZ");
|
|
2092
2124
|
}
|
|
@@ -2094,13 +2126,13 @@ var ToolBar = defineComponent({
|
|
|
2094
2126
|
"class": `${prefix}-icon`,
|
|
2095
2127
|
"aria-hidden": "true"
|
|
2096
2128
|
}, [createVNode("use", {
|
|
2097
|
-
"xlink:href": "#icon-next"
|
|
2129
|
+
"xlink:href": "#md-editor-icon-next"
|
|
2098
2130
|
}, null)])]);
|
|
2099
2131
|
}
|
|
2100
2132
|
case "save": {
|
|
2101
2133
|
return createVNode("div", {
|
|
2102
2134
|
"class": `${prefix}-toolbar-item`,
|
|
2103
|
-
"title": (
|
|
2135
|
+
"title": (_z = ult.value.toolbarTips) == null ? void 0 : _z.save,
|
|
2104
2136
|
"onClick": () => {
|
|
2105
2137
|
bus.emit(editorId, "onSave");
|
|
2106
2138
|
}
|
|
@@ -2108,13 +2140,13 @@ var ToolBar = defineComponent({
|
|
|
2108
2140
|
"class": `${prefix}-icon`,
|
|
2109
2141
|
"aria-hidden": "true"
|
|
2110
2142
|
}, [createVNode("use", {
|
|
2111
|
-
"xlink:href": "#icon-baocun"
|
|
2143
|
+
"xlink:href": "#md-editor-icon-baocun"
|
|
2112
2144
|
}, null)])]);
|
|
2113
2145
|
}
|
|
2114
2146
|
case "prettier": {
|
|
2115
2147
|
return !props.noPrettier ? createVNode("div", {
|
|
2116
2148
|
"class": `${prefix}-toolbar-item`,
|
|
2117
|
-
"title": (
|
|
2149
|
+
"title": (_A = ult.value.toolbarTips) == null ? void 0 : _A.prettier,
|
|
2118
2150
|
"onClick": () => {
|
|
2119
2151
|
emitHandler("prettier");
|
|
2120
2152
|
}
|
|
@@ -2122,13 +2154,13 @@ var ToolBar = defineComponent({
|
|
|
2122
2154
|
"class": `${prefix}-icon`,
|
|
2123
2155
|
"aria-hidden": "true"
|
|
2124
2156
|
}, [createVNode("use", {
|
|
2125
|
-
"xlink:href": "#icon-prettier"
|
|
2157
|
+
"xlink:href": "#md-editor-icon-prettier"
|
|
2126
2158
|
}, null)])]) : "";
|
|
2127
2159
|
}
|
|
2128
2160
|
case "pageFullscreen": {
|
|
2129
2161
|
return !props.setting.fullscreen && createVNode("div", {
|
|
2130
2162
|
"class": `${prefix}-toolbar-item`,
|
|
2131
|
-
"title": (
|
|
2163
|
+
"title": (_B = ult.value.toolbarTips) == null ? void 0 : _B.pageFullscreen,
|
|
2132
2164
|
"onClick": () => {
|
|
2133
2165
|
props.updateSetting(!props.setting.pageFullScreen, "pageFullScreen");
|
|
2134
2166
|
}
|
|
@@ -2136,25 +2168,25 @@ var ToolBar = defineComponent({
|
|
|
2136
2168
|
"class": `${prefix}-icon`,
|
|
2137
2169
|
"aria-hidden": "true"
|
|
2138
2170
|
}, [createVNode("use", {
|
|
2139
|
-
"xlink:href": `#icon-${props.setting.pageFullScreen ? "suoxiao" : "fangda"}`
|
|
2171
|
+
"xlink:href": `#md-editor-icon-${props.setting.pageFullScreen ? "suoxiao" : "fangda"}`
|
|
2140
2172
|
}, null)])]);
|
|
2141
2173
|
}
|
|
2142
2174
|
case "fullscreen": {
|
|
2143
2175
|
return createVNode("div", {
|
|
2144
2176
|
"class": `${prefix}-toolbar-item`,
|
|
2145
|
-
"title": (
|
|
2177
|
+
"title": (_C = ult.value.toolbarTips) == null ? void 0 : _C.fullscreen,
|
|
2146
2178
|
"onClick": fullScreenHandler
|
|
2147
2179
|
}, [createVNode("svg", {
|
|
2148
2180
|
"class": `${prefix}-icon`,
|
|
2149
2181
|
"aria-hidden": "true"
|
|
2150
2182
|
}, [createVNode("use", {
|
|
2151
|
-
"xlink:href": `#icon-${props.setting.fullscreen ? "fullScreen-exit" : "fullScreen"}`
|
|
2183
|
+
"xlink:href": `#md-editor-icon-${props.setting.fullscreen ? "fullScreen-exit" : "fullScreen"}`
|
|
2152
2184
|
}, null)])]);
|
|
2153
2185
|
}
|
|
2154
2186
|
case "preview": {
|
|
2155
2187
|
return createVNode("div", {
|
|
2156
2188
|
"class": `${prefix}-toolbar-item`,
|
|
2157
|
-
"title": (
|
|
2189
|
+
"title": (_D = ult.value.toolbarTips) == null ? void 0 : _D.preview,
|
|
2158
2190
|
"onClick": () => {
|
|
2159
2191
|
props.updateSetting(!props.setting.preview, "preview");
|
|
2160
2192
|
}
|
|
@@ -2162,13 +2194,13 @@ var ToolBar = defineComponent({
|
|
|
2162
2194
|
"class": `${prefix}-icon`,
|
|
2163
2195
|
"aria-hidden": "true"
|
|
2164
2196
|
}, [createVNode("use", {
|
|
2165
|
-
"xlink:href": "#icon-preview"
|
|
2197
|
+
"xlink:href": "#md-editor-icon-preview"
|
|
2166
2198
|
}, null)])]);
|
|
2167
2199
|
}
|
|
2168
2200
|
case "htmlPreview": {
|
|
2169
2201
|
return createVNode("div", {
|
|
2170
2202
|
"class": `${prefix}-toolbar-item`,
|
|
2171
|
-
"title": (
|
|
2203
|
+
"title": (_E = ult.value.toolbarTips) == null ? void 0 : _E.htmlPreview,
|
|
2172
2204
|
"onClick": () => {
|
|
2173
2205
|
props.updateSetting(!props.setting.htmlPreview, "htmlPreview");
|
|
2174
2206
|
}
|
|
@@ -2176,13 +2208,13 @@ var ToolBar = defineComponent({
|
|
|
2176
2208
|
"class": `${prefix}-icon`,
|
|
2177
2209
|
"aria-hidden": "true"
|
|
2178
2210
|
}, [createVNode("use", {
|
|
2179
|
-
"xlink:href": "#icon-coding"
|
|
2211
|
+
"xlink:href": "#md-editor-icon-coding"
|
|
2180
2212
|
}, null)])]);
|
|
2181
2213
|
}
|
|
2182
2214
|
case "catalog": {
|
|
2183
2215
|
return createVNode("div", {
|
|
2184
2216
|
"class": `${prefix}-toolbar-item`,
|
|
2185
|
-
"title": (
|
|
2217
|
+
"title": (_F = ult.value.toolbarTips) == null ? void 0 : _F.catalog,
|
|
2186
2218
|
"onClick": () => {
|
|
2187
2219
|
bus.emit(editorId, "catalogShow");
|
|
2188
2220
|
},
|
|
@@ -2191,19 +2223,19 @@ var ToolBar = defineComponent({
|
|
|
2191
2223
|
"class": `${prefix}-icon`,
|
|
2192
2224
|
"aria-hidden": "true"
|
|
2193
2225
|
}, [createVNode("use", {
|
|
2194
|
-
"xlink:href": "#icon-catalog"
|
|
2226
|
+
"xlink:href": "#md-editor-icon-catalog"
|
|
2195
2227
|
}, null)])]);
|
|
2196
2228
|
}
|
|
2197
2229
|
case "github": {
|
|
2198
2230
|
return createVNode("div", {
|
|
2199
2231
|
"class": `${prefix}-toolbar-item`,
|
|
2200
|
-
"title": (
|
|
2232
|
+
"title": (_G = ult.value.toolbarTips) == null ? void 0 : _G.github,
|
|
2201
2233
|
"onClick": () => goto("https://github.com/imzbf/md-editor-v3")
|
|
2202
2234
|
}, [createVNode("svg", {
|
|
2203
2235
|
"class": `${prefix}-icon`,
|
|
2204
2236
|
"aria-hidden": "true"
|
|
2205
2237
|
}, [createVNode("use", {
|
|
2206
|
-
"xlink:href": "#icon-github"
|
|
2238
|
+
"xlink:href": "#md-editor-icon-github"
|
|
2207
2239
|
}, null)])]);
|
|
2208
2240
|
}
|
|
2209
2241
|
case "mermaid": {
|
|
@@ -2223,42 +2255,42 @@ var ToolBar = defineComponent({
|
|
|
2223
2255
|
"onClick": () => {
|
|
2224
2256
|
emitHandler("flow");
|
|
2225
2257
|
}
|
|
2226
|
-
}, [(
|
|
2258
|
+
}, [(_H = ult.value.mermaid) == null ? void 0 : _H.flow]), createVNode("li", {
|
|
2227
2259
|
"class": `${prefix}-menu-item`,
|
|
2228
2260
|
"onClick": () => {
|
|
2229
2261
|
emitHandler("sequence");
|
|
2230
2262
|
}
|
|
2231
|
-
}, [(
|
|
2263
|
+
}, [(_I = ult.value.mermaid) == null ? void 0 : _I.sequence]), createVNode("li", {
|
|
2232
2264
|
"class": `${prefix}-menu-item`,
|
|
2233
2265
|
"onClick": () => {
|
|
2234
2266
|
emitHandler("gantt");
|
|
2235
2267
|
}
|
|
2236
|
-
}, [(
|
|
2268
|
+
}, [(_J = ult.value.mermaid) == null ? void 0 : _J.gantt]), createVNode("li", {
|
|
2237
2269
|
"class": `${prefix}-menu-item`,
|
|
2238
2270
|
"onClick": () => {
|
|
2239
2271
|
emitHandler("class");
|
|
2240
2272
|
}
|
|
2241
|
-
}, [(
|
|
2273
|
+
}, [(_K = ult.value.mermaid) == null ? void 0 : _K.class]), createVNode("li", {
|
|
2242
2274
|
"class": `${prefix}-menu-item`,
|
|
2243
2275
|
"onClick": () => {
|
|
2244
2276
|
emitHandler("state");
|
|
2245
2277
|
}
|
|
2246
|
-
}, [(
|
|
2278
|
+
}, [(_L = ult.value.mermaid) == null ? void 0 : _L.state]), createVNode("li", {
|
|
2247
2279
|
"class": `${prefix}-menu-item`,
|
|
2248
2280
|
"onClick": () => {
|
|
2249
2281
|
emitHandler("pie");
|
|
2250
2282
|
}
|
|
2251
|
-
}, [(
|
|
2283
|
+
}, [(_M = ult.value.mermaid) == null ? void 0 : _M.pie]), createVNode("li", {
|
|
2252
2284
|
"class": `${prefix}-menu-item`,
|
|
2253
2285
|
"onClick": () => {
|
|
2254
2286
|
emitHandler("relationship");
|
|
2255
2287
|
}
|
|
2256
|
-
}, [(
|
|
2288
|
+
}, [(_N = ult.value.mermaid) == null ? void 0 : _N.relationship]), createVNode("li", {
|
|
2257
2289
|
"class": `${prefix}-menu-item`,
|
|
2258
2290
|
"onClick": () => {
|
|
2259
2291
|
emitHandler("journey");
|
|
2260
2292
|
}
|
|
2261
|
-
}, [(
|
|
2293
|
+
}, [(_O = ult.value.mermaid) == null ? void 0 : _O.journey])]),
|
|
2262
2294
|
"key": "bar-mermaid"
|
|
2263
2295
|
}, {
|
|
2264
2296
|
default: () => {
|
|
@@ -2270,7 +2302,7 @@ var ToolBar = defineComponent({
|
|
|
2270
2302
|
"class": `${prefix}-icon`,
|
|
2271
2303
|
"aria-hidden": "true"
|
|
2272
2304
|
}, [createVNode("use", {
|
|
2273
|
-
"xlink:href": "#icon-mermaid"
|
|
2305
|
+
"xlink:href": "#md-editor-icon-mermaid"
|
|
2274
2306
|
}, null)])])];
|
|
2275
2307
|
}
|
|
2276
2308
|
});
|
|
@@ -2292,12 +2324,12 @@ var ToolBar = defineComponent({
|
|
|
2292
2324
|
"onClick": () => {
|
|
2293
2325
|
emitHandler("katexInline");
|
|
2294
2326
|
}
|
|
2295
|
-
}, [(
|
|
2327
|
+
}, [(_P = ult.value.katex) == null ? void 0 : _P.inline]), createVNode("li", {
|
|
2296
2328
|
"class": `${prefix}-menu-item`,
|
|
2297
2329
|
"onClick": () => {
|
|
2298
2330
|
emitHandler("katexBlock");
|
|
2299
2331
|
}
|
|
2300
|
-
}, [(
|
|
2332
|
+
}, [(_Q = ult.value.katex) == null ? void 0 : _Q.block])]),
|
|
2301
2333
|
"key": "bar-katex"
|
|
2302
2334
|
}, {
|
|
2303
2335
|
default: () => {
|
|
@@ -2309,7 +2341,7 @@ var ToolBar = defineComponent({
|
|
|
2309
2341
|
"class": `${prefix}-icon`,
|
|
2310
2342
|
"aria-hidden": "true"
|
|
2311
2343
|
}, [createVNode("use", {
|
|
2312
|
-
"xlink:href": "#icon-formula"
|
|
2344
|
+
"xlink:href": "#md-editor-icon-formula"
|
|
2313
2345
|
}, null)])])];
|
|
2314
2346
|
}
|
|
2315
2347
|
});
|
|
@@ -5025,6 +5057,12 @@ const directive2flag = (direct, selectedText = "", inputArea, params) => {
|
|
|
5025
5057
|
deviationStart = 2;
|
|
5026
5058
|
break;
|
|
5027
5059
|
}
|
|
5060
|
+
case "task": {
|
|
5061
|
+
targetValue = `- [ ] ${selectedText}`;
|
|
5062
|
+
deviationStart = 6;
|
|
5063
|
+
select = true;
|
|
5064
|
+
break;
|
|
5065
|
+
}
|
|
5028
5066
|
case "code": {
|
|
5029
5067
|
targetValue = "```language\n" + selectedText + "\n```\n";
|
|
5030
5068
|
deviationStart = 3;
|
|
@@ -5730,17 +5768,20 @@ const useAutoGenrator = (props, textAreaRef) => {
|
|
|
5730
5768
|
event.cancelBubble = true;
|
|
5731
5769
|
event.preventDefault();
|
|
5732
5770
|
event.stopPropagation();
|
|
5733
|
-
if (
|
|
5734
|
-
const resetPrefixStr = prefixStr == null ? void 0 : prefixStr.replace(
|
|
5771
|
+
if (/^(\d+\.|-)\s+(\[[x\s]\]\s+)?$/.test(enterPressRow)) {
|
|
5772
|
+
const resetPrefixStr = prefixStr == null ? void 0 : prefixStr.replace(/(\d+\.|-)\s+(\[[x\s]\]\s+)?$/, "");
|
|
5735
5773
|
props.onChange(resetPrefixStr + subStr);
|
|
5736
5774
|
setPosition(textAreaRef.value, resetPrefixStr == null ? void 0 : resetPrefixStr.length);
|
|
5737
5775
|
} else if (/^-\s+.+/.test(enterPressRow)) {
|
|
5738
|
-
|
|
5776
|
+
const newLine = /^-\s+\[[x\s]\]/.test(enterPressRow) ? "\n- [ ] " : "\n- ";
|
|
5777
|
+
props.onChange(insert(textAreaRef.value, newLine, {}));
|
|
5739
5778
|
} else {
|
|
5740
5779
|
const lastOrderMatch = enterPressRow == null ? void 0 : enterPressRow.match(/\d+(?=\.)/);
|
|
5741
5780
|
const nextOrder = lastOrderMatch && Number(lastOrderMatch[0]) + 1 || 1;
|
|
5742
|
-
|
|
5743
|
-
${nextOrder}.
|
|
5781
|
+
const newLine = /^\d\.\s+\[[x\s]\]/.test(enterPressRow) ? `
|
|
5782
|
+
${nextOrder}. [ ] ` : `
|
|
5783
|
+
${nextOrder}. `;
|
|
5784
|
+
props.onChange(insert(textAreaRef.value, newLine, {}));
|
|
5744
5785
|
}
|
|
5745
5786
|
}
|
|
5746
5787
|
}
|
|
@@ -6449,6 +6490,9 @@ const editorProps = () => ({
|
|
|
6449
6490
|
formatCopiedText: {
|
|
6450
6491
|
type: Function,
|
|
6451
6492
|
default: (text) => text
|
|
6493
|
+
},
|
|
6494
|
+
noUploadImg: {
|
|
6495
|
+
type: Boolean
|
|
6452
6496
|
}
|
|
6453
6497
|
});
|
|
6454
6498
|
const markedHeadingId = (text) => text;
|
|
@@ -6492,7 +6536,8 @@ const Editor = defineComponent({
|
|
|
6492
6536
|
"setting": setting,
|
|
6493
6537
|
"updateSetting": updateSetting,
|
|
6494
6538
|
"tableShape": props.tableShape,
|
|
6495
|
-
"defToolbars": defToolbars
|
|
6539
|
+
"defToolbars": defToolbars,
|
|
6540
|
+
"noUploadImg": props.noUploadImg
|
|
6496
6541
|
}, null), createVNode(Content, {
|
|
6497
6542
|
"value": props.modelValue,
|
|
6498
6543
|
"onChange": (value) => {
|