Skip to content

Commit 2e11068

Browse files
authored
feat(richtext-slate): add useElement hook to richtext-slate client exports (#8856)
I'm extending the Slate editor with a custom component and everything works great, except I have to import `useElement()` like this: ```tsx import { useElement } from 'node_modules/.pnpm/@payloadcms+richtext-slate@3.0.0-beta.113_monaco-editor@0.51.0_next@15.0.0-canary.191_@babel+_qmdxs6s5hpzjhuopohgawpvl6i/node_modules/@payloadcms/richtext-slate/dist/field/providers/ElementProvider.js' export function Element() { const { attributes, children } = useElement() return ( <p {...attributes} className="rich-text-preheading"> {children} </p> ) } ``` That's because it's not in the `@payloadcms/richtext-slate/client` module. This PR fixes this and would allow me to do: ```tsx import { useElement } from '@payloadcms/richtext-slate/client' ```
1 parent 749a7d9 commit 2e11068

File tree

1 file changed

+1
-0
lines changed
  • packages/richtext-slate/src/exports/client

1 file changed

+1
-0
lines changed

packages/richtext-slate/src/exports/client/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ export { UnderlineLeafButton } from '../../field/leaves/underline/LeafButton.js'
6262

6363
export { UnderlineLeaf } from '../../field/leaves/underline/Underline/index.js'
6464

65+
export { useElement } from '../../field/providers/ElementProvider.js'
6566
export { useLeaf } from '../../field/providers/LeafProvider.js'
6667
export { useSlatePlugin } from '../../utilities/useSlatePlugin.js'

0 commit comments

Comments
 (0)