-
Notifications
You must be signed in to change notification settings - Fork 61
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
support link text with boolean config & empty link #352
support link text with boolean config & empty link #352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small question, but otherwise looks good! I won't approve yet because the question could be blocking.
@@ -19,6 +18,5 @@ export interface CustomTypeModelContentRelationshipField< | |||
select: typeof CustomTypeModelLinkSelectType.Document | |||
customtypes?: readonly CustomTypeIDs[] | |||
tags?: readonly Tags[] | |||
text?: CustomTypeModelKeyTextField |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ #ask: Are we missing an allowText
property here, as seen in CustomTypeModelLinkField
and CustomTypeModelLinkToMediaField
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea is that content relationships are not links and thus don't need labels. What happens if someone wants to limit a link to only internal docs, not arbitrary URLs? Wouldn't they need a Content Relationship?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey,
Yes it's the idea, to not have link allow for CR. The fact is, today they are really mixed. In SM UI you cannot select to only link to documents. So that why I did that.
You think we should be more flexible on that?
At the end technically, if you edit manually your slice in SM it will work, custom types API will accept it. I was just thinking on prismic-client to not push for it as it's really name Content Relationship.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things might break if the @prismicio/client
types are not 1:1 with what other tools allow. For example, incorrect types might be generated via prismic-ts-codegen
, and users won't be able to access myContentRelationship.text
without TypeScript complaining.
In SM UI you cannot select to only link to documents.
Today, the content relationship field is used for that purpose. It has to be done that way because the link field does not allow for limiting what is accepted. It's a workaround since, as you said, a link field would be more appropriate if it had the capability of limiting what it accepts.
Since this is a new feature and there's no risk of making a breaking change, let's go with what the team already decided. We can always add text
to the content relationship type if we find it is necessary, or even better, enhance link so devs can define what it accepts. 👍
Resolves: DT-2283
Description
Checklist
Preview
How to QA 1
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩