@prosekit/vue 0.1.5 → 0.2.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.
@@ -27,9 +27,9 @@ import { Keymap } from '@prosekit/core';
27
27
  import type { Node as Node_2 } from '@prosekit/pm/model';
28
28
  import type { NodeViewConstructor } from '@prosekit/pm/view';
29
29
  import { Options } from 'tsup';
30
- import { PopoverOptions } from '@prosekit/lit/autocomplete-popover';
31
- import { PopoverOptions as PopoverOptions_alias_1 } from '@prosekit/lit/inline-popover';
32
30
  import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
31
+ import { PositioningOptions } from '@prosekit/lit/autocomplete-popover';
32
+ import { PositioningOptions as PositioningOptions_alias_1 } from '@prosekit/lit/inline-popover';
33
33
  import { Priority } from '@prosekit/core';
34
34
  import { PublicProps } from 'vue';
35
35
  import { Ref } from 'vue';
@@ -131,7 +131,9 @@ export declare function defineVueNodeViewFactory(nodeViewFactory: NodeViewFactor
131
131
 
132
132
  export declare function injectEditor(): Editor;
133
133
 
134
- declare const InlinePopover: (props: InlinePopoverProps_2 & {
134
+ declare const InlinePopover: (props: {
135
+ editor: Editor<any>;
136
+ } & PopoverProps_2 & {
135
137
  class?: string | undefined;
136
138
  } & {}) => any;
137
139
  export { InlinePopover }
@@ -149,11 +151,11 @@ export declare const Popover: (props: PopoverProps_2 & {
149
151
  class?: string | undefined;
150
152
  } & {}) => any;
151
153
 
152
- export { PopoverOptions }
154
+ export declare type PopoverProps = PropsWithClass<PopoverProps_2>;
153
155
 
154
- export { PopoverOptions_alias_1 }
156
+ export { PositioningOptions }
155
157
 
156
- export declare type PopoverProps = PropsWithClass<PopoverProps_2>;
158
+ export { PositioningOptions_alias_1 }
157
159
 
158
160
  /**
159
161
  * @internal
@@ -187,10 +189,17 @@ export declare type ResizableHandleProps = PropsWithClass<ResizableHandleProps_2
187
189
  export declare type ResizableProps = PropsWithClass<ResizableProps_2>;
188
190
 
189
191
  /**
190
- * Returns a shallow ref to the editor. If `update` is `true`, any editor update
191
- * will trigger an effect.
192
+ * Retrieves the editor instance from the nearest ProseKit component.
193
+ *
194
+ * @public
192
195
  */
193
196
  declare function useEditor<E extends Extension = any>(options?: {
197
+ /**
198
+ * Whether to update the component when the editor is mounted or editor state
199
+ * is updated.
200
+ *
201
+ * @default false
202
+ */
194
203
  update?: boolean;
195
204
  }): ShallowRef<Editor<E>>;
196
205
  export { useEditor }
@@ -1,3 +1,3 @@
1
- export { PopoverOptions } from './_tsup-dts-rollup';
1
+ export { PositioningOptions } from './_tsup-dts-rollup';
2
2
  export { AutocompletePopover_alias_1 as AutocompletePopover } from './_tsup-dts-rollup';
3
3
  export { AutocompletePopoverProps_alias_1 as AutocompletePopoverProps } from './_tsup-dts-rollup';
@@ -1,3 +1,3 @@
1
- export { PopoverOptions_alias_1 as PopoverOptions } from './_tsup-dts-rollup';
1
+ export { PositioningOptions_alias_1 as PositioningOptions } from './_tsup-dts-rollup';
2
2
  export { InlinePopover_alias_1 as InlinePopover } from './_tsup-dts-rollup';
3
3
  export { InlinePopoverProps_alias_1 as InlinePopoverProps } from './_tsup-dts-rollup';
@@ -209,7 +209,11 @@ import "@prosekit/core";
209
209
  import { unref, watchPostEffect } from "vue";
210
210
 
211
211
  // src/hooks/use-editor.ts
212
- import { defineUpdateHandler } from "@prosekit/core";
212
+ import {
213
+ defineMountHandler,
214
+ defineUpdateHandler,
215
+ union
216
+ } from "@prosekit/core";
213
217
  import {
214
218
  onMounted,
215
219
  onUnmounted as onUnmounted2,
@@ -224,7 +228,11 @@ function useEditor(options) {
224
228
  if (update) {
225
229
  onMounted(() => {
226
230
  const forceUpdate = () => triggerRef(editorRef);
227
- const dispose = editor.use(defineUpdateHandler(forceUpdate));
231
+ const extension = union([
232
+ defineMountHandler(forceUpdate),
233
+ defineUpdateHandler(forceUpdate)
234
+ ]);
235
+ const dispose = editor.use(extension);
228
236
  onUnmounted2(dispose);
229
237
  });
230
238
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/vue",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.2.0",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -95,8 +95,8 @@
95
95
  "dist"
96
96
  ],
97
97
  "dependencies": {
98
- "@prosekit/core": "^0.2.2",
99
- "@prosekit/lit": "^0.1.7",
98
+ "@prosekit/core": "^0.2.5",
99
+ "@prosekit/lit": "^0.2.0",
100
100
  "@prosekit/pm": "^0.1.1",
101
101
  "@prosemirror-adapter/core": "^0.2.6"
102
102
  },
@@ -112,8 +112,8 @@
112
112
  "@prosekit/dev": "*",
113
113
  "tsup": "^8.0.1",
114
114
  "typescript": "^5.3.3",
115
- "vitest": "^1.1.3",
116
- "vue": "^3.4.5"
115
+ "vitest": "^1.2.0",
116
+ "vue": "^3.4.13"
117
117
  },
118
118
  "scripts": {
119
119
  "build:tsup": "tsup",