diff --git a/hypha/apply/funds/templates/funds/application_base.html b/hypha/apply/funds/templates/funds/application_base.html index c4ecb9976d1082f6a35ecbbf40b8c61e8c6e18c0..0ccb5ec081f24bb46c67a625db6568bde1602845 100644 --- a/hypha/apply/funds/templates/funds/application_base.html +++ b/hypha/apply/funds/templates/funds/application_base.html @@ -60,6 +60,7 @@ <script src="{% static 'js/apply/file-uploads.js' %}"></script> <script src="{% static 'js/apply/tinymce-word-count.js' %}"></script> <script src="{% static 'js/apply/submission-form-copy.js' %}"></script> + <script src="{% static 'js/apply/external-link-new-window.js' %}"></script> {% if not show_all_group_fields %} <script src="{% static 'js/apply/form-group-toggle.js' %}"></script> {% endif %} diff --git a/hypha/apply/utils/options.py b/hypha/apply/utils/options.py index fed0ebf0ed7447100686c506c36fe1e9265879ae..9f9b45d4ddeff1d354f021e79e4650f04abff8a3 100644 --- a/hypha/apply/utils/options.py +++ b/hypha/apply/utils/options.py @@ -20,6 +20,7 @@ MCE_ATTRIBUTES = { ], 'relative_urls': False, 'browser_spellcheck': True, + 'default_link_target': '_blank', } MCE_ATTRIBUTES_SHORT = {**MCE_ATTRIBUTES, **{'height': 180}} diff --git a/hypha/settings/base.py b/hypha/settings/base.py index 7f557cc118163256cffc8d51cc6ac3eace69949a..e171189701b0ed2e77e00a8f23276b0f7c9ae815 100644 --- a/hypha/settings/base.py +++ b/hypha/settings/base.py @@ -494,7 +494,7 @@ SOCIAL_AUTH_PIPELINE = ( # Bleach Settings BLEACH_ALLOWED_TAGS = ['a', 'b', 'big', 'blockquote', 'br', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dl', 'dt', 'em', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'ins', 'li', 'ol', 'p', 'pre', 'small', 'span', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'th', 'thead', 'tr', 'ul'] -BLEACH_ALLOWED_ATTRIBUTES = ['class', 'colspan', 'href', 'rowspan', 'title', 'width'] +BLEACH_ALLOWED_ATTRIBUTES = ['class', 'colspan', 'href', 'rowspan', 'target', 'title', 'width'] BLEACH_ALLOWED_STYLES = [] diff --git a/hypha/static_src/src/javascript/apply/external-link-new-window.js b/hypha/static_src/src/javascript/apply/external-link-new-window.js new file mode 100644 index 0000000000000000000000000000000000000000..81b9d22fe628ece018189f4816fbff9f5cc92efd --- /dev/null +++ b/hypha/static_src/src/javascript/apply/external-link-new-window.js @@ -0,0 +1,8 @@ +(function ($) { + + 'use strict'; + + // Make external links on application forms open in a new window/tab. + $('.application-form').find("a[href^='http']").attr('target', '_blank'); + +})(jQuery);