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

Correct the constants for link destinations #25587

Open
mkaz opened this issue Sep 23, 2020 · 4 comments
Open

Correct the constants for link destinations #25587

mkaz opened this issue Sep 23, 2020 · 4 comments
Labels
[Feature] Media Anything that impacts the experience of managing media [Type] Code Quality Issues or PRs that relate to code quality

Comments

@mkaz
Copy link
Member

mkaz commented Sep 23, 2020

Describe the bug

While working on #25578 and #25582 we noticed the constants used for link destinations do not match the WordPress options used. The options as used elsewhere in classic editor and through numerous code examples should be:

"file" => Media File
"post" => Attachment Page

In Gutenberg, the constants are set to "media" and "attachment", these should be changed. They were updated in #25582 as the gallery is not connected to any other component.

So media-text block, image block, and the image-url-input-ui component should all be updated and the proper deprecation/migration of attributes.

By doing this update, this will allow the Block Editor to match what is set in WordPress options making it easier to understand what is happening.

@mkaz mkaz added the [Type] Code Quality Issues or PRs that relate to code quality label Sep 23, 2020
@skorasaurus skorasaurus added the [Feature] Media Anything that impacts the experience of managing media label Feb 22, 2021
@skorasaurus
Copy link
Member

@mkaz :

I started tackling this and have a notable observation:

Even the variable holds the value of what to link to ; is described named differently.

In the (image) and media and text block, the variable that stores the setting (of the link destination) is described as linkDestination.

In the gallery block; this setting's variable name is described as linkTo.

(The variable is still named linkTo in #25940 - the notable PR that is refactoring the gallery block). ref

I'd strongly prefer to make these consistent as well although that may be getting out of scope; I am interested to hear your thoughts.

@mkaz
Copy link
Member Author

mkaz commented Mar 16, 2021

I think it might make sense to normalize them all at the same time for consistency. It would probably be easier implementing making sure the names are the same across files. So totally fine to expand the scope 👍

@skorasaurus
Copy link
Member

@mkaz should I work off of trunk or off of #25940?

@mkaz
Copy link
Member Author

mkaz commented Mar 26, 2021

@skorasaurus That's a good question, I'm not sure how long you think the change might take, ie. will you be done prior to the Gallery changes get merged. I would normally work off trunk and then you can help rebase that PR when ready. It's a bit of a race, but hopefully either direction isn't too much work to change for whichever is ready first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media Anything that impacts the experience of managing media [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

No branches or pull requests

2 participants