diff --git a/packages/sanity/src/core/form/inputs/PortableText/PortableTextInput.tsx b/packages/sanity/src/core/form/inputs/PortableText/PortableTextInput.tsx index ceaa7af068b..f43d1b79a5a 100644 --- a/packages/sanity/src/core/form/inputs/PortableText/PortableTextInput.tsx +++ b/packages/sanity/src/core/form/inputs/PortableText/PortableTextInput.tsx @@ -65,8 +65,9 @@ export function PortableTextInput(props: PortableTextInputProps) { hotkeys, markers = EMPTY_ARRAY, onChange, - onEditorChange, onCopy, + onEditorChange, + onFullScreenChange, onInsert, onItemRemove, onPaste, @@ -122,9 +123,11 @@ export function PortableTextInput(props: PortableTextInputProps) { } else { telemetry.log(PortableTextInputCollapsed) } + + onFullScreenChange?.(next) return next }) - }, [telemetry]) + }, [onFullScreenChange, telemetry]) // Reset invalidValue if new value is coming in from props useEffect(() => { diff --git a/packages/sanity/src/core/form/types/inputProps.ts b/packages/sanity/src/core/form/types/inputProps.ts index d6e17c1a42e..da1b1909561 100644 --- a/packages/sanity/src/core/form/types/inputProps.ts +++ b/packages/sanity/src/core/form/types/inputProps.ts @@ -512,6 +512,12 @@ export interface PortableTextInputProps * Returns changes from the underlying editor */ onEditorChange?: (change: EditorChange, editor: PortableTextEditor) => void + /** + * Optional callback for when the editor goes into or out of full screen mode + * @hidden + * @beta + */ + onFullScreenChange?: (isFullScreen: boolean) => void /** * Custom copy function */