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