Skip to content

Commit

Permalink
fix(core/form/inputs): use isImage asserter to determine image preview (
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed May 26, 2023
1 parent cf002fb commit c2f98ba
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -4,7 +4,7 @@ import {
EditorSelection,
usePortableTextEditor,
} from '@sanity/portable-text-editor'
import {ObjectSchemaType, Path, PortableTextBlock} from '@sanity/types'
import {ObjectSchemaType, Path, PortableTextBlock, isImage} from '@sanity/types'
import {Tooltip, Flex, ResponsivePaddingProps, Box} from '@sanity/ui'
import React, {ComponentType, PropsWithChildren, useCallback, useMemo, useState} from 'react'
import {PatchArg} from '../../../patch'
Expand Down Expand Up @@ -287,7 +287,8 @@ export const DefaultBlockObjectComponent = (props: BlockProps) => {
value,
validation,
} = props
const isImagePreview = schemaType.name === 'image'

const isImagePreview = isImage(schemaType)
const hasError = validation.filter((v) => v.level === 'error').length > 0
const hasWarning = validation.filter((v) => v.level === 'warning').length > 0
const hasMarkers = Boolean(markers.length > 0)
Expand Down

2 comments on commit c2f98ba

@vercel
Copy link

@vercel vercel bot commented on c2f98ba May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio-git-next.sanity.build
performance-studio.sanity.build

@vercel
Copy link

@vercel vercel bot commented on c2f98ba May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio.sanity.build
test-studio-git-next.sanity.build

Please sign in to comment.