@milkdown/vue 6.5.0 → 6.5.3
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/Editor.d.ts +3 -3
- package/lib/Editor.d.ts.map +1 -1
- package/lib/EditorComponent.d.ts +4 -4
- package/lib/EditorComponent.d.ts.map +1 -1
- package/lib/VueNode.d.ts +7 -7
- package/lib/VueNode.d.ts.map +1 -1
- package/lib/VueNodeView.d.ts +3 -3
- package/lib/VueNodeView.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +44 -44
- package/lib/index.es.js.map +1 -1
- package/lib/types.d.ts +12 -12
- package/lib/types.d.ts.map +1 -1
- package/lib/useEditor.d.ts +1 -1
- package/lib/useEditor.d.ts.map +1 -1
- package/lib/useGetEditor.d.ts +4 -4
- package/lib/useGetEditor.d.ts.map +1 -1
- package/lib/utils.d.ts +5 -5
- package/lib/utils.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/Editor.tsx +84 -82
- package/src/EditorComponent.tsx +20 -18
- package/src/VueNode.tsx +35 -33
- package/src/VueNodeView.tsx +153 -161
- package/src/index.ts +4 -4
- package/src/types.ts +31 -31
- package/src/useEditor.ts +19 -19
- package/src/useGetEditor.ts +43 -40
- package/src/utils.ts +6 -7
package/lib/Editor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DefineComponent, InjectionKey } from 'vue';
|
|
2
|
-
import { EditorRef } from './EditorComponent';
|
|
3
|
-
import { EditorInfo, EditorInfoCtx } from './types';
|
|
1
|
+
import type { DefineComponent, InjectionKey } from 'vue';
|
|
2
|
+
import type { EditorRef } from './EditorComponent';
|
|
3
|
+
import type { EditorInfo, EditorInfoCtx } from './types';
|
|
4
4
|
export declare const editorInfoCtxKey: InjectionKey<EditorInfoCtx>;
|
|
5
5
|
export declare const VueEditor: DefineComponent<{
|
|
6
6
|
editor: EditorInfo;
|
package/lib/Editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,KAAK,CAAA;AAcZ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAIxD,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAA8B,CAAA;AA4BvF,eAAO,MAAM,SAAS;YAA6B,UAAU;;;YAAV,UAAU;;OA2D3D,CAAA"}
|
package/lib/EditorComponent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Editor } from '@milkdown/core';
|
|
2
|
-
import { GetEditor } from './types';
|
|
1
|
+
import type { Editor } from '@milkdown/core';
|
|
2
|
+
import type { GetEditor } from './types';
|
|
3
3
|
export declare const EditorComponent: import("vue").DefineComponent<{
|
|
4
4
|
editor: GetEditor;
|
|
5
5
|
editorRef?: EditorRef | undefined;
|
|
@@ -7,8 +7,8 @@ export declare const EditorComponent: import("vue").DefineComponent<{
|
|
|
7
7
|
editor: GetEditor;
|
|
8
8
|
editorRef?: EditorRef | undefined;
|
|
9
9
|
}>, {}>;
|
|
10
|
-
export
|
|
10
|
+
export interface EditorRef {
|
|
11
11
|
get: () => Editor | undefined;
|
|
12
12
|
dom: () => HTMLDivElement | null;
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
//# sourceMappingURL=EditorComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorComponent.d.ts","sourceRoot":"","sources":["../src/EditorComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"EditorComponent.d.ts","sourceRoot":"","sources":["../src/EditorComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAI5C,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAA;AAGvD,eAAO,MAAM,eAAe;YAA6B,SAAS;;;YAAT,SAAS;;OAehE,CAAA;AAGF,MAAM,WAAW,SAAS;IAAG,GAAG,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,cAAc,GAAG,IAAI,CAAA;CAAE"}
|
package/lib/VueNode.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Ctx } from '@milkdown/core';
|
|
2
|
-
import { Mark, Node } from '@milkdown/prose/model';
|
|
3
|
-
import { Decoration, EditorView } from '@milkdown/prose/view';
|
|
4
|
-
import { InjectionKey, Ref } from 'vue';
|
|
5
|
-
export
|
|
1
|
+
import type { Ctx } from '@milkdown/core';
|
|
2
|
+
import type { Mark, Node } from '@milkdown/prose/model';
|
|
3
|
+
import type { Decoration, EditorView } from '@milkdown/prose/view';
|
|
4
|
+
import type { InjectionKey, Ref } from 'vue';
|
|
5
|
+
export interface NodeContext<T extends Node | Mark = Node | Mark> {
|
|
6
6
|
ctx: Ctx;
|
|
7
7
|
node: Ref<T>;
|
|
8
8
|
view: EditorView;
|
|
9
9
|
getPos: T extends Mark ? boolean : T extends Node ? () => number : boolean | (() => number);
|
|
10
10
|
decorations: Ref<readonly Decoration[]>;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
export declare const nodeMetadata: InjectionKey<NodeContext>;
|
|
13
|
-
export
|
|
13
|
+
export type UseNodeCtx = <T extends Node | Mark = Node | Mark>() => NodeContext<T>;
|
|
14
14
|
export declare const useNodeCtx: UseNodeCtx;
|
|
15
15
|
export declare const VueNodeContainer: import("vue").DefineComponent<NodeContext<Node | Mark> & {
|
|
16
16
|
as: string;
|
package/lib/VueNode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VueNode.d.ts","sourceRoot":"","sources":["../src/VueNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VueNode.d.ts","sourceRoot":"","sources":["../src/VueNode.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG5C,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;IAC9D,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,CAAC,SAAS,IAAI,GAAG,OAAO,GAAG,CAAC,SAAS,IAAI,GAAG,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,CAAA;IAC3F,WAAW,EAAE,GAAG,CAAC,SAAS,UAAU,EAAE,CAAC,CAAA;CACxC;AAED,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,WAAW,CAA0B,CAAA;AAE7E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,WAAW,CAAC,CAAC,CAAC,CAAA;AAClF,eAAO,MAAM,UAAU,EAAE,UAA6D,CAAA;AAEtF,eAAO,MAAM,gBAAgB;QAAuC,MAAM;;QAAN,MAAM;OAYxE,CAAA;AAGF,eAAO,MAAM,OAAO;;;;OAKlB,CAAA"}
|
package/lib/VueNodeView.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Ctx } from '@milkdown/core';
|
|
1
|
+
import type { Ctx } from '@milkdown/core';
|
|
2
2
|
import { Mark, Node } from '@milkdown/prose/model';
|
|
3
3
|
import type { Decoration, DecorationSource, EditorView, MarkViewConstructor, NodeView, NodeViewConstructor } from '@milkdown/prose/view';
|
|
4
|
-
import { ComponentInternalInstance, DefineComponent, Ref } from 'vue';
|
|
5
|
-
export
|
|
4
|
+
import type { ComponentInternalInstance, DefineComponent, Ref } from 'vue';
|
|
5
|
+
export type RenderOptions = Partial<{
|
|
6
6
|
as: string;
|
|
7
7
|
update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;
|
|
8
8
|
} & Pick<NodeView, 'ignoreMutation' | 'deselectNode' | 'selectNode' | 'destroy'>>;
|
package/lib/VueNodeView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VueNodeView.d.ts","sourceRoot":"","sources":["../src/VueNodeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"VueNodeView.d.ts","sourceRoot":"","sources":["../src/VueNodeView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAO1E,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B;IACE,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,C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AI,UAAU,4BAKb;IAED,SAAS,QAAO,eAAe,CA0B9B;IAED,YAAY;IAWZ,OAAO;IAMP,cAAc,CAAC,QAAQ,EAAE,cAAc;IAwBvC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,UAAU,EAAE,EAAE,gBAAgB,EAAE,gBAAgB;IAuBzF,UAAU,2BAA2B;IAErC,YAAY,2BAA6B;CAC1C"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
|
package/lib/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var x = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { inject as v, ref as
|
|
2
|
+
var K = (o, e, t) => e in o ? x(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var m = (o, e, t) => (K(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { inject as v, ref as u, onMounted as S, onUnmounted as C, defineComponent as p, createVNode as l, provide as w, h as j, markRaw as k, Teleport as U, shallowReactive as B, getCurrentInstance as A, onBeforeMount as L, effect as _, isVNode as q } from "vue";
|
|
5
5
|
import { vueRendererCallOutOfScope as G } from "@milkdown/exception";
|
|
6
6
|
import { Mark as T, Node as I } from "@milkdown/prose/model";
|
|
7
7
|
import { customAlphabet as z } from "nanoid";
|
|
8
|
-
const
|
|
9
|
-
const e = v(
|
|
8
|
+
const E = Symbol("rendererKey"), F = (o) => {
|
|
9
|
+
const e = v(E, () => {
|
|
10
10
|
throw G();
|
|
11
|
-
}), { dom: t, loading: n, editor: a } = v(O, {}), s =
|
|
12
|
-
|
|
11
|
+
}), { dom: t, loading: n, editor: a } = v(O, {}), s = u(!1);
|
|
12
|
+
S(() => {
|
|
13
13
|
if (!t.value)
|
|
14
14
|
return;
|
|
15
15
|
const i = o(t.value, e);
|
|
@@ -18,12 +18,12 @@ const C = Symbol(), F = (o) => {
|
|
|
18
18
|
}).finally(() => {
|
|
19
19
|
n.value = !1, s.value = !1;
|
|
20
20
|
}).catch((r) => console.error(r)));
|
|
21
|
-
}),
|
|
21
|
+
}), C(() => {
|
|
22
22
|
var i;
|
|
23
23
|
(i = a.value) == null || i.destroy();
|
|
24
24
|
});
|
|
25
|
-
}, V =
|
|
26
|
-
name: "
|
|
25
|
+
}, V = p({
|
|
26
|
+
name: "MilkdownDomRoot",
|
|
27
27
|
setup: (o, {
|
|
28
28
|
slots: e
|
|
29
29
|
}) => {
|
|
@@ -38,8 +38,8 @@ const C = Symbol(), F = (o) => {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
V.props = ["editor", "editorRef"];
|
|
41
|
-
const
|
|
42
|
-
name: "
|
|
41
|
+
const R = Symbol("nodeMetadata"), ie = () => v(R), b = p({
|
|
42
|
+
name: "MilkdownNodeContainer",
|
|
43
43
|
setup: ({
|
|
44
44
|
node: o,
|
|
45
45
|
view: e,
|
|
@@ -47,7 +47,7 @@ const b = Symbol(), ie = () => v(b), N = m({
|
|
|
47
47
|
decorations: n,
|
|
48
48
|
ctx: a,
|
|
49
49
|
as: s
|
|
50
|
-
}, i) => (
|
|
50
|
+
}, i) => (w(R, {
|
|
51
51
|
ctx: a,
|
|
52
52
|
node: o,
|
|
53
53
|
view: e,
|
|
@@ -55,14 +55,14 @@ const b = Symbol(), ie = () => v(b), N = m({
|
|
|
55
55
|
decorations: n
|
|
56
56
|
}), () => {
|
|
57
57
|
var r, d;
|
|
58
|
-
return
|
|
58
|
+
return j(s, {
|
|
59
59
|
"data-view-container": !0
|
|
60
60
|
}, (d = (r = i.slots).default) == null ? void 0 : d.call(r));
|
|
61
61
|
})
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
name: "
|
|
63
|
+
b.props = ["ctx", "editor", "node", "view", "getPos", "decorations", "as"];
|
|
64
|
+
const N = p({
|
|
65
|
+
name: "MilkdownContent",
|
|
66
66
|
setup: ({
|
|
67
67
|
isInline: o
|
|
68
68
|
}) => () => o ? l("span", {
|
|
@@ -71,20 +71,20 @@ const R = m({
|
|
|
71
71
|
"data-view-content": !0
|
|
72
72
|
}, null)
|
|
73
73
|
});
|
|
74
|
-
|
|
74
|
+
N.props = ["isInline"];
|
|
75
75
|
const H = z("abcedfghicklmn", 10), J = (o, e, t) => (n, a = {}) => (s) => (i, r, d, f) => new Q(s, n, o, e, t, a, i, r, d, f);
|
|
76
76
|
var P, D;
|
|
77
77
|
class Q {
|
|
78
78
|
constructor(e, t, n, a, s, i, r, d, f, g) {
|
|
79
|
-
|
|
79
|
+
m(this, "getPortal", () => {
|
|
80
80
|
const e = this.component, t = this.options.as ? this.options.as : this.isInlineOrMark ? "span" : "div";
|
|
81
|
-
return
|
|
82
|
-
name: "
|
|
81
|
+
return k(p({
|
|
82
|
+
name: "MilkdownPortal",
|
|
83
83
|
setup: () => () => l(U, {
|
|
84
84
|
key: this.key,
|
|
85
85
|
to: this.teleportDOM
|
|
86
86
|
}, {
|
|
87
|
-
default: () => [l(
|
|
87
|
+
default: () => [l(b, {
|
|
88
88
|
as: t,
|
|
89
89
|
ctx: this.ctx,
|
|
90
90
|
node: this.node,
|
|
@@ -93,7 +93,7 @@ class Q {
|
|
|
93
93
|
decorations: this.decorations
|
|
94
94
|
}, {
|
|
95
95
|
default: () => [l(e, null, {
|
|
96
|
-
default: () => [l(
|
|
96
|
+
default: () => [l(N, {
|
|
97
97
|
isInline: this.isInlineOrMark
|
|
98
98
|
}, null)]
|
|
99
99
|
})]
|
|
@@ -101,9 +101,9 @@ class Q {
|
|
|
101
101
|
})
|
|
102
102
|
}));
|
|
103
103
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.ctx = e, this.component = t, this.rootInstance = n, this.addPortal = a, this.removePortalByKey = s, this.options = i, this.view = d, this.getPos = f, this.key = H(), this.node =
|
|
104
|
+
m(this, "selectNode", (P = this.options) == null ? void 0 : P.selectNode);
|
|
105
|
+
m(this, "deselectNode", (D = this.options) == null ? void 0 : D.deselectNode);
|
|
106
|
+
this.ctx = e, this.component = t, this.rootInstance = n, this.addPortal = a, this.removePortalByKey = s, this.options = i, this.view = d, this.getPos = f, this.key = H(), this.node = u(r), this.decorations = u(g);
|
|
107
107
|
const y = i.as ? i.as : this.isInlineOrMark ? "span" : "div";
|
|
108
108
|
this.teleportDOM = document.createElement(y), this.renderPortal();
|
|
109
109
|
}
|
|
@@ -147,7 +147,7 @@ class Q {
|
|
|
147
147
|
function W(o) {
|
|
148
148
|
return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !q(o);
|
|
149
149
|
}
|
|
150
|
-
const O = Symbol(), X = `
|
|
150
|
+
const O = Symbol("editorInfoCtxKey"), X = `
|
|
151
151
|
@milkdown/vue:
|
|
152
152
|
Passing ref to VueEditor will soon be deprecated, please use:
|
|
153
153
|
|
|
@@ -168,22 +168,22 @@ Passing editor directly to VueEditor will soon be deprecated, please use:
|
|
|
168
168
|
const { editor } = useEditor(/* creator */);
|
|
169
169
|
|
|
170
170
|
<VueEditor editor={editor} />
|
|
171
|
-
`, Z =
|
|
172
|
-
name: "
|
|
171
|
+
`, Z = p({
|
|
172
|
+
name: "MilkdownVueRoot",
|
|
173
173
|
setup: (o) => {
|
|
174
|
-
const e = B([]), t = A(), n =
|
|
174
|
+
const e = B([]), t = A(), n = u(null);
|
|
175
175
|
L(() => {
|
|
176
176
|
n.value = t.ctx._;
|
|
177
|
-
}),
|
|
177
|
+
}), C(() => {
|
|
178
178
|
n.value = null;
|
|
179
179
|
});
|
|
180
|
-
const a =
|
|
181
|
-
e.push([h,
|
|
182
|
-
}), s =
|
|
183
|
-
const h = e.findIndex((
|
|
180
|
+
const a = k((c, h) => {
|
|
181
|
+
e.push([h, c]);
|
|
182
|
+
}), s = k((c) => {
|
|
183
|
+
const h = e.findIndex((M) => M[0] === c);
|
|
184
184
|
e.splice(h, 1);
|
|
185
185
|
}), i = J(n, a, s);
|
|
186
|
-
|
|
186
|
+
w(E, i);
|
|
187
187
|
const r = Object.hasOwnProperty.call(o.editor, "getInstance"), {
|
|
188
188
|
getEditorCallback: d,
|
|
189
189
|
dom: f,
|
|
@@ -192,26 +192,26 @@ const { editor } = useEditor(/* creator */);
|
|
|
192
192
|
} = r ? o.editor.editor : o.editor;
|
|
193
193
|
return _(() => {
|
|
194
194
|
r && console.warn(Y), o.editorRef && console.warn(X);
|
|
195
|
-
}),
|
|
195
|
+
}), w(O, {
|
|
196
196
|
dom: f,
|
|
197
197
|
editor: g,
|
|
198
198
|
loading: y
|
|
199
199
|
}), () => {
|
|
200
|
-
const
|
|
200
|
+
const c = e.map(([h, M]) => l(M, {
|
|
201
201
|
key: h
|
|
202
202
|
}, null));
|
|
203
203
|
return l(V, {
|
|
204
204
|
editorRef: o.editorRef,
|
|
205
205
|
editor: d.value
|
|
206
|
-
}, W(
|
|
207
|
-
default: () => [
|
|
206
|
+
}, W(c) ? c : {
|
|
207
|
+
default: () => [c]
|
|
208
208
|
});
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
Z.props = ["editor", "editorRef"];
|
|
213
213
|
const re = (o) => {
|
|
214
|
-
const e =
|
|
214
|
+
const e = u(null), t = u(), n = u(!0), a = u((...s) => o(...s));
|
|
215
215
|
return {
|
|
216
216
|
loading: n,
|
|
217
217
|
getInstance: () => t.value,
|
|
@@ -225,11 +225,11 @@ const re = (o) => {
|
|
|
225
225
|
};
|
|
226
226
|
};
|
|
227
227
|
export {
|
|
228
|
-
|
|
228
|
+
N as Content,
|
|
229
229
|
Z as VueEditor,
|
|
230
|
-
|
|
230
|
+
b as VueNodeContainer,
|
|
231
231
|
O as editorInfoCtxKey,
|
|
232
|
-
|
|
232
|
+
R as nodeMetadata,
|
|
233
233
|
re as useEditor,
|
|
234
234
|
ie as useNodeCtx
|
|
235
235
|
};
|
package/lib/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/useGetEditor.ts","../src/EditorComponent.tsx","../src/VueNode.tsx","../src/VueNodeView.tsx","../src/Editor.tsx","../src/useEditor.ts"],"sourcesContent":["/* Copyright 2021, Milkdown by Mirone. */\nimport { Ctx } from '@milkdown/core';\nimport { vueRendererCallOutOfScope } from '@milkdown/exception';\nimport { MarkViewConstructor, NodeViewConstructor } from '@milkdown/prose/view';\nimport { DefineComponent, inject, InjectionKey, onMounted, onUnmounted, ref } from 'vue';\n\nimport { editorInfoCtxKey } from '.';\nimport { EditorInfoCtx, GetEditor, RenderOptions, RenderVue } from './types';\n\nexport const rendererKey: InjectionKey<\n (component: DefineComponent, options?: RenderOptions) => (ctx: Ctx) => NodeViewConstructor | MarkViewConstructor\n> = Symbol();\n\nexport const useGetEditor = (getEditor: GetEditor) => {\n const renderVue = inject<RenderVue>(rendererKey, () => {\n throw vueRendererCallOutOfScope();\n });\n const { dom, loading, editor: editorRef } = inject(editorInfoCtxKey, {} as EditorInfoCtx);\n const lock = ref(false);\n\n onMounted(() => {\n if (!dom.value) return;\n\n const editor = getEditor(dom.value, renderVue);\n if (!editor) return;\n\n if (lock.value) return;\n\n loading.value = true;\n lock.value = true;\n\n editor\n .create()\n .then((editor) => {\n editorRef.value = editor;\n return;\n })\n .finally(() => {\n loading.value = false;\n lock.value = false;\n })\n .catch((e) => console.error(e));\n });\n onUnmounted(() => {\n editorRef.value?.destroy();\n });\n};\n","/* Copyright 2021, Milkdown by Mirone. */\nimport { Editor } from '@milkdown/core';\nimport { defineComponent, h, inject } from 'vue';\n\nimport { editorInfoCtxKey } from './Editor';\nimport { EditorInfoCtx, GetEditor } from './types';\nimport { useGetEditor } from './useGetEditor';\n\nexport const EditorComponent = defineComponent<{ editor: GetEditor; editorRef?: EditorRef }>({\n name: 'milkdown-dom-root',\n setup: (props, { slots }) => {\n useGetEditor(props.editor);\n const ctx = inject(editorInfoCtxKey, {} as EditorInfoCtx);\n\n if (props.editorRef) {\n props.editorRef.get = () => ctx.editor.value;\n props.editorRef.dom = () => ctx.dom.value;\n }\n\n return () => <div ref={ctx.dom}>{slots['default']?.()}</div>;\n },\n});\nEditorComponent['props'] = ['editor', 'editorRef'];\n\nexport type EditorRef = { get: () => Editor | undefined; dom: () => HTMLDivElement | null };\n","/* Copyright 2021, Milkdown by Mirone. */\nimport { Ctx } from '@milkdown/core';\nimport { Mark, Node } from '@milkdown/prose/model';\nimport { Decoration, EditorView } from '@milkdown/prose/view';\nimport { defineComponent, h, inject, InjectionKey, provide, Ref } from 'vue';\n\nexport type NodeContext<T extends Node | Mark = Node | Mark> = {\n ctx: Ctx;\n node: Ref<T>;\n view: EditorView;\n getPos: T extends Mark ? boolean : T extends Node ? () => number : boolean | (() => number);\n decorations: Ref<readonly Decoration[]>;\n};\n\nexport const nodeMetadata: InjectionKey<NodeContext> = Symbol();\n\nexport type UseNodeCtx = <T extends Node | Mark = Node | Mark>() => NodeContext<T>;\nexport const useNodeCtx: UseNodeCtx = () => inject(nodeMetadata) as NodeContext<never>;\n\nexport const VueNodeContainer = defineComponent<NodeContext & { as: string }>({\n name: 'milkdown-node-container',\n setup: ({ node, view, getPos, decorations, ctx, as }, context) => {\n provide(nodeMetadata, {\n ctx,\n node,\n view,\n getPos,\n decorations,\n });\n return () => h(as, { 'data-view-container': true }, context.slots['default']?.());\n },\n});\nVueNodeContainer['props'] = ['ctx', 'editor', 'node', 'view', 'getPos', 'decorations', 'as'];\n\nexport const Content = defineComponent<{ isInline?: boolean }>({\n name: 'milkdown-content',\n setup: ({ isInline }) => {\n return () => (isInline ? <span data-view-content /> : <div data-view-content />);\n },\n});\nContent['props'] = ['isInline'];\n","/* Copyright 2021, Milkdown by Mirone. */\nimport { Ctx } from '@milkdown/core';\nimport { Mark, Node } from '@milkdown/prose/model';\nimport type {\n Decoration,\n DecorationSource,\n EditorView,\n MarkViewConstructor,\n NodeView,\n NodeViewConstructor,\n} from '@milkdown/prose/view';\nimport { customAlphabet } from 'nanoid';\nimport { ComponentInternalInstance, DefineComponent, defineComponent, h, markRaw, Ref, ref, Teleport } from 'vue';\n\nimport { Content, VueNodeContainer } from './VueNode';\n\nconst nanoid = customAlphabet('abcedfghicklmn', 10);\n\nexport type RenderOptions = Partial<\n {\n as: string;\n update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;\n } & Pick<NodeView, 'ignoreMutation' | 'deselectNode' | 'selectNode' | 'destroy'>\n>;\n\nexport const createVueView =\n (\n rootInstance: Ref<null | ComponentInternalInstance>,\n addPortal: (portal: DefineComponent, key: string) => void,\n removePortalByKey: (key: string) => void,\n ) =>\n (\n component: DefineComponent,\n options: RenderOptions = {},\n ): ((ctx: Ctx) => NodeViewConstructor | MarkViewConstructor) =>\n (ctx) =>\n (node, view, getPos, decorations) =>\n new VueNodeView(\n ctx,\n component,\n rootInstance,\n addPortal,\n removePortalByKey,\n options,\n node,\n view,\n getPos,\n decorations,\n );\n\nexport class VueNodeView implements NodeView {\n teleportDOM: HTMLElement;\n key: string;\n\n get isInlineOrMark() {\n return this.node.value instanceof Mark || this.node.value.isInline;\n }\n\n private node: Ref<Node | Mark>;\n private decorations: Ref<readonly Decoration[]>;\n\n constructor(\n private ctx: Ctx,\n private component: DefineComponent,\n private rootInstance: Ref<null | ComponentInternalInstance>,\n private addPortal: (portal: DefineComponent, key: string) => void,\n private removePortalByKey: (key: string) => void,\n private options: RenderOptions,\n node: Node | Mark,\n private view: EditorView,\n private getPos: boolean | (() => number),\n decorations: readonly Decoration[],\n ) {\n this.key = nanoid();\n this.node = ref(node);\n this.decorations = ref(decorations);\n const elementName = options.as ? options.as : this.isInlineOrMark ? 'span' : 'div';\n this.teleportDOM = document.createElement(elementName);\n this.renderPortal();\n }\n\n get dom() {\n return (this.teleportDOM.firstElementChild || this.teleportDOM) as HTMLElement;\n }\n\n get contentDOM() {\n if (this.node instanceof Node && this.node.isLeaf) {\n return undefined;\n }\n\n return this.teleportDOM.querySelector<HTMLElement>('[data-view-content]') || this.dom;\n }\n\n getPortal = (): DefineComponent => {\n const CustomComponent = this.component;\n const elementName = this.options.as ? this.options.as : this.isInlineOrMark ? 'span' : 'div';\n return markRaw(\n defineComponent({\n name: 'milkdown-portal',\n setup: () => {\n return () => (\n <Teleport key={this.key} to={this.teleportDOM}>\n <VueNodeContainer\n as={elementName}\n ctx={this.ctx}\n node={this.node}\n view={this.view}\n getPos={this.getPos}\n decorations={this.decorations}\n >\n <CustomComponent>\n <Content isInline={this.isInlineOrMark} />\n </CustomComponent>\n </VueNodeContainer>\n </Teleport>\n );\n },\n }) as DefineComponent,\n );\n };\n\n renderPortal() {\n if (!this.teleportDOM) return;\n\n const Portal = this.getPortal();\n this.addPortal(Portal, this.key);\n const instance = this.rootInstance.value;\n if (instance) {\n instance.update();\n }\n }\n\n destroy() {\n this.options.destroy?.();\n this.teleportDOM.remove();\n this.removePortalByKey(this.key);\n }\n\n ignoreMutation(mutation: MutationRecord) {\n if (this.options.ignoreMutation) {\n return this.options.ignoreMutation(mutation);\n }\n if (!this.dom || !this.contentDOM) {\n return true;\n }\n\n if (this.node instanceof Node) {\n if (this.node.isLeaf || this.node.isAtom) {\n return true;\n }\n }\n\n if ((mutation as unknown as { type: string }).type === 'selection') {\n return false;\n }\n\n if (this.contentDOM === this.dom) {\n return false;\n }\n\n if (this.contentDOM.contains(mutation.target)) {\n return false;\n }\n\n return true;\n }\n\n update(node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) {\n const innerUpdate = () => {\n if (this.options.update) {\n const result = this.options.update?.(node, decorations, innerDecorations);\n if (result != null) {\n return result;\n }\n }\n if (this.node.value.type !== node.type) {\n return false;\n }\n\n if (node === this.node.value && this.decorations.value === decorations) {\n return true;\n }\n\n this.node.value = node;\n this.decorations.value = decorations;\n return true;\n };\n\n const shouldUpdate = innerUpdate();\n\n return shouldUpdate;\n }\n\n selectNode = this.options?.selectNode;\n\n deselectNode = this.options?.deselectNode;\n}\n","/* Copyright 2021, Milkdown by Mirone. */\nimport {\n ComponentInternalInstance,\n DefineComponent,\n defineComponent,\n effect,\n getCurrentInstance,\n h,\n InjectionKey,\n markRaw,\n onBeforeMount,\n onUnmounted,\n provide,\n ref,\n shallowReactive,\n} from 'vue';\n\nimport { EditorComponent, EditorRef } from './EditorComponent';\nimport { EditorInfo, EditorInfoCtx } from './types';\nimport { rendererKey } from './useGetEditor';\nimport { createVueView } from './VueNodeView';\n\nexport const editorInfoCtxKey: InjectionKey<EditorInfoCtx> = Symbol();\n\nconst refDeprecatedInfo = `\n@milkdown/vue:\nPassing ref to VueEditor will soon be deprecated, please use:\n\nconst { editor, getInstance, getDom, loading } = useEditor(/* creator */);\n\neffect(() => {\n if (!loading) {\n const editor = getInstance();\n const rootDOM = getDom();\n }\n})\n\n<VueEditor editor={editor} />\n`;\n\nconst compositionDeprecatedInfo = `\n@milkdown/vue:\nPassing editor directly to VueEditor will soon be deprecated, please use:\n\nconst { editor } = useEditor(/* creator */);\n\n<VueEditor editor={editor} />\n`;\n\ntype PortalPair = [key: string, component: DefineComponent];\nexport const VueEditor = defineComponent<{ editor: EditorInfo; editorRef?: EditorRef }>({\n name: 'milkdown-vue-root',\n setup: (props) => {\n const portals = shallowReactive<PortalPair[]>([]);\n\n const instance = getCurrentInstance();\n\n const rootInstance = ref<null | ComponentInternalInstance>(null);\n\n onBeforeMount(() => {\n rootInstance.value = (instance as ComponentInternalInstance & { ctx: { _: ComponentInternalInstance } }).ctx\n ._ as ComponentInternalInstance;\n });\n\n onUnmounted(() => {\n rootInstance.value = null;\n });\n\n const addPortal = markRaw((component: DefineComponent, key: string) => {\n portals.push([key, component]);\n });\n const removePortalByKey = markRaw((key: string) => {\n const index = portals.findIndex((p) => p[0] === key);\n portals.splice(index, 1);\n });\n const renderVue = createVueView(rootInstance, addPortal, removePortalByKey);\n\n provide(rendererKey, renderVue);\n\n const usingDeprecatedCompositionAPI = Object.hasOwnProperty.call(props.editor, 'getInstance');\n\n const { getEditorCallback, dom, editor, loading } = usingDeprecatedCompositionAPI\n ? // @ts-expect-error deprecated old composition API\n (props.editor.editor as EditorInfo)\n : props.editor;\n\n effect(() => {\n if (usingDeprecatedCompositionAPI) {\n console.warn(compositionDeprecatedInfo);\n }\n if (props.editorRef) {\n console.warn(refDeprecatedInfo);\n }\n });\n\n provide(editorInfoCtxKey, {\n dom,\n editor,\n loading,\n });\n\n return () => {\n const portalElements = portals.map(([id, P]) => <P key={id} />);\n return (\n <EditorComponent editorRef={props.editorRef} editor={getEditorCallback.value}>\n {portalElements}\n </EditorComponent>\n );\n };\n },\n});\nVueEditor['props'] = ['editor', 'editorRef'];\n","/* Copyright 2021, Milkdown by Mirone. */\n\nimport { Editor } from '@milkdown/core';\nimport { ref } from 'vue';\n\nimport { GetEditor, UseEditorReturn } from './types';\n\nexport const useEditor = (getEditor: GetEditor): UseEditorReturn => {\n const dom = ref<HTMLDivElement | null>(null);\n const editor = ref<Editor>();\n const loading = ref(true);\n const getEditorCallback = ref<GetEditor>((...args) => getEditor(...args));\n\n return {\n loading,\n getInstance: () => editor.value,\n getDom: () => dom.value,\n editor: {\n getEditorCallback,\n dom,\n editor,\n loading,\n },\n };\n};\n"],"names":["EditorComponent","defineComponent","name","setup","props","slots","useGetEditor","editor","ctx","inject","editorInfoCtxKey","editorRef","get","value","dom","_createVNode","nodeMetadata","Symbol","useNodeCtx","VueNodeContainer","node","view","getPos","decorations","as","context","provide","h","Content","isInline","nanoid","customAlphabet","createVueView","rootInstance","addPortal","removePortalByKey","component","options","VueNodeView","constructor","getPortal","CustomComponent","elementName","isInlineOrMark","markRaw","key","teleportDOM","selectNode","deselectNode","ref","document","createElement","renderPortal","Mark","firstElementChild","contentDOM","Node","isLeaf","querySelector","Portal","instance","update","destroy","remove","ignoreMutation","mutation","isAtom","type","contains","target","innerDecorations","innerUpdate","result","refDeprecatedInfo","compositionDeprecatedInfo","VueEditor","portals","shallowReactive","getCurrentInstance","onBeforeMount","_","onUnmounted","push","index","findIndex","p","splice","renderVue","rendererKey","usingDeprecatedCompositionAPI","Object","hasOwnProperty","call","getEditorCallback","loading","effect","console","warn","portalElements","map","id","P"],"mappings":";;;;;;;AASO,MAAM,IAET,OAAO,GAEE,IAAe,CAAC,MAAyB;AAC5C,QAAA,IAAY,EAAkB,GAAa,MAAM;AACnD,UAAM,EAA0B;AAAA,EAAA,CACnC,GACK,EAAE,QAAK,YAAS,QAAQ,MAAc,EAAO,GAAkB,CAAA,CAAmB,GAClF,IAAO,EAAI,EAAK;AAEtB,IAAU,MAAM;AACZ,QAAI,CAAC,EAAI;AAAO;AAEhB,UAAM,IAAS,EAAU,EAAI,OAAO,CAAS;AAC7C,IAAI,CAAC,KAED,EAAK,SAET,GAAQ,QAAQ,IAChB,EAAK,QAAQ,IAEb,EACK,OAAO,EACP,KAAK,CAAC,MAAW;AACd,QAAU,QAAQ;AAAA,IAClB,CACH,EACA,QAAQ,MAAM;AACX,QAAQ,QAAQ,IAChB,EAAK,QAAQ;AAAA,IAAA,CAChB,EACA,MAAM,CAAC,MAAM,QAAQ,MAAM,CAAC,CAAC;AAAA,EAAA,CACrC,GACD,EAAY,MAAM;;AACd,WAAU,UAAV,UAAiB;AAAA,EAAQ,CAC5B;AACL,GCtCaA,IAAkBC,EAA8D;AAAA,EACzFC,MAAM;AAAA,EACNC,OAAO,CAACC,GAAO;AAAA,IAAEC;AAAAA,QAAY;AACzBC,MAAaF,EAAMG,MAAP;AACZ,UAAMC,IAAMC,EAAOC,GAAkB,CAAnB,CAAA;AAElB,WAAIN,EAAMO,aACNP,GAAMO,UAAUC,MAAM,MAAMJ,EAAID,OAAOM,OACvCT,EAAMO,UAAUG,MAAM,MAAMN,E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;AAAAA,MAAmB/E;AAAAA,MAAKP;AAAAA,MAAQuF;AAAAA,QAAYL,IAE7CrF,EAAMG,OAAOA,SACdH,EAAMG;AAEZwF,aAAO,MAAM;AACT,MAAIN,KACAO,QAAQC,KAAKvB,CAAb,GAEAtE,EAAMO,aACNqF,QAAQC,KAAKxB,CAAb;AAAA,IAEP,CAPK,GASN/C,EAAQhB,GAAkB;AAAA,MACtBI;AAAAA,MACAP;AAAAA,MACAuF;AAAAA,IAHsB,CAAnB,GAMA,MAAM;AACT,YAAMI,IAAiBtB,EAAQuB,IAAI,CAAC,CAACC,GAAIC,OAANtF,EAAA,GAAA;AAAA,QAAA,KAAqBqF;AAAAA,MAArB,GAAA,IAAA,CAAZ;AACvB,aAAArF,EAAA,GAAA;AAAA,QAAA,WACgCX,EAAMO;AAAAA,QADtC,QACyDkF,EAAkBhF;AAAAA,SAClEqF,EAAAA,CAFT,IAESA,IAFT;AAAA,QAAA,SAAA,MAAA,CAESA,CAFT;AAAA,MAAA,CAAA;AAAA;EAMP;AA3DmF,CAAhD;AA6DxCvB,EAAU,QAAW,CAAC,UAAU,WAAX;ACxGR,MAAA,KAAY,CAAC,MAA0C;AAC1D,QAAA,IAAM,EAA2B,IAAI,GACrC,IAAS,KACT,IAAU,EAAI,EAAI,GAClB,IAAoB,EAAe,IAAI,MAAS,EAAU,GAAG,CAAI,CAAC;AAEjE,SAAA;AAAA,IACH;AAAA,IACA,aAAa,MAAM,EAAO;AAAA,IAC1B,QAAQ,MAAM,EAAI;AAAA,IAClB,QAAQ;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EAAA;AAER;"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/useGetEditor.ts","../src/EditorComponent.tsx","../src/VueNode.tsx","../src/VueNodeView.tsx","../src/Editor.tsx","../src/useEditor.ts"],"sourcesContent":["/* Copyright 2021, Milkdown by Mirone. */\nimport type { Ctx } from '@milkdown/core'\nimport { vueRendererCallOutOfScope } from '@milkdown/exception'\nimport type { MarkViewConstructor, NodeViewConstructor } from '@milkdown/prose/view'\nimport type { DefineComponent, InjectionKey } from 'vue'\nimport { inject, onMounted, onUnmounted, ref } from 'vue'\n\nimport type { EditorInfoCtx, GetEditor, RenderOptions, RenderVue } from './types'\nimport { editorInfoCtxKey } from '.'\n\nexport const rendererKey: InjectionKey<\n (component: DefineComponent, options?: RenderOptions) => (ctx: Ctx) => NodeViewConstructor | MarkViewConstructor\n> = Symbol('rendererKey')\n\nexport const useGetEditor = (getEditor: GetEditor) => {\n const renderVue = inject<RenderVue>(rendererKey, () => {\n throw vueRendererCallOutOfScope()\n })\n const { dom, loading, editor: editorRef } = inject(editorInfoCtxKey, {} as EditorInfoCtx)\n const lock = ref(false)\n\n onMounted(() => {\n if (!dom.value)\n return\n\n const editor = getEditor(dom.value, renderVue)\n if (!editor)\n return\n\n if (lock.value)\n return\n\n loading.value = true\n lock.value = true\n\n editor\n .create()\n .then((editor) => {\n editorRef.value = editor\n })\n .finally(() => {\n loading.value = false\n lock.value = false\n })\n .catch(e => console.error(e))\n })\n onUnmounted(() => {\n editorRef.value?.destroy()\n })\n}\n","/* Copyright 2021, Milkdown by Mirone. */\nimport type { Editor } from '@milkdown/core'\nimport { defineComponent, h, inject } from 'vue'\n\nimport { editorInfoCtxKey } from './Editor'\nimport type { EditorInfoCtx, GetEditor } from './types'\nimport { useGetEditor } from './useGetEditor'\n\nexport const EditorComponent = defineComponent<{ editor: GetEditor; editorRef?: EditorRef }>({\n name: 'MilkdownDomRoot',\n setup: (props, { slots }) => {\n useGetEditor(props.editor)\n const ctx = inject(editorInfoCtxKey, {} as EditorInfoCtx)\n\n if (props.editorRef) {\n // eslint-disable-next-line vue/no-mutating-props\n props.editorRef.get = () => ctx.editor.value\n // eslint-disable-next-line vue/no-mutating-props\n props.editorRef.dom = () => ctx.dom.value\n }\n\n return () => <div ref={ctx.dom}>{slots.default?.()}</div>\n },\n})\nEditorComponent.props = ['editor', 'editorRef']\n\nexport interface EditorRef { get: () => Editor | undefined; dom: () => HTMLDivElement | null }\n","/* Copyright 2021, Milkdown by Mirone. */\n/* eslint-disable vue/one-component-per-file */\nimport type { Ctx } from '@milkdown/core'\nimport type { Mark, Node } from '@milkdown/prose/model'\nimport type { Decoration, EditorView } from '@milkdown/prose/view'\nimport type { InjectionKey, Ref } from 'vue'\nimport { defineComponent, h, inject, provide } from 'vue'\n\nexport interface NodeContext<T extends Node | Mark = Node | Mark> {\n ctx: Ctx\n node: Ref<T>\n view: EditorView\n getPos: T extends Mark ? boolean : T extends Node ? () => number : boolean | (() => number)\n decorations: Ref<readonly Decoration[]>\n}\n\nexport const nodeMetadata: InjectionKey<NodeContext> = Symbol('nodeMetadata')\n\nexport type UseNodeCtx = <T extends Node | Mark = Node | Mark>() => NodeContext<T>\nexport const useNodeCtx: UseNodeCtx = () => inject(nodeMetadata) as NodeContext<never>\n\nexport const VueNodeContainer = defineComponent<NodeContext & { as: string }>({\n name: 'MilkdownNodeContainer',\n setup: ({ node, view, getPos, decorations, ctx, as }, context) => {\n provide(nodeMetadata, {\n ctx,\n node,\n view,\n getPos,\n decorations,\n })\n return () => h(as, { 'data-view-container': true }, context.slots.default?.())\n },\n})\nVueNodeContainer.props = ['ctx', 'editor', 'node', 'view', 'getPos', 'decorations', 'as']\n\nexport const Content = defineComponent<{ isInline?: boolean }>({\n name: 'MilkdownContent',\n setup: ({ isInline }) => {\n return () => (isInline ? <span data-view-content /> : <div data-view-content />)\n },\n})\nContent.props = ['isInline']\n","/* Copyright 2021, Milkdown by Mirone. */\nimport type { Ctx } from '@milkdown/core'\nimport { Mark, Node } from '@milkdown/prose/model'\nimport type {\n Decoration,\n DecorationSource,\n EditorView,\n MarkViewConstructor,\n NodeView,\n NodeViewConstructor,\n} from '@milkdown/prose/view'\nimport { customAlphabet } from 'nanoid'\nimport type { ComponentInternalInstance, DefineComponent, Ref } from 'vue'\nimport { Teleport, defineComponent, h, markRaw, ref } from 'vue'\n\nimport { Content, VueNodeContainer } from './VueNode'\n\nconst nanoid = customAlphabet('abcedfghicklmn', 10)\n\nexport type RenderOptions = Partial<\n {\n as: string\n update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean\n } & Pick<NodeView, 'ignoreMutation' | 'deselectNode' | 'selectNode' | 'destroy'>\n>\n\nexport const createVueView\n = (\n rootInstance: Ref<null | ComponentInternalInstance>,\n addPortal: (portal: DefineComponent, key: string) => void,\n removePortalByKey: (key: string) => void,\n ) =>\n (\n component: DefineComponent,\n options: RenderOptions = {},\n ): ((ctx: Ctx) => NodeViewConstructor | MarkViewConstructor) =>\n ctx =>\n (node, view, getPos, decorations) =>\n new VueNodeView(\n ctx,\n component,\n rootInstance,\n addPortal,\n removePortalByKey,\n options,\n node,\n view,\n getPos,\n decorations,\n )\n\nexport class VueNodeView implements NodeView {\n teleportDOM: HTMLElement\n key: string\n\n get isInlineOrMark() {\n return this.node.value instanceof Mark || this.node.value.isInline\n }\n\n private node: Ref<Node | Mark>\n private decorations: Ref<readonly Decoration[]>\n\n constructor(\n private ctx: Ctx,\n private component: DefineComponent,\n private rootInstance: Ref<null | ComponentInternalInstance>,\n private addPortal: (portal: DefineComponent, key: string) => void,\n private removePortalByKey: (key: string) => void,\n private options: RenderOptions,\n node: Node | Mark,\n private view: EditorView,\n private getPos: boolean | (() => number),\n decorations: readonly Decoration[],\n ) {\n this.key = nanoid()\n this.node = ref(node)\n this.decorations = ref(decorations)\n const elementName = options.as ? options.as : this.isInlineOrMark ? 'span' : 'div'\n this.teleportDOM = document.createElement(elementName)\n this.renderPortal()\n }\n\n get dom() {\n return (this.teleportDOM.firstElementChild || this.teleportDOM) as HTMLElement\n }\n\n get contentDOM() {\n if (this.node instanceof Node && this.node.isLeaf)\n return undefined\n\n return this.teleportDOM.querySelector<HTMLElement>('[data-view-content]') || this.dom\n }\n\n getPortal = (): DefineComponent => {\n const CustomComponent = this.component\n const elementName = this.options.as ? this.options.as : this.isInlineOrMark ? 'span' : 'div'\n return markRaw(\n defineComponent({\n name: 'MilkdownPortal',\n setup: () => {\n return () => (\n <Teleport key={this.key} to={this.teleportDOM}>\n <VueNodeContainer\n as={elementName}\n ctx={this.ctx}\n node={this.node}\n view={this.view}\n getPos={this.getPos}\n decorations={this.decorations}\n >\n <CustomComponent>\n <Content isInline={this.isInlineOrMark} />\n </CustomComponent>\n </VueNodeContainer>\n </Teleport>\n )\n },\n }) as DefineComponent,\n )\n }\n\n renderPortal() {\n if (!this.teleportDOM)\n return\n\n const Portal = this.getPortal()\n this.addPortal(Portal, this.key)\n const instance = this.rootInstance.value\n if (instance)\n instance.update()\n }\n\n destroy() {\n this.options.destroy?.()\n this.teleportDOM.remove()\n this.removePortalByKey(this.key)\n }\n\n ignoreMutation(mutation: MutationRecord) {\n if (this.options.ignoreMutation)\n return this.options.ignoreMutation(mutation)\n\n if (!this.dom || !this.contentDOM)\n return true\n\n if (this.node instanceof Node) {\n if (this.node.isLeaf || this.node.isAtom)\n return true\n }\n\n if ((mutation as unknown as { type: string }).type === 'selection')\n return false\n\n if (this.contentDOM === this.dom)\n return false\n\n if (this.contentDOM.contains(mutation.target))\n return false\n\n return true\n }\n\n update(node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) {\n const innerUpdate = () => {\n if (this.options.update) {\n const result = this.options.update?.(node, decorations, innerDecorations)\n if (result != null)\n return result\n }\n if (this.node.value.type !== node.type)\n return false\n\n if (node === this.node.value && this.decorations.value === decorations)\n return true\n\n this.node.value = node\n this.decorations.value = decorations\n return true\n }\n\n const shouldUpdate = innerUpdate()\n\n return shouldUpdate\n }\n\n selectNode = this.options?.selectNode\n\n deselectNode = this.options?.deselectNode\n}\n","/* Copyright 2021, Milkdown by Mirone. */\nimport type {\n ComponentInternalInstance,\n DefineComponent,\n InjectionKey,\n} from 'vue'\nimport {\n defineComponent,\n effect,\n getCurrentInstance,\n h,\n markRaw,\n onBeforeMount,\n onUnmounted,\n provide,\n ref,\n shallowReactive,\n} from 'vue'\n\nimport type { EditorRef } from './EditorComponent'\nimport { EditorComponent } from './EditorComponent'\nimport type { EditorInfo, EditorInfoCtx } from './types'\nimport { rendererKey } from './useGetEditor'\nimport { createVueView } from './VueNodeView'\n\nexport const editorInfoCtxKey: InjectionKey<EditorInfoCtx> = Symbol('editorInfoCtxKey')\n\nconst refDeprecatedInfo = `\n@milkdown/vue:\nPassing ref to VueEditor will soon be deprecated, please use:\n\nconst { editor, getInstance, getDom, loading } = useEditor(/* creator */);\n\neffect(() => {\n if (!loading) {\n const editor = getInstance();\n const rootDOM = getDom();\n }\n})\n\n<VueEditor editor={editor} />\n`\n\nconst compositionDeprecatedInfo = `\n@milkdown/vue:\nPassing editor directly to VueEditor will soon be deprecated, please use:\n\nconst { editor } = useEditor(/* creator */);\n\n<VueEditor editor={editor} />\n`\n\ntype PortalPair = [key: string, component: DefineComponent]\nexport const VueEditor = defineComponent<{ editor: EditorInfo; editorRef?: EditorRef }>({\n name: 'MilkdownVueRoot',\n setup: (props) => {\n const portals = shallowReactive<PortalPair[]>([])\n\n const instance = getCurrentInstance()\n\n const rootInstance = ref<null | ComponentInternalInstance>(null)\n\n onBeforeMount(() => {\n rootInstance.value = (instance as ComponentInternalInstance & { ctx: { _: ComponentInternalInstance } }).ctx\n ._ as ComponentInternalInstance\n })\n\n onUnmounted(() => {\n rootInstance.value = null\n })\n\n const addPortal = markRaw((component: DefineComponent, key: string) => {\n portals.push([key, component])\n })\n const removePortalByKey = markRaw((key: string) => {\n const index = portals.findIndex(p => p[0] === key)\n portals.splice(index, 1)\n })\n const renderVue = createVueView(rootInstance, addPortal, removePortalByKey)\n\n provide(rendererKey, renderVue)\n\n const usingDeprecatedCompositionAPI = Object.hasOwnProperty.call(props.editor, 'getInstance')\n\n const { getEditorCallback, dom, editor, loading } = usingDeprecatedCompositionAPI\n // @ts-expect-error deprecated old composition API\n ? (props.editor.editor as EditorInfo)\n : props.editor\n\n effect(() => {\n if (usingDeprecatedCompositionAPI)\n console.warn(compositionDeprecatedInfo)\n\n if (props.editorRef)\n console.warn(refDeprecatedInfo)\n })\n\n provide(editorInfoCtxKey, {\n dom,\n editor,\n loading,\n })\n\n return () => {\n const portalElements = portals.map(([id, P]) => <P key={id} />)\n return (\n <EditorComponent editorRef={props.editorRef} editor={getEditorCallback.value}>\n {portalElements}\n </EditorComponent>\n )\n }\n },\n})\nVueEditor.props = ['editor', 'editorRef']\n","/* Copyright 2021, Milkdown by Mirone. */\n\nimport type { Editor } from '@milkdown/core'\nimport { ref } from 'vue'\n\nimport type { GetEditor, UseEditorReturn } from './types'\n\nexport const useEditor = (getEditor: GetEditor): UseEditorReturn => {\n const dom = ref<HTMLDivElement | null>(null)\n const editor = ref<Editor>()\n const loading = ref(true)\n const getEditorCallback = ref<GetEditor>((...args) => getEditor(...args))\n\n return {\n loading,\n getInstance: () => editor.value,\n getDom: () => dom.value,\n editor: {\n getEditorCallback,\n dom,\n editor,\n loading,\n },\n }\n}\n"],"names":["rendererKey","useGetEditor","getEditor","renderVue","inject","vueRendererCallOutOfScope","dom","loading","editorRef","editorInfoCtxKey","lock","ref","onMounted","editor","e","onUnmounted","_a","EditorComponent","defineComponent","name","setup","props","slots","ctx","get","value","_createVNode","default","nodeMetadata","Symbol","useNodeCtx","VueNodeContainer","node","view","getPos","decorations","as","context","provide","h","Content","isInline","nanoid","customAlphabet","createVueView","rootInstance","addPortal","removePortalByKey","component","options","VueNodeView","constructor","getPortal","CustomComponent","elementName","isInlineOrMark","markRaw","Teleport","key","teleportDOM","selectNode","deselectNode","_b","document","createElement","renderPortal","Mark","firstElementChild","contentDOM","Node","isLeaf","querySelector","Portal","instance","update","destroy","remove","ignoreMutation","mutation","isAtom","type","contains","target","innerDecorations","result","refDeprecatedInfo","compositionDeprecatedInfo","VueEditor","portals","shallowReactive","getCurrentInstance","onBeforeMount","_","push","index","findIndex","p","splice","usingDeprecatedCompositionAPI","Object","hasOwnProperty","call","getEditorCallback","effect","console","warn","portalElements","map","id","P","useEditor","args"],"m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,SAAA;AAAA,IACL,SAAAxG;AAAA,IACA,aAAa,MAAMM,EAAO;AAAA,IAC1B,QAAQ,MAAMP,EAAI;AAAA,IAClB,QAAQ;AAAA,MACN,mBAAAgG;AAAA,MACA,KAAAhG;AAAA,MACA,QAAAO;AAAA,MACA,SAAAN;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Ctx, Editor } from '@milkdown/core';
|
|
1
|
+
import type { Ctx, Editor } from '@milkdown/core';
|
|
2
2
|
import type { Mark, Node } from '@milkdown/prose/model';
|
|
3
|
-
import { Decoration, DecorationSource, MarkViewConstructor, NodeView, NodeViewConstructor } from '@milkdown/prose/view';
|
|
4
|
-
import { Ref } from 'vue';
|
|
5
|
-
import { AnyVueComponent } from './utils';
|
|
6
|
-
export
|
|
3
|
+
import type { Decoration, DecorationSource, MarkViewConstructor, NodeView, NodeViewConstructor } from '@milkdown/prose/view';
|
|
4
|
+
import type { Ref } from 'vue';
|
|
5
|
+
import type { AnyVueComponent } from './utils';
|
|
6
|
+
export type RenderOptions = Partial<{
|
|
7
7
|
as: string;
|
|
8
8
|
update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;
|
|
9
9
|
} & Pick<NodeView, 'ignoreMutation' | 'deselectNode' | 'selectNode' | 'destroy'>>;
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
10
|
+
export type RenderVue<U = never> = <T extends Node | Mark = Node | Mark>(Component: AnyVueComponent, options?: RenderOptions) => (ctx: Ctx) => U extends never ? T extends Node ? NodeViewConstructor : T extends Mark ? MarkViewConstructor : NodeViewConstructor & MarkViewConstructor : U extends Node ? NodeViewConstructor : U extends Mark ? MarkViewConstructor : NodeViewConstructor & MarkViewConstructor;
|
|
11
|
+
export type GetEditor = (container: HTMLDivElement, renderVue: RenderVue) => Editor;
|
|
12
|
+
export interface EditorInfoCtx {
|
|
13
13
|
dom: Ref<HTMLDivElement | null>;
|
|
14
14
|
editor: Ref<Editor | undefined>;
|
|
15
15
|
loading: Ref<boolean>;
|
|
16
|
-
}
|
|
17
|
-
export
|
|
16
|
+
}
|
|
17
|
+
export type EditorInfo = {
|
|
18
18
|
getEditorCallback: Ref<GetEditor>;
|
|
19
19
|
} & EditorInfoCtx;
|
|
20
|
-
export
|
|
20
|
+
export interface UseEditorReturn {
|
|
21
21
|
loading: Ref<boolean>;
|
|
22
22
|
getInstance: () => Editor | undefined;
|
|
23
23
|
getDom: () => HTMLDivElement | null;
|
|
24
24
|
editor: EditorInfo;
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC5H,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B;IACE,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,UAAU,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,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-1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../src/useEditor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzD,eAAO,MAAM,SAAS,cAAe,SAAS,KAAG,eAiBhD,CAAA"}
|
package/lib/useGetEditor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Ctx } from '@milkdown/core';
|
|
2
|
-
import { MarkViewConstructor, NodeViewConstructor } from '@milkdown/prose/view';
|
|
3
|
-
import { DefineComponent, InjectionKey } from 'vue';
|
|
4
|
-
import { GetEditor, RenderOptions } from './types';
|
|
1
|
+
import type { Ctx } from '@milkdown/core';
|
|
2
|
+
import type { MarkViewConstructor, NodeViewConstructor } from '@milkdown/prose/view';
|
|
3
|
+
import type { DefineComponent, InjectionKey } from 'vue';
|
|
4
|
+
import type { GetEditor, RenderOptions } from './types';
|
|
5
5
|
export declare const rendererKey: InjectionKey<(component: DefineComponent, options?: RenderOptions) => (ctx: Ctx) => NodeViewConstructor | MarkViewConstructor>;
|
|
6
6
|
export declare const useGetEditor: (getEditor: GetEditor) => void;
|
|
7
7
|
//# sourceMappingURL=useGetEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEditor.d.ts","sourceRoot":"","sources":["../src/useGetEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"useGetEditor.d.ts","sourceRoot":"","sources":["../src/useGetEditor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAGxD,OAAO,KAAK,EAAiB,SAAS,EAAE,aAAa,EAAa,MAAM,SAAS,CAAA;AAGjF,eAAO,MAAM,WAAW,EAAE,YAAY,CAClC,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,CAAC,GAAG,EAAE,GAAG,KAAK,mBAAmB,GAAG,mBAAmB,CAC3F,CAAA;AAEzB,eAAO,MAAM,YAAY,cAAe,SAAS,SAmChD,CAAA"}
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DefineComponent } from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { DefineComponent } from 'vue';
|
|
2
|
+
type Prepend<T, U extends unknown[]> = [T, ...U];
|
|
3
|
+
type Keys_<T extends Record<string, unknown>, U extends PropertyKey[]> = {
|
|
4
4
|
[P in keyof T]: Record<string, unknown> extends Omit<T, P> ? [P] : Prepend<P, Keys_<Omit<T, P>, U>>;
|
|
5
5
|
}[keyof T];
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type Keys<T extends Record<string, unknown>> = Keys_<T, []>;
|
|
7
|
+
export type AnyVueComponent = DefineComponent<any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAE1C,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAChD,KAAK,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,WAAW,EAAE,IAAI;KACtE,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACpG,CAAC,MAAM,CAAC,CAAC,CAAA;AACV,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAElE,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkdown/vue",
|
|
3
|
-
"version": "6.5.0",
|
|
4
3
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
"types": "./lib/index.d.ts",
|
|
7
|
-
"sideEffects": false,
|
|
4
|
+
"version": "6.5.3",
|
|
8
5
|
"license": "MIT",
|
|
9
|
-
"files": [
|
|
10
|
-
"lib",
|
|
11
|
-
"src"
|
|
12
|
-
],
|
|
13
6
|
"keywords": [
|
|
14
7
|
"milkdown",
|
|
15
8
|
"milkdown plugin",
|
|
16
9
|
"vue"
|
|
17
10
|
],
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"main": "./lib/index.es.js",
|
|
13
|
+
"types": "./lib/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"lib",
|
|
16
|
+
"src"
|
|
17
|
+
],
|
|
24
18
|
"peerDependencies": {
|
|
25
19
|
"@milkdown/core": "^6.0.1",
|
|
26
20
|
"@milkdown/prose": "^6.0.1",
|
|
27
21
|
"vue": "^3.0.0"
|
|
28
22
|
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"nanoid": "^4.0.0",
|
|
25
|
+
"tslib": "^2.4.0",
|
|
26
|
+
"@milkdown/exception": "6.5.3",
|
|
27
|
+
"@milkdown/utils": "6.5.3"
|
|
28
|
+
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"@milkdown/
|
|
32
|
-
"
|
|
30
|
+
"vue": "^3.2.38",
|
|
31
|
+
"@milkdown/core": "6.5.3",
|
|
32
|
+
"@milkdown/prose": "6.5.3"
|
|
33
33
|
},
|
|
34
34
|
"nx": {
|
|
35
35
|
"targets": {
|