diff --git a/.changeset/expose-value-sync-plugin.md b/.changeset/expose-value-sync-plugin.md new file mode 100644 index 000000000..cde05cb7c --- /dev/null +++ b/.changeset/expose-value-sync-plugin.md @@ -0,0 +1,5 @@ +--- +"@portabletext/plugin-sdk-value": patch +--- + +feat(sdk-value): expose `ValueSyncPlugin` diff --git a/packages/plugin-sdk-value/src/index.ts b/packages/plugin-sdk-value/src/index.ts index aeb399774..88a7f7e2a 100644 --- a/packages/plugin-sdk-value/src/index.ts +++ b/packages/plugin-sdk-value/src/index.ts @@ -1 +1 @@ -export {SDKValuePlugin} from './plugin.sdk-value' +export {SDKValuePlugin, ValueSyncPlugin} from './plugin.sdk-value' diff --git a/packages/plugin-sdk-value/src/plugin.sdk-value.tsx b/packages/plugin-sdk-value/src/plugin.sdk-value.tsx index c396adba8..49f8e76e4 100644 --- a/packages/plugin-sdk-value/src/plugin.sdk-value.tsx +++ b/packages/plugin-sdk-value/src/plugin.sdk-value.tsx @@ -339,12 +339,25 @@ export function SDKValuePlugin(props: SDKValuePluginProps) { ) } +/** + * @internal + */ type ValueSyncConfig = { getRemoteValue: () => PortableTextBlock[] | null | undefined pushValue: (value: PortableTextBlock[]) => void onRemoteValueChange: (callback: () => void) => () => void } +/** + * NOTE: You are probably looking for SDKValuePlugin instead of this. + * This is a lower-level plugin that only handles syncing the value + * between the editor and a remote source. It does not know anything + * about Sanity documents or how to fetch/update them. + * + * May be removed in the future, do not rely on this directly. + * + * @internal + */ export function ValueSyncPlugin(props: ValueSyncConfig) { const {getRemoteValue, pushValue, onRemoteValueChange} = props const editor = useEditor()