Skip to content

Add external_link_mode option to open links in a new tab#9

Merged
jon-betts merged 1 commit into
masterfrom
link-opening-options
Sep 24, 2020
Merged

Add external_link_mode option to open links in a new tab#9
jon-betts merged 1 commit into
masterfrom
link-opening-options

Conversation

@jon-betts
Copy link
Copy Markdown
Contributor

@jon-betts jon-betts commented Sep 7, 2020

This allows you to set an option and have links open in a new tab. For: hypothesis/via#259

Testing

Negative case:

Positive case:

@jon-betts jon-betts added the enhancement New feature or request label Sep 7, 2020
@jon-betts jon-betts requested a review from seanh September 7, 2020 13:19
@jon-betts jon-betts self-assigned this Sep 7, 2020
Base automatically changed from test-coverage to master September 23, 2020 15:30
embed_script.src = "{{ h_embed_url }}";
document.head.appendChild(embed_script);

setupExternalLinkHandler({{external_link_mode(env) | tojson}});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd copy pasted the code that actually does the work for this above from Via ages ago. We just need to turn it on.

The tojson here will convert our python string into a well formatted javascript string, and prevents any nonsense from leaking out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants