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

Images: Overriding "Link To" #15865

Closed
desrosj opened this issue May 28, 2019 · 7 comments
Closed

Images: Overriding "Link To" #15865

desrosj opened this issue May 28, 2019 · 7 comments
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Block] Image Affects the Image Block [Type] Enhancement A suggestion for improvement.

Comments

@desrosj
Copy link
Contributor

desrosj commented May 28, 2019

I couldn't find an issue or discussion for this. Feel free to redirect this discussion to a different area.

Describe the bug
In the Classic Editor, the default value for the "Link To" field for images could be overridden using the image_default_link_type filter. For galleries, the media_view_settings filter could be used to change the default Link To value.

In the block editor, it is not clear to me how to override these defaults, if you can at all. I also thought investigating if these preexisting filters could be used so that any preference that was defined for the Classic Editor would automatically be respected in the block editor.

This came up investigating Trac-46052. From my comment on that issue:

The image_default_link_type option is used to control the preferred image Link To value. This can be set to three values: none (default for new installs since WordPress 2.7 [https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-admin/includes/schema.php#L502 according to the database schema]), file, or post.

For galleries, the proper way to override the default Link To value is using the media_view_settings filter to add galleryDefaults to the list of settings ([https://core.trac.wordpress.org/browser/tags/5.2.1/src/wp-includes/media.php#L3768 filter documentation]).

These are the results of my testing:

  • While using the block editor with the image block, the option ''is not'' respected in the Link To field.
  • When using the block editor with the Classic Editor block to insert an image, the option ''is'' respected in the Link To field.
  • While using the block editor with the gallery block, the default Link To value ''is not'' respected.
  • When using the block editor with the Classic Editor block to insert a gallery, the default value ''is'' respected.
  • When using the Classic Editor plugin, both plugins and images correctly respect the methods above.

There is also a similar issue for image sizes to make the editor remember preference on a per user basis (#8663). This could also be explored for Link To, I think.

@desrosj desrosj added [Block] Image Affects the Image Block [Block] Gallery Affects the Gallery Block - used to display groups of images labels May 28, 2019
@ghost
Copy link

ghost commented Jul 10, 2019

+1 I'm also looking for a way to make 'Link to media file' the default behaviour. I keep forgetting this after saving a post, even after a year using the new editor.

@catdotgif
Copy link

This might seem like a minor issue, but it has a large and negative impact on the quality of the experience of using Gutenberg for the user.

@Gitami
Copy link

Gitami commented Jan 8, 2020

Before Gutenberg (in the Classic editor), the default behavior was that it remembered the last setting you had used. So if you had a "link to" media file - it just did that automatically going forward, until you changed it to something else, whereafter it did that going forward. Simple. That was such as subtle yet awesome UI design choice. Unfortunately it just disappeared out the window when Gutenberg came along.

For at long time I honestly just thought: "well okay, its new, they'll get around to fixed / reimplemeting that feature". Yet here we are. over a year later and still nothing. So you've forced me to take matters into my own hands and write this response.

This missing little feature cost millions of users extra clicks single every day - and it has cost me personally thousands of clicks since i moved to WP5.

Could we get this issue prioritized! Thanks.

@talldan talldan added the [Type] Enhancement A suggestion for improvement. label Feb 7, 2020
@talldan
Copy link
Contributor

talldan commented Feb 7, 2020

This seems like a duplicate of #10173.

I'll keep this open as it seems like the discussion has evolved.

@skorasaurus
Copy link
Member

I was wondering about this as well and I think the following PRs aim to solve this? #13797
and #17401 which appears to supersede the 13797.

@noisysocks
Copy link
Member

Duplicate of #10173.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Block] Image Affects the Image Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

7 participants