1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-21 16:50:01 +00:00

view.html: fix comment text copypasting in Firefox

Firefox would insert a lot of weird whitespace, because its
user-select would default to "all" and not "text", so it copypastes
the whitespace of otherwise completely invisible HTML elements.

I don't know why Firefox does this. It's stupid, and not what the
user expects. They're copying what they see, not what the DOM is.
This commit is contained in:
Nicolas F 2019-04-13 16:13:14 +02:00 committed by Nicolas F
parent 8f1925ce05
commit 8614da6322
2 changed files with 6 additions and 1 deletions

View file

@ -293,6 +293,11 @@ a.text-purple:hover, a.text-purple:active, a.text-purple:focus {
margin-bottom: 10px;
}
/* workaround for Mozilla whitespace copypaste dumbfuckery */
.comment-body {
-moz-user-select: text;
}
.comment-content {
overflow-wrap: break-word;
}

View file

@ -174,7 +174,7 @@
{% endif %}
</div>
</div>
<div class="row">
<div class="row comment-body">
{# Escape newlines into html entities because CF strips blank newlines #}
<div markdown-text class="comment-content" id="torrent-comment{{ comment.id }}">{{- comment.text | escape | replace('\r\n', '\n') | replace('\n', '&#10;'|safe) -}}</div>
{% if g.user.id == comment.user_id and comment_form %}