md-editor-v3 4.19.2-0 → 4.20.0
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 +18 -46
- package/lib/cjs/MdEditor.cjs +36 -22
- package/lib/cjs/chunks/dom.cjs +12 -18
- package/lib/cjs/chunks/event-name.cjs +1 -4
- package/lib/cjs/chunks/index.cjs +103 -128
- package/lib/cjs/chunks/index3.cjs +1 -2
- package/lib/es/MdEditor.mjs +37 -23
- package/lib/es/chunks/dom.mjs +12 -18
- package/lib/es/chunks/event-name.mjs +1 -4
- package/lib/es/chunks/index.mjs +103 -128
- package/lib/es/chunks/index3.mjs +1 -2
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/layouts/Content/composition/useResize.d.ts +1 -0
- package/lib/types/MdEditor/layouts/Content/type.d.ts +2 -0
- package/lib/types/MdEditor/type.d.ts +7 -1
- package/lib/umd/index.js +54 -53
- package/package.json +4 -2
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -8,6 +8,8 @@ const mediumZoom = require("medium-zoom");
|
|
|
8
8
|
const copy = require("copy-to-clipboard");
|
|
9
9
|
const mdit = require("markdown-it");
|
|
10
10
|
const ImageFiguresPlugin = require("markdown-it-image-figures");
|
|
11
|
+
const SubPlugin = require("markdown-it-sub");
|
|
12
|
+
const SupPlugin = require("markdown-it-sup");
|
|
11
13
|
const index$1 = require("./index5.cjs");
|
|
12
14
|
const lruCache = require("lru-cache");
|
|
13
15
|
function _mergeNamespaces(n, m) {
|
|
@@ -214,8 +216,10 @@ const useMermaid = (props) => {
|
|
|
214
216
|
`div.${config.prefix}-mermaid`
|
|
215
217
|
);
|
|
216
218
|
const svgContainingElement = document.createElement("div");
|
|
217
|
-
|
|
218
|
-
|
|
219
|
+
const sceWidth = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366;
|
|
220
|
+
const sceHeight = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
|
|
221
|
+
svgContainingElement.style.width = sceWidth + "px";
|
|
222
|
+
svgContainingElement.style.height = sceHeight + "px";
|
|
219
223
|
svgContainingElement.style.position = "fixed";
|
|
220
224
|
svgContainingElement.style.zIndex = "-10000";
|
|
221
225
|
svgContainingElement.style.top = "-10000";
|
|
@@ -306,7 +310,6 @@ const MermaidPlugin = (md, options) => {
|
|
|
306
310
|
return temp(tokens, idx, ops, env, slf);
|
|
307
311
|
};
|
|
308
312
|
};
|
|
309
|
-
const MermaidPlugin$1 = MermaidPlugin;
|
|
310
313
|
const mergeAttrs = (token, addAttrs) => {
|
|
311
314
|
const tmpAttrs = token.attrs ? token.attrs.slice() : [];
|
|
312
315
|
addAttrs.forEach((addAttr) => {
|
|
@@ -458,7 +461,6 @@ const KatexPlugin = (md, { katexRef }) => {
|
|
|
458
461
|
md.renderer.rules.math_inline = katexInline;
|
|
459
462
|
md.renderer.rules.math_block = katexBlock;
|
|
460
463
|
};
|
|
461
|
-
const KatexPlugin$1 = KatexPlugin;
|
|
462
464
|
const AdmonitionPlugin = (md, options) => {
|
|
463
465
|
options = options || {};
|
|
464
466
|
const markers = 3, markerStr = options.marker || "!", markerChar = markerStr.charCodeAt(0), markerLen = markerStr.length;
|
|
@@ -578,13 +580,12 @@ const AdmonitionPlugin = (md, options) => {
|
|
|
578
580
|
md.renderer.rules["admonition_title_close"] = render;
|
|
579
581
|
md.renderer.rules["admonition_close"] = render;
|
|
580
582
|
};
|
|
581
|
-
const AdmonitionPlugin$1 = AdmonitionPlugin;
|
|
582
583
|
const HeadingPlugin = (md, options) => {
|
|
583
584
|
md.renderer.rules.heading_open = (tokens, idx) => {
|
|
584
585
|
var _a;
|
|
585
586
|
const token = tokens[idx];
|
|
586
587
|
const text = ((_a = tokens[idx + 1].children) == null ? void 0 : _a.reduce((p, c) => {
|
|
587
|
-
return p + (["text", "code_inline"].includes(c.type) ? c.content || "" : "");
|
|
588
|
+
return p + (["text", "code_inline", "math_inline"].includes(c.type) ? c.content || "" : "");
|
|
588
589
|
}, "")) || "";
|
|
589
590
|
const level = token.markup.length;
|
|
590
591
|
options.headsRef.value.push({
|
|
@@ -603,7 +604,6 @@ const HeadingPlugin = (md, options) => {
|
|
|
603
604
|
return self2.renderToken(tokens, idx, opts);
|
|
604
605
|
};
|
|
605
606
|
};
|
|
606
|
-
const HeadingPlugin$1 = HeadingPlugin;
|
|
607
607
|
const StrIcon = (name, customIcon) => {
|
|
608
608
|
if (typeof customIcon[name] === "string") {
|
|
609
609
|
return customIcon[name];
|
|
@@ -708,7 +708,6 @@ const codetabs = (md, _opts) => {
|
|
|
708
708
|
md.renderer.rules.fence = fenceGroup;
|
|
709
709
|
md.renderer.rules.code_block = fenceGroup;
|
|
710
710
|
};
|
|
711
|
-
const CodePlugin = codetabs;
|
|
712
711
|
function getDefaultExportFromCjs(x) {
|
|
713
712
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
714
713
|
}
|
|
@@ -1061,8 +1060,7 @@ function onIgnoreAttr(name, value, options) {
|
|
|
1061
1060
|
}
|
|
1062
1061
|
var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img;
|
|
1063
1062
|
function safeAttrValue$1(name, value) {
|
|
1064
|
-
if (REGEXP_URL_JAVASCRIPT.test(value))
|
|
1065
|
-
return "";
|
|
1063
|
+
if (REGEXP_URL_JAVASCRIPT.test(value)) return "";
|
|
1066
1064
|
return value;
|
|
1067
1065
|
}
|
|
1068
1066
|
_default.whiteList = getDefaultWhiteList$1();
|
|
@@ -1108,8 +1106,7 @@ var util$1 = {
|
|
|
1108
1106
|
var _$3 = util$1;
|
|
1109
1107
|
function parseStyle$1(css2, onAttr2) {
|
|
1110
1108
|
css2 = _$3.trimRight(css2);
|
|
1111
|
-
if (css2[css2.length - 1] !== ";")
|
|
1112
|
-
css2 += ";";
|
|
1109
|
+
if (css2[css2.length - 1] !== ";") css2 += ";";
|
|
1113
1110
|
var cssLength = css2.length;
|
|
1114
1111
|
var isParenthesisOpen = false;
|
|
1115
1112
|
var lastPos = 0;
|
|
@@ -1124,8 +1121,7 @@ function parseStyle$1(css2, onAttr2) {
|
|
|
1124
1121
|
var value = _$3.trim(source.slice(j2 + 1));
|
|
1125
1122
|
if (name) {
|
|
1126
1123
|
var ret = onAttr2(lastPos, retCSS.length, name, value, source);
|
|
1127
|
-
if (ret)
|
|
1128
|
-
retCSS += ret + "; ";
|
|
1124
|
+
if (ret) retCSS += ret + "; ";
|
|
1129
1125
|
}
|
|
1130
1126
|
}
|
|
1131
1127
|
}
|
|
@@ -1135,8 +1131,7 @@ function parseStyle$1(css2, onAttr2) {
|
|
|
1135
1131
|
var c = css2[i];
|
|
1136
1132
|
if (c === "/" && css2[i + 1] === "*") {
|
|
1137
1133
|
var j = css2.indexOf("*/", i + 2);
|
|
1138
|
-
if (j === -1)
|
|
1139
|
-
break;
|
|
1134
|
+
if (j === -1) break;
|
|
1140
1135
|
i = j + 1;
|
|
1141
1136
|
lastPos = i + 1;
|
|
1142
1137
|
isParenthesisOpen = false;
|
|
@@ -1145,8 +1140,7 @@ function parseStyle$1(css2, onAttr2) {
|
|
|
1145
1140
|
} else if (c === ")") {
|
|
1146
1141
|
isParenthesisOpen = false;
|
|
1147
1142
|
} else if (c === ";") {
|
|
1148
|
-
if (isParenthesisOpen)
|
|
1149
|
-
;
|
|
1143
|
+
if (isParenthesisOpen) ;
|
|
1150
1144
|
else {
|
|
1151
1145
|
addNewAttr();
|
|
1152
1146
|
}
|
|
@@ -1180,8 +1174,7 @@ function FilterCSS$2(options) {
|
|
|
1180
1174
|
FilterCSS$2.prototype.process = function(css2) {
|
|
1181
1175
|
css2 = css2 || "";
|
|
1182
1176
|
css2 = css2.toString();
|
|
1183
|
-
if (!css2)
|
|
1184
|
-
return "";
|
|
1177
|
+
if (!css2) return "";
|
|
1185
1178
|
var me = this;
|
|
1186
1179
|
var options = me.options;
|
|
1187
1180
|
var whiteList = options.whiteList;
|
|
@@ -1191,17 +1184,12 @@ FilterCSS$2.prototype.process = function(css2) {
|
|
|
1191
1184
|
var retCSS = parseStyle(css2, function(sourcePosition, position, name, value, source) {
|
|
1192
1185
|
var check = whiteList[name];
|
|
1193
1186
|
var isWhite = false;
|
|
1194
|
-
if (check === true)
|
|
1195
|
-
|
|
1196
|
-
else if (
|
|
1197
|
-
|
|
1198
|
-
else if (check instanceof RegExp)
|
|
1199
|
-
isWhite = check.test(value);
|
|
1200
|
-
if (isWhite !== true)
|
|
1201
|
-
isWhite = false;
|
|
1187
|
+
if (check === true) isWhite = check;
|
|
1188
|
+
else if (typeof check === "function") isWhite = check(value);
|
|
1189
|
+
else if (check instanceof RegExp) isWhite = check.test(value);
|
|
1190
|
+
if (isWhite !== true) isWhite = false;
|
|
1202
1191
|
value = safeAttrValue2(name, value);
|
|
1203
|
-
if (!value)
|
|
1204
|
-
return;
|
|
1192
|
+
if (!value) return;
|
|
1205
1193
|
var opts = {
|
|
1206
1194
|
position,
|
|
1207
1195
|
sourcePosition,
|
|
@@ -1234,8 +1222,7 @@ var css = FilterCSS$2;
|
|
|
1234
1222
|
}
|
|
1235
1223
|
exports2 = module2.exports = filterCSS;
|
|
1236
1224
|
exports2.FilterCSS = FilterCSS2;
|
|
1237
|
-
for (var i in DEFAULT2)
|
|
1238
|
-
exports2[i] = DEFAULT2[i];
|
|
1225
|
+
for (var i in DEFAULT2) exports2[i] = DEFAULT2[i];
|
|
1239
1226
|
if (typeof window !== "undefined") {
|
|
1240
1227
|
window.filterCSS = module2.exports;
|
|
1241
1228
|
}
|
|
@@ -1386,8 +1373,7 @@ function safeAttrValue(tag, name, value, cssFilter) {
|
|
|
1386
1373
|
value = friendlyAttrValue(value);
|
|
1387
1374
|
if (name === "href" || name === "src") {
|
|
1388
1375
|
value = _$2.trim(value);
|
|
1389
|
-
if (value === "#")
|
|
1390
|
-
return "#";
|
|
1376
|
+
if (value === "#") return "#";
|
|
1391
1377
|
if (!(value.substr(0, 7) === "http://" || value.substr(0, 8) === "https://" || value.substr(0, 7) === "mailto:" || value.substr(0, 4) === "tel:" || value.substr(0, 11) === "data:image/" || value.substr(0, 6) === "ftp://" || value.substr(0, 2) === "./" || value.substr(0, 3) === "../" || value[0] === "#" || value[0] === "/")) {
|
|
1392
1378
|
return "";
|
|
1393
1379
|
}
|
|
@@ -1469,8 +1455,7 @@ function StripTagBody(tags, next) {
|
|
|
1469
1455
|
}
|
|
1470
1456
|
var isRemoveAllTag = !Array.isArray(tags);
|
|
1471
1457
|
function isRemoveTag(tag) {
|
|
1472
|
-
if (isRemoveAllTag)
|
|
1473
|
-
return true;
|
|
1458
|
+
if (isRemoveAllTag) return true;
|
|
1474
1459
|
return _$2.indexOf(tags, tag) !== -1;
|
|
1475
1460
|
}
|
|
1476
1461
|
var removeList = [];
|
|
@@ -1531,11 +1516,9 @@ function stripBlankChar(html) {
|
|
|
1531
1516
|
var chars = html.split("");
|
|
1532
1517
|
chars = chars.filter(function(char) {
|
|
1533
1518
|
var c = char.charCodeAt(0);
|
|
1534
|
-
if (c === 127)
|
|
1535
|
-
return false;
|
|
1519
|
+
if (c === 127) return false;
|
|
1536
1520
|
if (c <= 31) {
|
|
1537
|
-
if (c === 10 || c === 13)
|
|
1538
|
-
return true;
|
|
1521
|
+
if (c === 10 || c === 13) return true;
|
|
1539
1522
|
return false;
|
|
1540
1523
|
}
|
|
1541
1524
|
return true;
|
|
@@ -1575,10 +1558,8 @@ function getTagName(html) {
|
|
|
1575
1558
|
tagName = html.slice(1, i + 1);
|
|
1576
1559
|
}
|
|
1577
1560
|
tagName = _$1.trim(tagName).toLowerCase();
|
|
1578
|
-
if (tagName.slice(0, 1) === "/")
|
|
1579
|
-
|
|
1580
|
-
if (tagName.slice(-1) === "/")
|
|
1581
|
-
tagName = tagName.slice(0, -1);
|
|
1561
|
+
if (tagName.slice(0, 1) === "/") tagName = tagName.slice(1);
|
|
1562
|
+
if (tagName.slice(-1) === "/") tagName = tagName.slice(0, -1);
|
|
1582
1563
|
return tagName;
|
|
1583
1564
|
}
|
|
1584
1565
|
function isClosing(html) {
|
|
@@ -1593,56 +1574,55 @@ function parseTag$1(html, onTag2, escapeHtml2) {
|
|
|
1593
1574
|
var len = html.length;
|
|
1594
1575
|
var currentTagName = "";
|
|
1595
1576
|
var currentHtml = "";
|
|
1596
|
-
chariterator:
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
if (
|
|
1577
|
+
chariterator: for (currentPos = 0; currentPos < len; currentPos++) {
|
|
1578
|
+
var c = html.charAt(currentPos);
|
|
1579
|
+
if (tagStart === false) {
|
|
1580
|
+
if (c === "<") {
|
|
1581
|
+
tagStart = currentPos;
|
|
1582
|
+
continue;
|
|
1583
|
+
}
|
|
1584
|
+
} else {
|
|
1585
|
+
if (quoteStart === false) {
|
|
1600
1586
|
if (c === "<") {
|
|
1587
|
+
rethtml += escapeHtml2(html.slice(lastPos, currentPos));
|
|
1601
1588
|
tagStart = currentPos;
|
|
1589
|
+
lastPos = currentPos;
|
|
1602
1590
|
continue;
|
|
1603
1591
|
}
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
}
|
|
1627
|
-
if (c === '"' || c === "'") {
|
|
1628
|
-
var i = 1;
|
|
1629
|
-
var ic = html.charAt(currentPos - i);
|
|
1630
|
-
while (ic.trim() === "" || ic === "=") {
|
|
1631
|
-
if (ic === "=") {
|
|
1632
|
-
quoteStart = c;
|
|
1633
|
-
continue chariterator;
|
|
1634
|
-
}
|
|
1635
|
-
ic = html.charAt(currentPos - ++i);
|
|
1592
|
+
if (c === ">" || currentPos === len - 1) {
|
|
1593
|
+
rethtml += escapeHtml2(html.slice(lastPos, tagStart));
|
|
1594
|
+
currentHtml = html.slice(tagStart, currentPos + 1);
|
|
1595
|
+
currentTagName = getTagName(currentHtml);
|
|
1596
|
+
rethtml += onTag2(
|
|
1597
|
+
tagStart,
|
|
1598
|
+
rethtml.length,
|
|
1599
|
+
currentTagName,
|
|
1600
|
+
currentHtml,
|
|
1601
|
+
isClosing(currentHtml)
|
|
1602
|
+
);
|
|
1603
|
+
lastPos = currentPos + 1;
|
|
1604
|
+
tagStart = false;
|
|
1605
|
+
continue;
|
|
1606
|
+
}
|
|
1607
|
+
if (c === '"' || c === "'") {
|
|
1608
|
+
var i = 1;
|
|
1609
|
+
var ic = html.charAt(currentPos - i);
|
|
1610
|
+
while (ic.trim() === "" || ic === "=") {
|
|
1611
|
+
if (ic === "=") {
|
|
1612
|
+
quoteStart = c;
|
|
1613
|
+
continue chariterator;
|
|
1636
1614
|
}
|
|
1615
|
+
ic = html.charAt(currentPos - ++i);
|
|
1637
1616
|
}
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1617
|
+
}
|
|
1618
|
+
} else {
|
|
1619
|
+
if (c === quoteStart) {
|
|
1620
|
+
quoteStart = false;
|
|
1621
|
+
continue;
|
|
1643
1622
|
}
|
|
1644
1623
|
}
|
|
1645
1624
|
}
|
|
1625
|
+
}
|
|
1646
1626
|
if (lastPos < len) {
|
|
1647
1627
|
rethtml += escapeHtml2(html.substr(lastPos));
|
|
1648
1628
|
}
|
|
@@ -1658,11 +1638,9 @@ function parseAttr$1(html, onAttr2) {
|
|
|
1658
1638
|
function addAttr(name, value) {
|
|
1659
1639
|
name = _$1.trim(name);
|
|
1660
1640
|
name = name.replace(REGEXP_ILLEGAL_ATTR_NAME, "").toLowerCase();
|
|
1661
|
-
if (name.length < 1)
|
|
1662
|
-
return;
|
|
1641
|
+
if (name.length < 1) return;
|
|
1663
1642
|
var ret = onAttr2(name, value || "");
|
|
1664
|
-
if (ret)
|
|
1665
|
-
retAttrs.push(ret);
|
|
1643
|
+
if (ret) retAttrs.push(ret);
|
|
1666
1644
|
}
|
|
1667
1645
|
for (var i = 0; i < len; i++) {
|
|
1668
1646
|
var c = html.charAt(i);
|
|
@@ -1729,30 +1707,24 @@ function parseAttr$1(html, onAttr2) {
|
|
|
1729
1707
|
function findNextEqual(str, i) {
|
|
1730
1708
|
for (; i < str.length; i++) {
|
|
1731
1709
|
var c = str[i];
|
|
1732
|
-
if (c === " ")
|
|
1733
|
-
|
|
1734
|
-
if (c === "=")
|
|
1735
|
-
return i;
|
|
1710
|
+
if (c === " ") continue;
|
|
1711
|
+
if (c === "=") return i;
|
|
1736
1712
|
return -1;
|
|
1737
1713
|
}
|
|
1738
1714
|
}
|
|
1739
1715
|
function findNextQuotationMark(str, i) {
|
|
1740
1716
|
for (; i < str.length; i++) {
|
|
1741
1717
|
var c = str[i];
|
|
1742
|
-
if (c === " ")
|
|
1743
|
-
|
|
1744
|
-
if (c === "'" || c === '"')
|
|
1745
|
-
return i;
|
|
1718
|
+
if (c === " ") continue;
|
|
1719
|
+
if (c === "'" || c === '"') return i;
|
|
1746
1720
|
return -1;
|
|
1747
1721
|
}
|
|
1748
1722
|
}
|
|
1749
1723
|
function findBeforeEqual(str, i) {
|
|
1750
1724
|
for (; i > 0; i--) {
|
|
1751
1725
|
var c = str[i];
|
|
1752
|
-
if (c === " ")
|
|
1753
|
-
|
|
1754
|
-
if (c === "=")
|
|
1755
|
-
return i;
|
|
1726
|
+
if (c === " ") continue;
|
|
1727
|
+
if (c === "=") return i;
|
|
1756
1728
|
return -1;
|
|
1757
1729
|
}
|
|
1758
1730
|
}
|
|
@@ -1791,8 +1763,7 @@ function getAttrs(html) {
|
|
|
1791
1763
|
}
|
|
1792
1764
|
html = _.trim(html.slice(i + 1, -1));
|
|
1793
1765
|
var isClosing2 = html[html.length - 1] === "/";
|
|
1794
|
-
if (isClosing2)
|
|
1795
|
-
html = _.trim(html.slice(0, -1));
|
|
1766
|
+
if (isClosing2) html = _.trim(html.slice(0, -1));
|
|
1796
1767
|
return {
|
|
1797
1768
|
html,
|
|
1798
1769
|
closing: isClosing2
|
|
@@ -1851,8 +1822,7 @@ function FilterXSS(options) {
|
|
|
1851
1822
|
FilterXSS.prototype.process = function(html) {
|
|
1852
1823
|
html = html || "";
|
|
1853
1824
|
html = html.toString();
|
|
1854
|
-
if (!html)
|
|
1855
|
-
return "";
|
|
1825
|
+
if (!html) return "";
|
|
1856
1826
|
var me = this;
|
|
1857
1827
|
var options = me.options;
|
|
1858
1828
|
var whiteList = options.whiteList;
|
|
@@ -1888,8 +1858,7 @@ FilterXSS.prototype.process = function(html) {
|
|
|
1888
1858
|
isWhite: Object.prototype.hasOwnProperty.call(whiteList, tag)
|
|
1889
1859
|
};
|
|
1890
1860
|
var ret = onTag2(tag, html2, info);
|
|
1891
|
-
if (!isNull(ret))
|
|
1892
|
-
return ret;
|
|
1861
|
+
if (!isNull(ret)) return ret;
|
|
1893
1862
|
if (info.isWhite) {
|
|
1894
1863
|
if (info.isClosing) {
|
|
1895
1864
|
return "</" + tag + ">";
|
|
@@ -1899,8 +1868,7 @@ FilterXSS.prototype.process = function(html) {
|
|
|
1899
1868
|
var attrsHtml = parseAttr(attrs.html, function(name, value) {
|
|
1900
1869
|
var isWhiteAttr = _.indexOf(whiteAttrList, name) !== -1;
|
|
1901
1870
|
var ret2 = onTagAttr2(tag, name, value, isWhiteAttr);
|
|
1902
|
-
if (!isNull(ret2))
|
|
1903
|
-
return ret2;
|
|
1871
|
+
if (!isNull(ret2)) return ret2;
|
|
1904
1872
|
if (isWhiteAttr) {
|
|
1905
1873
|
value = safeAttrValue2(tag, name, value, cssFilter);
|
|
1906
1874
|
if (value) {
|
|
@@ -1910,22 +1878,18 @@ FilterXSS.prototype.process = function(html) {
|
|
|
1910
1878
|
}
|
|
1911
1879
|
} else {
|
|
1912
1880
|
ret2 = onIgnoreTagAttr2(tag, name, value, isWhiteAttr);
|
|
1913
|
-
if (!isNull(ret2))
|
|
1914
|
-
return ret2;
|
|
1881
|
+
if (!isNull(ret2)) return ret2;
|
|
1915
1882
|
return;
|
|
1916
1883
|
}
|
|
1917
1884
|
});
|
|
1918
1885
|
html2 = "<" + tag;
|
|
1919
|
-
if (attrsHtml)
|
|
1920
|
-
|
|
1921
|
-
if (attrs.closing)
|
|
1922
|
-
html2 += " /";
|
|
1886
|
+
if (attrsHtml) html2 += " " + attrsHtml;
|
|
1887
|
+
if (attrs.closing) html2 += " /";
|
|
1923
1888
|
html2 += ">";
|
|
1924
1889
|
return html2;
|
|
1925
1890
|
} else {
|
|
1926
1891
|
ret = onIgnoreTag2(tag, html2, info);
|
|
1927
|
-
if (!isNull(ret))
|
|
1928
|
-
return ret;
|
|
1892
|
+
if (!isNull(ret)) return ret;
|
|
1929
1893
|
return escapeHtml2(html2);
|
|
1930
1894
|
}
|
|
1931
1895
|
},
|
|
@@ -2033,7 +1997,6 @@ const XSSPlugin = (md, options) => {
|
|
|
2033
1997
|
}
|
|
2034
1998
|
});
|
|
2035
1999
|
};
|
|
2036
|
-
const XSSPlugin$1 = XSSPlugin;
|
|
2037
2000
|
const attrSet = (token, name, value) => {
|
|
2038
2001
|
const index2 = token.attrIndex(name);
|
|
2039
2002
|
const attr = [name, value];
|
|
@@ -2127,7 +2090,6 @@ const githubTaskLists = (md, options = {}) => {
|
|
|
2127
2090
|
}
|
|
2128
2091
|
});
|
|
2129
2092
|
};
|
|
2130
|
-
const TaskListPlugin = githubTaskLists;
|
|
2131
2093
|
const initLineNumber = (md) => {
|
|
2132
2094
|
md.core.ruler.push("init-line-number", (state) => {
|
|
2133
2095
|
state.tokens.forEach((token) => {
|
|
@@ -2172,22 +2134,22 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2172
2134
|
},
|
|
2173
2135
|
{
|
|
2174
2136
|
type: "admonition",
|
|
2175
|
-
plugin: AdmonitionPlugin
|
|
2137
|
+
plugin: AdmonitionPlugin,
|
|
2176
2138
|
options: {}
|
|
2177
2139
|
},
|
|
2178
2140
|
{
|
|
2179
2141
|
type: "taskList",
|
|
2180
|
-
plugin:
|
|
2142
|
+
plugin: githubTaskLists,
|
|
2181
2143
|
options: {}
|
|
2182
2144
|
},
|
|
2183
2145
|
{
|
|
2184
2146
|
type: "heading",
|
|
2185
|
-
plugin: HeadingPlugin
|
|
2147
|
+
plugin: HeadingPlugin,
|
|
2186
2148
|
options: { mdHeadingId: props.mdHeadingId, headsRef }
|
|
2187
2149
|
},
|
|
2188
2150
|
{
|
|
2189
2151
|
type: "code",
|
|
2190
|
-
plugin:
|
|
2152
|
+
plugin: codetabs,
|
|
2191
2153
|
options: {
|
|
2192
2154
|
editorId,
|
|
2193
2155
|
usedLanguageTextRef,
|
|
@@ -2199,21 +2161,31 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2199
2161
|
},
|
|
2200
2162
|
{
|
|
2201
2163
|
type: "xss",
|
|
2202
|
-
plugin: XSSPlugin
|
|
2164
|
+
plugin: XSSPlugin,
|
|
2165
|
+
options: {}
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
type: "sub",
|
|
2169
|
+
plugin: SubPlugin,
|
|
2170
|
+
options: {}
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
type: "sup",
|
|
2174
|
+
plugin: SupPlugin,
|
|
2203
2175
|
options: {}
|
|
2204
2176
|
}
|
|
2205
2177
|
];
|
|
2206
2178
|
if (!props.noKatex) {
|
|
2207
2179
|
plugins.push({
|
|
2208
2180
|
type: "katex",
|
|
2209
|
-
plugin: KatexPlugin
|
|
2181
|
+
plugin: KatexPlugin,
|
|
2210
2182
|
options: { katexRef }
|
|
2211
2183
|
});
|
|
2212
2184
|
}
|
|
2213
2185
|
if (!props.noMermaid) {
|
|
2214
2186
|
plugins.push({
|
|
2215
2187
|
type: "mermaid",
|
|
2216
|
-
plugin: MermaidPlugin
|
|
2188
|
+
plugin: MermaidPlugin,
|
|
2217
2189
|
options: { themeRef }
|
|
2218
2190
|
});
|
|
2219
2191
|
}
|
|
@@ -2311,7 +2283,6 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2311
2283
|
});
|
|
2312
2284
|
return { html, key };
|
|
2313
2285
|
};
|
|
2314
|
-
const useMarkdownIt$1 = useMarkdownIt;
|
|
2315
2286
|
const template = {
|
|
2316
2287
|
checked: {
|
|
2317
2288
|
regexp: /- \[x\]/,
|
|
@@ -2529,7 +2500,7 @@ const ContentPreview = /* @__PURE__ */ vue.defineComponent({
|
|
|
2529
2500
|
const {
|
|
2530
2501
|
html,
|
|
2531
2502
|
key
|
|
2532
|
-
} = useMarkdownIt
|
|
2503
|
+
} = useMarkdownIt(props, props.previewOnly);
|
|
2533
2504
|
useCopyCode(props, html, key);
|
|
2534
2505
|
userZoom(props, html);
|
|
2535
2506
|
useTaskState(props, html);
|
|
@@ -2973,6 +2944,10 @@ const useExpose$1 = (props, ctx, catalogVisible, setting, updateSetting, codeRef
|
|
|
2973
2944
|
},
|
|
2974
2945
|
execCommand(direct) {
|
|
2975
2946
|
eventName.bus.emit(editorId, eventName.REPLACE, direct);
|
|
2947
|
+
},
|
|
2948
|
+
getEditorView() {
|
|
2949
|
+
var _a;
|
|
2950
|
+
return (_a = codeRef.value) == null ? void 0 : _a.getEditorView();
|
|
2976
2951
|
}
|
|
2977
2952
|
};
|
|
2978
2953
|
ctx.expose(exposeParam);
|
|
@@ -349,7 +349,6 @@ const CatalogLink = /* @__PURE__ */ vue.defineComponent({
|
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
351
|
});
|
|
352
|
-
const CatalogLink$1 = CatalogLink;
|
|
353
352
|
const props = {
|
|
354
353
|
/**
|
|
355
354
|
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
@@ -547,7 +546,7 @@ const MdCatalog = /* @__PURE__ */ vue.defineComponent({
|
|
|
547
546
|
"class": [`${config.prefix}-catalog${props2.theme === "dark" ? "-dark" : ""}`, `${props2.class}`],
|
|
548
547
|
"ref": catalogRef
|
|
549
548
|
}, [catalogs.value.map((item) => {
|
|
550
|
-
return vue.createVNode(CatalogLink
|
|
549
|
+
return vue.createVNode(CatalogLink, {
|
|
551
550
|
"mdHeadingId": props2.mdHeadingId,
|
|
552
551
|
"tocItem": item,
|
|
553
552
|
"key": `link-${item.level}-${item.text}`,
|