@prosekit/preact 0.0.21 → 0.1.1
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 +7 -1
- package/dist/prosekit-preact.js +3 -1
- package/package.json +6 -6
- package/src/index.ts +4 -0
@@ -131,7 +131,13 @@ declare function useEditor<E extends Extension = any>(): Editor<E>;
|
|
131
131
|
export { useEditor }
|
132
132
|
export { useEditor as useEditor_alias_1 }
|
133
133
|
|
134
|
-
|
134
|
+
/**
|
135
|
+
* Add an extension to the editor.
|
136
|
+
*
|
137
|
+
* It accepts an optional extension. If the extension is changed, the previous
|
138
|
+
* extension will be removed and the new one (if not null) will be added.
|
139
|
+
*/
|
140
|
+
declare function useExtension<T extends Extension = Extension>(extension: T | null): void;
|
135
141
|
export { useExtension }
|
136
142
|
export { useExtension as useExtension_alias_1 }
|
137
143
|
|
package/dist/prosekit-preact.js
CHANGED
@@ -31,7 +31,9 @@ import { useEffect } from "preact/hooks";
|
|
31
31
|
function useExtension(extension) {
|
32
32
|
const editor = useEditor();
|
33
33
|
useEffect(() => {
|
34
|
-
|
34
|
+
if (extension) {
|
35
|
+
return editor.use(extension);
|
36
|
+
}
|
35
37
|
}, [editor, extension]);
|
36
38
|
}
|
37
39
|
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/preact",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.1.1",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -85,8 +85,8 @@
|
|
85
85
|
"dist"
|
86
86
|
],
|
87
87
|
"dependencies": {
|
88
|
-
"@prosekit/core": "^0.0
|
89
|
-
"@prosekit/lit": "^0.0
|
88
|
+
"@prosekit/core": "^0.1.0",
|
89
|
+
"@prosekit/lit": "^0.1.0"
|
90
90
|
},
|
91
91
|
"peerDependencies": {
|
92
92
|
"preact": ">= 9.0.0"
|
@@ -98,9 +98,9 @@
|
|
98
98
|
},
|
99
99
|
"devDependencies": {
|
100
100
|
"@prosekit/dev": "*",
|
101
|
-
"preact": "^10.
|
102
|
-
"tsup": "^
|
103
|
-
"typescript": "^5.
|
101
|
+
"preact": "^10.19.2",
|
102
|
+
"tsup": "^8.0.1",
|
103
|
+
"typescript": "^5.3.2",
|
104
104
|
"vitest": "^0.34.6"
|
105
105
|
},
|
106
106
|
"scripts": {
|
package/src/index.ts
ADDED