@prosekit/solid 0.2.1 → 0.2.3
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 +20 -0
- package/dist/prosekit-solid.d.ts +2 -0
- package/dist/prosekit-solid.js +17 -1
- package/package.json +3 -2
@@ -10,6 +10,7 @@ import type { ComboBoxProps as ComboBoxProps_2 } from '@prosekit/lit/combo-box';
|
|
10
10
|
import { Component } from 'solid-js';
|
11
11
|
import { ContextProviderComponent } from 'solid-js';
|
12
12
|
import { Editor } from '@prosekit/core';
|
13
|
+
import type { EditorState } from '@prosekit/pm/state';
|
13
14
|
import { Extension } from '@prosekit/core';
|
14
15
|
import type { InlinePopoverProps as InlinePopoverProps_2 } from '@prosekit/lit/inline-popover';
|
15
16
|
import type { JSXElement } from 'solid-js';
|
@@ -19,6 +20,7 @@ import { ParentProps } from 'solid-js';
|
|
19
20
|
import type { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
|
20
21
|
import { PositioningOptions } from '@prosekit/lit/autocomplete-popover';
|
21
22
|
import { Priority } from '@prosekit/core';
|
23
|
+
import type { ProseMirrorNode } from '@prosekit/pm/model';
|
22
24
|
import type { ResizableHandleProps as ResizableHandleProps_2 } from '@prosekit/lit/resizable-handle';
|
23
25
|
import type { ResizableProps as ResizableProps_2 } from '@prosekit/lit/resizable';
|
24
26
|
|
@@ -170,6 +172,15 @@ export declare type ResizableProps = PropsWithChildren<PropsWithClass<ResizableP
|
|
170
172
|
*/
|
171
173
|
export declare function toValue<T extends MaybeAccessor<any>>(v: T): MaybeAccessorValue<T>;
|
172
174
|
|
175
|
+
/**
|
176
|
+
* Calls the given handler whenever the editor document changes.
|
177
|
+
*
|
178
|
+
* @public
|
179
|
+
*/
|
180
|
+
declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void;
|
181
|
+
export { useDocChange }
|
182
|
+
export { useDocChange as useDocChange_alias_1 }
|
183
|
+
|
173
184
|
/**
|
174
185
|
* Retrieves the editor instance from the nearest ProseKit component.
|
175
186
|
*
|
@@ -232,4 +243,13 @@ export { useKeymap as useKeymap_alias_1 }
|
|
232
243
|
*/
|
233
244
|
export declare function usePriorityExtension<T extends Extension = Extension>(extension: () => T | null, priority?: Priority | null): () => T | null;
|
234
245
|
|
246
|
+
/**
|
247
|
+
* Calls the given handler whenever the editor state changes.
|
248
|
+
*
|
249
|
+
* @public
|
250
|
+
*/
|
251
|
+
declare function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void;
|
252
|
+
export { useStateUpdate }
|
253
|
+
export { useStateUpdate as useStateUpdate_alias_1 }
|
254
|
+
|
235
255
|
export { }
|
package/dist/prosekit-solid.d.ts
CHANGED
@@ -4,6 +4,8 @@ export { useEditor } from './_tsup-dts-rollup';
|
|
4
4
|
export { useExtension } from './_tsup-dts-rollup';
|
5
5
|
export { UseExtensionOptions } from './_tsup-dts-rollup';
|
6
6
|
export { useKeymap } from './_tsup-dts-rollup';
|
7
|
+
export { useStateUpdate } from './_tsup-dts-rollup';
|
8
|
+
export { useDocChange } from './_tsup-dts-rollup';
|
7
9
|
export { MaybeAccessor } from './_tsup-dts-rollup';
|
8
10
|
export { PropsWithChildren } from './_tsup-dts-rollup';
|
9
11
|
export { PropsWithClass } from './_tsup-dts-rollup';
|
package/dist/prosekit-solid.js
CHANGED
@@ -108,9 +108,25 @@ function useKeymap(keymap, options) {
|
|
108
108
|
const extension = () => defineKeymap(keymap());
|
109
109
|
return useExtension(extension, options);
|
110
110
|
}
|
111
|
+
|
112
|
+
// src/hooks/use-state-update.ts
|
113
|
+
import { defineUpdateHandler as defineUpdateHandler2 } from "@prosekit/core";
|
114
|
+
function useStateUpdate(handler, options) {
|
115
|
+
const extension = defineUpdateHandler2((view) => handler(view.state));
|
116
|
+
return useExtension(() => extension, options);
|
117
|
+
}
|
118
|
+
|
119
|
+
// src/hooks/use-doc-change.ts
|
120
|
+
import { defineDocChangeHandler } from "@prosekit/core";
|
121
|
+
function useDocChange(handler, options) {
|
122
|
+
const extension = defineDocChangeHandler((view) => handler(view.state.doc));
|
123
|
+
return useExtension(() => extension, options);
|
124
|
+
}
|
111
125
|
export {
|
112
126
|
ProseKit,
|
127
|
+
useDocChange,
|
113
128
|
useEditor,
|
114
129
|
useExtension,
|
115
|
-
useKeymap
|
130
|
+
useKeymap,
|
131
|
+
useStateUpdate
|
116
132
|
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/solid",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.2.
|
4
|
+
"version": "0.2.3",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -96,7 +96,8 @@
|
|
96
96
|
],
|
97
97
|
"dependencies": {
|
98
98
|
"@prosekit/core": "^0.2.7",
|
99
|
-
"@prosekit/lit": "^0.2.1"
|
99
|
+
"@prosekit/lit": "^0.2.1",
|
100
|
+
"@prosekit/pm": "^0.1.1"
|
100
101
|
},
|
101
102
|
"peerDependencies": {
|
102
103
|
"solid-js": ">= 1.7.0"
|