md-editor-v3 4.13.4 → 4.14.0-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 -2
- package/lib/cjs/MdCatalog.cjs +14 -8
- package/lib/cjs/MdEditor.cjs +105 -79
- package/lib/cjs/ModalToolbar.cjs +3 -0
- package/lib/cjs/chunks/config.cjs +174 -16
- package/lib/cjs/chunks/dom.cjs +14 -5
- package/lib/cjs/chunks/event-name.cjs +95 -0
- package/lib/cjs/chunks/index.cjs +207 -165
- package/lib/cjs/chunks/index2.cjs +5 -1
- package/lib/cjs/chunks/index3.cjs +3 -8
- package/lib/cjs/chunks/index4.cjs +7 -94
- package/lib/cjs/config.cjs +1 -0
- package/lib/cjs/index.cjs +1 -0
- package/lib/es/MdCatalog.mjs +12 -6
- package/lib/es/MdEditor.mjs +52 -26
- package/lib/es/ModalToolbar.mjs +3 -0
- package/lib/es/chunks/config.mjs +176 -18
- package/lib/es/chunks/dom.mjs +14 -5
- package/lib/es/chunks/event-name.mjs +96 -0
- package/lib/es/chunks/index.mjs +159 -117
- package/lib/es/chunks/index2.mjs +5 -1
- package/lib/es/chunks/index3.mjs +4 -9
- package/lib/es/chunks/index4.mjs +11 -98
- package/lib/es/config.mjs +2 -1
- package/lib/es/index.mjs +2 -1
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/DropdownToolbar/DropdownToolbar.d.ts +6 -0
- package/lib/types/DropdownToolbar/index.d.ts +12 -0
- package/lib/types/MdCatalog/MdCatalog.d.ts +1 -1
- package/lib/types/MdCatalog/index.d.ts +3 -3
- package/lib/types/MdEditor/Editor.d.ts +0 -3
- package/lib/types/MdEditor/config.d.ts +1 -0
- package/lib/types/MdEditor/index.d.ts +0 -7
- package/lib/types/MdEditor/props.d.ts +2 -1
- package/lib/types/MdEditor/type.d.ts +46 -0
- package/lib/types/MdEditor/utils/dom.d.ts +9 -1
- package/lib/types/MdEditor/utils/index.d.ts +4 -0
- package/lib/types/ModalToolbar/ModalToolbar.d.ts +6 -0
- package/lib/types/ModalToolbar/index.d.ts +12 -0
- package/lib/types/config.d.ts +1 -1
- package/lib/umd/index.js +43 -43
- package/package.json +3 -3
|
@@ -108,7 +108,8 @@ const Dropdown = /* @__PURE__ */ vue.defineComponent({
|
|
|
108
108
|
ctx
|
|
109
109
|
}, "overlay");
|
|
110
110
|
const trigger = vue.cloneVNode(slotDefault instanceof Array ? slotDefault[0] : slotDefault, {
|
|
111
|
-
ref: triggerRef
|
|
111
|
+
ref: triggerRef,
|
|
112
|
+
key: "cloned-dropdown-trigger"
|
|
112
113
|
});
|
|
113
114
|
const overlay = vue.createVNode("div", {
|
|
114
115
|
"class": [`${config.prefix}-dropdown`, ctl.overlayClass],
|
|
@@ -152,6 +153,9 @@ const props = {
|
|
|
152
153
|
theme: {
|
|
153
154
|
type: String
|
|
154
155
|
},
|
|
156
|
+
previewTheme: {
|
|
157
|
+
type: String
|
|
158
|
+
},
|
|
155
159
|
/**
|
|
156
160
|
* ==结束
|
|
157
161
|
*/
|
|
@@ -3,6 +3,7 @@ const vue = require("vue");
|
|
|
3
3
|
const config = require("./config.cjs");
|
|
4
4
|
const vueTsx = require("./vue-tsx.cjs");
|
|
5
5
|
const dom = require("./dom.cjs");
|
|
6
|
+
const index = require("./index4.cjs");
|
|
6
7
|
const Icon$1 = /* @__PURE__ */ vue.defineComponent({
|
|
7
8
|
props: {
|
|
8
9
|
name: {
|
|
@@ -86,12 +87,6 @@ const props = {
|
|
|
86
87
|
default: () => ({})
|
|
87
88
|
}
|
|
88
89
|
};
|
|
89
|
-
const getNextIndex = /* @__PURE__ */ (() => {
|
|
90
|
-
let startIndex = 2e4;
|
|
91
|
-
return () => {
|
|
92
|
-
return ++startIndex;
|
|
93
|
-
};
|
|
94
|
-
})();
|
|
95
90
|
const MdModal = /* @__PURE__ */ vue.defineComponent({
|
|
96
91
|
name: "MdModal",
|
|
97
92
|
props,
|
|
@@ -149,8 +144,8 @@ const MdModal = /* @__PURE__ */ vue.defineComponent({
|
|
|
149
144
|
});
|
|
150
145
|
vue.watch(() => props2.visible, (nVal) => {
|
|
151
146
|
if (nVal) {
|
|
152
|
-
state.maskStyle.zIndex =
|
|
153
|
-
state.modalStyle.zIndex =
|
|
147
|
+
state.maskStyle.zIndex = config.configOption.editorConfig.zIndex + index.getZIndexIncrement();
|
|
148
|
+
state.modalStyle.zIndex = config.configOption.editorConfig.zIndex + index.getZIndexIncrement();
|
|
154
149
|
modalClass.value.push("zoom-in");
|
|
155
150
|
modalVisible.value = nVal;
|
|
156
151
|
vue.nextTick(() => {
|
|
@@ -1,77 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
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
|
-
};
|
|
8
|
-
class Bus {
|
|
9
|
-
constructor() {
|
|
10
|
-
// 事件池
|
|
11
|
-
__publicField(this, "pools", {});
|
|
12
|
-
}
|
|
13
|
-
// 移除事件监听
|
|
14
|
-
remove(race, name, func) {
|
|
15
|
-
const targetRace = this.pools[race];
|
|
16
|
-
const events = targetRace && this.pools[race][name];
|
|
17
|
-
if (events) {
|
|
18
|
-
this.pools[race][name] = events.filter((item) => item !== func);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
// 清空全部事件,由于单一实例,多次注册会被共享内容
|
|
22
|
-
clear(race) {
|
|
23
|
-
this.pools[race] = {};
|
|
24
|
-
}
|
|
25
|
-
// 注册事件监听
|
|
26
|
-
on(race, event) {
|
|
27
|
-
if (!this.pools[race]) {
|
|
28
|
-
this.pools[race] = {};
|
|
29
|
-
}
|
|
30
|
-
if (!this.pools[race][event.name]) {
|
|
31
|
-
this.pools[race][event.name] = [];
|
|
32
|
-
}
|
|
33
|
-
this.pools[race][event.name].push(event.callback);
|
|
34
|
-
return this.pools[race][event.name].includes(event.callback);
|
|
35
|
-
}
|
|
36
|
-
// 触发事件
|
|
37
|
-
emit(race, name, ...params) {
|
|
38
|
-
if (!this.pools[race]) {
|
|
39
|
-
this.pools[race] = {};
|
|
40
|
-
}
|
|
41
|
-
const targetRace = this.pools[race];
|
|
42
|
-
const events = targetRace[name];
|
|
43
|
-
if (events) {
|
|
44
|
-
events.forEach((item) => {
|
|
45
|
-
try {
|
|
46
|
-
item(...params);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error(`${name} monitor event exception!`, error);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const bus = new Bus();
|
|
55
|
-
const ON_SAVE = "onSave";
|
|
56
|
-
const CHANGE_CATALOG_VISIBLE = "changeCatalogVisible";
|
|
57
|
-
const CHANGE_FULL_SCREEN = "changeFullscreen";
|
|
58
|
-
const PAGE_FULL_SCREEN_CHANGED = "pageFullscreenChanged";
|
|
59
|
-
const FULL_SCREEN_CHANGED = "fullscreenChanged";
|
|
60
|
-
const PREVIEW_CHANGED = "previewChanged";
|
|
61
|
-
const PREVIEW_ONLY_CHANGED = "previewOnlyChanged";
|
|
62
|
-
const HTML_PREVIEW_CHANGED = "htmlPreviewChanged";
|
|
63
|
-
const CATALOG_VISIBLE_CHANGED = "catalogVisibleChanged";
|
|
64
|
-
const BUILD_FINISHED = "buildFinished";
|
|
65
|
-
const ERROR_CATCHER = "errorCatcher";
|
|
66
|
-
const REPLACE = "replace";
|
|
67
|
-
const UPLOAD_IMAGE = "uploadImage";
|
|
68
|
-
const OPEN_MODALS = "openModals";
|
|
69
|
-
const CTRL_Z = "ctrlZ";
|
|
70
|
-
const CTRL_SHIFT_Z = "ctrlShiftZ";
|
|
71
|
-
const CATALOG_CHANGED = "catalogChanged";
|
|
72
|
-
const PUSH_CATALOG = "pushCatalog";
|
|
73
|
-
const RERENDER = "rerender";
|
|
74
|
-
const EVENT_LISTENER = "eventListener";
|
|
75
2
|
const base642File = (base64, fileName = "image.png") => {
|
|
76
3
|
const arr = base64.split(",");
|
|
77
4
|
const regResult = arr[0].match(/:(.*?);/);
|
|
@@ -116,28 +43,14 @@ const getNextId = /* @__PURE__ */ (() => {
|
|
|
116
43
|
return prefix + ++count;
|
|
117
44
|
};
|
|
118
45
|
})();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
exports.CTRL_Z = CTRL_Z;
|
|
126
|
-
exports.ERROR_CATCHER = ERROR_CATCHER;
|
|
127
|
-
exports.EVENT_LISTENER = EVENT_LISTENER;
|
|
128
|
-
exports.FULL_SCREEN_CHANGED = FULL_SCREEN_CHANGED;
|
|
129
|
-
exports.HTML_PREVIEW_CHANGED = HTML_PREVIEW_CHANGED;
|
|
130
|
-
exports.ON_SAVE = ON_SAVE;
|
|
131
|
-
exports.OPEN_MODALS = OPEN_MODALS;
|
|
132
|
-
exports.PAGE_FULL_SCREEN_CHANGED = PAGE_FULL_SCREEN_CHANGED;
|
|
133
|
-
exports.PREVIEW_CHANGED = PREVIEW_CHANGED;
|
|
134
|
-
exports.PREVIEW_ONLY_CHANGED = PREVIEW_ONLY_CHANGED;
|
|
135
|
-
exports.PUSH_CATALOG = PUSH_CATALOG;
|
|
136
|
-
exports.REPLACE = REPLACE;
|
|
137
|
-
exports.RERENDER = RERENDER;
|
|
138
|
-
exports.UPLOAD_IMAGE = UPLOAD_IMAGE;
|
|
46
|
+
const getZIndexIncrement = /* @__PURE__ */ (() => {
|
|
47
|
+
let startIndex = 0;
|
|
48
|
+
return () => {
|
|
49
|
+
return ++startIndex;
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
139
52
|
exports.base642File = base642File;
|
|
140
|
-
exports.bus = bus;
|
|
141
53
|
exports.generateCodeRowNumber = generateCodeRowNumber;
|
|
142
54
|
exports.getNextId = getNextId;
|
|
143
55
|
exports.getRelativeTop = getRelativeTop;
|
|
56
|
+
exports.getZIndexIncrement = getZIndexIncrement;
|
package/lib/cjs/config.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const en_US = config.staticTextDefault["en-US"];
|
|
|
6
6
|
exports.allFooter = config.allFooter;
|
|
7
7
|
exports.allToolbar = config.allToolbar;
|
|
8
8
|
exports.config = config.config;
|
|
9
|
+
exports.editorExtensionsAttrs = config.editorExtensionsAttrs;
|
|
9
10
|
exports.iconfontClassUrl = config.iconfontClassUrl;
|
|
10
11
|
exports.iconfontSvgUrl = config.iconfontSvgUrl;
|
|
11
12
|
exports.en_US = en_US;
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -21,5 +21,6 @@ exports.zh_CN = config.zh_CN;
|
|
|
21
21
|
exports.allFooter = config$1.allFooter;
|
|
22
22
|
exports.allToolbar = config$1.allToolbar;
|
|
23
23
|
exports.config = config$1.config;
|
|
24
|
+
exports.editorExtensionsAttrs = config$1.editorExtensionsAttrs;
|
|
24
25
|
exports.iconfontClassUrl = config$1.iconfontClassUrl;
|
|
25
26
|
exports.iconfontSvgUrl = config$1.iconfontSvgUrl;
|
package/lib/es/MdCatalog.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, createVNode, reactive, shallowRef, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
|
2
2
|
import { p as prefix } from "./chunks/config.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { g as getRelativeTop } from "./chunks/index4.mjs";
|
|
4
|
+
import { b as bus, C as CATALOG_CHANGED, P as PUSH_CATALOG } from "./chunks/event-name.mjs";
|
|
4
5
|
const props$1 = {
|
|
5
6
|
tocItem: {
|
|
6
7
|
type: Object,
|
|
@@ -224,18 +225,23 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
224
225
|
}
|
|
225
226
|
});
|
|
226
227
|
onMounted(() => {
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
228
|
+
let scrollContainer = window;
|
|
229
|
+
const findScrollContainer = () => {
|
|
230
|
+
const scrollElement_ = getScrollElement();
|
|
231
|
+
scrollContainer = scrollElement_ === document.documentElement ? window : scrollElement_;
|
|
232
|
+
};
|
|
230
233
|
bus.on(editorId, {
|
|
231
234
|
name: CATALOG_CHANGED,
|
|
232
235
|
callback: (_list) => {
|
|
233
|
-
|
|
236
|
+
scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", scrollHandler);
|
|
234
237
|
findActiveHeading(_list);
|
|
235
|
-
|
|
238
|
+
findScrollContainer();
|
|
239
|
+
scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", scrollHandler);
|
|
236
240
|
}
|
|
237
241
|
});
|
|
238
242
|
bus.emit(editorId, PUSH_CATALOG);
|
|
243
|
+
findScrollContainer();
|
|
244
|
+
scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", scrollHandler);
|
|
239
245
|
});
|
|
240
246
|
onBeforeUnmount(() => {
|
|
241
247
|
var _a;
|
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -4,13 +4,14 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { defineComponent, createVNode, inject, ref, onMounted, reactive,
|
|
8
|
-
import { p as prefix,
|
|
7
|
+
import { defineComponent, createVNode, inject, ref, onMounted, reactive, watch, computed, nextTick, Fragment, cloneVNode, toRef, shallowRef, onBeforeUnmount } from "vue";
|
|
8
|
+
import { p as prefix, f as configOption, b as allToolbar, M as MinInputBoxWidth, d as allFooter } from "./chunks/config.mjs";
|
|
9
9
|
import { draggingScroll, linkTo, debounce, createSmoothScroll, throttle } from "@vavt/util";
|
|
10
10
|
import { a as Dropdown, D as DropdownToolbar } from "./chunks/index2.mjs";
|
|
11
|
-
import { b as bus,
|
|
12
|
-
import { a as appendHandler } from "./chunks/dom.mjs";
|
|
11
|
+
import { b as bus, h as CHANGE_FULL_SCREEN, E as ERROR_CATCHER, U as UPLOAD_IMAGE, j as OPEN_MODALS, g as REPLACE, a as CHANGE_CATALOG_VISIBLE, O as ON_SAVE, k as CTRL_SHIFT_Z, l as CTRL_Z, i as EVENT_LISTENER } from "./chunks/event-name.mjs";
|
|
12
|
+
import { c as createHTMLElement, a as appendHandler } from "./chunks/dom.mjs";
|
|
13
13
|
import { M as MdModal, I as Icon } from "./chunks/index3.mjs";
|
|
14
|
+
import { d as base642File } from "./chunks/index4.mjs";
|
|
14
15
|
import { EditorView as EditorView$1 } from "codemirror";
|
|
15
16
|
import { EditorView, placeholder, keymap } from "@codemirror/view";
|
|
16
17
|
import { languages } from "@codemirror/language-data";
|
|
@@ -84,10 +85,9 @@ const toolbarProps = {
|
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
87
|
const useSreenfull = (props2) => {
|
|
87
|
-
var _a, _b, _c, _d;
|
|
88
88
|
const editorId = inject("editorId");
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const { editorExtensions, editorExtensionsAttrs } = configOption;
|
|
90
|
+
let screenfull = editorExtensions.screenfull.instance;
|
|
91
91
|
const screenfullMe = ref(false);
|
|
92
92
|
const fullscreenHandler = (status) => {
|
|
93
93
|
if (!screenfull) {
|
|
@@ -124,12 +124,15 @@ const useSreenfull = (props2) => {
|
|
|
124
124
|
onScreenfullEvent();
|
|
125
125
|
};
|
|
126
126
|
onMounted(() => {
|
|
127
|
+
var _a;
|
|
127
128
|
onScreenfullEvent();
|
|
128
129
|
if (!screenfull) {
|
|
129
|
-
const screenScript =
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
const screenScript = createHTMLElement("script", {
|
|
131
|
+
...(_a = editorExtensionsAttrs.screenfull) == null ? void 0 : _a.js,
|
|
132
|
+
src: editorExtensions.screenfull.js,
|
|
133
|
+
id: `${prefix}-screenfull`,
|
|
134
|
+
onload: screenfullLoad
|
|
135
|
+
});
|
|
133
136
|
appendHandler(screenScript, "screenfull");
|
|
134
137
|
}
|
|
135
138
|
});
|
|
@@ -160,21 +163,46 @@ const TableShape = /* @__PURE__ */ defineComponent({
|
|
|
160
163
|
x: -1,
|
|
161
164
|
y: -1
|
|
162
165
|
});
|
|
166
|
+
const initShape = () => {
|
|
167
|
+
const shape = [...props2.tableShape];
|
|
168
|
+
if (!shape[2] || shape[2] < shape[0]) {
|
|
169
|
+
shape[2] = shape[0];
|
|
170
|
+
}
|
|
171
|
+
if (!shape[3] || shape[3] < shape[3]) {
|
|
172
|
+
shape[3] = shape[1];
|
|
173
|
+
}
|
|
174
|
+
return shape;
|
|
175
|
+
};
|
|
176
|
+
const tableShape = ref(initShape());
|
|
177
|
+
watch(() => props2.tableShape, () => {
|
|
178
|
+
tableShape.value = initShape();
|
|
179
|
+
});
|
|
163
180
|
return () => createVNode("div", {
|
|
164
181
|
"class": `${prefix}-table-shape`,
|
|
165
182
|
"onMouseleave": () => {
|
|
183
|
+
tableShape.value = initShape();
|
|
166
184
|
hoverPosition.x = -1;
|
|
167
185
|
hoverPosition.y = -1;
|
|
168
186
|
}
|
|
169
|
-
}, [new Array(
|
|
187
|
+
}, [new Array(tableShape.value[1]).fill("").map((_, rowIndex) => createVNode("div", {
|
|
170
188
|
"class": `${prefix}-table-shape-row`,
|
|
171
189
|
"key": `table-shape-row-${rowIndex}`
|
|
172
|
-
}, [new Array(
|
|
190
|
+
}, [new Array(tableShape.value[0]).fill("").map((_2, colIndex) => createVNode("div", {
|
|
173
191
|
"class": `${prefix}-table-shape-col`,
|
|
174
192
|
"key": `table-shape-col-${colIndex}`,
|
|
175
193
|
"onMouseenter": () => {
|
|
176
194
|
hoverPosition.x = rowIndex;
|
|
177
195
|
hoverPosition.y = colIndex;
|
|
196
|
+
if (colIndex + 1 === tableShape.value[0] && colIndex + 1 < tableShape.value[2]) {
|
|
197
|
+
tableShape.value[0]++;
|
|
198
|
+
} else if (colIndex + 2 < tableShape.value[0] && tableShape.value[0] > props2.tableShape[0]) {
|
|
199
|
+
tableShape.value[0]--;
|
|
200
|
+
}
|
|
201
|
+
if (rowIndex + 1 === tableShape.value[1] && rowIndex + 1 < tableShape.value[3]) {
|
|
202
|
+
tableShape.value[1]++;
|
|
203
|
+
} else if (rowIndex + 2 < tableShape.value[1] && tableShape.value[1] > props2.tableShape[1]) {
|
|
204
|
+
tableShape.value[1]--;
|
|
205
|
+
}
|
|
178
206
|
},
|
|
179
207
|
"onClick": () => {
|
|
180
208
|
props2.onSelected(hoverPosition);
|
|
@@ -307,10 +335,9 @@ const props$4 = {
|
|
|
307
335
|
const ClipModal = /* @__PURE__ */ defineComponent({
|
|
308
336
|
props: props$4,
|
|
309
337
|
setup(props2) {
|
|
310
|
-
var _a, _b, _c;
|
|
311
338
|
const ult = inject("usedLanguageText");
|
|
312
339
|
const editorId = inject("editorId");
|
|
313
|
-
let Cropper =
|
|
340
|
+
let Cropper = configOption.editorExtensions.cropper.instance;
|
|
314
341
|
const uploadRef = ref();
|
|
315
342
|
const uploadImgRef = ref();
|
|
316
343
|
const previewTargetRef = ref();
|
|
@@ -376,10 +403,10 @@ const ClipModal = /* @__PURE__ */ defineComponent({
|
|
|
376
403
|
data.imgSelected = false;
|
|
377
404
|
};
|
|
378
405
|
return () => {
|
|
379
|
-
var
|
|
406
|
+
var _a;
|
|
380
407
|
return createVNode(MdModal, {
|
|
381
408
|
"class": `${prefix}-modal-clip`,
|
|
382
|
-
"title": (
|
|
409
|
+
"title": (_a = ult.value.clipModalTips) == null ? void 0 : _a.title,
|
|
383
410
|
"visible": props2.visible,
|
|
384
411
|
"onClose": props2.onCancel,
|
|
385
412
|
"showAdjust": true,
|
|
@@ -391,7 +418,7 @@ const ClipModal = /* @__PURE__ */ defineComponent({
|
|
|
391
418
|
"height": "421px"
|
|
392
419
|
}, {
|
|
393
420
|
default: () => {
|
|
394
|
-
var
|
|
421
|
+
var _a2, _b;
|
|
395
422
|
return [createVNode("div", {
|
|
396
423
|
"class": `${prefix}-form-item ${prefix}-clip`
|
|
397
424
|
}, [createVNode("div", {
|
|
@@ -434,7 +461,7 @@ const ClipModal = /* @__PURE__ */ defineComponent({
|
|
|
434
461
|
reset();
|
|
435
462
|
}
|
|
436
463
|
}
|
|
437
|
-
}, [((
|
|
464
|
+
}, [((_a2 = ult.value.clipModalTips) == null ? void 0 : _a2.buttonUpload) || ((_b = ult.value.linkModalTips) == null ? void 0 : _b.buttonOK)])]), createVNode("input", {
|
|
438
465
|
"ref": uploadRef,
|
|
439
466
|
"accept": "image/*",
|
|
440
467
|
"type": "file",
|
|
@@ -1508,14 +1535,14 @@ const useAutoScroll = (props2, html, codeMirrorUt) => {
|
|
|
1508
1535
|
onMounted(rebindEvent);
|
|
1509
1536
|
};
|
|
1510
1537
|
const directive2flag = (direct, codeMirrorUt, params) => {
|
|
1511
|
-
var _a
|
|
1538
|
+
var _a;
|
|
1512
1539
|
let targetValue = "";
|
|
1513
1540
|
let deviationStart = 0;
|
|
1514
1541
|
let deviationEnd = 0;
|
|
1515
1542
|
let select = true;
|
|
1516
1543
|
let replaceAll = false;
|
|
1517
1544
|
const selectedText = codeMirrorUt.getSelectedText();
|
|
1518
|
-
const mermaidTemplate =
|
|
1545
|
+
const mermaidTemplate = configOption.editorConfig.mermaidTemplate;
|
|
1519
1546
|
if (/^h[1-6]{1}$/.test(direct)) {
|
|
1520
1547
|
const pix = direct.replace(/^h(\d)/, (_, num) => {
|
|
1521
1548
|
return new Array(Number(num)).fill("#", 0, num).join("");
|
|
@@ -1523,9 +1550,9 @@ const directive2flag = (direct, codeMirrorUt, params) => {
|
|
|
1523
1550
|
targetValue = `${pix} ${selectedText}`;
|
|
1524
1551
|
deviationStart = pix.length + 1;
|
|
1525
1552
|
} else if (direct === "prettier") {
|
|
1526
|
-
const prettier = window.prettier ||
|
|
1553
|
+
const prettier = window.prettier || configOption.editorExtensions.prettier.prettierInstance;
|
|
1527
1554
|
const prettierPlugins = [
|
|
1528
|
-
((
|
|
1555
|
+
((_a = window.prettierPlugins) == null ? void 0 : _a.markdown) || configOption.editorExtensions.prettier.parserMarkdownInstance
|
|
1529
1556
|
];
|
|
1530
1557
|
if (!prettier || prettierPlugins[0] === void 0) {
|
|
1531
1558
|
bus.emit(params.editorId, ERROR_CATCHER, {
|
|
@@ -3108,7 +3135,6 @@ const Editor = /* @__PURE__ */ defineComponent({
|
|
|
3108
3135
|
});
|
|
3109
3136
|
useExpose(props2, ctx, catalogVisible, setting, updateSetting, codeRef);
|
|
3110
3137
|
return () => {
|
|
3111
|
-
var _a;
|
|
3112
3138
|
const defToolbars = getSlot({
|
|
3113
3139
|
props: props2,
|
|
3114
3140
|
ctx
|
|
@@ -3121,7 +3147,7 @@ const Editor = /* @__PURE__ */ defineComponent({
|
|
|
3121
3147
|
"id": editorId,
|
|
3122
3148
|
"class": [prefix, props2.class, props2.theme === "dark" && `${prefix}-dark`, setting.fullscreen || setting.pageFullscreen ? `${prefix}-fullscreen` : ""],
|
|
3123
3149
|
"style": props2.style
|
|
3124
|
-
}, [createVNode(ToolBar, {
|
|
3150
|
+
}, [props2.toolbars.length > 0 && createVNode(ToolBar, {
|
|
3125
3151
|
"noPrettier": noPrettier,
|
|
3126
3152
|
"toolbars": props2.toolbars,
|
|
3127
3153
|
"toolbarsExclude": props2.toolbarsExclude,
|
|
@@ -3207,7 +3233,7 @@ const Editor = /* @__PURE__ */ defineComponent({
|
|
|
3207
3233
|
},
|
|
3208
3234
|
"sanitizeMermaid": props2.sanitizeMermaid,
|
|
3209
3235
|
"transformImgUrl": props2.transformImgUrl
|
|
3210
|
-
}, null),
|
|
3236
|
+
}, null), props2.footers.length > 0 && createVNode(Footer, {
|
|
3211
3237
|
"modelValue": props2.modelValue,
|
|
3212
3238
|
"footers": props2.footers,
|
|
3213
3239
|
"defFooters": defFooters,
|
package/lib/es/ModalToolbar.mjs
CHANGED
package/lib/es/chunks/config.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deepMerge } from "@vavt/util";
|
|
1
2
|
const prefix = "md-editor";
|
|
2
3
|
const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_rfu1p40qggh.js";
|
|
3
4
|
const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_rfu1p40qggh.css";
|
|
@@ -253,9 +254,178 @@ const codeCss = {
|
|
|
253
254
|
dark: `${cdnBase}/highlight.js/11.8.0/styles/stackoverflow-dark.min.css`
|
|
254
255
|
}
|
|
255
256
|
};
|
|
257
|
+
const editorExtensionsAttrs = {
|
|
258
|
+
highlight: {
|
|
259
|
+
js: {
|
|
260
|
+
integrity: "sha384-g4mRvs7AO0/Ol5LxcGyz4Doe21pVhGNnC3EQw5shw+z+aXDN86HqUdwXWO+Gz2zI",
|
|
261
|
+
crossOrigin: "anonymous"
|
|
262
|
+
},
|
|
263
|
+
css: {
|
|
264
|
+
a11y: {
|
|
265
|
+
light: {
|
|
266
|
+
integrity: "sha384-qdZDAN3jffvh670RHw1wxLekabidEFaNRninYgIzBvMbL6WlHdXeHS/Bt+vx33lN",
|
|
267
|
+
crossOrigin: "anonymous"
|
|
268
|
+
},
|
|
269
|
+
dark: {
|
|
270
|
+
integrity: "sha384-2QAAjX8pqaM5azX68KWI2wExF6Q13kY4kEiQFY4b/1zPe6rpgmTByNpDEllH3sb+",
|
|
271
|
+
crossOrigin: "anonymous"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
atom: {
|
|
275
|
+
light: {
|
|
276
|
+
integrity: "sha384-w6Ujm1VWa9HYFqGc89oAPn/DWDi2gUamjNrq9DRvEYm2X3ClItg9Y9xs1ViVo5b5",
|
|
277
|
+
crossOrigin: "anonymous"
|
|
278
|
+
},
|
|
279
|
+
dark: {
|
|
280
|
+
integrity: "sha384-oaMLBGEzBOJx3UHwac0cVndtX5fxGQIfnAeFZ35RTgqPcYlbprH9o9PUV/F8Le07",
|
|
281
|
+
crossOrigin: "anonymous"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
github: {
|
|
285
|
+
light: {
|
|
286
|
+
integrity: "sha384-eFTL69TLRZTkNfYZOLM+G04821K1qZao/4QLJbet1pP4tcF+fdXq/9CdqAbWRl/L",
|
|
287
|
+
crossOrigin: "anonymous"
|
|
288
|
+
},
|
|
289
|
+
dark: {
|
|
290
|
+
integrity: "sha384-wH75j6z1lH97ZOpMOInqhgKzFkAInZPPSPlZpYKYTOqsaizPvhQZmAtLcPKXpLyH",
|
|
291
|
+
crossOrigin: "anonymous"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
gradient: {
|
|
295
|
+
light: {
|
|
296
|
+
integrity: "sha384-yErHBR8aEZPxRl3XmR8dGSRAclMlnSRRw8sXQLcmPWzWUvb56BzQmBw3EWHl7QGI",
|
|
297
|
+
crossOrigin: "anonymous"
|
|
298
|
+
},
|
|
299
|
+
dark: {
|
|
300
|
+
integrity: "sha384-lUCvtSOdvDbp5hLWKgwz/taFu1HxlpqES2OVP5UG2JMTfnU481gXcBhGF9lAGoSr",
|
|
301
|
+
crossOrigin: "anonymous"
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
kimbie: {
|
|
305
|
+
light: {
|
|
306
|
+
integrity: "sha384-tloeSLUPczAvoZ48TUz+OxRie0oYLCRwlkadUXovGzzJEIbNQB2TkfUuvJ6SW5Mi",
|
|
307
|
+
crossOrigin: "anonymous"
|
|
308
|
+
},
|
|
309
|
+
dark: {
|
|
310
|
+
integrity: "sha384-o5F1vUaMNOmou1sQrsWiFo4/QUGSV0svqNZW+EesmKxWC8MpFJcveBhAyfvTHbGb",
|
|
311
|
+
crossOrigin: "anonymous"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
paraiso: {
|
|
315
|
+
light: {
|
|
316
|
+
integrity: "sha384-5j6QHU2Hwg1ehtlIQNDebhETDB8bga3/88hzBFsMRaGmgQHCftqIN7GZNDNw0vTL",
|
|
317
|
+
crossOrigin: "anonymous"
|
|
318
|
+
},
|
|
319
|
+
dark: {
|
|
320
|
+
integrity: "sha384-I5vnnMQu0LWDQnHpT61xyoMwKarAB8jpZkB2ioFOlmzUFnIFaV4QbUwlBBOMKhTH",
|
|
321
|
+
crossOrigin: "anonymous"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
qtcreator: {
|
|
325
|
+
light: {
|
|
326
|
+
integrity: "sha384-iEBgHrwi8Hv4dSZBz+MOGvS05rF7I7fGKM2fASQyE9jn2Istg9Qd5dSoK18WyRTB",
|
|
327
|
+
crossOrigin: "anonymous"
|
|
328
|
+
},
|
|
329
|
+
dark: {
|
|
330
|
+
integrity: "sha384-D6LXJGWNR4QV7gnpuP3ccbvOYoR02td3cU0y7lESABPg/tzCSC4m+y+M2TtrmpHc",
|
|
331
|
+
crossOrigin: "anonymous"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
stackoverflow: {
|
|
335
|
+
light: {
|
|
336
|
+
integrity: "sha384-FMwt7cTGo4aLxZnno5k0xTj0W4gmi48Kwept+y/oQmE6cFk36Kr+QJZOKNOQwORe",
|
|
337
|
+
crossOrigin: "anonymous"
|
|
338
|
+
},
|
|
339
|
+
dark: {
|
|
340
|
+
integrity: "sha384-iL+x+BroCyHm/p2c6sMA9umXhdCWp2cKe4QUjPeMzHgwXAk+ZxHyIGP3NZTZensU",
|
|
341
|
+
crossOrigin: "anonymous"
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
prettier: {
|
|
347
|
+
standaloneJs: {
|
|
348
|
+
integrity: "sha384-cBKW1A8TbwohtSsrm+VWpXevI1PWdPmUrozwqTw7aS51JIhz9IvgHHa/bV6icWeL",
|
|
349
|
+
crossOrigin: "anonymous"
|
|
350
|
+
},
|
|
351
|
+
parserMarkdownJs: {
|
|
352
|
+
integrity: "sha384-kXeeC2HiA6n3rpvz0MOjB7yZo9QjvYNAMihonwR5fdTOFs/rm/Bm3Xg8cOSE4900",
|
|
353
|
+
crossOrigin: "anonymous"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
cropper: {
|
|
357
|
+
js: {
|
|
358
|
+
integrity: "sha384-r+ljwOAhwY4/kdyzMnuBg7MEVoWpTMp5EYUDntB/E9qzNwL9dAEcNrb2XaV+mJc2",
|
|
359
|
+
crossOrigin: "anonymous"
|
|
360
|
+
},
|
|
361
|
+
css: {
|
|
362
|
+
integrity: "sha384-oMy41mb/qJnpJlpXOF57hSu2KGi47l/UV9+tPNrBOs7/ap5Vubj/3phrCtjutHMQ",
|
|
363
|
+
crossOrigin: "anonymous"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
iconfont: {
|
|
367
|
+
integrity: "sha384-re+xpK8m5zCba6cD67TTpnI2Exr9m2LkD1LyD0wsKnETw00YWUOFOpuoPLrRDlgF",
|
|
368
|
+
crossOrigin: "anonymous"
|
|
369
|
+
},
|
|
370
|
+
iconfontClass: {
|
|
371
|
+
integrity: "sha384-aM5RSsvQjertneee/Ntz1poyGMo3kWmIhBciGBibd5+pnaXBlZoMkLO4StM7tH10",
|
|
372
|
+
crossOrigin: "anonymous"
|
|
373
|
+
},
|
|
374
|
+
screenfull: {
|
|
375
|
+
js: {
|
|
376
|
+
integrity: "sha384-ELVAm9p9T4LGCG4lz8hbYalUYAppIpI1zV8IXYDCBUJFiVnV+EeG8vGSYQi+Wi4S",
|
|
377
|
+
crossOrigin: "anonymous"
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
mermaid: {
|
|
381
|
+
js: {
|
|
382
|
+
integrity: "sha384-zmipzuFBFDAekHS2uY4mN5cvpcSvgUi3aMjMJ2xnVRsU2kDHBtqLOJRnianHJeP1",
|
|
383
|
+
crossOrigin: "anonymous"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
katex: {
|
|
387
|
+
js: {
|
|
388
|
+
integrity: "sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8",
|
|
389
|
+
crossOrigin: "anonymous"
|
|
390
|
+
},
|
|
391
|
+
css: {
|
|
392
|
+
integrity: "sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV",
|
|
393
|
+
crossOrigin: "anonymous"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
};
|
|
256
397
|
const configOption = {
|
|
257
|
-
editorExtensions: {
|
|
258
|
-
|
|
398
|
+
editorExtensions: {
|
|
399
|
+
highlight: {
|
|
400
|
+
js: highlightUrl,
|
|
401
|
+
css: codeCss
|
|
402
|
+
},
|
|
403
|
+
prettier: {
|
|
404
|
+
standaloneJs: prettierUrl.main,
|
|
405
|
+
parserMarkdownJs: prettierUrl.markdown
|
|
406
|
+
},
|
|
407
|
+
cropper: {
|
|
408
|
+
...cropperUrl
|
|
409
|
+
},
|
|
410
|
+
iconfont: iconfontSvgUrl,
|
|
411
|
+
iconfontClass: iconfontClassUrl,
|
|
412
|
+
screenfull: {
|
|
413
|
+
js: screenfullUrl
|
|
414
|
+
},
|
|
415
|
+
mermaid: {
|
|
416
|
+
js: mermaidUrl
|
|
417
|
+
},
|
|
418
|
+
katex: {
|
|
419
|
+
...katexUrl
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
editorExtensionsAttrs: {},
|
|
423
|
+
editorConfig: {
|
|
424
|
+
languageUserDefined: {},
|
|
425
|
+
mermaidTemplate: {},
|
|
426
|
+
renderDelay: 500,
|
|
427
|
+
zIndex: 2e4
|
|
428
|
+
},
|
|
259
429
|
codeMirrorExtensions: (_theme, innerExtensions) => innerExtensions,
|
|
260
430
|
markdownItConfig: () => {
|
|
261
431
|
},
|
|
@@ -264,14 +434,7 @@ const configOption = {
|
|
|
264
434
|
mermaidConfig: (c) => c
|
|
265
435
|
};
|
|
266
436
|
const config = (option) => {
|
|
267
|
-
|
|
268
|
-
for (const key in option) {
|
|
269
|
-
const optionItem = option[key];
|
|
270
|
-
if (optionItem) {
|
|
271
|
-
configOption[key] = optionItem;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
437
|
+
return deepMerge(configOption, option);
|
|
275
438
|
};
|
|
276
439
|
const MinInputBoxWidth = 170;
|
|
277
440
|
export {
|
|
@@ -280,15 +443,10 @@ export {
|
|
|
280
443
|
allToolbar as b,
|
|
281
444
|
config as c,
|
|
282
445
|
allFooter as d,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
highlightUrl as h,
|
|
446
|
+
editorExtensionsAttrs as e,
|
|
447
|
+
configOption as f,
|
|
448
|
+
codeCss as g,
|
|
287
449
|
iconfontClassUrl as i,
|
|
288
|
-
cropperUrl as j,
|
|
289
|
-
katexUrl as k,
|
|
290
|
-
screenfullUrl as l,
|
|
291
|
-
mermaidUrl as m,
|
|
292
450
|
prefix as p,
|
|
293
451
|
staticTextDefault as s
|
|
294
452
|
};
|
package/lib/es/chunks/dom.mjs
CHANGED
|
@@ -52,14 +52,23 @@ const appendHandler = (ele, checkKey = "") => {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
const updateHandler = debounce((
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
55
|
+
const updateHandler = debounce((ele) => {
|
|
56
|
+
const insertedEle = document.getElementById(ele.id);
|
|
57
|
+
insertedEle == null ? void 0 : insertedEle.remove();
|
|
58
|
+
appendHandler(ele);
|
|
60
59
|
}, 10);
|
|
60
|
+
const createHTMLElement = (tagName, attributes) => {
|
|
61
|
+
const element = document.createElement(tagName);
|
|
62
|
+
Object.keys(attributes).forEach((key) => {
|
|
63
|
+
if (attributes[key] !== void 0) {
|
|
64
|
+
element[key] = attributes[key];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return element;
|
|
68
|
+
};
|
|
61
69
|
export {
|
|
62
70
|
appendHandler as a,
|
|
71
|
+
createHTMLElement as c,
|
|
63
72
|
keyMove as k,
|
|
64
73
|
updateHandler as u
|
|
65
74
|
};
|