Skip to content

Commit 84a0c90

Browse files
hermanwiknerskogsmaskin
andauthoredFeb 29, 2024
feat(core): add onFullScreenChange to Portable Text Input (#5879)
* doc(core/form): add prop doc for PT-input (onToggleFullscreen) * feat(core): add `onFullScreenChange` prop to PT-input --------- Co-authored-by: Per-Kristian Nordnes <per.kristian.nordnes@gmail.com>
1 parent 2deebb1 commit 84a0c90

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
 

‎packages/sanity/src/core/form/inputs/PortableText/PortableTextInput.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ export function PortableTextInput(props: PortableTextInputProps) {
6565
hotkeys,
6666
markers = EMPTY_ARRAY,
6767
onChange,
68-
onEditorChange,
6968
onCopy,
69+
onEditorChange,
70+
onFullScreenChange,
7071
onInsert,
7172
onItemRemove,
7273
onPaste,
@@ -122,9 +123,11 @@ export function PortableTextInput(props: PortableTextInputProps) {
122123
} else {
123124
telemetry.log(PortableTextInputCollapsed)
124125
}
126+
127+
onFullScreenChange?.(next)
125128
return next
126129
})
127-
}, [telemetry])
130+
}, [onFullScreenChange, telemetry])
128131

129132
// Reset invalidValue if new value is coming in from props
130133
useEffect(() => {

‎packages/sanity/src/core/form/types/inputProps.ts

+6
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,12 @@ export interface PortableTextInputProps
512512
* Returns changes from the underlying editor
513513
*/
514514
onEditorChange?: (change: EditorChange, editor: PortableTextEditor) => void
515+
/**
516+
* Optional callback for when the editor goes into or out of full screen mode
517+
* @hidden
518+
* @beta
519+
*/
520+
onFullScreenChange?: (isFullScreen: boolean) => void
515521
/**
516522
* Custom copy function
517523
*/

0 commit comments

Comments
 (0)
Please sign in to comment.