@prosekit/preact 0.1.0 → 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.
@@ -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
- declare function useExtension<T extends Extension = Extension>(extension: T): void;
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
 
@@ -31,7 +31,9 @@ import { useEffect } from "preact/hooks";
31
31
  function useExtension(extension) {
32
32
  const editor = useEditor();
33
33
  useEffect(() => {
34
- return editor.use(extension);
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.1.0",
4
+ "version": "0.1.1",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -98,9 +98,9 @@
98
98
  },
99
99
  "devDependencies": {
100
100
  "@prosekit/dev": "*",
101
- "preact": "^10.18.2",
102
- "tsup": "^7.2.0",
103
- "typescript": "^5.2.2",
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
@@ -0,0 +1,4 @@
1
+ export { ProseKit, type ProseKitProps } from './components/prosekit'
2
+ export { useEditor } from './hooks/use-editor'
3
+ export { useExtension } from './hooks/use-extension'
4
+ export { useKeymap } from './hooks/use-keymap'