@prosekit/vue 0.2.2 → 0.2.3

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.
@@ -34,6 +34,7 @@ import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
34
34
  import { PositioningOptions } from '@prosekit/lit/autocomplete-popover';
35
35
  import { PositioningOptions as PositioningOptions_alias_1 } from '@prosekit/lit/inline-popover';
36
36
  import { Priority } from '@prosekit/core';
37
+ import type { ProseMirrorNode } from '@prosekit/pm/model';
37
38
  import { PublicProps } from 'vue';
38
39
  import type { Ref } from 'vue';
39
40
  import { RendererElement } from 'vue';
@@ -197,6 +198,15 @@ export declare type ResizableHandleProps = PropsWithClass<ResizableHandleProps_2
197
198
 
198
199
  export declare type ResizableProps = PropsWithClass<ResizableProps_2>;
199
200
 
201
+ /**
202
+ * Calls the given handler whenever the editor document changes.
203
+ *
204
+ * @public
205
+ */
206
+ declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void;
207
+ export { useDocChange }
208
+ export { useDocChange as useDocChange_alias_1 }
209
+
200
210
  /**
201
211
  * Retrieves the editor instance from the nearest ProseKit component.
202
212
  *
@@ -7,5 +7,6 @@ export { useExtension } from './_tsup-dts-rollup';
7
7
  export { UseExtensionOptions } from './_tsup-dts-rollup';
8
8
  export { useKeymap } from './_tsup-dts-rollup';
9
9
  export { useStateUpdate } from './_tsup-dts-rollup';
10
+ export { useDocChange } from './_tsup-dts-rollup';
10
11
  export { VueNodeViewComponent } from './_tsup-dts-rollup';
11
12
  export { VueNodeViewProps } from './_tsup-dts-rollup';
@@ -320,9 +320,17 @@ function useStateUpdate(handler, options) {
320
320
  const extension = defineUpdateHandler2((view) => handler(view.state));
321
321
  return useExtension(extension, options);
322
322
  }
323
+
324
+ // src/hooks/use-doc-change.ts
325
+ import { defineDocChangeHandler } from "@prosekit/core";
326
+ function useDocChange(handler, options) {
327
+ const extension = defineDocChangeHandler((view) => handler(view.state.doc));
328
+ return useExtension(extension, options);
329
+ }
323
330
  export {
324
331
  ProseKit,
325
332
  defineVueNodeView,
333
+ useDocChange,
326
334
  useEditor,
327
335
  useExtension,
328
336
  useKeymap,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/vue",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",