Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
toddpadwick opened this issue Apr 9, 2024 · 0 comments

Comments

@toddpadwick
Copy link

toddpadwick commented Apr 9, 2024

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 toddpadwick changed the title Reference search results in block content fields are cut off and unusable Reference search result titles in block content fields are almost entirely cut off by the type name Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant