@prosekit/vue 0.0.0-next-20230627094841 → 0.0.2
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/dist/prosekit-vue-components-menu-item.d.ts +9 -0
- package/dist/prosekit-vue-components-menu.d.ts +9 -0
- package/dist/prosekit-vue-components-popover-suggestion.d.ts +18 -0
- package/dist/prosekit-vue-components-popover.d.ts +9 -0
- package/dist/prosekit-vue.d.ts +14 -0
- package/dist/prosekit-vue.js +7 -37
- package/package.json +7 -7
- package/dist/prosekit-vue-components-popover-slash.js +0 -42
- package/dist/prosekit-vue-components-popover-suggestion-consumer.js +0 -14
- package/dist/prosekit-vue-components-popover2.js +0 -14
- package/dist/prosekit-vue-components-slash-popover.js +0 -14
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Editor } from '@prosekit/core';
|
2
|
+
import { PredictionRule, PopoverSuggestionContext } from '@prosekit/lit/elements/popover-suggestion';
|
3
|
+
export { PopoverSuggestionContext, PredictionRule } from '@prosekit/lit/elements/popover-suggestion';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @module @prosekit/vue/components/popover-suggestion
|
7
|
+
*/
|
8
|
+
|
9
|
+
interface PopoverSuggestionProps {
|
10
|
+
editor: Editor;
|
11
|
+
rules: PredictionRule[];
|
12
|
+
}
|
13
|
+
interface PopoverSuggestionSlots {
|
14
|
+
default: PopoverSuggestionContext;
|
15
|
+
}
|
16
|
+
declare const PopoverSuggestion: (props: PopoverSuggestionProps & {}) => any;
|
17
|
+
|
18
|
+
export { PopoverSuggestion, PopoverSuggestionProps, PopoverSuggestionSlots };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Editor, Keymap, Extension } from '@prosekit/core';
|
2
|
+
|
3
|
+
interface ProseKitProps {
|
4
|
+
editor: Editor;
|
5
|
+
}
|
6
|
+
declare const ProseKit: (props: ProseKitProps & {}) => any;
|
7
|
+
|
8
|
+
declare function useKeymap({ keymap }: {
|
9
|
+
keymap: Keymap;
|
10
|
+
}): void;
|
11
|
+
|
12
|
+
declare function useEditor<E extends Extension = any>(): Editor<E>;
|
13
|
+
|
14
|
+
export { ProseKit, ProseKitProps, useEditor, useKeymap };
|
package/dist/prosekit-vue.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
// src/components/prosekit.ts
|
2
|
-
import {
|
3
|
-
import { computed, defineComponent, effect } from "vue";
|
2
|
+
import { defineComponent } from "vue";
|
4
3
|
|
5
4
|
// src/injection/editor-injection.ts
|
6
5
|
import { ProseKitError } from "@prosekit/core";
|
@@ -20,50 +19,21 @@ function injectEditor() {
|
|
20
19
|
// src/components/prosekit.ts
|
21
20
|
var ProseKit = defineComponent(
|
22
21
|
(props, { slots }) => {
|
23
|
-
|
24
|
-
provideEditor(editorRef.value);
|
25
|
-
effect(() => {
|
26
|
-
const editor = editorRef.value;
|
27
|
-
if (props.place) {
|
28
|
-
editor.mount(props.place);
|
29
|
-
} else if (editor.mounted) {
|
30
|
-
editor.unmount();
|
31
|
-
}
|
32
|
-
});
|
22
|
+
provideEditor(props.editor);
|
33
23
|
return () => {
|
34
24
|
var _a;
|
35
25
|
return (_a = slots.default) == null ? void 0 : _a.call(slots);
|
36
26
|
};
|
37
27
|
},
|
38
|
-
{ props: ["editor"
|
28
|
+
{ props: ["editor"] }
|
39
29
|
);
|
40
|
-
function useComputedEditor(props) {
|
41
|
-
return computed(() => {
|
42
|
-
if (props.editor) {
|
43
|
-
if (props.extension) {
|
44
|
-
throw new ProseKitError2(
|
45
|
-
"You can't pass both an editor and an extension to ProseKit"
|
46
|
-
);
|
47
|
-
}
|
48
|
-
return props.editor;
|
49
|
-
} else {
|
50
|
-
if (props.extension) {
|
51
|
-
return createEditor({ extension: props.extension });
|
52
|
-
} else {
|
53
|
-
throw new ProseKitError2(
|
54
|
-
"You must pass either an editor or an extension to ProseKit"
|
55
|
-
);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
});
|
59
|
-
}
|
60
30
|
|
61
31
|
// src/hooks/use-keymap.ts
|
62
32
|
import { addKeymap } from "@prosekit/core";
|
63
|
-
import { computed
|
33
|
+
import { computed } from "vue";
|
64
34
|
|
65
35
|
// src/hooks/use-extension.ts
|
66
|
-
import { effect
|
36
|
+
import { effect } from "vue";
|
67
37
|
|
68
38
|
// src/hooks/use-editor.ts
|
69
39
|
function useEditor() {
|
@@ -73,12 +43,12 @@ function useEditor() {
|
|
73
43
|
// src/hooks/use-extension.ts
|
74
44
|
function useExtension({ extension }) {
|
75
45
|
const editor = useEditor();
|
76
|
-
|
46
|
+
effect(() => editor.use(extension));
|
77
47
|
}
|
78
48
|
|
79
49
|
// src/hooks/use-keymap.ts
|
80
50
|
function useKeymap({ keymap }) {
|
81
|
-
const extension =
|
51
|
+
const extension = computed(() => addKeymap(keymap));
|
82
52
|
useExtension({ extension: extension.value });
|
83
53
|
}
|
84
54
|
export {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/vue",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.2",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -55,8 +55,8 @@
|
|
55
55
|
"dist"
|
56
56
|
],
|
57
57
|
"dependencies": {
|
58
|
-
"@prosekit/core": "0.0.
|
59
|
-
"@prosekit/lit": "0.0.
|
58
|
+
"@prosekit/core": "^0.0.2",
|
59
|
+
"@prosekit/lit": "^0.0.2"
|
60
60
|
},
|
61
61
|
"peerDependencies": {
|
62
62
|
"vue": ">= 3.0.0"
|
@@ -67,11 +67,11 @@
|
|
67
67
|
}
|
68
68
|
},
|
69
69
|
"devDependencies": {
|
70
|
+
"@prosekit/dev": "*",
|
70
71
|
"tsup": "^7.1.0",
|
71
|
-
"typescript": "^5.1.
|
72
|
-
"vitest": "^0.
|
73
|
-
"vue": "^3.3.4"
|
74
|
-
"@prosekit/dev": "0.0.0"
|
72
|
+
"typescript": "^5.1.6",
|
73
|
+
"vitest": "^0.33.0",
|
74
|
+
"vue": "^3.3.4"
|
75
75
|
},
|
76
76
|
"scripts": {
|
77
77
|
"build:tsup": "tsup",
|
@@ -1,42 +0,0 @@
|
|
1
|
-
// src/components/popover-slash.ts
|
2
|
-
import { defineComponent as defineComponent2, h as h2, ref } from "vue";
|
3
|
-
|
4
|
-
// src/components/popover-slash.gen.ts
|
5
|
-
import "@prosekit/lit/elements/popover-slash";
|
6
|
-
import { defineComponent, h } from "vue";
|
7
|
-
var PopoverSlash = defineComponent(
|
8
|
-
(props, { slots }) => {
|
9
|
-
return () => {
|
10
|
-
var _a;
|
11
|
-
return h("prosekit-popover-slash", props, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
12
|
-
};
|
13
|
-
}
|
14
|
-
);
|
15
|
-
|
16
|
-
// src/components/popover-slash.ts
|
17
|
-
var PopoverSlash2 = defineComponent2(
|
18
|
-
({ editor }, { slots }) => {
|
19
|
-
const contextRef = ref(null);
|
20
|
-
const onContext = (context) => {
|
21
|
-
contextRef.value = context;
|
22
|
-
};
|
23
|
-
return () => {
|
24
|
-
const context = contextRef.value;
|
25
|
-
const query = context == null ? void 0 : context.query;
|
26
|
-
return h2(
|
27
|
-
PopoverSlash,
|
28
|
-
{
|
29
|
-
".editor": editor,
|
30
|
-
".onContext": onContext
|
31
|
-
},
|
32
|
-
() => {
|
33
|
-
var _a;
|
34
|
-
return (_a = slots.default) == null ? void 0 : _a.call(slots, { query });
|
35
|
-
}
|
36
|
-
);
|
37
|
-
};
|
38
|
-
}
|
39
|
-
);
|
40
|
-
export {
|
41
|
-
PopoverSlash2 as PopoverSlash
|
42
|
-
};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
// src/components/popover-suggestion-consumer.gen.ts
|
2
|
-
import "@prosekit/lit/elements/popover-suggestion-consumer";
|
3
|
-
import { defineComponent, h } from "vue";
|
4
|
-
var PopoverSuggestionConsumer = defineComponent(
|
5
|
-
(props, { slots }) => {
|
6
|
-
return () => {
|
7
|
-
var _a;
|
8
|
-
return h("prosekit-popover-suggestion-consumer", props, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
9
|
-
};
|
10
|
-
}
|
11
|
-
);
|
12
|
-
export {
|
13
|
-
PopoverSuggestionConsumer
|
14
|
-
};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
// src/components/popover2.gen.ts
|
2
|
-
import "@prosekit/lit/elements/popover2";
|
3
|
-
import { defineComponent, h } from "vue";
|
4
|
-
var Popover2 = defineComponent(
|
5
|
-
(props, { slots }) => {
|
6
|
-
return () => {
|
7
|
-
var _a;
|
8
|
-
return h("prosekit-popover2", props, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
9
|
-
};
|
10
|
-
}
|
11
|
-
);
|
12
|
-
export {
|
13
|
-
Popover2
|
14
|
-
};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
// src/components/slash-popover.gen.ts
|
2
|
-
import "@prosekit/lit/elements/slash-popover";
|
3
|
-
import { defineComponent, h } from "vue";
|
4
|
-
var SlashPopover = defineComponent(
|
5
|
-
(props, { slots }) => {
|
6
|
-
return () => {
|
7
|
-
var _a;
|
8
|
-
return h("prosekit-slash-popover", props, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
9
|
-
};
|
10
|
-
}
|
11
|
-
);
|
12
|
-
export {
|
13
|
-
SlashPopover
|
14
|
-
};
|