@prosekit/react 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.
- package/dist/_tsup-dts-rollup.d.ts +10 -0
- package/dist/prosekit-react.d.ts +1 -0
- package/dist/prosekit-react.js +17 -1
- package/package.json +6 -6
@@ -42,6 +42,7 @@ import { Popover as Popover_2 } from '@prosekit/lit/popover';
|
|
42
42
|
import { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
|
43
43
|
import { PositioningOptions } from '@prosekit/lit/autocomplete-popover';
|
44
44
|
import { Priority } from '@prosekit/core';
|
45
|
+
import type { ProseMirrorNode } from '@prosekit/pm/model';
|
45
46
|
import { Provider } from 'react';
|
46
47
|
import { default as React_2 } from 'react';
|
47
48
|
import { ReactNode } from 'react';
|
@@ -250,6 +251,15 @@ export declare type ResizableHandleProps = React_2.PropsWithChildren<PropsWithCl
|
|
250
251
|
|
251
252
|
export declare type ResizableProps = React_2.PropsWithChildren<PropsWithClassName<ResizableProps_2>>;
|
252
253
|
|
254
|
+
/**
|
255
|
+
* Calls the given handler whenever the editor document changes.
|
256
|
+
*
|
257
|
+
* @public
|
258
|
+
*/
|
259
|
+
declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void;
|
260
|
+
export { useDocChange }
|
261
|
+
export { useDocChange as useDocChange_alias_1 }
|
262
|
+
|
253
263
|
/**
|
254
264
|
* Retrieves the editor instance from the nearest ProseKit component.
|
255
265
|
*
|
package/dist/prosekit-react.d.ts
CHANGED
@@ -7,6 +7,7 @@ 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 { PropsWithClassName } from './_tsup-dts-rollup';
|
11
12
|
export { ReactNodeViewComponent } from './_tsup-dts-rollup';
|
12
13
|
export { ReactNodeViewProps } from './_tsup-dts-rollup';
|
package/dist/prosekit-react.js
CHANGED
@@ -308,13 +308,29 @@ function useKeymap(keymap, options) {
|
|
308
308
|
|
309
309
|
// src/hooks/use-state-update.ts
|
310
310
|
import { defineUpdateHandler as defineUpdateHandler2 } from "@prosekit/core";
|
311
|
+
import { useMemo as useMemo5 } from "react";
|
311
312
|
function useStateUpdate(handler, options) {
|
312
|
-
const extension =
|
313
|
+
const extension = useMemo5(
|
314
|
+
() => defineUpdateHandler2((view) => handler(view.state)),
|
315
|
+
[handler]
|
316
|
+
);
|
317
|
+
return useExtension(extension, options);
|
318
|
+
}
|
319
|
+
|
320
|
+
// src/hooks/use-doc-change.ts
|
321
|
+
import { defineDocChangeHandler } from "@prosekit/core";
|
322
|
+
import { useMemo as useMemo6 } from "react";
|
323
|
+
function useDocChange(handler, options) {
|
324
|
+
const extension = useMemo6(
|
325
|
+
() => defineDocChangeHandler((view) => handler(view.state.doc)),
|
326
|
+
[handler]
|
327
|
+
);
|
313
328
|
return useExtension(extension, options);
|
314
329
|
}
|
315
330
|
export {
|
316
331
|
ProseKit,
|
317
332
|
defineReactNodeView,
|
333
|
+
useDocChange,
|
318
334
|
useEditor,
|
319
335
|
useExtension,
|
320
336
|
useKeymap,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.2.
|
4
|
+
"version": "0.2.4",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -95,9 +95,9 @@
|
|
95
95
|
"dist"
|
96
96
|
],
|
97
97
|
"dependencies": {
|
98
|
-
"@lit/react": "^1.0.
|
99
|
-
"@prosekit/core": "^0.
|
100
|
-
"@prosekit/lit": "^0.2.
|
98
|
+
"@lit/react": "^1.0.3",
|
99
|
+
"@prosekit/core": "^0.3.0",
|
100
|
+
"@prosekit/lit": "^0.2.2",
|
101
101
|
"@prosekit/pm": "^0.1.1",
|
102
102
|
"@prosemirror-adapter/core": "^0.2.6"
|
103
103
|
},
|
@@ -115,13 +115,13 @@
|
|
115
115
|
},
|
116
116
|
"devDependencies": {
|
117
117
|
"@prosekit/dev": "*",
|
118
|
-
"@types/react": "^18.2.
|
118
|
+
"@types/react": "^18.2.52",
|
119
119
|
"@types/react-dom": "^18.2.18",
|
120
120
|
"react": "^18.2.0",
|
121
121
|
"react-dom": "^18.2.0",
|
122
122
|
"tsup": "^8.0.1",
|
123
123
|
"typescript": "^5.3.3",
|
124
|
-
"vitest": "^1.2.
|
124
|
+
"vitest": "^1.2.2"
|
125
125
|
},
|
126
126
|
"scripts": {
|
127
127
|
"build:tsup": "tsup",
|