md-editor-v3 4.12.0-beta.2 → 4.12.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.
@@ -1,7 +1,7 @@
1
1
  var i = Object.defineProperty;
2
2
  var p = (o, s, t) => s in o ? i(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
3
  var r = (o, s, t) => (p(o, typeof s != "symbol" ? s + "" : s, t), t);
4
- class h {
4
+ class E {
5
5
  constructor() {
6
6
  // 事件池
7
7
  r(this, "pools", {});
@@ -32,7 +32,7 @@ class h {
32
32
  });
33
33
  }
34
34
  }
35
- const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscreen", A = "pageFullscreenChanged", _ = "fullscreenChanged", d = "previewChanged", L = "htmlPreviewChanged", N = "catalogVisibleChanged", f = "buildFinished", G = "errorCatcher", H = "replace", b = "uploadImage", I = "openModals", m = "ctrlZ", S = "ctrlShiftZ", D = "catalogChanged", F = "pushCatalog", T = "rerender", O = (o, s = "image.png") => {
35
+ const C = new E(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscreen", A = "pageFullscreenChanged", _ = "fullscreenChanged", L = "previewChanged", d = "htmlPreviewChanged", N = "catalogVisibleChanged", f = "buildFinished", G = "errorCatcher", H = "replace", I = "uploadImage", b = "openModals", S = "ctrlZ", T = "ctrlShiftZ", m = "catalogChanged", D = "pushCatalog", F = "rerender", O = "eventListener", w = (o, s = "image.png") => {
36
36
  const t = o.split(","), n = t[0].match(/:(.*?);/);
37
37
  if (n) {
38
38
  const l = n[1], e = atob(t[1]);
@@ -43,7 +43,7 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
43
43
  return new File([c], s, { type: l });
44
44
  }
45
45
  return null;
46
- }, w = (o) => {
46
+ }, P = (o) => {
47
47
  if (!o)
48
48
  return o;
49
49
  const s = o.split(`
@@ -51,7 +51,7 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
51
51
  return s.forEach(() => {
52
52
  t.push("<span></span>");
53
53
  }), t.push("</span>"), `<span class="code-block">${o}</span>${t.join("")}`;
54
- }, P = (o, s) => {
54
+ }, U = (o, s) => {
55
55
  if (!o || !s)
56
56
  return 0;
57
57
  const t = o == null ? void 0 : o.getBoundingClientRect();
@@ -59,32 +59,33 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
59
59
  return t.top - s.clientTop;
60
60
  const n = s == null ? void 0 : s.getBoundingClientRect();
61
61
  return t.top - n.top;
62
- }, U = /* @__PURE__ */ (() => {
62
+ }, V = /* @__PURE__ */ (() => {
63
63
  let o = 0;
64
64
  return (s) => s + ++o;
65
65
  })();
66
66
  export {
67
67
  f as B,
68
- D as C,
68
+ m as C,
69
69
  G as E,
70
70
  _ as F,
71
- L as H,
71
+ d as H,
72
72
  u as O,
73
- F as P,
74
- T as R,
75
- b as U,
76
- w as a,
73
+ D as P,
74
+ F as R,
75
+ I as U,
76
+ P as a,
77
77
  C as b,
78
78
  g as c,
79
79
  A as d,
80
- d as e,
80
+ L as e,
81
81
  N as f,
82
- P as g,
82
+ U as g,
83
83
  H as h,
84
84
  R as i,
85
- U as j,
86
- O as k,
87
- I as l,
88
- S as m,
89
- m as n
85
+ O as j,
86
+ V as k,
87
+ w as l,
88
+ b as m,
89
+ T as n,
90
+ S as o
90
91
  };
@@ -1,4 +1,8 @@
1
1
  declare const _default: import("vue").DefineComponent<{
2
+ updateModelValue: {
3
+ type: import("vue").PropType<(v: string) => void>;
4
+ default: () => void;
5
+ };
2
6
  onChange: {
3
7
  type: import("vue").PropType<(v: string) => void>;
4
8
  default: () => void;
@@ -112,6 +116,10 @@ declare const _default: import("vue").DefineComponent<{
112
116
  type: import("vue").PropType<(h: string) => Promise<string>>;
113
117
  };
114
118
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
119
+ updateModelValue: {
120
+ type: import("vue").PropType<(v: string) => void>;
121
+ default: () => void;
122
+ };
115
123
  onChange: {
116
124
  type: import("vue").PropType<(v: string) => void>;
117
125
  default: () => void;
@@ -241,6 +249,7 @@ declare const _default: import("vue").DefineComponent<{
241
249
  formatCopiedText: (text: string) => string;
242
250
  noHighlight: boolean;
243
251
  setting: import('../../type').SettingType;
252
+ updateModelValue: (v: string) => void;
244
253
  previewOnly: boolean;
245
254
  }, {}>;
246
255
  export default _default;
@@ -57,6 +57,10 @@ export declare const contentPreviewProps: {
57
57
  };
58
58
  };
59
59
  export declare const contentProps: {
60
+ updateModelValue: {
61
+ type: PropType<(v: string) => void>;
62
+ default: () => void;
63
+ };
60
64
  onChange: {
61
65
  type: PropType<(v: string) => void>;
62
66
  default: () => void;
@@ -17,3 +17,4 @@ export declare const CTRL_SHIFT_Z = "ctrlShiftZ";
17
17
  export declare const CATALOG_CHANGED = "catalogChanged";
18
18
  export declare const PUSH_CATALOG = "pushCatalog";
19
19
  export declare const RERENDER = "rerender";
20
+ export declare const EVENT_LISTENER = "eventListener";
@@ -2,7 +2,7 @@ import { LooseRequired } from '@vue/shared';
2
2
  import markdownit from 'markdown-it/lib';
3
3
  import { Component, ExtractPropTypes, SetupContext } from 'vue';
4
4
  import { Extension } from '@codemirror/state';
5
- import { KeyBinding } from '@codemirror/view';
5
+ import { KeyBinding, EditorView } from '@codemirror/view';
6
6
  import { editorProps, mdPreviewProps } from './props';
7
7
  import { IconName } from './components/Icon/Icon';
8
8
  declare global {
@@ -302,6 +302,9 @@ export interface ExposeEvent {
302
302
  htmlPreview(status: boolean): void;
303
303
  catalog(status: boolean): void;
304
304
  }
305
+ export type DOMEventHandlers = {
306
+ [e in keyof HTMLElementEventMap]?: (event: HTMLElementEventMap[e], view: EditorView) => boolean | void;
307
+ };
305
308
  export interface InsertParam {
306
309
  targetValue: string;
307
310
  select?: boolean;
@@ -396,6 +399,12 @@ export interface ExposeParam {
396
399
  * 重置已经存在的历史记录
397
400
  */
398
401
  resetHistory(): void;
402
+ /**
403
+ * codemirror事件
404
+ *
405
+ * @param handlers
406
+ */
407
+ domEventHandlers(handlers: DOMEventHandlers): void;
399
408
  }
400
409
  export type ExposePreviewParam = Pick<ExposeParam, 'rerender'>;
401
410
  export type EditorProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>;