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