md-editor-v3 4.17.4 → 4.18.0-1
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 +1 -1
- package/lib/cjs/MdEditor.cjs +12 -0
- package/lib/cjs/chunks/event-name.cjs +2 -0
- package/lib/cjs/chunks/index.cjs +78 -11
- package/lib/es/MdEditor.mjs +13 -1
- package/lib/es/chunks/event-name.mjs +2 -0
- package/lib/es/chunks/index.mjs +80 -13
- package/lib/types/MdEditor/Editor.d.ts +6 -6
- package/lib/types/MdEditor/index.d.ts +12 -12
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +9 -0
- package/lib/types/MdEditor/layouts/Content/composition/index.d.ts +1 -0
- package/lib/types/MdEditor/layouts/Content/composition/useTaskState.d.ts +3 -0
- package/lib/types/MdEditor/layouts/Content/index.d.ts +8 -8
- package/lib/types/MdEditor/layouts/Content/props.d.ts +8 -4
- package/lib/types/MdEditor/props.d.ts +12 -6
- package/lib/types/MdEditor/static/event-name.d.ts +1 -0
- package/lib/types/MdPreview/MdPreview.d.ts +6 -0
- package/lib/types/MdPreview/index.d.ts +12 -0
- package/lib/umd/index.js +32 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -309,6 +309,7 @@ export interface StaticTextDefaultValue {
|
|
|
309
309
|
|
|
310
310
|
| name | type | description |
|
|
311
311
|
| --- | --- | --- |
|
|
312
|
+
| onChange | `value: string` | Content changed(bind to `oninput` of `textarea`) |
|
|
312
313
|
| onHtmlChanged | `html: string` | Compile markdown successful event, you can use it to get the html code |
|
|
313
314
|
| onGetCatalog | `list: Array<HeadList>` | Get catalog of article |
|
|
314
315
|
|
|
@@ -318,7 +319,6 @@ Except for the same as `MdPreview`:
|
|
|
318
319
|
|
|
319
320
|
| name | type | description |
|
|
320
321
|
| --- | --- | --- |
|
|
321
|
-
| onChange | `value: string` | Content changed(bind to `oninput` of `textarea`) |
|
|
322
322
|
| onSave | `value: string, html: Promise<string>` | Saving content, `ctrl+s` and clicking button will trigger it |
|
|
323
323
|
| onUploadImg | `files: Array<File>, callback: (urls: string[] \| { url: string; alt: string; title: string }[]) => void` | Uploading picture, when picture is uploading the modal will not close, please provide right urls to the callback function |
|
|
324
324
|
| onError | `err: { name: 'Cropper' \| 'fullscreen' \| 'prettier' \| 'overlength'; message: string }` | Catch run-time error, `Cropper`, `fullscreen` and `prettier` are used when they are not loaded. And content exceeds the length limit error |
|
package/lib/cjs/MdEditor.cjs
CHANGED
|
@@ -2776,6 +2776,17 @@ const useCodeMirror = (props2) => {
|
|
|
2776
2776
|
});
|
|
2777
2777
|
})
|
|
2778
2778
|
});
|
|
2779
|
+
eventName.bus.on(editorId, {
|
|
2780
|
+
name: eventName.TASK_STATE_CHANGED,
|
|
2781
|
+
callback: (lineNumber, value) => {
|
|
2782
|
+
const line = view2.state.doc.line(lineNumber);
|
|
2783
|
+
view2.dispatch(
|
|
2784
|
+
view2.state.update({
|
|
2785
|
+
changes: { from: line.from, to: line.to, insert: value }
|
|
2786
|
+
})
|
|
2787
|
+
);
|
|
2788
|
+
}
|
|
2789
|
+
});
|
|
2779
2790
|
});
|
|
2780
2791
|
vue.watch(
|
|
2781
2792
|
theme,
|
|
@@ -2980,6 +2991,7 @@ const Content = /* @__PURE__ */ vue.defineComponent({
|
|
|
2980
2991
|
"ref": resizeRef
|
|
2981
2992
|
}, null), vue.createVNode(MdPreview.ContentPreview, {
|
|
2982
2993
|
"modelValue": props2.modelValue,
|
|
2994
|
+
"onChange": props2.onChange,
|
|
2983
2995
|
"setting": props2.setting,
|
|
2984
2996
|
"onHtmlChanged": (html_) => {
|
|
2985
2997
|
html.value = html_;
|
|
@@ -72,6 +72,7 @@ const CATALOG_CHANGED = "catalogChanged";
|
|
|
72
72
|
const PUSH_CATALOG = "pushCatalog";
|
|
73
73
|
const RERENDER = "rerender";
|
|
74
74
|
const EVENT_LISTENER = "eventListener";
|
|
75
|
+
const TASK_STATE_CHANGED = "taskStateChanged";
|
|
75
76
|
exports.BUILD_FINISHED = BUILD_FINISHED;
|
|
76
77
|
exports.CATALOG_CHANGED = CATALOG_CHANGED;
|
|
77
78
|
exports.CATALOG_VISIBLE_CHANGED = CATALOG_VISIBLE_CHANGED;
|
|
@@ -91,5 +92,6 @@ exports.PREVIEW_ONLY_CHANGED = PREVIEW_ONLY_CHANGED;
|
|
|
91
92
|
exports.PUSH_CATALOG = PUSH_CATALOG;
|
|
92
93
|
exports.REPLACE = REPLACE;
|
|
93
94
|
exports.RERENDER = RERENDER;
|
|
95
|
+
exports.TASK_STATE_CHANGED = TASK_STATE_CHANGED;
|
|
94
96
|
exports.UPLOAD_IMAGE = UPLOAD_IMAGE;
|
|
95
97
|
exports.bus = bus;
|
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -2207,11 +2207,76 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2207
2207
|
return { html, key };
|
|
2208
2208
|
};
|
|
2209
2209
|
const useMarkdownIt$1 = useMarkdownIt;
|
|
2210
|
+
const template = {
|
|
2211
|
+
checked: {
|
|
2212
|
+
regexp: /- \[x\]/,
|
|
2213
|
+
value: "- [ ]"
|
|
2214
|
+
},
|
|
2215
|
+
unChecked: {
|
|
2216
|
+
regexp: /- \[\s\]/,
|
|
2217
|
+
value: "- [x]"
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
const useTaskState = (props, html) => {
|
|
2221
|
+
const editorId = vue.inject("editorId");
|
|
2222
|
+
let removeListener = () => {
|
|
2223
|
+
};
|
|
2224
|
+
const addListener = () => {
|
|
2225
|
+
const tasks = document.querySelectorAll(`#${editorId} .task-list-item.enabled`);
|
|
2226
|
+
const listener = (e) => {
|
|
2227
|
+
var _a;
|
|
2228
|
+
e.preventDefault();
|
|
2229
|
+
const nextValue = e.target.checked ? "unChecked" : "checked";
|
|
2230
|
+
const line = (_a = e.target.parentElement) == null ? void 0 : _a.dataset.line;
|
|
2231
|
+
if (!line) {
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
const lineNumber = Number(line);
|
|
2235
|
+
const lines = props.modelValue.split("\n");
|
|
2236
|
+
const targetValue = lines[Number(lineNumber)].replace(
|
|
2237
|
+
template[nextValue].regexp,
|
|
2238
|
+
template[nextValue].value
|
|
2239
|
+
);
|
|
2240
|
+
if (props.previewOnly) {
|
|
2241
|
+
lines[Number(lineNumber)] = targetValue;
|
|
2242
|
+
props.onChange(lines.join("\n"));
|
|
2243
|
+
} else {
|
|
2244
|
+
eventName.bus.emit(editorId, eventName.TASK_STATE_CHANGED, lineNumber + 1, targetValue);
|
|
2245
|
+
}
|
|
2246
|
+
};
|
|
2247
|
+
tasks.forEach((item) => {
|
|
2248
|
+
item.addEventListener("click", listener);
|
|
2249
|
+
});
|
|
2250
|
+
removeListener = () => {
|
|
2251
|
+
tasks.forEach((item) => {
|
|
2252
|
+
item.removeEventListener("click", listener);
|
|
2253
|
+
});
|
|
2254
|
+
};
|
|
2255
|
+
};
|
|
2256
|
+
vue.onBeforeUnmount(() => {
|
|
2257
|
+
removeListener();
|
|
2258
|
+
});
|
|
2259
|
+
vue.watch(
|
|
2260
|
+
[html],
|
|
2261
|
+
() => {
|
|
2262
|
+
removeListener();
|
|
2263
|
+
vue.nextTick(addListener);
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
immediate: true
|
|
2267
|
+
}
|
|
2268
|
+
);
|
|
2269
|
+
};
|
|
2210
2270
|
const contentPreviewProps = {
|
|
2211
2271
|
modelValue: {
|
|
2212
2272
|
type: String,
|
|
2213
2273
|
default: ""
|
|
2214
2274
|
},
|
|
2275
|
+
onChange: {
|
|
2276
|
+
type: Function,
|
|
2277
|
+
default: () => {
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2215
2280
|
setting: {
|
|
2216
2281
|
type: Object,
|
|
2217
2282
|
default: () => ({ preview: true })
|
|
@@ -2275,11 +2340,6 @@ const contentProps = {
|
|
|
2275
2340
|
default: () => {
|
|
2276
2341
|
}
|
|
2277
2342
|
},
|
|
2278
|
-
onChange: {
|
|
2279
|
-
type: Function,
|
|
2280
|
-
default: () => {
|
|
2281
|
-
}
|
|
2282
|
-
},
|
|
2283
2343
|
placeholder: {
|
|
2284
2344
|
type: String,
|
|
2285
2345
|
default: ""
|
|
@@ -2363,6 +2423,7 @@ const ContentPreview = /* @__PURE__ */ vue.defineComponent({
|
|
|
2363
2423
|
} = useMarkdownIt$1(props, props.previewOnly);
|
|
2364
2424
|
useCopyCode(props, html, key);
|
|
2365
2425
|
userZoom(props, html);
|
|
2426
|
+
useTaskState(props, html);
|
|
2366
2427
|
return () => {
|
|
2367
2428
|
return vue.createVNode(vue.Fragment, null, [props.setting.preview && vue.createVNode("div", {
|
|
2368
2429
|
"id": `${editorId}-preview-wrapper`,
|
|
@@ -2817,6 +2878,12 @@ const mdPreviewProps = {
|
|
|
2817
2878
|
type: String,
|
|
2818
2879
|
default: ""
|
|
2819
2880
|
},
|
|
2881
|
+
/**
|
|
2882
|
+
* input回调事件
|
|
2883
|
+
*/
|
|
2884
|
+
onChange: {
|
|
2885
|
+
type: Function
|
|
2886
|
+
},
|
|
2820
2887
|
/**
|
|
2821
2888
|
* 主题,支持light和dark
|
|
2822
2889
|
*
|
|
@@ -3017,12 +3084,6 @@ const mdPreviewProps = {
|
|
|
3017
3084
|
};
|
|
3018
3085
|
const editorProps = {
|
|
3019
3086
|
...mdPreviewProps,
|
|
3020
|
-
/**
|
|
3021
|
-
* input回调事件
|
|
3022
|
-
*/
|
|
3023
|
-
onChange: {
|
|
3024
|
-
type: Function
|
|
3025
|
-
},
|
|
3026
3087
|
/**
|
|
3027
3088
|
* input回调事件
|
|
3028
3089
|
*/
|
|
@@ -3326,6 +3387,12 @@ const MdPreview = /* @__PURE__ */ vue.defineComponent({
|
|
|
3326
3387
|
"style": props.style
|
|
3327
3388
|
}, [vue.createVNode(ContentPreview, {
|
|
3328
3389
|
"modelValue": props.modelValue,
|
|
3390
|
+
"onChange": (value) => {
|
|
3391
|
+
if (props.onChange) {
|
|
3392
|
+
props.onChange(value);
|
|
3393
|
+
}
|
|
3394
|
+
ctx.emit("onChange", value);
|
|
3395
|
+
},
|
|
3329
3396
|
"onHtmlChanged": (html) => {
|
|
3330
3397
|
if (props.onHtmlChanged) {
|
|
3331
3398
|
props.onHtmlChanged(html);
|
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { defineComponent, createVNode, inject, ref, onMounted, reactive, watch,
|
|
|
8
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, a as CHANGE_FULL_SCREEN, E as ERROR_CATCHER, U as UPLOAD_IMAGE, O as OPEN_MODALS, R as REPLACE, c as CHANGE_CATALOG_VISIBLE, d as ON_SAVE, e as CTRL_SHIFT_Z, f as CTRL_Z, g as EVENT_LISTENER } from "./chunks/event-name.mjs";
|
|
11
|
+
import { b as bus, a as CHANGE_FULL_SCREEN, E as ERROR_CATCHER, U as UPLOAD_IMAGE, O as OPEN_MODALS, R as REPLACE, c as CHANGE_CATALOG_VISIBLE, d as ON_SAVE, e as CTRL_SHIFT_Z, f as CTRL_Z, g as EVENT_LISTENER, T as TASK_STATE_CHANGED } from "./chunks/event-name.mjs";
|
|
12
12
|
import { a as appendHandler } from "./chunks/dom.mjs";
|
|
13
13
|
import { M as MdModal, I as Icon } from "./chunks/index3.mjs";
|
|
14
14
|
import { b as base642File } from "./chunks/index4.mjs";
|
|
@@ -2775,6 +2775,17 @@ const useCodeMirror = (props2) => {
|
|
|
2775
2775
|
});
|
|
2776
2776
|
})
|
|
2777
2777
|
});
|
|
2778
|
+
bus.on(editorId, {
|
|
2779
|
+
name: TASK_STATE_CHANGED,
|
|
2780
|
+
callback: (lineNumber, value) => {
|
|
2781
|
+
const line = view.state.doc.line(lineNumber);
|
|
2782
|
+
view.dispatch(
|
|
2783
|
+
view.state.update({
|
|
2784
|
+
changes: { from: line.from, to: line.to, insert: value }
|
|
2785
|
+
})
|
|
2786
|
+
);
|
|
2787
|
+
}
|
|
2788
|
+
});
|
|
2778
2789
|
});
|
|
2779
2790
|
watch(
|
|
2780
2791
|
theme,
|
|
@@ -2979,6 +2990,7 @@ const Content = /* @__PURE__ */ defineComponent({
|
|
|
2979
2990
|
"ref": resizeRef
|
|
2980
2991
|
}, null), createVNode(ContentPreview, {
|
|
2981
2992
|
"modelValue": props2.modelValue,
|
|
2993
|
+
"onChange": props2.onChange,
|
|
2982
2994
|
"setting": props2.setting,
|
|
2983
2995
|
"onHtmlChanged": (html_) => {
|
|
2984
2996
|
html.value = html_;
|
|
@@ -71,6 +71,7 @@ const CATALOG_CHANGED = "catalogChanged";
|
|
|
71
71
|
const PUSH_CATALOG = "pushCatalog";
|
|
72
72
|
const RERENDER = "rerender";
|
|
73
73
|
const EVENT_LISTENER = "eventListener";
|
|
74
|
+
const TASK_STATE_CHANGED = "taskStateChanged";
|
|
74
75
|
export {
|
|
75
76
|
BUILD_FINISHED as B,
|
|
76
77
|
CATALOG_CHANGED as C,
|
|
@@ -80,6 +81,7 @@ export {
|
|
|
80
81
|
OPEN_MODALS as O,
|
|
81
82
|
PUSH_CATALOG as P,
|
|
82
83
|
REPLACE as R,
|
|
84
|
+
TASK_STATE_CHANGED as T,
|
|
83
85
|
UPLOAD_IMAGE as U,
|
|
84
86
|
CHANGE_FULL_SCREEN as a,
|
|
85
87
|
bus as b,
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inject, onMounted, watch, toRef, nextTick, shallowRef, ref, computed, defineComponent, createVNode, Fragment, reactive, provide
|
|
1
|
+
import { inject, onMounted, watch, toRef, nextTick, shallowRef, ref, computed, onBeforeUnmount, defineComponent, createVNode, Fragment, reactive, provide } from "vue";
|
|
2
2
|
import { p as prefix, f as configOption, g as codeCss, s as staticTextDefault, b as allToolbar, d as allFooter } from "./config.mjs";
|
|
3
|
-
import { b as bus, C as CATALOG_CHANGED, P as PUSH_CATALOG, h as RERENDER, B as BUILD_FINISHED, d as ON_SAVE, E as ERROR_CATCHER, U as UPLOAD_IMAGE, c as CHANGE_CATALOG_VISIBLE, i as PAGE_FULL_SCREEN_CHANGED, F as FULL_SCREEN_CHANGED, j as PREVIEW_CHANGED, k as PREVIEW_ONLY_CHANGED, H as HTML_PREVIEW_CHANGED, l as CATALOG_VISIBLE_CHANGED, R as REPLACE, a as CHANGE_FULL_SCREEN, g as EVENT_LISTENER } from "./event-name.mjs";
|
|
3
|
+
import { b as bus, C as CATALOG_CHANGED, P as PUSH_CATALOG, h as RERENDER, B as BUILD_FINISHED, T as TASK_STATE_CHANGED, d as ON_SAVE, E as ERROR_CATCHER, U as UPLOAD_IMAGE, c as CHANGE_CATALOG_VISIBLE, i as PAGE_FULL_SCREEN_CHANGED, F as FULL_SCREEN_CHANGED, j as PREVIEW_CHANGED, k as PREVIEW_ONLY_CHANGED, H as HTML_PREVIEW_CHANGED, l as CATALOG_VISIBLE_CHANGED, R as REPLACE, a as CHANGE_FULL_SCREEN, g as EVENT_LISTENER } from "./event-name.mjs";
|
|
4
4
|
import { a as appendHandler, u as updateHandler } from "./dom.mjs";
|
|
5
5
|
import { debounce, uuid, deepMerge, deepClone } from "@vavt/util";
|
|
6
6
|
import mediumZoom from "medium-zoom";
|
|
@@ -2206,11 +2206,76 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2206
2206
|
return { html, key };
|
|
2207
2207
|
};
|
|
2208
2208
|
const useMarkdownIt$1 = useMarkdownIt;
|
|
2209
|
+
const template = {
|
|
2210
|
+
checked: {
|
|
2211
|
+
regexp: /- \[x\]/,
|
|
2212
|
+
value: "- [ ]"
|
|
2213
|
+
},
|
|
2214
|
+
unChecked: {
|
|
2215
|
+
regexp: /- \[\s\]/,
|
|
2216
|
+
value: "- [x]"
|
|
2217
|
+
}
|
|
2218
|
+
};
|
|
2219
|
+
const useTaskState = (props, html) => {
|
|
2220
|
+
const editorId = inject("editorId");
|
|
2221
|
+
let removeListener = () => {
|
|
2222
|
+
};
|
|
2223
|
+
const addListener = () => {
|
|
2224
|
+
const tasks = document.querySelectorAll(`#${editorId} .task-list-item.enabled`);
|
|
2225
|
+
const listener = (e) => {
|
|
2226
|
+
var _a;
|
|
2227
|
+
e.preventDefault();
|
|
2228
|
+
const nextValue = e.target.checked ? "unChecked" : "checked";
|
|
2229
|
+
const line = (_a = e.target.parentElement) == null ? void 0 : _a.dataset.line;
|
|
2230
|
+
if (!line) {
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
const lineNumber = Number(line);
|
|
2234
|
+
const lines = props.modelValue.split("\n");
|
|
2235
|
+
const targetValue = lines[Number(lineNumber)].replace(
|
|
2236
|
+
template[nextValue].regexp,
|
|
2237
|
+
template[nextValue].value
|
|
2238
|
+
);
|
|
2239
|
+
if (props.previewOnly) {
|
|
2240
|
+
lines[Number(lineNumber)] = targetValue;
|
|
2241
|
+
props.onChange(lines.join("\n"));
|
|
2242
|
+
} else {
|
|
2243
|
+
bus.emit(editorId, TASK_STATE_CHANGED, lineNumber + 1, targetValue);
|
|
2244
|
+
}
|
|
2245
|
+
};
|
|
2246
|
+
tasks.forEach((item) => {
|
|
2247
|
+
item.addEventListener("click", listener);
|
|
2248
|
+
});
|
|
2249
|
+
removeListener = () => {
|
|
2250
|
+
tasks.forEach((item) => {
|
|
2251
|
+
item.removeEventListener("click", listener);
|
|
2252
|
+
});
|
|
2253
|
+
};
|
|
2254
|
+
};
|
|
2255
|
+
onBeforeUnmount(() => {
|
|
2256
|
+
removeListener();
|
|
2257
|
+
});
|
|
2258
|
+
watch(
|
|
2259
|
+
[html],
|
|
2260
|
+
() => {
|
|
2261
|
+
removeListener();
|
|
2262
|
+
nextTick(addListener);
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
immediate: true
|
|
2266
|
+
}
|
|
2267
|
+
);
|
|
2268
|
+
};
|
|
2209
2269
|
const contentPreviewProps = {
|
|
2210
2270
|
modelValue: {
|
|
2211
2271
|
type: String,
|
|
2212
2272
|
default: ""
|
|
2213
2273
|
},
|
|
2274
|
+
onChange: {
|
|
2275
|
+
type: Function,
|
|
2276
|
+
default: () => {
|
|
2277
|
+
}
|
|
2278
|
+
},
|
|
2214
2279
|
setting: {
|
|
2215
2280
|
type: Object,
|
|
2216
2281
|
default: () => ({ preview: true })
|
|
@@ -2274,11 +2339,6 @@ const contentProps = {
|
|
|
2274
2339
|
default: () => {
|
|
2275
2340
|
}
|
|
2276
2341
|
},
|
|
2277
|
-
onChange: {
|
|
2278
|
-
type: Function,
|
|
2279
|
-
default: () => {
|
|
2280
|
-
}
|
|
2281
|
-
},
|
|
2282
2342
|
placeholder: {
|
|
2283
2343
|
type: String,
|
|
2284
2344
|
default: ""
|
|
@@ -2362,6 +2422,7 @@ const ContentPreview = /* @__PURE__ */ defineComponent({
|
|
|
2362
2422
|
} = useMarkdownIt$1(props, props.previewOnly);
|
|
2363
2423
|
useCopyCode(props, html, key);
|
|
2364
2424
|
userZoom(props, html);
|
|
2425
|
+
useTaskState(props, html);
|
|
2365
2426
|
return () => {
|
|
2366
2427
|
return createVNode(Fragment, null, [props.setting.preview && createVNode("div", {
|
|
2367
2428
|
"id": `${editorId}-preview-wrapper`,
|
|
@@ -2816,6 +2877,12 @@ const mdPreviewProps = {
|
|
|
2816
2877
|
type: String,
|
|
2817
2878
|
default: ""
|
|
2818
2879
|
},
|
|
2880
|
+
/**
|
|
2881
|
+
* input回调事件
|
|
2882
|
+
*/
|
|
2883
|
+
onChange: {
|
|
2884
|
+
type: Function
|
|
2885
|
+
},
|
|
2819
2886
|
/**
|
|
2820
2887
|
* 主题,支持light和dark
|
|
2821
2888
|
*
|
|
@@ -3016,12 +3083,6 @@ const mdPreviewProps = {
|
|
|
3016
3083
|
};
|
|
3017
3084
|
const editorProps = {
|
|
3018
3085
|
...mdPreviewProps,
|
|
3019
|
-
/**
|
|
3020
|
-
* input回调事件
|
|
3021
|
-
*/
|
|
3022
|
-
onChange: {
|
|
3023
|
-
type: Function
|
|
3024
|
-
},
|
|
3025
3086
|
/**
|
|
3026
3087
|
* input回调事件
|
|
3027
3088
|
*/
|
|
@@ -3325,6 +3386,12 @@ const MdPreview = /* @__PURE__ */ defineComponent({
|
|
|
3325
3386
|
"style": props.style
|
|
3326
3387
|
}, [createVNode(ContentPreview, {
|
|
3327
3388
|
"modelValue": props.modelValue,
|
|
3389
|
+
"onChange": (value) => {
|
|
3390
|
+
if (props.onChange) {
|
|
3391
|
+
props.onChange(value);
|
|
3392
|
+
}
|
|
3393
|
+
ctx.emit("onChange", value);
|
|
3394
|
+
},
|
|
3328
3395
|
"onHtmlChanged": (html) => {
|
|
3329
3396
|
if (props.onHtmlChanged) {
|
|
3330
3397
|
props.onHtmlChanged(html);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const Editor: import("vue").DefineComponent<{
|
|
2
|
-
onChange: {
|
|
3
|
-
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
4
|
-
};
|
|
5
2
|
onSave: {
|
|
6
3
|
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
7
4
|
};
|
|
@@ -116,6 +113,9 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
116
113
|
type: import("vue").PropType<string>;
|
|
117
114
|
default: string;
|
|
118
115
|
};
|
|
116
|
+
onChange: {
|
|
117
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
118
|
+
};
|
|
119
119
|
theme: {
|
|
120
120
|
type: import("vue").PropType<import("./type").Themes>;
|
|
121
121
|
default: string;
|
|
@@ -210,9 +210,6 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
210
210
|
default: number;
|
|
211
211
|
};
|
|
212
212
|
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("./type").EditorEmits, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue" | "onBlur" | "onFocus" | "onInput" | "onDrop" | "onInputBoxWitdhChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
213
|
-
onChange: {
|
|
214
|
-
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
215
|
-
};
|
|
216
213
|
onSave: {
|
|
217
214
|
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
218
215
|
};
|
|
@@ -327,6 +324,9 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
327
324
|
type: import("vue").PropType<string>;
|
|
328
325
|
default: string;
|
|
329
326
|
};
|
|
327
|
+
onChange: {
|
|
328
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
329
|
+
};
|
|
330
330
|
theme: {
|
|
331
331
|
type: import("vue").PropType<import("./type").Themes>;
|
|
332
332
|
default: string;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
|
|
4
|
-
onChange: {
|
|
5
|
-
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
6
|
-
};
|
|
7
4
|
onSave: {
|
|
8
5
|
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
9
6
|
};
|
|
@@ -118,6 +115,9 @@ declare const _default: {
|
|
|
118
115
|
type: import("vue").PropType<string>;
|
|
119
116
|
default: string;
|
|
120
117
|
};
|
|
118
|
+
onChange: {
|
|
119
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
120
|
+
};
|
|
121
121
|
theme: {
|
|
122
122
|
type: import("vue").PropType<import("./type").Themes>;
|
|
123
123
|
default: string;
|
|
@@ -225,9 +225,6 @@ declare const _default: {
|
|
|
225
225
|
onOnDrop?: ((...args: any[]) => any) | undefined;
|
|
226
226
|
onOnInputBoxWitdhChange?: ((...args: any[]) => any) | undefined;
|
|
227
227
|
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("./type").EditorEmits, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
228
|
-
onChange: {
|
|
229
|
-
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
230
|
-
};
|
|
231
228
|
onSave: {
|
|
232
229
|
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
233
230
|
};
|
|
@@ -342,6 +339,9 @@ declare const _default: {
|
|
|
342
339
|
type: import("vue").PropType<string>;
|
|
343
340
|
default: string;
|
|
344
341
|
};
|
|
342
|
+
onChange: {
|
|
343
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
344
|
+
};
|
|
345
345
|
theme: {
|
|
346
346
|
type: import("vue").PropType<import("./type").Themes>;
|
|
347
347
|
default: string;
|
|
@@ -492,9 +492,6 @@ declare const _default: {
|
|
|
492
492
|
M: {};
|
|
493
493
|
Defaults: {};
|
|
494
494
|
}, Readonly<import("vue").ExtractPropTypes<{
|
|
495
|
-
onChange: {
|
|
496
|
-
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
497
|
-
};
|
|
498
495
|
onSave: {
|
|
499
496
|
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
500
497
|
};
|
|
@@ -609,6 +606,9 @@ declare const _default: {
|
|
|
609
606
|
type: import("vue").PropType<string>;
|
|
610
607
|
default: string;
|
|
611
608
|
};
|
|
609
|
+
onChange: {
|
|
610
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
611
|
+
};
|
|
612
612
|
theme: {
|
|
613
613
|
type: import("vue").PropType<import("./type").Themes>;
|
|
614
614
|
default: string;
|
|
@@ -756,9 +756,6 @@ declare const _default: {
|
|
|
756
756
|
__isTeleport?: undefined;
|
|
757
757
|
__isSuspense?: undefined;
|
|
758
758
|
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
759
|
-
onChange: {
|
|
760
|
-
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
761
|
-
};
|
|
762
759
|
onSave: {
|
|
763
760
|
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
764
761
|
};
|
|
@@ -873,6 +870,9 @@ declare const _default: {
|
|
|
873
870
|
type: import("vue").PropType<string>;
|
|
874
871
|
default: string;
|
|
875
872
|
};
|
|
873
|
+
onChange: {
|
|
874
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
875
|
+
};
|
|
876
876
|
theme: {
|
|
877
877
|
type: import("vue").PropType<import("./type").Themes>;
|
|
878
878
|
default: string;
|
|
@@ -7,6 +7,10 @@ declare const ContentPreview: import("vue").DefineComponent<{
|
|
|
7
7
|
type: import("vue").PropType<string>;
|
|
8
8
|
default: string;
|
|
9
9
|
};
|
|
10
|
+
onChange: {
|
|
11
|
+
type: import("vue").PropType<(v: string) => void>;
|
|
12
|
+
default: () => void;
|
|
13
|
+
};
|
|
10
14
|
setting: {
|
|
11
15
|
type: import("vue").PropType<import("../../type").SettingType>;
|
|
12
16
|
default: () => {
|
|
@@ -66,6 +70,10 @@ declare const ContentPreview: import("vue").DefineComponent<{
|
|
|
66
70
|
type: import("vue").PropType<string>;
|
|
67
71
|
default: string;
|
|
68
72
|
};
|
|
73
|
+
onChange: {
|
|
74
|
+
type: import("vue").PropType<(v: string) => void>;
|
|
75
|
+
default: () => void;
|
|
76
|
+
};
|
|
69
77
|
setting: {
|
|
70
78
|
type: import("vue").PropType<import("../../type").SettingType>;
|
|
71
79
|
default: () => {
|
|
@@ -122,6 +130,7 @@ declare const ContentPreview: import("vue").DefineComponent<{
|
|
|
122
130
|
};
|
|
123
131
|
}>>, {
|
|
124
132
|
previewOnly: boolean;
|
|
133
|
+
onChange: (v: string) => void;
|
|
125
134
|
onHtmlChanged: (h: string) => void;
|
|
126
135
|
onGetCatalog: (list: import("../../type").HeadList[]) => void;
|
|
127
136
|
modelValue: string;
|
|
@@ -4,4 +4,5 @@ import userZoom from './userZoom';
|
|
|
4
4
|
import useCopyCode from './useCopyCode';
|
|
5
5
|
import useMarkdownIt from './useMarkdownIt';
|
|
6
6
|
import useResize from './useResize';
|
|
7
|
+
export * from './useTaskState';
|
|
7
8
|
export { useAutoScroll, useCodeMirror, userZoom, useCopyCode, useMarkdownIt, useResize };
|
|
@@ -3,10 +3,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3
3
|
type: import("vue").PropType<(v: string) => void>;
|
|
4
4
|
default: () => void;
|
|
5
5
|
};
|
|
6
|
-
onChange: {
|
|
7
|
-
type: import("vue").PropType<(v: string) => void>;
|
|
8
|
-
default: () => void;
|
|
9
|
-
};
|
|
10
6
|
placeholder: {
|
|
11
7
|
type: import("vue").PropType<string>;
|
|
12
8
|
default: string;
|
|
@@ -71,6 +67,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
71
67
|
type: import("vue").PropType<string>;
|
|
72
68
|
default: string;
|
|
73
69
|
};
|
|
70
|
+
onChange: {
|
|
71
|
+
type: import("vue").PropType<(v: string) => void>;
|
|
72
|
+
default: () => void;
|
|
73
|
+
};
|
|
74
74
|
setting: {
|
|
75
75
|
type: import("vue").PropType<import("../../type").SettingType>;
|
|
76
76
|
default: () => {
|
|
@@ -130,10 +130,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
130
130
|
type: import("vue").PropType<(v: string) => void>;
|
|
131
131
|
default: () => void;
|
|
132
132
|
};
|
|
133
|
-
onChange: {
|
|
134
|
-
type: import("vue").PropType<(v: string) => void>;
|
|
135
|
-
default: () => void;
|
|
136
|
-
};
|
|
137
133
|
placeholder: {
|
|
138
134
|
type: import("vue").PropType<string>;
|
|
139
135
|
default: string;
|
|
@@ -198,6 +194,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
198
194
|
type: import("vue").PropType<string>;
|
|
199
195
|
default: string;
|
|
200
196
|
};
|
|
197
|
+
onChange: {
|
|
198
|
+
type: import("vue").PropType<(v: string) => void>;
|
|
199
|
+
default: () => void;
|
|
200
|
+
};
|
|
201
201
|
setting: {
|
|
202
202
|
type: import("vue").PropType<import("../../type").SettingType>;
|
|
203
203
|
default: () => {
|
|
@@ -7,6 +7,10 @@ export declare const contentPreviewProps: {
|
|
|
7
7
|
type: PropType<string>;
|
|
8
8
|
default: string;
|
|
9
9
|
};
|
|
10
|
+
onChange: {
|
|
11
|
+
type: PropType<(v: string) => void>;
|
|
12
|
+
default: () => void;
|
|
13
|
+
};
|
|
10
14
|
setting: {
|
|
11
15
|
type: PropType<SettingType>;
|
|
12
16
|
default: () => {
|
|
@@ -67,10 +71,6 @@ export declare const contentProps: {
|
|
|
67
71
|
type: PropType<(v: string) => void>;
|
|
68
72
|
default: () => void;
|
|
69
73
|
};
|
|
70
|
-
onChange: {
|
|
71
|
-
type: PropType<(v: string) => void>;
|
|
72
|
-
default: () => void;
|
|
73
|
-
};
|
|
74
74
|
placeholder: {
|
|
75
75
|
type: PropType<string>;
|
|
76
76
|
default: string;
|
|
@@ -141,6 +141,10 @@ export declare const contentProps: {
|
|
|
141
141
|
type: PropType<string>;
|
|
142
142
|
default: string;
|
|
143
143
|
};
|
|
144
|
+
onChange: {
|
|
145
|
+
type: PropType<(v: string) => void>;
|
|
146
|
+
default: () => void;
|
|
147
|
+
};
|
|
144
148
|
setting: {
|
|
145
149
|
type: PropType<SettingType>;
|
|
146
150
|
default: () => {
|
|
@@ -12,6 +12,12 @@ export declare const mdPreviewProps: {
|
|
|
12
12
|
type: PropType<string>;
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* input回调事件
|
|
17
|
+
*/
|
|
18
|
+
onChange: {
|
|
19
|
+
type: PropType<ChangeEvent>;
|
|
20
|
+
};
|
|
15
21
|
/**
|
|
16
22
|
* 主题,支持light和dark
|
|
17
23
|
*
|
|
@@ -211,12 +217,6 @@ export declare const mdPreviewProps: {
|
|
|
211
217
|
};
|
|
212
218
|
};
|
|
213
219
|
export declare const editorProps: {
|
|
214
|
-
/**
|
|
215
|
-
* input回调事件
|
|
216
|
-
*/
|
|
217
|
-
onChange: {
|
|
218
|
-
type: PropType<ChangeEvent>;
|
|
219
|
-
};
|
|
220
220
|
/**
|
|
221
221
|
* input回调事件
|
|
222
222
|
*/
|
|
@@ -481,6 +481,12 @@ export declare const editorProps: {
|
|
|
481
481
|
type: PropType<string>;
|
|
482
482
|
default: string;
|
|
483
483
|
};
|
|
484
|
+
/**
|
|
485
|
+
* input回调事件
|
|
486
|
+
*/
|
|
487
|
+
onChange: {
|
|
488
|
+
type: PropType<ChangeEvent>;
|
|
489
|
+
};
|
|
484
490
|
/**
|
|
485
491
|
* 主题,支持light和dark
|
|
486
492
|
*
|
|
@@ -19,3 +19,4 @@ export declare const CATALOG_CHANGED = "catalogChanged";
|
|
|
19
19
|
export declare const PUSH_CATALOG = "pushCatalog";
|
|
20
20
|
export declare const RERENDER = "rerender";
|
|
21
21
|
export declare const EVENT_LISTENER = "eventListener";
|
|
22
|
+
export declare const TASK_STATE_CHANGED = "taskStateChanged";
|