sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Reference search result titles in block content fields are almost entirely cut off by the type name

Open toddpadwick opened this issue 4 months ago • 0 comments

When I use block content fields, such as this one which is used to create internal links, for the most part, its near impossible to find or add the right internal entry for the link, since the text is truncated. At the very least, i'd expect hovering over it to reveal the title attribute of the element would show the full title, but instead it shows the publish date, which in this case is not helpful.

Client is finding it almost impossible to add internal links. Is there a quick work around while this bug is fixed?

Screenshot 2024-04-09 at 16 03 25

Here is my sanity version info:

@sanity/cli (global)             3.30.0 (latest: 3.37.0)
@sanity/color-input               3.1.1 (up to date)
@sanity/default-layout           2.36.2 (up to date)
@sanity/eslint-config-studio      3.0.1 (latest: 4.0.0)
@sanity/google-maps-input         3.0.2 (latest: 4.0.1)
@sanity/image-url                 1.0.2 (up to date)
@sanity/orderable-document-list   1.2.1 (up to date)
@sanity/table                     1.1.2 (up to date)
@sanity/vision                   3.30.0 (latest: 3.37.0)
sanity                           3.30.0 (latest: 3.37.0)

Here is the code for my link field:

import {FiLink} from "react-icons/fi";
export default {
	type:'object',
	name:'link',
	icon:FiLink,
	description:'Choose an entry from the CMS, or add an external url',
	fields:[
		{
			type: 'internalLink',
			name:'internal',
			description:'Recommended. Clear this field, to reveal option to insert external url instead.',
			title:'Internal entry',
			hidden: ({ parent, value }) => parent?.external && !value,
		},
		{
			name: 'external',
			type: 'url',
			description:'For external websites only. Clear this field to reveal the option to insert an internal link instead.',
			placeholder:'https://',
			title: 'External URL',
			hidden: ({ parent, value }) => parent?.internal && !value,
		}
		
	],
	preview: {
		select: {
			entryTitle: 'internal.title',
			entryType:'internal._type',
			url: 'external'
		},
		prepare({entryTitle,entryType,url}) {
			return {
				title: entryTitle ? entryTitle : entryType ? entryType : url,
			}
		}
	}
}

toddpadwick avatar Apr 09 '24 17:04 toddpadwick