@prosekit/react 0.0.24 → 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.
@@ -179,7 +179,13 @@ declare interface UseEditorOptions {
179
179
  export { UseEditorOptions }
180
180
  export { UseEditorOptions as UseEditorOptions_alias_1 }
181
181
 
182
- declare function useExtension<T extends Extension = Extension>(extension: T): void;
182
+ /**
183
+ * Add an extension to the editor.
184
+ *
185
+ * It accepts an optional extension. If the extension is changed, the previous
186
+ * extension will be removed and the new one (if not null) will be added.
187
+ */
188
+ declare function useExtension<T extends Extension = Extension>(extension: T | null): void;
183
189
  export { useExtension }
184
190
  export { useExtension as useExtension_alias_1 }
185
191
 
@@ -87,7 +87,9 @@ function useForceUpdate() {
87
87
  function useExtension(extension) {
88
88
  const editor = useEditor();
89
89
  useEffect2(() => {
90
- return editor.use(extension);
90
+ if (extension) {
91
+ return editor.use(extension);
92
+ }
91
93
  }, [editor, extension]);
92
94
  }
93
95
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/react",
3
3
  "type": "module",
4
- "version": "0.0.24",
4
+ "version": "0.1.1",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -85,9 +85,9 @@
85
85
  "dist"
86
86
  ],
87
87
  "dependencies": {
88
- "@lit/react": "^1.0.1",
89
- "@prosekit/core": "^0.0.20",
90
- "@prosekit/lit": "^0.0.24",
88
+ "@lit/react": "^1.0.2",
89
+ "@prosekit/core": "^0.1.0",
90
+ "@prosekit/lit": "^0.1.0",
91
91
  "@prosemirror-adapter/react": "^0.2.6"
92
92
  },
93
93
  "peerDependencies": {
@@ -104,12 +104,12 @@
104
104
  },
105
105
  "devDependencies": {
106
106
  "@prosekit/dev": "*",
107
- "@types/react": "^18.2.37",
108
- "@types/react-dom": "^18.2.15",
107
+ "@types/react": "^18.2.38",
108
+ "@types/react-dom": "^18.2.17",
109
109
  "react": "^18.2.0",
110
110
  "react-dom": "^18.2.0",
111
- "tsup": "^7.2.0",
112
- "typescript": "^5.2.2",
111
+ "tsup": "^8.0.1",
112
+ "typescript": "^5.3.2",
113
113
  "vitest": "^0.34.6"
114
114
  },
115
115
  "scripts": {
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ export { useNodeViewContext } from '@prosemirror-adapter/react'
2
+ export { ProseKit, type ProseKitProps } from './components/prosekit'
3
+ export {
4
+ defineReactNodeView,
5
+ type ReactNodeViewComponentProps,
6
+ type ReactNodeViewOptions,
7
+ } from './extensions/react-node-view'
8
+ export { useEditor, type UseEditorOptions } from './hooks/use-editor'
9
+ export { useExtension } from './hooks/use-extension'
10
+ export { useKeymap } from './hooks/use-keymap'