@prosekit/react 0.2.1 → 0.2.2
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,6 +27,7 @@ import type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core';
|
|
27
27
|
import type { Decoration } from '@prosekit/pm/view';
|
28
28
|
import type { DecorationSource } from '@prosekit/pm/view';
|
29
29
|
import { Editor } from '@prosekit/core';
|
30
|
+
import type { EditorState } from '@prosekit/pm/state';
|
30
31
|
import type { EditorView } from '@prosekit/pm/view';
|
31
32
|
import { Extension } from '@prosekit/core';
|
32
33
|
import { ExtensionTyping } from '@prosekit/core';
|
@@ -317,4 +318,13 @@ export declare function useReactNodeViewCreator(renderReactRenderer: ReactRender
|
|
317
318
|
|
318
319
|
export declare function useReactRenderer(): ReactRendererResult;
|
319
320
|
|
321
|
+
/**
|
322
|
+
* Calls the given handler whenever the editor state changes.
|
323
|
+
*
|
324
|
+
* @public
|
325
|
+
*/
|
326
|
+
declare function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void;
|
327
|
+
export { useStateUpdate }
|
328
|
+
export { useStateUpdate as useStateUpdate_alias_1 }
|
329
|
+
|
320
330
|
export { }
|
package/dist/prosekit-react.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
export { ReactNodeViewComponent } from './_tsup-dts-rollup';
|
2
1
|
export { ProseKit } from './_tsup-dts-rollup';
|
3
2
|
export { ProseKitProps } from './_tsup-dts-rollup';
|
4
3
|
export { defineReactNodeView } from './_tsup-dts-rollup';
|
@@ -7,5 +6,7 @@ export { useEditor } from './_tsup-dts-rollup';
|
|
7
6
|
export { useExtension } from './_tsup-dts-rollup';
|
8
7
|
export { UseExtensionOptions } from './_tsup-dts-rollup';
|
9
8
|
export { useKeymap } from './_tsup-dts-rollup';
|
9
|
+
export { useStateUpdate } from './_tsup-dts-rollup';
|
10
10
|
export { PropsWithClassName } from './_tsup-dts-rollup';
|
11
|
+
export { ReactNodeViewComponent } from './_tsup-dts-rollup';
|
11
12
|
export { ReactNodeViewProps } from './_tsup-dts-rollup';
|
package/dist/prosekit-react.js
CHANGED
@@ -305,10 +305,18 @@ function useKeymap(keymap, options) {
|
|
305
305
|
const extension = useMemo4(() => defineKeymap(keymap), [keymap]);
|
306
306
|
return useExtension(extension, options);
|
307
307
|
}
|
308
|
+
|
309
|
+
// src/hooks/use-state-update.ts
|
310
|
+
import { defineUpdateHandler as defineUpdateHandler2 } from "@prosekit/core";
|
311
|
+
function useStateUpdate(handler, options) {
|
312
|
+
const extension = defineUpdateHandler2((view) => handler(view.state));
|
313
|
+
return useExtension(extension, options);
|
314
|
+
}
|
308
315
|
export {
|
309
316
|
ProseKit,
|
310
317
|
defineReactNodeView,
|
311
318
|
useEditor,
|
312
319
|
useExtension,
|
313
|
-
useKeymap
|
320
|
+
useKeymap,
|
321
|
+
useStateUpdate
|
314
322
|
};
|