-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Try to figure out which is the right LinkDestination value for an image #14398
Conversation
I'm sorry. I misread the output from the npm run lint command and there were some errors. I've fixed them so now I hope the code will pass the checks. |
@jesusangel, thanks a lot for taking up this bug fix! It's not clear from your description whether you also managed to fix what @talldan flagged?
The changes he suggested I make didn't seem to work. |
Hello @SeanDS, I made the changes sugested by @talldan. I didn't get the
|
Hello @SeanDS, I didn't get the
When I was testing again this issue, I realised that I haven't changed the onSelectURL event handler to manage the possible case of a default linkDestination value different than none. I'm going to make another commit to fix that. Kind regards, |
Hi @jesusangel did you get to do this last change you mention?
|
Hi @draganescu , Yes, I fixed it in commit d325b35bc on march 14th. Kind regards, |
Any update on this one? Would be really nice to have it in |
Hi @jesusangel Is there anything else that is needed for this PR? |
Hi, It's been a while since I submited the pull request, but I think it's ready for final review and merge. Kind regards, |
Hey @jesusangel I have noticed that older PR's need to be rebased. Could you please do so. |
Hi, I've just rebased my pull request on master. Kind regards, |
Thank you @jesusangel! |
I'm not a reviewer, but seems you did it very wrong (now your PR contains 1100+ commits and 2000+ affected files). Please rebase to keep only related commits in your MR so people can understand what's going on. Usually |
Usually instead of rebasing I personally just do |
@swissspidy very depends on both team and the person :) If one knows how to do rebases, the final history will be much cleaner than the one bloated with dozens of merges. But it's easier to screw up the stuff with rebase, it's true. |
eeb50b5
to
50fb29b
Compare
Hi @okainov, You are right, I've screw up the stuff with the rebase :-( I'm trying to fix it, but now the PR seems to be closed. There are no commits nor files changed. |
I've created a new PR: #17401 |
I want to always link the images in my posts to its source url. This way, users can click on the thumbnail and see the image full size. In Gutenberg's image block, the default setting is not to link the images, so I have to manually change the LinkDestination select for each image I insert in the posts.
Users can change the default value of LinkDestination with a plugin and some JavaScript like this:
The actual code of the Gutenberg's image block doesn't work well when it finds old posts with no LinkDestination attribute, as no attribute means default value, but the new default value isn't the same as the old one.
Description
I've added code to the componentDidMount method of the image block to figure out which is the right value for the LinkDestination attribute based on the innerHTML. This work is based on @SeanDS pull request #13797 and closes issue #13749.
How has this been tested?
I used the latest development release of Gutenberg (cloned at 313974f), and WordPress 5.1, using docker images. I used the plugin showed above to change the default link target to media. I added several images with different LinkDestination values and I edited again after disabling the plugin.
This change doesn't affect other areas of the code.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: