md-editor-v3 4.19.2-0 → 4.19.2
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/lib/cjs/MdEditor.cjs +15 -11
- package/lib/cjs/chunks/dom.cjs +12 -18
- package/lib/cjs/chunks/event-name.cjs +1 -4
- package/lib/cjs/chunks/index.cjs +86 -127
- package/lib/cjs/chunks/index3.cjs +1 -2
- package/lib/es/MdEditor.mjs +16 -12
- package/lib/es/chunks/dom.mjs +12 -18
- package/lib/es/chunks/event-name.mjs +1 -4
- package/lib/es/chunks/index.mjs +86 -127
- package/lib/es/chunks/index3.mjs +1 -2
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/umd/index.js +54 -53
- package/package.json +2 -2
package/lib/cjs/MdEditor.cjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) =>
|
|
5
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
const vue = require("vue");
|
|
9
6
|
const config = require("./chunks/config.cjs");
|
|
10
7
|
const util = require("@vavt/util");
|
|
@@ -222,7 +219,6 @@ const TableShape = /* @__PURE__ */ vue.defineComponent({
|
|
|
222
219
|
}, null)]))]))]);
|
|
223
220
|
}
|
|
224
221
|
});
|
|
225
|
-
const TableShape$1 = TableShape;
|
|
226
222
|
const props$5 = {
|
|
227
223
|
type: {
|
|
228
224
|
type: String,
|
|
@@ -874,7 +870,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
|
|
|
874
870
|
visible.table = v;
|
|
875
871
|
},
|
|
876
872
|
"key": "bar-table",
|
|
877
|
-
"overlay": vue.createVNode(TableShape
|
|
873
|
+
"overlay": vue.createVNode(TableShape, {
|
|
878
874
|
"tableShape": props2.tableShape,
|
|
879
875
|
"onSelected": (selectedShape) => {
|
|
880
876
|
emitHandler("table", {
|
|
@@ -2364,9 +2360,15 @@ const useCodeMirror = (props2) => {
|
|
|
2364
2360
|
const theme = vue.inject("theme");
|
|
2365
2361
|
const inputWrapperRef = vue.ref();
|
|
2366
2362
|
const codeMirrorUt = vue.shallowRef();
|
|
2363
|
+
const spelling = vue.ref(false);
|
|
2367
2364
|
const languageComp = new state.Compartment(), themeComp = new state.Compartment(), autocompletionComp = new state.Compartment(), historyComp = new state.Compartment(), eventComp = new state.Compartment();
|
|
2368
2365
|
const mdEditorCommands = createCommands(editorId, props2);
|
|
2369
|
-
const
|
|
2366
|
+
const getDefaultKeymaps = () => [
|
|
2367
|
+
...commands.defaultKeymap,
|
|
2368
|
+
...commands.historyKeymap,
|
|
2369
|
+
...mdEditorCommands,
|
|
2370
|
+
commands.indentWithTab
|
|
2371
|
+
];
|
|
2370
2372
|
const pasteHandler = usePasteUpload(props2, codeMirrorUt);
|
|
2371
2373
|
const domEventHandlers = {
|
|
2372
2374
|
paste: pasteHandler,
|
|
@@ -2395,7 +2397,7 @@ const useCodeMirror = (props2) => {
|
|
|
2395
2397
|
}
|
|
2396
2398
|
};
|
|
2397
2399
|
const defaultExtensions = [
|
|
2398
|
-
view.keymap.of(
|
|
2400
|
+
view.keymap.of(getDefaultKeymaps()),
|
|
2399
2401
|
historyComp.of(commands.history()),
|
|
2400
2402
|
languageComp.of(langMarkdown.markdown({ codeLanguages: languageData.languages })),
|
|
2401
2403
|
// 横向换行
|
|
@@ -2418,9 +2420,11 @@ const useCodeMirror = (props2) => {
|
|
|
2418
2420
|
themeComp.of(theme.value === "light" ? oneLight : oneDark),
|
|
2419
2421
|
autocompletionComp.of(createAutocompletion(props2.completions))
|
|
2420
2422
|
];
|
|
2421
|
-
return config.configOption.codeMirrorExtensions(
|
|
2422
|
-
|
|
2423
|
-
|
|
2423
|
+
return config.configOption.codeMirrorExtensions(
|
|
2424
|
+
theme.value,
|
|
2425
|
+
extensions,
|
|
2426
|
+
getDefaultKeymaps()
|
|
2427
|
+
);
|
|
2424
2428
|
};
|
|
2425
2429
|
vue.onMounted(() => {
|
|
2426
2430
|
const view2 = new codemirror.EditorView({
|
package/lib/cjs/chunks/dom.cjs
CHANGED
|
@@ -73,18 +73,16 @@ const zoomMermaid = /* @__PURE__ */ (() => {
|
|
|
73
73
|
let posY = 0;
|
|
74
74
|
let isDragging = false;
|
|
75
75
|
let startX, startY;
|
|
76
|
-
let initialDistance
|
|
76
|
+
let initialDistance;
|
|
77
77
|
let initialScale = 1;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
78
|
+
const updateTransform = () => {
|
|
79
|
+
content.style.transform = `translate(${posX}px, ${posY}px) scale(${scale})`;
|
|
80
|
+
};
|
|
82
81
|
container.addEventListener("touchstart", (event) => {
|
|
83
82
|
if (event.touches.length === 1) {
|
|
84
83
|
isDragging = true;
|
|
85
84
|
startX = event.touches[0].clientX - posX;
|
|
86
85
|
startY = event.touches[0].clientY - posY;
|
|
87
|
-
container.style.cursor = "grabbing";
|
|
88
86
|
} else if (event.touches.length === 2) {
|
|
89
87
|
initialDistance = Math.hypot(
|
|
90
88
|
event.touches[0].clientX - event.touches[1].clientX,
|
|
@@ -105,21 +103,20 @@ const zoomMermaid = /* @__PURE__ */ (() => {
|
|
|
105
103
|
event.touches[0].clientY - event.touches[1].clientY
|
|
106
104
|
);
|
|
107
105
|
const scaleChange = newDistance / initialDistance;
|
|
108
|
-
|
|
106
|
+
const previousScale = scale;
|
|
107
|
+
scale = initialScale * (1 + (scaleChange - 1));
|
|
109
108
|
const centerX = (event.touches[0].clientX + event.touches[1].clientX) / 2;
|
|
110
109
|
const centerY = (event.touches[0].clientY + event.touches[1].clientY) / 2;
|
|
111
110
|
const rect = content.getBoundingClientRect();
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
posX -=
|
|
115
|
-
posY -=
|
|
111
|
+
const relativeX = (centerX - rect.left) / previousScale;
|
|
112
|
+
const relativeY = (centerY - rect.top) / previousScale;
|
|
113
|
+
posX -= relativeX * (scale - previousScale);
|
|
114
|
+
posY -= relativeY * (scale - previousScale);
|
|
116
115
|
updateTransform();
|
|
117
116
|
}
|
|
118
117
|
});
|
|
119
118
|
container.addEventListener("touchend", () => {
|
|
120
119
|
isDragging = false;
|
|
121
|
-
container.style.cursor = "grab";
|
|
122
|
-
initialDistance = -1;
|
|
123
120
|
});
|
|
124
121
|
container.addEventListener("wheel", (event) => {
|
|
125
122
|
event.preventDefault();
|
|
@@ -133,15 +130,14 @@ const zoomMermaid = /* @__PURE__ */ (() => {
|
|
|
133
130
|
const rect = content.getBoundingClientRect();
|
|
134
131
|
const mouseX = event.clientX - rect.left;
|
|
135
132
|
const mouseY = event.clientY - rect.top;
|
|
136
|
-
posX -= mouseX * (scale - previousScale);
|
|
137
|
-
posY -= mouseY * (scale - previousScale);
|
|
133
|
+
posX -= mouseX / previousScale * (scale - previousScale);
|
|
134
|
+
posY -= mouseY / previousScale * (scale - previousScale);
|
|
138
135
|
updateTransform();
|
|
139
136
|
});
|
|
140
137
|
container.addEventListener("mousedown", (event) => {
|
|
141
138
|
isDragging = true;
|
|
142
139
|
startX = event.clientX - posX;
|
|
143
140
|
startY = event.clientY - posY;
|
|
144
|
-
container.style.cursor = "grabbing";
|
|
145
141
|
});
|
|
146
142
|
container.addEventListener("mousemove", (event) => {
|
|
147
143
|
if (isDragging) {
|
|
@@ -152,11 +148,9 @@ const zoomMermaid = /* @__PURE__ */ (() => {
|
|
|
152
148
|
});
|
|
153
149
|
container.addEventListener("mouseup", () => {
|
|
154
150
|
isDragging = false;
|
|
155
|
-
container.style.cursor = "grab";
|
|
156
151
|
});
|
|
157
152
|
container.addEventListener("mouseleave", () => {
|
|
158
153
|
isDragging = false;
|
|
159
|
-
container.style.cursor = "grab";
|
|
160
154
|
});
|
|
161
155
|
};
|
|
162
156
|
const handler = (containers) => {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) =>
|
|
5
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
class Bus {
|
|
9
6
|
constructor() {
|
|
10
7
|
// 事件池
|
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -214,8 +214,10 @@ const useMermaid = (props) => {
|
|
|
214
214
|
`div.${config.prefix}-mermaid`
|
|
215
215
|
);
|
|
216
216
|
const svgContainingElement = document.createElement("div");
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
const sceWidth = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366;
|
|
218
|
+
const sceHeight = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
|
|
219
|
+
svgContainingElement.style.width = sceWidth + "px";
|
|
220
|
+
svgContainingElement.style.height = sceHeight + "px";
|
|
219
221
|
svgContainingElement.style.position = "fixed";
|
|
220
222
|
svgContainingElement.style.zIndex = "-10000";
|
|
221
223
|
svgContainingElement.style.top = "-10000";
|
|
@@ -306,7 +308,6 @@ const MermaidPlugin = (md, options) => {
|
|
|
306
308
|
return temp(tokens, idx, ops, env, slf);
|
|
307
309
|
};
|
|
308
310
|
};
|
|
309
|
-
const MermaidPlugin$1 = MermaidPlugin;
|
|
310
311
|
const mergeAttrs = (token, addAttrs) => {
|
|
311
312
|
const tmpAttrs = token.attrs ? token.attrs.slice() : [];
|
|
312
313
|
addAttrs.forEach((addAttr) => {
|
|
@@ -458,7 +459,6 @@ const KatexPlugin = (md, { katexRef }) => {
|
|
|
458
459
|
md.renderer.rules.math_inline = katexInline;
|
|
459
460
|
md.renderer.rules.math_block = katexBlock;
|
|
460
461
|
};
|
|
461
|
-
const KatexPlugin$1 = KatexPlugin;
|
|
462
462
|
const AdmonitionPlugin = (md, options) => {
|
|
463
463
|
options = options || {};
|
|
464
464
|
const markers = 3, markerStr = options.marker || "!", markerChar = markerStr.charCodeAt(0), markerLen = markerStr.length;
|
|
@@ -578,7 +578,6 @@ const AdmonitionPlugin = (md, options) => {
|
|
|
578
578
|
md.renderer.rules["admonition_title_close"] = render;
|
|
579
579
|
md.renderer.rules["admonition_close"] = render;
|
|
580
580
|
};
|
|
581
|
-
const AdmonitionPlugin$1 = AdmonitionPlugin;
|
|
582
581
|
const HeadingPlugin = (md, options) => {
|
|
583
582
|
md.renderer.rules.heading_open = (tokens, idx) => {
|
|
584
583
|
var _a;
|
|
@@ -603,7 +602,6 @@ const HeadingPlugin = (md, options) => {
|
|
|
603
602
|
return self2.renderToken(tokens, idx, opts);
|
|
604
603
|
};
|
|
605
604
|
};
|
|
606
|
-
const HeadingPlugin$1 = HeadingPlugin;
|
|
607
605
|
const StrIcon = (name, customIcon) => {
|
|
608
606
|
if (typeof customIcon[name] === "string") {
|
|
609
607
|
return customIcon[name];
|
|
@@ -708,7 +706,6 @@ const codetabs = (md, _opts) => {
|
|
|
708
706
|
md.renderer.rules.fence = fenceGroup;
|
|
709
707
|
md.renderer.rules.code_block = fenceGroup;
|
|
710
708
|
};
|
|
711
|
-
const CodePlugin = codetabs;
|
|
712
709
|
function getDefaultExportFromCjs(x) {
|
|
713
710
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
714
711
|
}
|
|
@@ -1061,8 +1058,7 @@ function onIgnoreAttr(name, value, options) {
|
|
|
1061
1058
|
}
|
|
1062
1059
|
var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img;
|
|
1063
1060
|
function safeAttrValue$1(name, value) {
|
|
1064
|
-
if (REGEXP_URL_JAVASCRIPT.test(value))
|
|
1065
|
-
return "";
|
|
1061
|
+
if (REGEXP_URL_JAVASCRIPT.test(value)) return "";
|
|
1066
1062
|
return value;
|
|
1067
1063
|
}
|
|
1068
1064
|
_default.whiteList = getDefaultWhiteList$1();
|
|
@@ -1108,8 +1104,7 @@ var util$1 = {
|
|
|
1108
1104
|
var _$3 = util$1;
|
|
1109
1105
|
function parseStyle$1(css2, onAttr2) {
|
|
1110
1106
|
css2 = _$3.trimRight(css2);
|
|
1111
|
-
if (css2[css2.length - 1] !== ";")
|
|
1112
|
-
css2 += ";";
|
|
1107
|
+
if (css2[css2.length - 1] !== ";") css2 += ";";
|
|
1113
1108
|
var cssLength = css2.length;
|
|
1114
1109
|
var isParenthesisOpen = false;
|
|
1115
1110
|
var lastPos = 0;
|
|
@@ -1124,8 +1119,7 @@ function parseStyle$1(css2, onAttr2) {
|
|
|
1124
1119
|
var value = _$3.trim(source.slice(j2 + 1));
|
|
1125
1120
|
if (name) {
|
|
1126
1121
|
var ret = onAttr2(lastPos, retCSS.length, name, value, source);
|
|
1127
|
-
if (ret)
|
|
1128
|
-
retCSS += ret + "; ";
|
|
1122
|
+
if (ret) retCSS += ret + "; ";
|
|
1129
1123
|
}
|
|
1130
1124
|
}
|
|
1131
1125
|
}
|
|
@@ -1135,8 +1129,7 @@ function parseStyle$1(css2, onAttr2) {
|
|
|
1135
1129
|
var c = css2[i];
|
|
1136
1130
|
if (c === "/" && css2[i + 1] === "*") {
|
|
1137
1131
|
var j = css2.indexOf("*/", i + 2);
|
|
1138
|
-
if (j === -1)
|
|
1139
|
-
break;
|
|
1132
|
+
if (j === -1) break;
|
|
1140
1133
|
i = j + 1;
|
|
1141
1134
|
lastPos = i + 1;
|
|
1142
1135
|
isParenthesisOpen = false;
|
|
@@ -1145,8 +1138,7 @@ function parseStyle$1(css2, onAttr2) {
|
|
|
1145
1138
|
} else if (c === ")") {
|
|
1146
1139
|
isParenthesisOpen = false;
|
|
1147
1140
|
} else if (c === ";") {
|
|
1148
|
-
if (isParenthesisOpen)
|
|
1149
|
-
;
|
|
1141
|
+
if (isParenthesisOpen) ;
|
|
1150
1142
|
else {
|
|
1151
1143
|
addNewAttr();
|
|
1152
1144
|
}
|
|
@@ -1180,8 +1172,7 @@ function FilterCSS$2(options) {
|
|
|
1180
1172
|
FilterCSS$2.prototype.process = function(css2) {
|
|
1181
1173
|
css2 = css2 || "";
|
|
1182
1174
|
css2 = css2.toString();
|
|
1183
|
-
if (!css2)
|
|
1184
|
-
return "";
|
|
1175
|
+
if (!css2) return "";
|
|
1185
1176
|
var me = this;
|
|
1186
1177
|
var options = me.options;
|
|
1187
1178
|
var whiteList = options.whiteList;
|
|
@@ -1191,17 +1182,12 @@ FilterCSS$2.prototype.process = function(css2) {
|
|
|
1191
1182
|
var retCSS = parseStyle(css2, function(sourcePosition, position, name, value, source) {
|
|
1192
1183
|
var check = whiteList[name];
|
|
1193
1184
|
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;
|
|
1185
|
+
if (check === true) isWhite = check;
|
|
1186
|
+
else if (typeof check === "function") isWhite = check(value);
|
|
1187
|
+
else if (check instanceof RegExp) isWhite = check.test(value);
|
|
1188
|
+
if (isWhite !== true) isWhite = false;
|
|
1202
1189
|
value = safeAttrValue2(name, value);
|
|
1203
|
-
if (!value)
|
|
1204
|
-
return;
|
|
1190
|
+
if (!value) return;
|
|
1205
1191
|
var opts = {
|
|
1206
1192
|
position,
|
|
1207
1193
|
sourcePosition,
|
|
@@ -1234,8 +1220,7 @@ var css = FilterCSS$2;
|
|
|
1234
1220
|
}
|
|
1235
1221
|
exports2 = module2.exports = filterCSS;
|
|
1236
1222
|
exports2.FilterCSS = FilterCSS2;
|
|
1237
|
-
for (var i in DEFAULT2)
|
|
1238
|
-
exports2[i] = DEFAULT2[i];
|
|
1223
|
+
for (var i in DEFAULT2) exports2[i] = DEFAULT2[i];
|
|
1239
1224
|
if (typeof window !== "undefined") {
|
|
1240
1225
|
window.filterCSS = module2.exports;
|
|
1241
1226
|
}
|
|
@@ -1386,8 +1371,7 @@ function safeAttrValue(tag, name, value, cssFilter) {
|
|
|
1386
1371
|
value = friendlyAttrValue(value);
|
|
1387
1372
|
if (name === "href" || name === "src") {
|
|
1388
1373
|
value = _$2.trim(value);
|
|
1389
|
-
if (value === "#")
|
|
1390
|
-
return "#";
|
|
1374
|
+
if (value === "#") return "#";
|
|
1391
1375
|
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
1376
|
return "";
|
|
1393
1377
|
}
|
|
@@ -1469,8 +1453,7 @@ function StripTagBody(tags, next) {
|
|
|
1469
1453
|
}
|
|
1470
1454
|
var isRemoveAllTag = !Array.isArray(tags);
|
|
1471
1455
|
function isRemoveTag(tag) {
|
|
1472
|
-
if (isRemoveAllTag)
|
|
1473
|
-
return true;
|
|
1456
|
+
if (isRemoveAllTag) return true;
|
|
1474
1457
|
return _$2.indexOf(tags, tag) !== -1;
|
|
1475
1458
|
}
|
|
1476
1459
|
var removeList = [];
|
|
@@ -1531,11 +1514,9 @@ function stripBlankChar(html) {
|
|
|
1531
1514
|
var chars = html.split("");
|
|
1532
1515
|
chars = chars.filter(function(char) {
|
|
1533
1516
|
var c = char.charCodeAt(0);
|
|
1534
|
-
if (c === 127)
|
|
1535
|
-
return false;
|
|
1517
|
+
if (c === 127) return false;
|
|
1536
1518
|
if (c <= 31) {
|
|
1537
|
-
if (c === 10 || c === 13)
|
|
1538
|
-
return true;
|
|
1519
|
+
if (c === 10 || c === 13) return true;
|
|
1539
1520
|
return false;
|
|
1540
1521
|
}
|
|
1541
1522
|
return true;
|
|
@@ -1575,10 +1556,8 @@ function getTagName(html) {
|
|
|
1575
1556
|
tagName = html.slice(1, i + 1);
|
|
1576
1557
|
}
|
|
1577
1558
|
tagName = _$1.trim(tagName).toLowerCase();
|
|
1578
|
-
if (tagName.slice(0, 1) === "/")
|
|
1579
|
-
|
|
1580
|
-
if (tagName.slice(-1) === "/")
|
|
1581
|
-
tagName = tagName.slice(0, -1);
|
|
1559
|
+
if (tagName.slice(0, 1) === "/") tagName = tagName.slice(1);
|
|
1560
|
+
if (tagName.slice(-1) === "/") tagName = tagName.slice(0, -1);
|
|
1582
1561
|
return tagName;
|
|
1583
1562
|
}
|
|
1584
1563
|
function isClosing(html) {
|
|
@@ -1593,56 +1572,55 @@ function parseTag$1(html, onTag2, escapeHtml2) {
|
|
|
1593
1572
|
var len = html.length;
|
|
1594
1573
|
var currentTagName = "";
|
|
1595
1574
|
var currentHtml = "";
|
|
1596
|
-
chariterator:
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
if (
|
|
1575
|
+
chariterator: for (currentPos = 0; currentPos < len; currentPos++) {
|
|
1576
|
+
var c = html.charAt(currentPos);
|
|
1577
|
+
if (tagStart === false) {
|
|
1578
|
+
if (c === "<") {
|
|
1579
|
+
tagStart = currentPos;
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
} else {
|
|
1583
|
+
if (quoteStart === false) {
|
|
1600
1584
|
if (c === "<") {
|
|
1585
|
+
rethtml += escapeHtml2(html.slice(lastPos, currentPos));
|
|
1601
1586
|
tagStart = currentPos;
|
|
1587
|
+
lastPos = currentPos;
|
|
1602
1588
|
continue;
|
|
1603
1589
|
}
|
|
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);
|
|
1590
|
+
if (c === ">" || currentPos === len - 1) {
|
|
1591
|
+
rethtml += escapeHtml2(html.slice(lastPos, tagStart));
|
|
1592
|
+
currentHtml = html.slice(tagStart, currentPos + 1);
|
|
1593
|
+
currentTagName = getTagName(currentHtml);
|
|
1594
|
+
rethtml += onTag2(
|
|
1595
|
+
tagStart,
|
|
1596
|
+
rethtml.length,
|
|
1597
|
+
currentTagName,
|
|
1598
|
+
currentHtml,
|
|
1599
|
+
isClosing(currentHtml)
|
|
1600
|
+
);
|
|
1601
|
+
lastPos = currentPos + 1;
|
|
1602
|
+
tagStart = false;
|
|
1603
|
+
continue;
|
|
1604
|
+
}
|
|
1605
|
+
if (c === '"' || c === "'") {
|
|
1606
|
+
var i = 1;
|
|
1607
|
+
var ic = html.charAt(currentPos - i);
|
|
1608
|
+
while (ic.trim() === "" || ic === "=") {
|
|
1609
|
+
if (ic === "=") {
|
|
1610
|
+
quoteStart = c;
|
|
1611
|
+
continue chariterator;
|
|
1636
1612
|
}
|
|
1613
|
+
ic = html.charAt(currentPos - ++i);
|
|
1637
1614
|
}
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1615
|
+
}
|
|
1616
|
+
} else {
|
|
1617
|
+
if (c === quoteStart) {
|
|
1618
|
+
quoteStart = false;
|
|
1619
|
+
continue;
|
|
1643
1620
|
}
|
|
1644
1621
|
}
|
|
1645
1622
|
}
|
|
1623
|
+
}
|
|
1646
1624
|
if (lastPos < len) {
|
|
1647
1625
|
rethtml += escapeHtml2(html.substr(lastPos));
|
|
1648
1626
|
}
|
|
@@ -1658,11 +1636,9 @@ function parseAttr$1(html, onAttr2) {
|
|
|
1658
1636
|
function addAttr(name, value) {
|
|
1659
1637
|
name = _$1.trim(name);
|
|
1660
1638
|
name = name.replace(REGEXP_ILLEGAL_ATTR_NAME, "").toLowerCase();
|
|
1661
|
-
if (name.length < 1)
|
|
1662
|
-
return;
|
|
1639
|
+
if (name.length < 1) return;
|
|
1663
1640
|
var ret = onAttr2(name, value || "");
|
|
1664
|
-
if (ret)
|
|
1665
|
-
retAttrs.push(ret);
|
|
1641
|
+
if (ret) retAttrs.push(ret);
|
|
1666
1642
|
}
|
|
1667
1643
|
for (var i = 0; i < len; i++) {
|
|
1668
1644
|
var c = html.charAt(i);
|
|
@@ -1729,30 +1705,24 @@ function parseAttr$1(html, onAttr2) {
|
|
|
1729
1705
|
function findNextEqual(str, i) {
|
|
1730
1706
|
for (; i < str.length; i++) {
|
|
1731
1707
|
var c = str[i];
|
|
1732
|
-
if (c === " ")
|
|
1733
|
-
|
|
1734
|
-
if (c === "=")
|
|
1735
|
-
return i;
|
|
1708
|
+
if (c === " ") continue;
|
|
1709
|
+
if (c === "=") return i;
|
|
1736
1710
|
return -1;
|
|
1737
1711
|
}
|
|
1738
1712
|
}
|
|
1739
1713
|
function findNextQuotationMark(str, i) {
|
|
1740
1714
|
for (; i < str.length; i++) {
|
|
1741
1715
|
var c = str[i];
|
|
1742
|
-
if (c === " ")
|
|
1743
|
-
|
|
1744
|
-
if (c === "'" || c === '"')
|
|
1745
|
-
return i;
|
|
1716
|
+
if (c === " ") continue;
|
|
1717
|
+
if (c === "'" || c === '"') return i;
|
|
1746
1718
|
return -1;
|
|
1747
1719
|
}
|
|
1748
1720
|
}
|
|
1749
1721
|
function findBeforeEqual(str, i) {
|
|
1750
1722
|
for (; i > 0; i--) {
|
|
1751
1723
|
var c = str[i];
|
|
1752
|
-
if (c === " ")
|
|
1753
|
-
|
|
1754
|
-
if (c === "=")
|
|
1755
|
-
return i;
|
|
1724
|
+
if (c === " ") continue;
|
|
1725
|
+
if (c === "=") return i;
|
|
1756
1726
|
return -1;
|
|
1757
1727
|
}
|
|
1758
1728
|
}
|
|
@@ -1791,8 +1761,7 @@ function getAttrs(html) {
|
|
|
1791
1761
|
}
|
|
1792
1762
|
html = _.trim(html.slice(i + 1, -1));
|
|
1793
1763
|
var isClosing2 = html[html.length - 1] === "/";
|
|
1794
|
-
if (isClosing2)
|
|
1795
|
-
html = _.trim(html.slice(0, -1));
|
|
1764
|
+
if (isClosing2) html = _.trim(html.slice(0, -1));
|
|
1796
1765
|
return {
|
|
1797
1766
|
html,
|
|
1798
1767
|
closing: isClosing2
|
|
@@ -1851,8 +1820,7 @@ function FilterXSS(options) {
|
|
|
1851
1820
|
FilterXSS.prototype.process = function(html) {
|
|
1852
1821
|
html = html || "";
|
|
1853
1822
|
html = html.toString();
|
|
1854
|
-
if (!html)
|
|
1855
|
-
return "";
|
|
1823
|
+
if (!html) return "";
|
|
1856
1824
|
var me = this;
|
|
1857
1825
|
var options = me.options;
|
|
1858
1826
|
var whiteList = options.whiteList;
|
|
@@ -1888,8 +1856,7 @@ FilterXSS.prototype.process = function(html) {
|
|
|
1888
1856
|
isWhite: Object.prototype.hasOwnProperty.call(whiteList, tag)
|
|
1889
1857
|
};
|
|
1890
1858
|
var ret = onTag2(tag, html2, info);
|
|
1891
|
-
if (!isNull(ret))
|
|
1892
|
-
return ret;
|
|
1859
|
+
if (!isNull(ret)) return ret;
|
|
1893
1860
|
if (info.isWhite) {
|
|
1894
1861
|
if (info.isClosing) {
|
|
1895
1862
|
return "</" + tag + ">";
|
|
@@ -1899,8 +1866,7 @@ FilterXSS.prototype.process = function(html) {
|
|
|
1899
1866
|
var attrsHtml = parseAttr(attrs.html, function(name, value) {
|
|
1900
1867
|
var isWhiteAttr = _.indexOf(whiteAttrList, name) !== -1;
|
|
1901
1868
|
var ret2 = onTagAttr2(tag, name, value, isWhiteAttr);
|
|
1902
|
-
if (!isNull(ret2))
|
|
1903
|
-
return ret2;
|
|
1869
|
+
if (!isNull(ret2)) return ret2;
|
|
1904
1870
|
if (isWhiteAttr) {
|
|
1905
1871
|
value = safeAttrValue2(tag, name, value, cssFilter);
|
|
1906
1872
|
if (value) {
|
|
@@ -1910,22 +1876,18 @@ FilterXSS.prototype.process = function(html) {
|
|
|
1910
1876
|
}
|
|
1911
1877
|
} else {
|
|
1912
1878
|
ret2 = onIgnoreTagAttr2(tag, name, value, isWhiteAttr);
|
|
1913
|
-
if (!isNull(ret2))
|
|
1914
|
-
return ret2;
|
|
1879
|
+
if (!isNull(ret2)) return ret2;
|
|
1915
1880
|
return;
|
|
1916
1881
|
}
|
|
1917
1882
|
});
|
|
1918
1883
|
html2 = "<" + tag;
|
|
1919
|
-
if (attrsHtml)
|
|
1920
|
-
|
|
1921
|
-
if (attrs.closing)
|
|
1922
|
-
html2 += " /";
|
|
1884
|
+
if (attrsHtml) html2 += " " + attrsHtml;
|
|
1885
|
+
if (attrs.closing) html2 += " /";
|
|
1923
1886
|
html2 += ">";
|
|
1924
1887
|
return html2;
|
|
1925
1888
|
} else {
|
|
1926
1889
|
ret = onIgnoreTag2(tag, html2, info);
|
|
1927
|
-
if (!isNull(ret))
|
|
1928
|
-
return ret;
|
|
1890
|
+
if (!isNull(ret)) return ret;
|
|
1929
1891
|
return escapeHtml2(html2);
|
|
1930
1892
|
}
|
|
1931
1893
|
},
|
|
@@ -2033,7 +1995,6 @@ const XSSPlugin = (md, options) => {
|
|
|
2033
1995
|
}
|
|
2034
1996
|
});
|
|
2035
1997
|
};
|
|
2036
|
-
const XSSPlugin$1 = XSSPlugin;
|
|
2037
1998
|
const attrSet = (token, name, value) => {
|
|
2038
1999
|
const index2 = token.attrIndex(name);
|
|
2039
2000
|
const attr = [name, value];
|
|
@@ -2127,7 +2088,6 @@ const githubTaskLists = (md, options = {}) => {
|
|
|
2127
2088
|
}
|
|
2128
2089
|
});
|
|
2129
2090
|
};
|
|
2130
|
-
const TaskListPlugin = githubTaskLists;
|
|
2131
2091
|
const initLineNumber = (md) => {
|
|
2132
2092
|
md.core.ruler.push("init-line-number", (state) => {
|
|
2133
2093
|
state.tokens.forEach((token) => {
|
|
@@ -2172,22 +2132,22 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2172
2132
|
},
|
|
2173
2133
|
{
|
|
2174
2134
|
type: "admonition",
|
|
2175
|
-
plugin: AdmonitionPlugin
|
|
2135
|
+
plugin: AdmonitionPlugin,
|
|
2176
2136
|
options: {}
|
|
2177
2137
|
},
|
|
2178
2138
|
{
|
|
2179
2139
|
type: "taskList",
|
|
2180
|
-
plugin:
|
|
2140
|
+
plugin: githubTaskLists,
|
|
2181
2141
|
options: {}
|
|
2182
2142
|
},
|
|
2183
2143
|
{
|
|
2184
2144
|
type: "heading",
|
|
2185
|
-
plugin: HeadingPlugin
|
|
2145
|
+
plugin: HeadingPlugin,
|
|
2186
2146
|
options: { mdHeadingId: props.mdHeadingId, headsRef }
|
|
2187
2147
|
},
|
|
2188
2148
|
{
|
|
2189
2149
|
type: "code",
|
|
2190
|
-
plugin:
|
|
2150
|
+
plugin: codetabs,
|
|
2191
2151
|
options: {
|
|
2192
2152
|
editorId,
|
|
2193
2153
|
usedLanguageTextRef,
|
|
@@ -2199,21 +2159,21 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2199
2159
|
},
|
|
2200
2160
|
{
|
|
2201
2161
|
type: "xss",
|
|
2202
|
-
plugin: XSSPlugin
|
|
2162
|
+
plugin: XSSPlugin,
|
|
2203
2163
|
options: {}
|
|
2204
2164
|
}
|
|
2205
2165
|
];
|
|
2206
2166
|
if (!props.noKatex) {
|
|
2207
2167
|
plugins.push({
|
|
2208
2168
|
type: "katex",
|
|
2209
|
-
plugin: KatexPlugin
|
|
2169
|
+
plugin: KatexPlugin,
|
|
2210
2170
|
options: { katexRef }
|
|
2211
2171
|
});
|
|
2212
2172
|
}
|
|
2213
2173
|
if (!props.noMermaid) {
|
|
2214
2174
|
plugins.push({
|
|
2215
2175
|
type: "mermaid",
|
|
2216
|
-
plugin: MermaidPlugin
|
|
2176
|
+
plugin: MermaidPlugin,
|
|
2217
2177
|
options: { themeRef }
|
|
2218
2178
|
});
|
|
2219
2179
|
}
|
|
@@ -2311,7 +2271,6 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2311
2271
|
});
|
|
2312
2272
|
return { html, key };
|
|
2313
2273
|
};
|
|
2314
|
-
const useMarkdownIt$1 = useMarkdownIt;
|
|
2315
2274
|
const template = {
|
|
2316
2275
|
checked: {
|
|
2317
2276
|
regexp: /- \[x\]/,
|
|
@@ -2529,7 +2488,7 @@ const ContentPreview = /* @__PURE__ */ vue.defineComponent({
|
|
|
2529
2488
|
const {
|
|
2530
2489
|
html,
|
|
2531
2490
|
key
|
|
2532
|
-
} = useMarkdownIt
|
|
2491
|
+
} = useMarkdownIt(props, props.previewOnly);
|
|
2533
2492
|
useCopyCode(props, html, key);
|
|
2534
2493
|
userZoom(props, html);
|
|
2535
2494
|
useTaskState(props, html);
|
|
@@ -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}`,
|