@prosekit/solid 0.1.1 → 0.1.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.
@@ -137,7 +137,13 @@ export declare interface UseEditorOptions {
137
137
  update?: boolean;
138
138
  }
139
139
 
140
- declare function useExtension<T extends Extension = Extension>(extension: T): void;
140
+ /**
141
+ * Add an extension to the editor.
142
+ *
143
+ * It accepts an optional extension. If the extension is changed, the previous
144
+ * extension will be removed and the new one (if not null) will be added.
145
+ */
146
+ declare function useExtension<T extends Extension = Extension>(extension: T | null): void;
141
147
  export { useExtension }
142
148
  export { useExtension as useExtension_alias_1 }
143
149
 
@@ -56,7 +56,9 @@ import { createEffect as createEffect2, onCleanup } from "solid-js";
56
56
  function useExtension(extension) {
57
57
  const editor = useEditor();
58
58
  createEffect2(() => {
59
- onCleanup(editor().use(extension));
59
+ if (extension) {
60
+ onCleanup(editor().use(extension));
61
+ }
60
62
  });
61
63
  }
62
64
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/solid",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -99,8 +99,8 @@
99
99
  "devDependencies": {
100
100
  "@prosekit/dev": "*",
101
101
  "solid-js": "^1.8.5",
102
- "tsup": "^7.2.0",
103
- "typescript": "^5.2.2",
102
+ "tsup": "^8.0.1",
103
+ "typescript": "^5.3.2",
104
104
  "vitest": "^0.34.6"
105
105
  },
106
106
  "scripts": {