@prosekit/vue 0.2.2 → 0.2.4

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';
@@ -134,6 +135,7 @@ export declare function defineVueNodeViewFactory(nodeViewFactory: NodeViewFactor
134
135
 
135
136
  declare const InlinePopover: (props: {
136
137
  editor: Editor<any>;
138
+ available?: boolean | undefined;
137
139
  } & PopoverProps_2 & {
138
140
  class?: string | undefined;
139
141
  } & {}) => any;
@@ -197,6 +199,15 @@ export declare type ResizableHandleProps = PropsWithClass<ResizableHandleProps_2
197
199
 
198
200
  export declare type ResizableProps = PropsWithClass<ResizableProps_2>;
199
201
 
202
+ /**
203
+ * Calls the given handler whenever the editor document changes.
204
+ *
205
+ * @public
206
+ */
207
+ declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void;
208
+ export { useDocChange }
209
+ export { useDocChange as useDocChange_alias_1 }
210
+
200
211
  /**
201
212
  * Retrieves the editor instance from the nearest ProseKit component.
202
213
  *
@@ -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';
@@ -4,10 +4,10 @@ import { defineComponent as defineComponent4, h as h3 } from "vue";
4
4
 
5
5
  // src/injection/editor-context.ts
6
6
  import "@prosekit/core";
7
- import { inject, provide, toRef } from "vue";
7
+ import { inject, provide } from "vue";
8
8
  var symbol = Symbol("prosekit-vue-editor-context");
9
9
  function provideEditor(editor) {
10
- provide(symbol, toRef(editor));
10
+ provide(symbol, editor);
11
11
  }
12
12
  function useEditorContext() {
13
13
  return inject(symbol);
@@ -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.4",
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.7",
99
- "@prosekit/lit": "^0.2.1",
98
+ "@prosekit/core": "^0.3.0",
99
+ "@prosekit/lit": "^0.2.2",
100
100
  "@prosekit/pm": "^0.1.1",
101
101
  "@prosemirror-adapter/core": "^0.2.6"
102
102
  },
@@ -112,7 +112,7 @@
112
112
  "@prosekit/dev": "*",
113
113
  "tsup": "^8.0.1",
114
114
  "typescript": "^5.3.3",
115
- "vitest": "^1.2.1",
115
+ "vitest": "^1.2.2",
116
116
  "vue": "^3.4.15"
117
117
  },
118
118
  "scripts": {