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

support link text with boolean config & empty link #352

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

xrutayisire
Copy link
Contributor

Resolves: DT-2283

Description

  • Support empty link with text
  • Update link config to allow text with a boolean and not a key text config

Checklist

  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

Copy link
Member

@angeloashmore angeloashmore left a 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
Copy link
Member

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?

Copy link
Member

@angeloashmore angeloashmore Sep 13, 2024

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?

Copy link
Contributor Author

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.

Copy link
Member

@angeloashmore angeloashmore Sep 13, 2024

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. 👍

@dani-mp dani-mp merged commit 47bbfef into lg/text-in-links Sep 17, 2024
26 checks passed
@dani-mp dani-mp deleted the xru/support-link-text-boolean-empty-link branch September 17, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants