md-editor-v3 2.0.0-beta.2 → 2.0.0-beta.5

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.
@@ -114,13 +114,12 @@ declare const Editor: import("vue").DefineComponent<{
114
114
  };
115
115
  onError: {
116
116
  type: PropType<(err: InnerError) => void>;
117
- default: () => () => void;
118
117
  };
119
118
  codeCssName: {
120
119
  type: PropType<string>;
121
120
  default: string;
122
121
  };
123
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
122
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onChange" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
124
123
  modelValue: {
125
124
  type: PropType<string>;
126
125
  default: string;
@@ -233,7 +232,6 @@ declare const Editor: import("vue").DefineComponent<{
233
232
  };
234
233
  onError: {
235
234
  type: PropType<(err: InnerError) => void>;
236
- default: () => () => void;
237
235
  };
238
236
  codeCssName: {
239
237
  type: PropType<string>;
@@ -263,7 +261,6 @@ declare const Editor: import("vue").DefineComponent<{
263
261
  sanitize: (html: string) => string;
264
262
  placeholder: string;
265
263
  noKatex: boolean;
266
- onError: (err: InnerError) => void;
267
264
  codeCssName: string;
268
265
  }>;
269
266
  export default Editor;
@@ -12,12 +12,11 @@ declare const _default: import("vue").DefineComponent<{
12
12
  };
13
13
  onChange: {
14
14
  type: PropType<(visible: boolean) => void>;
15
- default: () => () => void;
16
15
  };
17
16
  overlay: {
18
17
  type: PropType<string | JSX.Element>;
19
18
  };
20
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
20
  title: {
22
21
  type: PropType<string>;
23
22
  default: string;
@@ -30,13 +29,11 @@ declare const _default: import("vue").DefineComponent<{
30
29
  };
31
30
  onChange: {
32
31
  type: PropType<(visible: boolean) => void>;
33
- default: () => () => void;
34
32
  };
35
33
  overlay: {
36
34
  type: PropType<string | JSX.Element>;
37
35
  };
38
36
  }>>, {
39
37
  title: string;
40
- onChange: (visible: boolean) => void;
41
38
  }>;
42
39
  export default _default;
@@ -5,7 +5,7 @@ export interface TocItem {
5
5
  level: number;
6
6
  children?: Array<TocItem>;
7
7
  }
8
- declare const Catalog: import("vue").DefineComponent<{
8
+ declare const MdCatalog: import("vue").DefineComponent<{
9
9
  editorId: {
10
10
  type: PropType<string>;
11
11
  };
@@ -48,4 +48,4 @@ declare const Catalog: import("vue").DefineComponent<{
48
48
  class: string;
49
49
  markedHeadingId: MarkedHeadingId;
50
50
  }>;
51
- export default Catalog;
51
+ export default MdCatalog;
@@ -24,11 +24,9 @@ declare const _default: import("vue").DefineComponent<{
24
24
  };
25
25
  onClick: {
26
26
  type: PropType<() => void>;
27
- default: () => () => void;
28
27
  };
29
28
  onClose: {
30
29
  type: PropType<() => void>;
31
- default: () => () => void;
32
30
  };
33
31
  /**
34
32
  * 显示全屏按钮
@@ -43,9 +41,8 @@ declare const _default: import("vue").DefineComponent<{
43
41
  };
44
42
  onAdjust: {
45
43
  type: PropType<(val: boolean) => void>;
46
- default: () => () => void;
47
44
  };
48
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
45
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onClick" | "onClose" | "onAdjust", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
49
46
  title: {
50
47
  type: PropType<string>;
51
48
  default: string;
@@ -70,11 +67,9 @@ declare const _default: import("vue").DefineComponent<{
70
67
  };
71
68
  onClick: {
72
69
  type: PropType<() => void>;
73
- default: () => () => void;
74
70
  };
75
71
  onClose: {
76
72
  type: PropType<() => void>;
77
- default: () => () => void;
78
73
  };
79
74
  /**
80
75
  * 显示全屏按钮
@@ -89,17 +84,13 @@ declare const _default: import("vue").DefineComponent<{
89
84
  };
90
85
  onAdjust: {
91
86
  type: PropType<(val: boolean) => void>;
92
- default: () => () => void;
93
87
  };
94
88
  }>>, {
95
89
  title: string;
96
- onClick: () => void;
97
90
  modalTitle: string;
98
91
  width: string;
99
92
  height: string;
100
- onClose: () => void;
101
93
  showAdjust: boolean;
102
94
  isFullscreen: boolean;
103
- onAdjust: (val: boolean) => void;
104
95
  }>;
105
96
  export default _default;
@@ -9,9 +9,8 @@ declare const _default: import("vue").DefineComponent<{
9
9
  };
10
10
  onClick: {
11
11
  type: PropType<(e: MouseEvent) => void>;
12
- default: () => () => void;
13
12
  };
14
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
13
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
14
  title: {
16
15
  type: PropType<string>;
17
16
  default: string;
@@ -21,10 +20,8 @@ declare const _default: import("vue").DefineComponent<{
21
20
  };
22
21
  onClick: {
23
22
  type: PropType<(e: MouseEvent) => void>;
24
- default: () => () => void;
25
23
  };
26
24
  }>>, {
27
25
  title: string;
28
- onClick: (e: MouseEvent) => void;
29
26
  }>;
30
27
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { App } from 'vue';
2
2
  import NormalToolbar from './extensions/NormalToolbar';
3
3
  import DropdownToolbar from './extensions/DropdownToolbar';
4
- import Catalog from './extensions/Catalog';
4
+ import MdCatalog from './extensions/MdCatalog';
5
5
  import ModalToolbar from './extensions/ModalToolbar';
6
6
  import configFn from './utils/config';
7
7
  declare const _default: {
@@ -32,7 +32,6 @@ declare const _default: {
32
32
  sanitize: (html: string) => string;
33
33
  placeholder: string;
34
34
  noKatex: boolean;
35
- onError: (err: import("./type").InnerError) => void;
36
35
  codeCssName: string;
37
36
  }> & Omit<Readonly<import("vue").ExtractPropTypes<{
38
37
  modelValue: {
@@ -147,13 +146,12 @@ declare const _default: {
147
146
  };
148
147
  onError: {
149
148
  type: import("vue").PropType<(err: import("./type").InnerError) => void>;
150
- default: () => () => void;
151
149
  };
152
150
  codeCssName: {
153
151
  type: import("vue").PropType<string>;
154
152
  default: string;
155
153
  };
156
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "editorId" | "preview" | "htmlPreview" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "noPrettier" | "style" | "class" | "modelValue" | "pageFullScreen" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "onError" | "codeCssName">;
154
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "editorId" | "preview" | "htmlPreview" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "noPrettier" | "style" | "class" | "modelValue" | "pageFullScreen" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeCssName">;
157
155
  $attrs: {
158
156
  [x: string]: unknown;
159
157
  };
@@ -165,7 +163,7 @@ declare const _default: {
165
163
  }>;
166
164
  $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
167
165
  $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
168
- $emit: (event: string, ...args: any[]) => void;
166
+ $emit: ((event: string, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
169
167
  $el: any;
170
168
  $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
171
169
  modelValue: {
@@ -280,13 +278,12 @@ declare const _default: {
280
278
  };
281
279
  onError: {
282
280
  type: import("vue").PropType<(err: import("./type").InnerError) => void>;
283
- default: () => () => void;
284
281
  };
285
282
  codeCssName: {
286
283
  type: import("vue").PropType<string>;
287
284
  default: string;
288
285
  };
289
- }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {
286
+ }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {
290
287
  editorId: string;
291
288
  preview: boolean;
292
289
  htmlPreview: boolean;
@@ -310,7 +307,6 @@ declare const _default: {
310
307
  sanitize: (html: string) => string;
311
308
  placeholder: string;
312
309
  noKatex: boolean;
313
- onError: (err: import("./type").InnerError) => void;
314
310
  codeCssName: string;
315
311
  }> & {
316
312
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
@@ -445,7 +441,6 @@ declare const _default: {
445
441
  };
446
442
  onError: {
447
443
  type: import("vue").PropType<(err: import("./type").InnerError) => void>;
448
- default: () => () => void;
449
444
  };
450
445
  codeCssName: {
451
446
  type: import("vue").PropType<string>;
@@ -568,13 +563,12 @@ declare const _default: {
568
563
  };
569
564
  onError: {
570
565
  type: import("vue").PropType<(err: import("./type").InnerError) => void>;
571
- default: () => () => void;
572
566
  };
573
567
  codeCssName: {
574
568
  type: import("vue").PropType<string>;
575
569
  default: string;
576
570
  };
577
- }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {
571
+ }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onChange" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError", {
578
572
  editorId: string;
579
573
  preview: boolean;
580
574
  htmlPreview: boolean;
@@ -598,12 +592,11 @@ declare const _default: {
598
592
  sanitize: (html: string) => string;
599
593
  placeholder: string;
600
594
  noKatex: boolean;
601
- onError: (err: import("./type").InnerError) => void;
602
595
  codeCssName: string;
603
596
  }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
604
597
  readonly NormalToolbar: typeof NormalToolbar;
605
598
  readonly DropdownToolbar: typeof DropdownToolbar;
606
- readonly Catalog: typeof Catalog;
599
+ readonly MdCatalog: typeof MdCatalog;
607
600
  readonly ModalToolbar: typeof ModalToolbar;
608
601
  readonly config: typeof configFn;
609
602
  install: (app: App) => App;
@@ -5454,7 +5454,7 @@ const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
5454
5454
  let initScrollAuto = () => {
5455
5455
  };
5456
5456
  const initCopyEntry = () => {
5457
- document.querySelectorAll(`#${editorId} .${prefix}-preview pre`).forEach((pre) => {
5457
+ document.querySelectorAll(`#${editorId}-preview > pre`).forEach((pre) => {
5458
5458
  var _a;
5459
5459
  const copyButton = document.createElement("span");
5460
5460
  copyButton.setAttribute("class", "copy-button");
@@ -5800,8 +5800,8 @@ const CatalogLink = defineComponent({
5800
5800
  }
5801
5801
  });
5802
5802
  var style = "";
5803
- const Catalog = defineComponent({
5804
- name: "Catalog",
5803
+ const MdCatalog = defineComponent({
5804
+ name: "MdCatalog",
5805
5805
  props: {
5806
5806
  editorId: {
5807
5807
  type: String
@@ -6001,9 +6001,7 @@ const props = {
6001
6001
  type: [String, Object]
6002
6002
  },
6003
6003
  onError: {
6004
- type: Function,
6005
- default: () => () => {
6006
- }
6004
+ type: Function
6007
6005
  },
6008
6006
  codeCssName: {
6009
6007
  type: String,
@@ -6013,6 +6011,7 @@ const props = {
6013
6011
  const Editor = defineComponent({
6014
6012
  name: "MdEditorV3",
6015
6013
  props,
6014
+ emits: ["onChange", "onSave", "onUploadImg", "onHtmlChanged", "onGetCatalog", "onError"],
6016
6015
  setup(props2, context) {
6017
6016
  const {
6018
6017
  editorId
@@ -6086,7 +6085,11 @@ const Editor = defineComponent({
6086
6085
  bus.on(editorId, {
6087
6086
  name: "errorCatcher",
6088
6087
  callback: (err) => {
6089
- props2.onError(err);
6088
+ if (props2.onError instanceof Function) {
6089
+ props2.onError(err);
6090
+ } else {
6091
+ context.emit("onError", err);
6092
+ }
6090
6093
  }
6091
6094
  });
6092
6095
  });
@@ -6142,7 +6145,7 @@ const Editor = defineComponent({
6142
6145
  "placeholder": props2.placeholder,
6143
6146
  "noKatex": props2.noKatex,
6144
6147
  "mermaidTemplate": (_a = extension == null ? void 0 : extension.editorConfig) == null ? void 0 : _a.mermaidTemplate
6145
- }, null), catalogShow.value && createVNode(Catalog, {
6148
+ }, null), catalogShow.value && createVNode(MdCatalog, {
6146
6149
  "theme": props2.theme,
6147
6150
  "style": {
6148
6151
  display: state.catalogVisible ? "block" : "none"
@@ -6165,11 +6168,10 @@ var NormalToolbar = defineComponent({
6165
6168
  type: [String, Object]
6166
6169
  },
6167
6170
  onClick: {
6168
- type: Function,
6169
- default: () => () => {
6170
- }
6171
+ type: Function
6171
6172
  }
6172
6173
  },
6174
+ emits: ["onClick"],
6173
6175
  setup(props2, ctx) {
6174
6176
  return () => {
6175
6177
  const Trigger = getSlot({
@@ -6204,14 +6206,13 @@ var DropdownToolbar = defineComponent({
6204
6206
  type: [String, Object]
6205
6207
  },
6206
6208
  onChange: {
6207
- type: Function,
6208
- default: () => () => {
6209
- }
6209
+ type: Function
6210
6210
  },
6211
6211
  overlay: {
6212
6212
  type: [String, Object]
6213
6213
  }
6214
6214
  },
6215
+ emits: ["onChange"],
6215
6216
  setup(props2, ctx) {
6216
6217
  const editorId = inject("editorId");
6217
6218
  return () => {
@@ -6272,14 +6273,10 @@ var ModalToolbar = defineComponent({
6272
6273
  type: [String, Object]
6273
6274
  },
6274
6275
  onClick: {
6275
- type: Function,
6276
- default: () => () => {
6277
- }
6276
+ type: Function
6278
6277
  },
6279
6278
  onClose: {
6280
- type: Function,
6281
- default: () => () => {
6282
- }
6279
+ type: Function
6283
6280
  },
6284
6281
  showAdjust: {
6285
6282
  type: Boolean,
@@ -6290,11 +6287,10 @@ var ModalToolbar = defineComponent({
6290
6287
  default: false
6291
6288
  },
6292
6289
  onAdjust: {
6293
- type: Function,
6294
- default: () => () => {
6295
- }
6290
+ type: Function
6296
6291
  }
6297
6292
  },
6293
+ emits: ["onClick", "onClose", "onAdjust"],
6298
6294
  setup(props2, ctx) {
6299
6295
  return () => {
6300
6296
  const Trigger = getSlot({
@@ -6357,13 +6353,13 @@ Editor.install = (app) => {
6357
6353
  app.component(Editor.name, Editor);
6358
6354
  app.component(NormalToolbar.name, NormalToolbar);
6359
6355
  app.component(DropdownToolbar.name, DropdownToolbar);
6360
- app.component(Catalog.name, Catalog);
6356
+ app.component(MdCatalog.name, MdCatalog);
6361
6357
  app.component(ModalToolbar.name, ModalToolbar);
6362
6358
  return app;
6363
6359
  };
6364
6360
  Editor.NormalToolbar = NormalToolbar;
6365
6361
  Editor.DropdownToolbar = DropdownToolbar;
6366
- Editor.Catalog = Catalog;
6362
+ Editor.MdCatalog = MdCatalog;
6367
6363
  Editor.ModalToolbar = ModalToolbar;
6368
6364
  Editor.config = config;
6369
6365
  export { Editor as default };