@prosekit/solid 0.2.2 → 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.
@@ -20,6 +20,7 @@ import { ParentProps } from 'solid-js';
|
|
20
20
|
import type { PopoverProps as PopoverProps_2 } from '@prosekit/lit/popover';
|
21
21
|
import { PositioningOptions } from '@prosekit/lit/autocomplete-popover';
|
22
22
|
import { Priority } from '@prosekit/core';
|
23
|
+
import type { ProseMirrorNode } from '@prosekit/pm/model';
|
23
24
|
import type { ResizableHandleProps as ResizableHandleProps_2 } from '@prosekit/lit/resizable-handle';
|
24
25
|
import type { ResizableProps as ResizableProps_2 } from '@prosekit/lit/resizable';
|
25
26
|
|
@@ -171,6 +172,15 @@ export declare type ResizableProps = PropsWithChildren<PropsWithClass<ResizableP
|
|
171
172
|
*/
|
172
173
|
export declare function toValue<T extends MaybeAccessor<any>>(v: T): MaybeAccessorValue<T>;
|
173
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
|
+
|
174
184
|
/**
|
175
185
|
* Retrieves the editor instance from the nearest ProseKit component.
|
176
186
|
*
|
package/dist/prosekit-solid.d.ts
CHANGED
@@ -5,6 +5,7 @@ export { useExtension } from './_tsup-dts-rollup';
|
|
5
5
|
export { UseExtensionOptions } from './_tsup-dts-rollup';
|
6
6
|
export { useKeymap } from './_tsup-dts-rollup';
|
7
7
|
export { useStateUpdate } from './_tsup-dts-rollup';
|
8
|
+
export { useDocChange } from './_tsup-dts-rollup';
|
8
9
|
export { MaybeAccessor } from './_tsup-dts-rollup';
|
9
10
|
export { PropsWithChildren } from './_tsup-dts-rollup';
|
10
11
|
export { PropsWithClass } from './_tsup-dts-rollup';
|
package/dist/prosekit-solid.js
CHANGED
@@ -115,8 +115,16 @@ function useStateUpdate(handler, options) {
|
|
115
115
|
const extension = defineUpdateHandler2((view) => handler(view.state));
|
116
116
|
return useExtension(() => extension, options);
|
117
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
|
+
}
|
118
125
|
export {
|
119
126
|
ProseKit,
|
127
|
+
useDocChange,
|
120
128
|
useEditor,
|
121
129
|
useExtension,
|
122
130
|
useKeymap,
|