Skip to content

Commit

Permalink
refactor(core): remove PTE connection event handling (#7830)
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhg authored Nov 18, 2024
1 parent f75230c commit 962ca8c
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export function PortableTextInput(props: PortableTextInputProps): ReactNode {
const [invalidValue, setInvalidValue] = useState<InvalidValue | null>(null)
const [isFullscreen, setIsFullscreen] = useState(initialFullscreen ?? false)
const [isActive, setIsActive] = useState(initialActive ?? false)
const [isOffline, setIsOffline] = useState(false)
const [hasFocusWithin, setHasFocusWithin] = useState(false)
const telemetry = useTelemetry()

Expand Down Expand Up @@ -220,13 +219,6 @@ export function PortableTextInput(props: PortableTextInputProps): ReactNode {
case 'mutation':
onChange(toFormPatches(change.patches))
break
case 'connection':
if (change.value === 'offline') {
setIsOffline(true)
} else if (change.value === 'online') {
setIsOffline(false)
}
break
case 'selection':
setFocusPathFromEditorSelection(change.selection)
break
Expand Down Expand Up @@ -272,13 +264,13 @@ export function PortableTextInput(props: PortableTextInputProps): ReactNode {
onChange={handleEditorChange}
onIgnore={handleIgnoreInvalidValue}
resolution={invalidValue.resolution}
readOnly={isOffline || readOnly}
readOnly={readOnly}
/>
</Box>
)
}
return null
}, [handleEditorChange, handleIgnoreInvalidValue, invalidValue, isOffline, readOnly])
}, [handleEditorChange, handleIgnoreInvalidValue, invalidValue, readOnly])

const handleActivate = useCallback((): void => {
if (!isActive) {
Expand Down Expand Up @@ -389,7 +381,7 @@ export function PortableTextInput(props: PortableTextInputProps): ReactNode {
onChange={handleEditorChange}
maxBlocks={undefined} // TODO: from schema?
ref={editorRef}
readOnly={isOffline || readOnly}
readOnly={readOnly}
schemaType={schemaType}
value={value}
>
Expand Down

0 comments on commit 962ca8c

Please sign in to comment.