@prosekit/vue 0.1.5 → 0.1.6

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.
@@ -187,10 +187,17 @@ export declare type ResizableHandleProps = PropsWithClass<ResizableHandleProps_2
187
187
  export declare type ResizableProps = PropsWithClass<ResizableProps_2>;
188
188
 
189
189
  /**
190
- * Returns a shallow ref to the editor. If `update` is `true`, any editor update
191
- * will trigger an effect.
190
+ * Retrieves the editor instance from the nearest ProseKit component.
191
+ *
192
+ * @public
192
193
  */
193
194
  declare function useEditor<E extends Extension = any>(options?: {
195
+ /**
196
+ * Whether to update the component when the editor is mounted or editor state
197
+ * is updated.
198
+ *
199
+ * @default false
200
+ */
194
201
  update?: boolean;
195
202
  }): ShallowRef<Editor<E>>;
196
203
  export { useEditor }
@@ -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.1.6",
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.1.9",
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",