fix (image block): allow richtext in image captions#2965
Merged
Conversation
🤖 Pull request artifacts
|
|
Size Change: +2.48 kB (0%) Total Size: 1.99 MB
ℹ️ View Unchanged
|
bfintal
commented
Nov 21, 2023
Contributor
Author
There was a problem hiding this comment.
Can you try these scenarios, all should not have any block errors:
- Create an image block in < 3.11.8, then update to this PR
- Create an image block in < 3.11.8, then update to 3.12.3, save the page, then update to this PR
- Create an image block in < 3.11.8 add a link in adv tab > link, then update to 3.12.3, save the page, then update to this PR
- Create an image block in 3.12.3, then update to this PR
- Create an image block in 3.12.3, add a caption, then update to this PR
- Create an image block in 3.12.3, add a link in adv tab > link, then update to this PR
Contributor
|
bfintal
commented
Dec 6, 2023
| const { | ||
| attrNameTemplate = 'link%s', | ||
| selector = 'a', | ||
| selector = 'a.stk-link', |
Contributor
Author
There was a problem hiding this comment.
Instead of changing the default value for everyone that uses the selector, can you instead provide a.stk-link to the block/component that needs this?
Suggested change
| selector = 'a.stk-link', | |
| selector = 'a', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #2964
TODO
This is an incomplete fix. Now that RichText in the image caption is allowed, it now conflicts with the image link: If you add an image block, then add a caption with a link, then also add a link from the advanced tab > link, the block will produce an error after saving and refreshing the editor.
The cause of the error is that the Adv tab > Link option incorrectly changes the
figuretag into anatag. The browser then detects that there is anatag within anatag (because you have a link in the figcaption), and tries to split the 2atags and that messes up the block structure causing the block error.The proposed fix for this is to change the implementation of
customWrapperinsrc/block-components/image/image.js. Since this prop is only used to turn the image into the link, we need to change this intolinkUrlprop instead.. the image should always be afigure, then if the image needs to be made into a link, then it should just wrap theimgtag with a link.