-
Notifications
You must be signed in to change notification settings - Fork 153
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
external links in rich text blocks now opening in new tab #8195
Conversation
…on.mozilla.org into rich_text_external_link
@@ -84,6 +86,21 @@ def register_large_feature(features): | |||
features.default_features.append('large') | |||
|
|||
|
|||
# Updating external links in rich text blocks to open in a new tab | |||
class RichTextExternalLinkNewTabHandler(LinkHandler): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs Referenced: https://docs.wagtail.org/en/latest/extending/rich_text_internals.html#registering-rewrite-handlers
What this new block is doing is adding a new handler for rich text links, and if they are external, add the target='_blank' to open in a new tab
According to whatwg/html#4078 we no longer need to set noopener nofollower as these are set by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kristinashu! That was intentional, from my understanding, the ticket asked for only links in rich text fields. Should I create a new ticket for that or should I add it to this ticket? Thank you! |
Ah ok thank you for explaining. Yes, perhaps open a new ticket to tackle any remaining external links. Will approve this one now tho! |
Sounds good @kristinashu thanks for the approval! I have created #8214 to tackle the rest of the links on the page 😃 |
Closes #8002
Link to sample test page: https://foundation-s-rich-text--1wiazw.mofostaging.net/en/blog/initial-test-blog-post-with-fixed-title/
Steps to test: