@prosekit/solid 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.
- package/dist/_tsup-dts-rollup.d.ts +11 -0
- package/dist/prosekit-solid.js +8 -2
- package/package.json +5 -5
@@ -131,7 +131,18 @@ export declare type ResizableHandleProps = PropsWithChildren<PropsWithClass<Resi
|
|
131
131
|
|
132
132
|
export declare type ResizableProps = PropsWithChildren<PropsWithClass<ResizableProps_2>>;
|
133
133
|
|
134
|
+
/**
|
135
|
+
* Retrieves the editor instance from the nearest ProseKit component.
|
136
|
+
*
|
137
|
+
* @public
|
138
|
+
*/
|
134
139
|
declare function useEditor<E extends Extension = any>(options?: {
|
140
|
+
/**
|
141
|
+
* Whether to update the component when the editor is mounted or editor state
|
142
|
+
* is updated.
|
143
|
+
*
|
144
|
+
* @default false
|
145
|
+
*/
|
135
146
|
update?: boolean;
|
136
147
|
}): () => Editor<E>;
|
137
148
|
export { useEditor }
|
package/dist/prosekit-solid.js
CHANGED
@@ -22,7 +22,9 @@ var ProseKit = (props) => {
|
|
22
22
|
// src/hooks/use-editor.ts
|
23
23
|
import {
|
24
24
|
ProseKitError,
|
25
|
-
defineUpdateHandler
|
25
|
+
defineUpdateHandler,
|
26
|
+
defineMountHandler,
|
27
|
+
union
|
26
28
|
} from "@prosekit/core";
|
27
29
|
import { createEffect, createSignal, useContext } from "solid-js";
|
28
30
|
function useEditor(options) {
|
@@ -38,7 +40,11 @@ function useEditor(options) {
|
|
38
40
|
const [depend, forceUpdate] = useForceUpdate();
|
39
41
|
createEffect(() => {
|
40
42
|
if (update) {
|
41
|
-
|
43
|
+
const extension = union([
|
44
|
+
defineMountHandler(forceUpdate),
|
45
|
+
defineUpdateHandler(forceUpdate)
|
46
|
+
]);
|
47
|
+
return editor.use(extension);
|
42
48
|
}
|
43
49
|
}, [editor, update, forceUpdate]);
|
44
50
|
return () => {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/solid",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1.
|
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.
|
99
|
-
"@prosekit/lit": "^0.1.
|
98
|
+
"@prosekit/core": "^0.2.5",
|
99
|
+
"@prosekit/lit": "^0.1.9"
|
100
100
|
},
|
101
101
|
"peerDependencies": {
|
102
102
|
"solid-js": ">= 1.7.0"
|
@@ -108,10 +108,10 @@
|
|
108
108
|
},
|
109
109
|
"devDependencies": {
|
110
110
|
"@prosekit/dev": "*",
|
111
|
-
"solid-js": "^1.8.
|
111
|
+
"solid-js": "^1.8.11",
|
112
112
|
"tsup": "^8.0.1",
|
113
113
|
"typescript": "^5.3.3",
|
114
|
-
"vitest": "^1.
|
114
|
+
"vitest": "^1.2.0"
|
115
115
|
},
|
116
116
|
"scripts": {
|
117
117
|
"build:tsup": "tsup",
|