@milkdown/vue 6.1.4 → 6.3.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.
- package/lib/Editor.d.ts +8 -25
- package/lib/Editor.d.ts.map +1 -1
- package/lib/EditorComponent.d.ts +14 -0
- package/lib/EditorComponent.d.ts.map +1 -0
- package/lib/VueNode.d.ts +9 -7
- package/lib/VueNode.d.ts.map +1 -1
- package/lib/VueNodeView.d.ts +14 -16
- package/lib/VueNodeView.d.ts.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +206 -226
- package/lib/index.es.js.map +1 -1
- package/lib/types.d.ts +26 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/useEditor.d.ts +3 -0
- package/lib/useEditor.d.ts.map +1 -0
- package/lib/useGetEditor.d.ts +7 -0
- package/lib/useGetEditor.d.ts.map +1 -0
- package/package.json +7 -6
- package/src/Editor.tsx +57 -71
- package/src/EditorComponent.tsx +25 -0
- package/src/VueNode.tsx +8 -5
- package/src/VueNodeView.tsx +79 -51
- package/src/index.ts +3 -1
- package/src/types.ts +50 -0
- package/src/useEditor.ts +25 -0
- package/src/useGetEditor.ts +51 -0
package/lib/Editor.d.ts
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AnyVueComponent } from './utils';
|
|
5
|
-
import { RenderOptions } from './VueNodeView';
|
|
6
|
-
declare type GetEditor = (container: HTMLDivElement, renderVue: (Component: AnyVueComponent, options?: RenderOptions) => (ctx: Ctx) => ViewFactory) => Editor;
|
|
7
|
-
export declare const EditorComponent: DefineComponent<{
|
|
8
|
-
editor: GetEditor;
|
|
9
|
-
editorRef?: Ref<EditorRef> | undefined;
|
|
10
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
11
|
-
editor: GetEditor;
|
|
12
|
-
editorRef?: Ref<EditorRef> | undefined;
|
|
13
|
-
}>, {}>;
|
|
14
|
-
export declare type EditorRef = {
|
|
15
|
-
get: () => Editor | undefined;
|
|
16
|
-
dom: () => HTMLDivElement | null;
|
|
17
|
-
};
|
|
1
|
+
import { ComponentInternalInstance, DefineComponent, InjectionKey } from 'vue';
|
|
2
|
+
import { EditorRef } from './EditorComponent';
|
|
3
|
+
import { EditorInfo, EditorInfoCtx } from './types';
|
|
18
4
|
export declare const getRootInstance: () => ComponentInternalInstance | null;
|
|
5
|
+
export declare const editorInfoCtxKey: InjectionKey<EditorInfoCtx>;
|
|
19
6
|
export declare const VueEditor: DefineComponent<{
|
|
20
|
-
editor:
|
|
21
|
-
editorRef?:
|
|
7
|
+
editor: EditorInfo;
|
|
8
|
+
editorRef?: EditorRef | undefined;
|
|
22
9
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
23
|
-
editor:
|
|
24
|
-
editorRef?:
|
|
10
|
+
editor: EditorInfo;
|
|
11
|
+
editorRef?: EditorRef | undefined;
|
|
25
12
|
}>, {}>;
|
|
26
|
-
export declare const useEditor: (getEditor: GetEditor) => (container: HTMLDivElement, renderVue: (Component: AnyVueComponent, options?: Partial<{
|
|
27
|
-
as: string;
|
|
28
|
-
} & Pick<import("@milkdown/prose/view").NodeView<any>, "update" | "selectNode" | "deselectNode" | "ignoreMutation" | "destroy">> | undefined) => (ctx: Ctx) => ViewFactory) => Editor;
|
|
29
|
-
export {};
|
|
30
13
|
//# sourceMappingURL=Editor.d.ts.map
|
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,EACH,yBAAyB,EACzB,eAAe,EAKf,YAAY,EAMf,MAAM,KAAK,CAAC;AAEb,OAAO,EAAmB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AASpD,eAAO,MAAM,eAAe,wCAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAAY,CAAC;AA4BtE,eAAO,MAAM,SAAS;YAA6B,UAAU;;;YAAV,UAAU;;OA0D3D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Editor } from '@milkdown/core';
|
|
2
|
+
import { GetEditor } from './types';
|
|
3
|
+
export declare const EditorComponent: import("vue").DefineComponent<{
|
|
4
|
+
editor: GetEditor;
|
|
5
|
+
editorRef?: EditorRef | undefined;
|
|
6
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
7
|
+
editor: GetEditor;
|
|
8
|
+
editorRef?: EditorRef | undefined;
|
|
9
|
+
}>, {}>;
|
|
10
|
+
export declare type EditorRef = {
|
|
11
|
+
get: () => Editor | undefined;
|
|
12
|
+
dom: () => HTMLDivElement | null;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=EditorComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorComponent.d.ts","sourceRoot":"","sources":["../src/EditorComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,OAAO,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAC;AAGnD,eAAO,MAAM,eAAe;YAA6B,SAAS;;;YAAT,SAAS;;OAahE,CAAC;AAGH,oBAAY,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,cAAc,GAAG,IAAI,CAAA;CAAE,CAAC"}
|
package/lib/VueNode.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { Ctx } from '@milkdown/core';
|
|
2
2
|
import { Mark, Node } from '@milkdown/prose/model';
|
|
3
3
|
import { Decoration, EditorView } from '@milkdown/prose/view';
|
|
4
|
-
import { InjectionKey } from 'vue';
|
|
5
|
-
export declare type NodeContext = {
|
|
4
|
+
import { InjectionKey, Ref } from 'vue';
|
|
5
|
+
export declare type NodeContext<T extends Node | Mark = Node | Mark> = {
|
|
6
6
|
ctx: Ctx;
|
|
7
|
-
node:
|
|
7
|
+
node: Ref<T>;
|
|
8
8
|
view: EditorView;
|
|
9
|
-
getPos: boolean | (() => number);
|
|
10
|
-
decorations: Decoration[]
|
|
9
|
+
getPos: T extends Mark ? boolean : T extends Node ? () => number : boolean | (() => number);
|
|
10
|
+
decorations: Ref<readonly Decoration[]>;
|
|
11
11
|
};
|
|
12
12
|
export declare const nodeMetadata: InjectionKey<NodeContext>;
|
|
13
|
-
export declare
|
|
13
|
+
export declare type UseNodeCtx = <T extends Node | Mark = Node | Mark>() => NodeContext<T>;
|
|
14
|
+
export declare const useNodeCtx: UseNodeCtx;
|
|
15
|
+
export declare const VueNodeContainer: import("vue").DefineComponent<NodeContext<Mark | Node> & {
|
|
14
16
|
as: string;
|
|
15
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<NodeContext & {
|
|
17
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<NodeContext<Mark | Node> & {
|
|
16
18
|
as: string;
|
|
17
19
|
}>, {}>;
|
|
18
20
|
export declare const Content: import("vue").DefineComponent<{
|
package/lib/VueNode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VueNode.d.ts","sourceRoot":"","sources":["../src/VueNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"VueNode.d.ts","sourceRoot":"","sources":["../src/VueNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAA8B,YAAY,EAAW,GAAG,EAAE,MAAM,KAAK,CAAC;AAE7E,oBAAY,WAAW,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI;IAC3D,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,CAAC,SAAS,IAAI,GAAG,OAAO,GAAG,CAAC,SAAS,IAAI,GAAG,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IAC5F,WAAW,EAAE,GAAG,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,WAAW,CAAY,CAAC;AAEhE,oBAAY,UAAU,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;AACnF,eAAO,MAAM,UAAU,EAAE,UAA6D,CAAC;AAEvF,eAAO,MAAM,gBAAgB;QAAuC,MAAM;;QAAN,MAAM;OAYxE,CAAC;AAGH,eAAO,MAAM,OAAO;;;;OAKlB,CAAC"}
|
package/lib/VueNodeView.d.ts
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
import { Ctx } from '@milkdown/core';
|
|
2
|
-
import type { ViewFactory } from '@milkdown/prose';
|
|
3
2
|
import { Mark, Node } from '@milkdown/prose/model';
|
|
4
|
-
import type { Decoration,
|
|
3
|
+
import type { Decoration, DecorationSource, EditorView, MarkViewConstructor, NodeView, NodeViewConstructor } from '@milkdown/prose/view';
|
|
5
4
|
import { DefineComponent } from 'vue';
|
|
6
5
|
export declare type RenderOptions = Partial<{
|
|
7
6
|
as: string;
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;
|
|
8
|
+
} & Pick<NodeView, 'ignoreMutation' | 'deselectNode' | 'selectNode' | 'destroy'>>;
|
|
9
|
+
export declare const createVueView: (addPortal: (portal: DefineComponent, key: string) => void, removePortalByKey: (key: string) => void) => (component: DefineComponent, options?: RenderOptions) => (ctx: Ctx) => NodeViewConstructor | MarkViewConstructor;
|
|
10
10
|
export declare class VueNodeView implements NodeView {
|
|
11
11
|
private ctx;
|
|
12
12
|
private component;
|
|
13
13
|
private addPortal;
|
|
14
14
|
private removePortalByKey;
|
|
15
15
|
private options;
|
|
16
|
-
private node;
|
|
17
16
|
private view;
|
|
18
17
|
private getPos;
|
|
19
|
-
private decorations;
|
|
20
18
|
teleportDOM: HTMLElement;
|
|
21
19
|
key: string;
|
|
22
20
|
get isInlineOrMark(): boolean;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
private node;
|
|
22
|
+
private decorations;
|
|
23
|
+
constructor(ctx: Ctx, component: DefineComponent, addPortal: (portal: DefineComponent, key: string) => void, removePortalByKey: (key: string) => void, options: RenderOptions, node: Node | Mark, view: EditorView, getPos: boolean | (() => number), decorations: readonly Decoration[]);
|
|
24
|
+
get dom(): HTMLElement;
|
|
25
|
+
get contentDOM(): HTMLElement | undefined;
|
|
26
|
+
getPortal: () => DefineComponent;
|
|
26
27
|
renderPortal(): void;
|
|
27
28
|
destroy(): void;
|
|
28
|
-
ignoreMutation(mutation: MutationRecord
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
update(node: Node, decorations: Decoration[], innerDecorations: DecorationSet): boolean;
|
|
33
|
-
selectNode: (() => void) | null | undefined;
|
|
34
|
-
deselectNode: (() => void) | null | undefined;
|
|
29
|
+
ignoreMutation(mutation: MutationRecord): boolean;
|
|
30
|
+
update(node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource): boolean;
|
|
31
|
+
selectNode: (() => void) | undefined;
|
|
32
|
+
deselectNode: (() => void) | undefined;
|
|
35
33
|
}
|
|
36
34
|
//# sourceMappingURL=VueNodeView.d.ts.map
|
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,CAAC;AACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"VueNodeView.d.ts","sourceRoot":"","sources":["../src/VueNodeView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EACR,UAAU,EACV,gBAAgB,EACh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,GAAG,CAAC,MAAM,MAAM,CAAC,EACxC,WAAW,EAAE,SAAS,UAAU,EAAE;IAUtC,IAAI,GAAG,gBAEN;IAED,IAAI,UAAU,4BAMb;IAED,SAAS,QAAO,eAAe,CA0B7B;IAEF,YAAY;IAWZ,OAAO;IAMP,cAAc,CAAC,QAAQ,EAAE,cAAc;IA6BvC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,UAAU,EAAE,EAAE,gBAAgB,EAAE,gBAAgB;IA0BzF,UAAU,2BAA4B;IAEtC,YAAY,2BAA8B;CAC7C"}
|
package/lib/index.d.ts
CHANGED
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,CAAC;AACzB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|