@prosekit/vue 0.0.22 → 0.0.24
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.
@@ -9,9 +9,11 @@ import { ComboBoxListProps as ComboBoxListProps_2 } from '@prosekit/lit/combo-bo
|
|
9
9
|
import { ComboBoxProps as ComboBoxProps_2 } from '@prosekit/lit/combo-box';
|
10
10
|
import { Editor } from '@prosekit/core';
|
11
11
|
import { Extension } from '@prosekit/core';
|
12
|
+
import { InlinePopoverProps as InlinePopoverProps_2 } from '@prosekit/lit/inline-popover';
|
12
13
|
import { Keymap } from '@prosekit/core';
|
13
14
|
import { Options } from 'tsup';
|
14
15
|
import { PopoverOptions } from '@prosekit/lit/autocomplete-popover';
|
16
|
+
import { PopoverOptions as PopoverOptions_alias_1 } from '@prosekit/lit/inline-popover';
|
15
17
|
import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
|
16
18
|
import { ShallowRef } from 'vue';
|
17
19
|
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
@@ -110,12 +112,26 @@ export declare const default_alias_1: UserProjectConfigExport;
|
|
110
112
|
|
111
113
|
export declare function injectEditor(): Editor;
|
112
114
|
|
115
|
+
declare const InlinePopover: (props: {
|
116
|
+
class?: string | undefined;
|
117
|
+
} & InlinePopoverProps_2 & {}) => any;
|
118
|
+
export { InlinePopover }
|
119
|
+
export { InlinePopover as InlinePopover_alias_1 }
|
120
|
+
|
121
|
+
declare type InlinePopoverProps = {
|
122
|
+
class?: string;
|
123
|
+
} & InlinePopoverProps_2;
|
124
|
+
export { InlinePopoverProps }
|
125
|
+
export { InlinePopoverProps as InlinePopoverProps_alias_1 }
|
126
|
+
|
113
127
|
export declare const Popover: (props: {
|
114
128
|
class?: string | undefined;
|
115
129
|
} & PopoverProps_2 & {}) => any;
|
116
130
|
|
117
131
|
export { PopoverOptions }
|
118
132
|
|
133
|
+
export { PopoverOptions_alias_1 }
|
134
|
+
|
119
135
|
export declare type PopoverProps = {
|
120
136
|
class?: string;
|
121
137
|
} & PopoverProps_2;
|
@@ -132,14 +148,16 @@ export { ProseKitProps as ProseKitProps_alias_1 }
|
|
132
148
|
|
133
149
|
export declare function provideEditor(editor: Editor): void;
|
134
150
|
|
135
|
-
|
151
|
+
/**
|
152
|
+
* Returns a shallow ref to the editor. If `update` is `true`, any editor update
|
153
|
+
* will trigger an effect.
|
154
|
+
*/
|
155
|
+
declare function useEditor<E extends Extension = any>(options?: {
|
156
|
+
update?: boolean;
|
157
|
+
}): ShallowRef<Editor<E>>;
|
136
158
|
export { useEditor }
|
137
159
|
export { useEditor as useEditor_alias_1 }
|
138
160
|
|
139
|
-
declare function useEditorRef<E extends Extension = any>(): ShallowRef<Editor<E>>;
|
140
|
-
export { useEditorRef }
|
141
|
-
export { useEditorRef as useEditorRef_alias_1 }
|
142
|
-
|
143
161
|
export declare function useExtension({ extension }: UseExtensionProps): void;
|
144
162
|
|
145
163
|
declare interface UseExtensionProps<T extends Extension = Extension> {
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// src/components/inline-popover.gen.ts
|
2
|
+
import "@prosekit/lit/inline-popover";
|
3
|
+
import { propNames } from "@prosekit/lit/inline-popover";
|
4
|
+
import { defineComponent, h } from "vue";
|
5
|
+
var InlinePopover = defineComponent(
|
6
|
+
(props, { slots }) => {
|
7
|
+
return () => {
|
8
|
+
var _a;
|
9
|
+
const webComponentProps = Object.fromEntries(
|
10
|
+
Object.entries(props).filter((entry) => entry[1] !== void 0).map(([key, value]) => [(key === "class" ? "" : ".") + key, value])
|
11
|
+
);
|
12
|
+
return h("prosekit-inline-popover", webComponentProps, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
13
|
+
};
|
14
|
+
},
|
15
|
+
{ props: ["class", ...propNames] }
|
16
|
+
);
|
17
|
+
export {
|
18
|
+
InlinePopover
|
19
|
+
};
|
package/dist/prosekit-vue.d.ts
CHANGED
package/dist/prosekit-vue.js
CHANGED
@@ -35,20 +35,37 @@ import { computed } from "vue";
|
|
35
35
|
|
36
36
|
// src/hooks/use-extension.ts
|
37
37
|
import "@prosekit/core";
|
38
|
-
import { onMounted, onUnmounted } from "vue";
|
38
|
+
import { onMounted as onMounted2, onUnmounted as onUnmounted2 } from "vue";
|
39
39
|
|
40
40
|
// src/hooks/use-editor.ts
|
41
|
-
import "@prosekit/core";
|
42
|
-
|
43
|
-
|
41
|
+
import { defineEventHandler } from "@prosekit/core";
|
42
|
+
import {
|
43
|
+
onMounted,
|
44
|
+
onUnmounted,
|
45
|
+
shallowRef,
|
46
|
+
triggerRef
|
47
|
+
} from "vue";
|
48
|
+
function useEditor(options) {
|
49
|
+
var _a;
|
50
|
+
const update = (_a = options == null ? void 0 : options.update) != null ? _a : false;
|
51
|
+
const editor = injectEditor();
|
52
|
+
const editorRef = shallowRef(editor);
|
53
|
+
if (update) {
|
54
|
+
onMounted(() => {
|
55
|
+
const forceUpdate = () => triggerRef(editorRef);
|
56
|
+
const dispose = editor.use(defineEventHandler({ update: forceUpdate }));
|
57
|
+
onUnmounted(dispose);
|
58
|
+
});
|
59
|
+
}
|
60
|
+
return editorRef;
|
44
61
|
}
|
45
62
|
|
46
63
|
// src/hooks/use-extension.ts
|
47
64
|
function useExtension({ extension }) {
|
48
65
|
const editor = useEditor();
|
49
|
-
|
50
|
-
const dispose = editor.use(extension);
|
51
|
-
|
66
|
+
onMounted2(() => {
|
67
|
+
const dispose = editor.value.use(extension);
|
68
|
+
onUnmounted2(dispose);
|
52
69
|
});
|
53
70
|
}
|
54
71
|
|
@@ -57,28 +74,8 @@ function useKeymap({ keymap }) {
|
|
57
74
|
const extension = computed(() => defineKeymap(keymap));
|
58
75
|
useExtension({ extension: extension.value });
|
59
76
|
}
|
60
|
-
|
61
|
-
// src/hooks/use-editor-ref.ts
|
62
|
-
import { defineEventHandler } from "@prosekit/core";
|
63
|
-
import {
|
64
|
-
onMounted as onMounted2,
|
65
|
-
onUnmounted as onUnmounted2,
|
66
|
-
shallowRef,
|
67
|
-
triggerRef
|
68
|
-
} from "vue";
|
69
|
-
function useEditorRef() {
|
70
|
-
const editor = useEditor();
|
71
|
-
const editorRef = shallowRef(editor);
|
72
|
-
onMounted2(() => {
|
73
|
-
const forceUpdate = () => triggerRef(editorRef);
|
74
|
-
const dispose = editor.use(defineEventHandler({ update: forceUpdate }));
|
75
|
-
onUnmounted2(dispose);
|
76
|
-
});
|
77
|
-
return editorRef;
|
78
|
-
}
|
79
77
|
export {
|
80
78
|
ProseKit,
|
81
79
|
useEditor,
|
82
|
-
useEditorRef,
|
83
80
|
useKeymap
|
84
81
|
};
|
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.24",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -75,6 +75,11 @@
|
|
75
75
|
"import": "./dist/prosekit-vue-combo-box-list.js",
|
76
76
|
"default": "./dist/prosekit-vue-combo-box-list.js"
|
77
77
|
},
|
78
|
+
"./inline-popover": {
|
79
|
+
"types": "./dist/prosekit-vue-inline-popover.d.ts",
|
80
|
+
"import": "./dist/prosekit-vue-inline-popover.js",
|
81
|
+
"default": "./dist/prosekit-vue-inline-popover.js"
|
82
|
+
},
|
78
83
|
"./popover": {
|
79
84
|
"types": "./dist/prosekit-vue-popover.d.ts",
|
80
85
|
"import": "./dist/prosekit-vue-popover.js",
|
@@ -85,8 +90,8 @@
|
|
85
90
|
"dist"
|
86
91
|
],
|
87
92
|
"dependencies": {
|
88
|
-
"@prosekit/core": "^0.0.
|
89
|
-
"@prosekit/lit": "^0.0.
|
93
|
+
"@prosekit/core": "^0.0.19",
|
94
|
+
"@prosekit/lit": "^0.0.23"
|
90
95
|
},
|
91
96
|
"peerDependencies": {
|
92
97
|
"vue": ">= 3.0.0"
|
@@ -140,6 +145,9 @@
|
|
140
145
|
"combo-box-list": [
|
141
146
|
"./dist/prosekit-vue-combo-box-list.d.ts"
|
142
147
|
],
|
148
|
+
"inline-popover": [
|
149
|
+
"./dist/prosekit-vue-inline-popover.d.ts"
|
150
|
+
],
|
143
151
|
"popover": [
|
144
152
|
"./dist/prosekit-vue-popover.d.ts"
|
145
153
|
]
|