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.
Please describe your changes
I am improving on this pull request, which doesnt solve the issue (actually brings another one): #4346 (comment)
In the mentioned PR only when the exact A element is clicked, it opens the link. But there are cases, when you have mark Bold or some other on the link text as well. The B / STRONG element is rendered INSIDE the A element, thus the condition nodeName !== 'A' does check and it cancels opening the link. I fixed that.
How did you accomplish your changes
I iterate all clicked nodes nodeParents till I approach parent DIV node (inline node must be inside block node, so this is logical rule; Link is inline node). If none of those parent nodes are not A node, only then do I cancel the link opening. This handles all other marks (ie STRONG element inside A element etc) where it previously mistakengly canceled it.
Also I removed the condition that links are opened only when editor is in editable state. I think expected behaviour should be that links are always openable, even if the editor is not right in its edit state.
How have you tested your changes
I added test case into demos/src/Marks/Link/React/index.jsx (added B node inside first A node in the sample content). Previously the link didnt open, now it opens correctly.
How can we verify your changes
Test it, like I did.
Remarks
Checklist
Related issues
#4346 (comment)