md-editor-v3 5.2.3 → 5.3.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/lib/cjs/MdEditor.cjs +39 -12
- package/lib/cjs/chunks/event-name.cjs +4 -0
- package/lib/cjs/chunks/index.cjs +38 -4
- package/lib/cjs/chunks/index3.cjs +57 -17
- package/lib/es/MdEditor.mjs +41 -14
- package/lib/es/chunks/event-name.mjs +4 -0
- package/lib/es/chunks/index.mjs +38 -4
- package/lib/es/chunks/index3.mjs +58 -18
- package/lib/preview.css +1 -1
- package/lib/style.css +2 -2
- package/lib/types/MdCatalog/MdCatalog.d.ts +3 -0
- package/lib/types/MdEditor/Editor.d.ts +5 -1
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +2 -0
- package/lib/types/MdEditor/layouts/Content/composition/index.d.ts +1 -0
- package/lib/types/MdEditor/layouts/Content/composition/useRemount.d.ts +3 -0
- package/lib/types/MdEditor/layouts/Content/composition/useResize.d.ts +0 -1
- package/lib/types/MdEditor/layouts/Content/index.d.ts +2 -0
- package/lib/types/MdEditor/layouts/Content/markdownIt/code/index.d.ts +1 -0
- package/lib/types/MdEditor/layouts/Content/props.d.ts +6 -0
- package/lib/types/MdEditor/props.d.ts +18 -0
- package/lib/types/MdEditor/static/event-name.d.ts +2 -0
- package/lib/types/MdEditor/type.d.ts +2 -1
- package/lib/types/MdPreview/MdPreview.d.ts +5 -1
- package/lib/umd/index.js +95 -93
- package/package.json +1 -1
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, watch, nextTick, createVNode, reactive, shallowRef, provide, computed, onMounted, onBeforeUnmount, Fragment } from "vue";
|
|
2
2
|
import { p as prefix } from "./config.mjs";
|
|
3
3
|
import { a as getRelativeTop } from "./index5.mjs";
|
|
4
|
-
import { b as bus, g as CATALOG_CHANGED, P as PUSH_CATALOG } from "./event-name.mjs";
|
|
4
|
+
import { b as bus, g as CATALOG_CHANGED, G as GET_EDITOR_VIEW, P as PUSH_CATALOG, S as SEND_EDITOR_VIEW } from "./event-name.mjs";
|
|
5
5
|
import { debounce, createSmoothScroll } from "@vavt/util";
|
|
6
6
|
const DATA_LINE_SELECTOR = `.${prefix}-preview > [data-line]`;
|
|
7
7
|
const getComputedStyleNum = (ele, key) => {
|
|
@@ -329,8 +329,11 @@ const CatalogLink = /* @__PURE__ */ defineComponent({
|
|
|
329
329
|
"ref": currRef,
|
|
330
330
|
"class": [`${prefix}-catalog-link`, tocItem.active && `${prefix}-catalog-active`],
|
|
331
331
|
"onClick": (e) => {
|
|
332
|
-
onClick(e, tocItem);
|
|
333
332
|
e.stopPropagation();
|
|
333
|
+
onClick(e, tocItem);
|
|
334
|
+
if (e.defaultPrevented) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
334
337
|
const id = mdHeadingId(tocItem.text, tocItem.level, tocItem.index);
|
|
335
338
|
const targetHeadEle = rootNodeRef.value.getElementById(id);
|
|
336
339
|
const scrollContainer = scrollElementRef.value;
|
|
@@ -433,6 +436,15 @@ const props = {
|
|
|
433
436
|
isScrollElementInShadow: {
|
|
434
437
|
type: Boolean,
|
|
435
438
|
default: false
|
|
439
|
+
},
|
|
440
|
+
/**
|
|
441
|
+
* 设置与哪个区域同步,默认与内容区域同步
|
|
442
|
+
*
|
|
443
|
+
* >= v5.3.0
|
|
444
|
+
*/
|
|
445
|
+
syncWith: {
|
|
446
|
+
type: String,
|
|
447
|
+
default: "preview"
|
|
436
448
|
}
|
|
437
449
|
};
|
|
438
450
|
const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
@@ -452,6 +464,7 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
452
464
|
const scrollElementRef = ref();
|
|
453
465
|
const scrollContainerRef = ref();
|
|
454
466
|
const rootNodeRef = ref();
|
|
467
|
+
const editorViewRef = shallowRef();
|
|
455
468
|
const indicatorStyles = ref({});
|
|
456
469
|
provide("scrollElementRef", scrollElementRef);
|
|
457
470
|
provide("roorNodeRef", rootNodeRef);
|
|
@@ -460,11 +473,13 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
460
473
|
state.list.forEach((listItem, index) => {
|
|
461
474
|
const {
|
|
462
475
|
text,
|
|
463
|
-
level
|
|
476
|
+
level,
|
|
477
|
+
line
|
|
464
478
|
} = listItem;
|
|
465
479
|
const item = {
|
|
466
480
|
level,
|
|
467
481
|
text,
|
|
482
|
+
line,
|
|
468
483
|
index: index + 1,
|
|
469
484
|
active: activeItem.value === listItem
|
|
470
485
|
};
|
|
@@ -515,15 +530,25 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
515
530
|
activeHead
|
|
516
531
|
} = list.reduce((activeData, link, index) => {
|
|
517
532
|
var _a;
|
|
518
|
-
|
|
519
|
-
if (
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
|
|
523
|
-
activeHead: link,
|
|
524
|
-
minTop: relativeTop
|
|
525
|
-
};
|
|
533
|
+
let relativeTop = 0;
|
|
534
|
+
if (props2.syncWith === "preview") {
|
|
535
|
+
const linkEle = (_a = rootNodeRef.value) == null ? void 0 : _a.getElementById(props2.mdHeadingId(link.text, link.level, index + 1));
|
|
536
|
+
if (linkEle instanceof HTMLElement) {
|
|
537
|
+
relativeTop = getRelativeTop(linkEle, scrollElementRef.value);
|
|
526
538
|
}
|
|
539
|
+
} else {
|
|
540
|
+
const view = editorViewRef.value;
|
|
541
|
+
if (view) {
|
|
542
|
+
const top = view.lineBlockAt(view.state.doc.line(link.line + 1).from).top;
|
|
543
|
+
const scrollTop = view.scrollDOM.scrollTop;
|
|
544
|
+
relativeTop = top - scrollTop;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (relativeTop < props2.offsetTop && relativeTop > activeData.minTop) {
|
|
548
|
+
return {
|
|
549
|
+
activeHead: link,
|
|
550
|
+
minTop: relativeTop
|
|
551
|
+
};
|
|
527
552
|
}
|
|
528
553
|
return activeData;
|
|
529
554
|
}, {
|
|
@@ -545,25 +570,41 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
545
570
|
findActiveHeading(state.list);
|
|
546
571
|
};
|
|
547
572
|
const catalogChangedHandler = (_list) => {
|
|
548
|
-
var _a, _b;
|
|
549
|
-
const scrollElement = getScrollElement();
|
|
550
|
-
scrollElementRef.value = scrollElement;
|
|
551
|
-
scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
|
|
573
|
+
var _a, _b, _c;
|
|
552
574
|
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
575
|
+
if (props2.syncWith === "editor") {
|
|
576
|
+
scrollContainerRef.value = (_b = editorViewRef.value) == null ? void 0 : _b.scrollDOM;
|
|
577
|
+
} else {
|
|
578
|
+
const scrollElement = getScrollElement();
|
|
579
|
+
scrollElementRef.value = scrollElement;
|
|
580
|
+
scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
|
|
581
|
+
}
|
|
553
582
|
findActiveHeading(_list);
|
|
554
|
-
(
|
|
583
|
+
(_c = scrollContainerRef.value) == null ? void 0 : _c.addEventListener("scroll", scrollHandler);
|
|
584
|
+
};
|
|
585
|
+
const getEditorView = (view) => {
|
|
586
|
+
editorViewRef.value = view;
|
|
555
587
|
};
|
|
588
|
+
watch(() => props2.syncWith, () => {
|
|
589
|
+
catalogChangedHandler(state.list);
|
|
590
|
+
});
|
|
556
591
|
onMounted(() => {
|
|
557
592
|
rootNodeRef.value = catalogRef.value.getRootNode();
|
|
558
593
|
bus.on(editorId, {
|
|
559
594
|
name: CATALOG_CHANGED,
|
|
560
595
|
callback: catalogChangedHandler
|
|
561
596
|
});
|
|
597
|
+
bus.on(editorId, {
|
|
598
|
+
name: GET_EDITOR_VIEW,
|
|
599
|
+
callback: getEditorView
|
|
600
|
+
});
|
|
562
601
|
bus.emit(editorId, PUSH_CATALOG);
|
|
602
|
+
bus.emit(editorId, SEND_EDITOR_VIEW);
|
|
563
603
|
});
|
|
564
604
|
onBeforeUnmount(() => {
|
|
565
605
|
var _a;
|
|
566
606
|
bus.remove(editorId, CATALOG_CHANGED, catalogChangedHandler);
|
|
607
|
+
bus.remove(editorId, GET_EDITOR_VIEW, getEditorView);
|
|
567
608
|
(_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
|
|
568
609
|
});
|
|
569
610
|
return () => createVNode("div", {
|
|
@@ -583,9 +624,8 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
|
|
|
583
624
|
"onClick": (e, t) => {
|
|
584
625
|
if (props2.onClick) {
|
|
585
626
|
props2.onClick(e, t);
|
|
586
|
-
} else {
|
|
587
|
-
ctx.emit("onClick", e, t);
|
|
588
627
|
}
|
|
628
|
+
ctx.emit("onClick", e, t);
|
|
589
629
|
},
|
|
590
630
|
"scrollElementOffsetTop": props2.scrollElementOffsetTop
|
|
591
631
|
}, null);
|
package/lib/preview.css
CHANGED
|
@@ -149,11 +149,11 @@
|
|
|
149
149
|
flex: 1;
|
|
150
150
|
box-sizing: border-box;
|
|
151
151
|
overflow: auto;
|
|
152
|
-
padding: 10px 20px;
|
|
153
152
|
}.md-editor-preview {
|
|
154
153
|
font-size: 16px;
|
|
155
154
|
word-break: break-all;
|
|
156
155
|
overflow: hidden;
|
|
156
|
+
padding: 10px 20px;
|
|
157
157
|
}.md-editor-modal-container {
|
|
158
158
|
--md-color: #3f4a54;
|
|
159
159
|
--md-hover-color: #000;
|
package/lib/style.css
CHANGED
|
@@ -372,7 +372,7 @@
|
|
|
372
372
|
overflow: hidden;
|
|
373
373
|
background-color: var(--md-bk-hover-color);
|
|
374
374
|
color: var(--md-color);
|
|
375
|
-
}.md-editor
|
|
375
|
+
}.md-editor-input-wrapper:has(+ *) .cm-scroller {
|
|
376
376
|
overflow-y: scroll;
|
|
377
377
|
}.md-editor .cm-scroller .cm-content[contenteditable='true'] {
|
|
378
378
|
margin: 10px;
|
|
@@ -594,11 +594,11 @@
|
|
|
594
594
|
flex: 1;
|
|
595
595
|
box-sizing: border-box;
|
|
596
596
|
overflow: auto;
|
|
597
|
-
padding: 10px 20px;
|
|
598
597
|
}.md-editor-preview {
|
|
599
598
|
font-size: 16px;
|
|
600
599
|
word-break: break-all;
|
|
601
600
|
overflow: hidden;
|
|
601
|
+
padding: 10px 20px;
|
|
602
602
|
}.md-editor-modal-container {
|
|
603
603
|
--md-color: #3f4a54;
|
|
604
604
|
--md-hover-color: #000;
|
|
@@ -10,6 +10,7 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
10
10
|
readonly offsetTop: number;
|
|
11
11
|
readonly scrollElementOffsetTop: number;
|
|
12
12
|
readonly isScrollElementInShadow: boolean;
|
|
13
|
+
readonly syncWith: "preview" | "editor";
|
|
13
14
|
readonly onClick: ((e: MouseEvent, t: TocItem) => void) | undefined;
|
|
14
15
|
readonly editorId: string | undefined;
|
|
15
16
|
readonly onActive: ((heading: HeadList | undefined, activeElement: HTMLDivElement) => void) | undefined;
|
|
@@ -21,6 +22,7 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
21
22
|
readonly offsetTop: number;
|
|
22
23
|
readonly scrollElementOffsetTop: number;
|
|
23
24
|
readonly isScrollElementInShadow: boolean;
|
|
25
|
+
readonly syncWith: "preview" | "editor";
|
|
24
26
|
readonly onClick: ((e: MouseEvent, t: TocItem) => void) | undefined;
|
|
25
27
|
readonly editorId: string | undefined;
|
|
26
28
|
readonly onActive: ((heading: HeadList | undefined, activeElement: HTMLDivElement) => void) | undefined;
|
|
@@ -39,5 +41,6 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
39
41
|
scrollElementOffsetTop: number;
|
|
40
42
|
scrollElement: string | HTMLElement;
|
|
41
43
|
isScrollElementInShadow: boolean;
|
|
44
|
+
syncWith: "preview" | "editor";
|
|
42
45
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
46
|
export default MdCatalog;
|
|
@@ -258,6 +258,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
258
258
|
readonly onInput: ((event: Event) => void) | undefined;
|
|
259
259
|
readonly onDrop: ((event: DragEvent) => void) | undefined;
|
|
260
260
|
readonly oninputBoxWidthChange: ((width: string) => void) | undefined;
|
|
261
|
+
readonly onRemount: (() => void) | undefined;
|
|
261
262
|
readonly id: string | undefined;
|
|
262
263
|
readonly defToolbars: string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
263
264
|
[key: string]: any;
|
|
@@ -268,7 +269,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
268
269
|
readonly maxLength: number | undefined;
|
|
269
270
|
readonly completions: import("@codemirror/autocomplete").CompletionSource[] | undefined;
|
|
270
271
|
readonly editorId: string | undefined;
|
|
271
|
-
}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("./type").EditorEmits, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue" | "onBlur" | "onFocus" | "onInput" | "onDrop" | "oninputBoxWidthChange", import("vue").PublicProps, Readonly<{
|
|
272
|
+
}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("./type").EditorEmits, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue" | "onBlur" | "onFocus" | "onInput" | "onDrop" | "oninputBoxWidthChange" | "onRemount", import("vue").PublicProps, Readonly<{
|
|
272
273
|
readonly preview: boolean;
|
|
273
274
|
readonly pageFullscreen: boolean;
|
|
274
275
|
readonly htmlPreview: boolean;
|
|
@@ -528,6 +529,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
528
529
|
readonly onInput: ((event: Event) => void) | undefined;
|
|
529
530
|
readonly onDrop: ((event: DragEvent) => void) | undefined;
|
|
530
531
|
readonly oninputBoxWidthChange: ((width: string) => void) | undefined;
|
|
532
|
+
readonly onRemount: (() => void) | undefined;
|
|
531
533
|
readonly id: string | undefined;
|
|
532
534
|
readonly defToolbars: string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
533
535
|
[key: string]: any;
|
|
@@ -551,6 +553,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
551
553
|
onOnInput?: ((...args: any[]) => any) | undefined;
|
|
552
554
|
onOnDrop?: ((...args: any[]) => any) | undefined;
|
|
553
555
|
onOninputBoxWidthChange?: ((...args: any[]) => any) | undefined;
|
|
556
|
+
onOnRemount?: ((...args: any[]) => any) | undefined;
|
|
554
557
|
}>, {
|
|
555
558
|
preview: boolean;
|
|
556
559
|
pageFullscreen: boolean;
|
|
@@ -566,6 +569,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
566
569
|
onInput: (event: Event) => void;
|
|
567
570
|
onDrop: (event: DragEvent) => void;
|
|
568
571
|
oninputBoxWidthChange: (width: string) => void;
|
|
572
|
+
onRemount: () => void;
|
|
569
573
|
style: string | import("vue").CSSProperties;
|
|
570
574
|
class: string;
|
|
571
575
|
id: string;
|
|
@@ -15,6 +15,7 @@ declare const ContentPreview: import("vue").DefineComponent<{
|
|
|
15
15
|
readonly formatCopiedText: (text: string) => string;
|
|
16
16
|
readonly noHighlight: boolean;
|
|
17
17
|
readonly setting: import("../../type").SettingType;
|
|
18
|
+
readonly onRemount: (() => void) | undefined;
|
|
18
19
|
readonly noImgZoomIn: boolean | undefined;
|
|
19
20
|
readonly sanitizeMermaid: ((h: string) => Promise<string>) | undefined;
|
|
20
21
|
readonly codeFoldable: boolean | undefined;
|
|
@@ -32,6 +33,7 @@ declare const ContentPreview: import("vue").DefineComponent<{
|
|
|
32
33
|
readonly formatCopiedText: (text: string) => string;
|
|
33
34
|
readonly noHighlight: boolean;
|
|
34
35
|
readonly setting: import("../../type").SettingType;
|
|
36
|
+
readonly onRemount: (() => void) | undefined;
|
|
35
37
|
readonly noImgZoomIn: boolean | undefined;
|
|
36
38
|
readonly sanitizeMermaid: ((h: string) => Promise<string>) | undefined;
|
|
37
39
|
readonly codeFoldable: boolean | undefined;
|
|
@@ -5,4 +5,5 @@ import useCopyCode from './useCopyCode';
|
|
|
5
5
|
import useMarkdownIt from './useMarkdownIt';
|
|
6
6
|
import useResize from './useResize';
|
|
7
7
|
export * from './useTaskState';
|
|
8
|
+
export * from './useRemount';
|
|
8
9
|
export { useAutoScroll, useCodeMirror, userZoom, useCopyCode, useMarkdownIt, useResize };
|
|
@@ -20,6 +20,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
20
20
|
readonly updateModelValue: (v: string) => void;
|
|
21
21
|
readonly onInput: ((event: Event) => void) | undefined;
|
|
22
22
|
readonly oninputBoxWidthChange: ((width: string) => void) | undefined;
|
|
23
|
+
readonly onRemount: (() => void) | undefined;
|
|
23
24
|
readonly noPrettier: boolean | undefined;
|
|
24
25
|
readonly scrollAuto: boolean | undefined;
|
|
25
26
|
readonly disabled: boolean | undefined;
|
|
@@ -56,6 +57,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
56
57
|
readonly updateModelValue: (v: string) => void;
|
|
57
58
|
readonly onInput: ((event: Event) => void) | undefined;
|
|
58
59
|
readonly oninputBoxWidthChange: ((width: string) => void) | undefined;
|
|
60
|
+
readonly onRemount: (() => void) | undefined;
|
|
59
61
|
readonly noPrettier: boolean | undefined;
|
|
60
62
|
readonly scrollAuto: boolean | undefined;
|
|
61
63
|
readonly disabled: boolean | undefined;
|
|
@@ -15,6 +15,7 @@ export interface CodeTabsPluginOps extends markdownit.Options {
|
|
|
15
15
|
codeFoldable: boolean;
|
|
16
16
|
autoFoldThreshold: number;
|
|
17
17
|
customIconRef: ComputedRef<CustomIcon>;
|
|
18
|
+
extraTools?: string;
|
|
18
19
|
}
|
|
19
20
|
declare const codetabs: (md: markdownit, _opts: CodeTabsPluginOps) => void;
|
|
20
21
|
export default codetabs;
|
|
@@ -65,6 +65,9 @@ export declare const contentPreviewProps: {
|
|
|
65
65
|
autoFoldThreshold: {
|
|
66
66
|
type: PropType<number>;
|
|
67
67
|
};
|
|
68
|
+
onRemount: {
|
|
69
|
+
type: PropType<() => void>;
|
|
70
|
+
};
|
|
68
71
|
};
|
|
69
72
|
export declare const contentProps: {
|
|
70
73
|
updateModelValue: {
|
|
@@ -199,5 +202,8 @@ export declare const contentProps: {
|
|
|
199
202
|
autoFoldThreshold: {
|
|
200
203
|
type: PropType<number>;
|
|
201
204
|
};
|
|
205
|
+
onRemount: {
|
|
206
|
+
type: PropType<() => void>;
|
|
207
|
+
};
|
|
202
208
|
};
|
|
203
209
|
export type ContentProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof contentProps>>>>;
|
|
@@ -220,6 +220,15 @@ export declare const mdPreviewProps: {
|
|
|
220
220
|
type: PropType<number>;
|
|
221
221
|
default: number;
|
|
222
222
|
};
|
|
223
|
+
/**
|
|
224
|
+
* 内容重新挂载事件
|
|
225
|
+
*
|
|
226
|
+
* 相比起onHtmlChanged,onRemount会在重新挂载后触发
|
|
227
|
+
*/
|
|
228
|
+
onRemount: {
|
|
229
|
+
type: PropType<() => void>;
|
|
230
|
+
default: undefined;
|
|
231
|
+
};
|
|
223
232
|
};
|
|
224
233
|
export declare const editorProps: {
|
|
225
234
|
/**
|
|
@@ -708,6 +717,15 @@ export declare const editorProps: {
|
|
|
708
717
|
type: PropType<number>;
|
|
709
718
|
default: number;
|
|
710
719
|
};
|
|
720
|
+
/**
|
|
721
|
+
* 内容重新挂载事件
|
|
722
|
+
*
|
|
723
|
+
* 相比起onHtmlChanged,onRemount会在重新挂载后触发
|
|
724
|
+
*/
|
|
725
|
+
onRemount: {
|
|
726
|
+
type: PropType<() => void>;
|
|
727
|
+
default: undefined;
|
|
728
|
+
};
|
|
711
729
|
};
|
|
712
730
|
export declare const mdPreviewEmits: EditorEmits;
|
|
713
731
|
export declare const editorEmits: EditorEmits;
|
|
@@ -20,3 +20,5 @@ export declare const PUSH_CATALOG = "pushCatalog";
|
|
|
20
20
|
export declare const RERENDER = "rerender";
|
|
21
21
|
export declare const EVENT_LISTENER = "eventListener";
|
|
22
22
|
export declare const TASK_STATE_CHANGED = "taskStateChanged";
|
|
23
|
+
export declare const SEND_EDITOR_VIEW = "sendEditorView";
|
|
24
|
+
export declare const GET_EDITOR_VIEW = "getEditorView";
|
|
@@ -127,6 +127,7 @@ export interface HeadList {
|
|
|
127
127
|
text: string;
|
|
128
128
|
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
129
129
|
active?: boolean;
|
|
130
|
+
line: number;
|
|
130
131
|
}
|
|
131
132
|
export type MdHeadingId = (text: string, level: number, index: number) => string;
|
|
132
133
|
export interface MermaidTemplate {
|
|
@@ -460,7 +461,7 @@ export interface ExposeParam {
|
|
|
460
461
|
export type ExposePreviewParam = Pick<ExposeParam, 'rerender'>;
|
|
461
462
|
export type EditorProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>;
|
|
462
463
|
export type MdPreviewProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof mdPreviewProps>>>>;
|
|
463
|
-
export type EditorEmits = Array<'onChange' | 'onSave' | 'onUploadImg' | 'onHtmlChanged' | 'onGetCatalog' | 'onError' | 'update:modelValue' | 'onBlur' | 'onFocus' | 'onInput' | 'onDrop' | 'oninputBoxWidthChange'>;
|
|
464
|
+
export type EditorEmits = Array<'onChange' | 'onSave' | 'onUploadImg' | 'onHtmlChanged' | 'onGetCatalog' | 'onError' | 'update:modelValue' | 'onBlur' | 'onFocus' | 'onInput' | 'onDrop' | 'oninputBoxWidthChange' | 'onRemount'>;
|
|
464
465
|
export type EditorContext = SetupContext<EditorEmits>;
|
|
465
466
|
/**
|
|
466
467
|
* 自定义图标的数据类型
|
|
@@ -231,9 +231,10 @@ declare const MdPreview: import("vue").DefineComponent<{
|
|
|
231
231
|
readonly onChange: import("../MdEditor/type").ChangeEvent | undefined;
|
|
232
232
|
readonly onHtmlChanged: import("../MdEditor/type").HtmlChangedEvent | undefined;
|
|
233
233
|
readonly onGetCatalog: import("../MdEditor/type").GetCatalogEvent | undefined;
|
|
234
|
+
readonly onRemount: (() => void) | undefined;
|
|
234
235
|
readonly id: string | undefined;
|
|
235
236
|
readonly editorId: string | undefined;
|
|
236
|
-
}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("../MdEditor/type").EditorEmits, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue" | "onBlur" | "onFocus" | "onInput" | "onDrop" | "oninputBoxWidthChange", import("vue").PublicProps, Readonly<{
|
|
237
|
+
}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("../MdEditor/type").EditorEmits, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue" | "onBlur" | "onFocus" | "onInput" | "onDrop" | "oninputBoxWidthChange" | "onRemount", import("vue").PublicProps, Readonly<{
|
|
237
238
|
readonly style: string | import("vue").CSSProperties;
|
|
238
239
|
readonly class: string;
|
|
239
240
|
readonly language: string;
|
|
@@ -466,6 +467,7 @@ declare const MdPreview: import("vue").DefineComponent<{
|
|
|
466
467
|
readonly onChange: import("../MdEditor/type").ChangeEvent | undefined;
|
|
467
468
|
readonly onHtmlChanged: import("../MdEditor/type").HtmlChangedEvent | undefined;
|
|
468
469
|
readonly onGetCatalog: import("../MdEditor/type").GetCatalogEvent | undefined;
|
|
470
|
+
readonly onRemount: (() => void) | undefined;
|
|
469
471
|
readonly id: string | undefined;
|
|
470
472
|
readonly editorId: string | undefined;
|
|
471
473
|
}> & Readonly<{
|
|
@@ -481,10 +483,12 @@ declare const MdPreview: import("vue").DefineComponent<{
|
|
|
481
483
|
onOnInput?: ((...args: any[]) => any) | undefined;
|
|
482
484
|
onOnDrop?: ((...args: any[]) => any) | undefined;
|
|
483
485
|
onOninputBoxWidthChange?: ((...args: any[]) => any) | undefined;
|
|
486
|
+
onOnRemount?: ((...args: any[]) => any) | undefined;
|
|
484
487
|
}>, {
|
|
485
488
|
onChange: import("../MdEditor/type").ChangeEvent;
|
|
486
489
|
onHtmlChanged: import("../MdEditor/type").HtmlChangedEvent;
|
|
487
490
|
onGetCatalog: import("../MdEditor/type").GetCatalogEvent;
|
|
491
|
+
onRemount: () => void;
|
|
488
492
|
style: string | import("vue").CSSProperties;
|
|
489
493
|
class: string;
|
|
490
494
|
id: string;
|