Commit c223fa0b by Zia Fazal

Removed linkify of text when it is in response textarea

parent 81d6ab51
{% load tz %} {% load tz %}
{% load i18n %} {% load i18n %}
{% load oa_extras %}
{% spaceless %} {% spaceless %}
{% block list_item %} {% block list_item %}
<li class="openassessment__steps__step step--response is--in-progress is--showing ui-slidable__container" <li class="openassessment__steps__step step--response is--in-progress is--showing ui-slidable__container"
...@@ -104,7 +103,7 @@ ...@@ -104,7 +103,7 @@
aria-describedby="submission__answer__tip__{{ xblock_id }}" aria-describedby="submission__answer__tip__{{ xblock_id }}"
placeholder="{% trans "Enter your response to the prompt above." %}" placeholder="{% trans "Enter your response to the prompt above." %}"
maxlength="100000" maxlength="100000"
>{{ part.text|escape|link_and_linebreak }}</textarea> >{{ part.text }}</textarea>
</div> </div>
{% with forloop.counter|stringformat:"s" as submission_num %} {% with forloop.counter|stringformat:"s" as submission_num %}
{% include "openassessmentblock/oa_latex_preview.html" with id="submission__"|add:xblock_id|add:submission_num elem="div" preview_name="submission__"|add:submission_num %} {% include "openassessmentblock/oa_latex_preview.html" with id="submission__"|add:xblock_id|add:submission_num elem="div" preview_name="submission__"|add:submission_num %}
......
...@@ -9,12 +9,16 @@ import bleach ...@@ -9,12 +9,16 @@ import bleach
register = template.Library() register = template.Library()
@register.filter(needs_autoescape=True) @register.filter()
@stringfilter @stringfilter
def link_and_linebreak(text, autoescape=True): def link_and_linebreak(text):
"""
if text and len(text) > 0: Converts URLs in text into clickable links with their target attribute set to `_blank`.
the_text = conditional_escape(text) It wraps givent tags into <p> tags and converts line breaks(\n) to <br> tags.
return mark_safe(linebreaks(bleach.linkify(the_text, callbacks=[callbacks.target_blank]))) Args:
else: text: (str) Text having URLs to be converted
return text Returns: (str) Text with URLs convert to links
"""
if text:
escaped_text = conditional_escape(text)
return mark_safe(linebreaks(bleach.linkify(escaped_text, callbacks=[callbacks.target_blank])))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment