Fix preserved whitespace-related issues for previews by separating them from main text

This commit is contained in:
Jérémie Astori 2017-07-20 01:58:04 -04:00
parent a13c08a45b
commit 1c8ea0b75c
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8
7 changed files with 22 additions and 22 deletions

View File

@ -943,7 +943,7 @@ kbd {
#chat .time, #chat .time,
#chat .from, #chat .from,
#chat .text { #chat .content {
display: block; display: block;
padding: 2px 0; padding: 2px 0;
flex: 0 0 auto; flex: 0 0 auto;
@ -965,7 +965,7 @@ kbd {
position: relative; position: relative;
} }
#chat .text { #chat .content {
flex: 1 1 auto; flex: 1 1 auto;
overflow: hidden; overflow: hidden;
} }
@ -1024,7 +1024,7 @@ kbd {
#chat.colored-nicks .user.color-31 { color: #ff4846; } #chat.colored-nicks .user.color-31 { color: #ff4846; }
#chat.colored-nicks .user.color-32 { color: #ff199b; } #chat.colored-nicks .user.color-32 { color: #ff199b; }
#chat .text { #chat .content {
padding-left: 10px; padding-left: 10px;
padding-right: 6px; padding-right: 6px;
} }
@ -1093,14 +1093,14 @@ kbd {
display: none !important; display: none !important;
} }
#chat .join .text, #chat .join .content,
#chat .kick .text, #chat .kick .content,
#chat .mode .text, #chat .mode .content,
#chat .nick .text, #chat .nick .content,
#chat .part .text, #chat .part .content,
#chat .quit .text, #chat .quit .content,
#chat .topic .text, #chat .topic .content,
#chat .topic_set_by .text { #chat .topic_set_by .content {
color: #999; color: #999;
} }
@ -1978,7 +1978,7 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */
#chat .time, #chat .time,
#chat .from, #chat .from,
#chat .text { #chat .content {
border: 0; border: 0;
display: inline; display: inline;
padding: 0; padding: 0;
@ -2097,7 +2097,7 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */
#chat .part-reason, #chat .part-reason,
#chat .quit-reason, #chat .quit-reason,
#chat .new-topic, #chat .new-topic,
#chat .action-text, #chat .action .text,
#chat table.channel-list .topic { #chat table.channel-list .topic {
white-space: pre-wrap; white-space: pre-wrap;
} }

View File

@ -71,10 +71,10 @@ function buildChatMessage(data) {
} }
const msg = $(templates[template](data.msg)); const msg = $(templates[template](data.msg));
const text = msg.find(".text"); const content = msg.find(".content");
if (template === "msg_action") { if (template === "msg_action") {
text.html(templates.actions[type](data.msg)); content.html(templates.actions[type](data.msg));
} }
data.msg.previews.forEach((preview) => { data.msg.previews.forEach((preview) => {

View File

@ -34,7 +34,7 @@ function renderPreview(preview, msg) {
$("#chat").on("click", ".toggle-button", function() { $("#chat").on("click", ".toggle-button", function() {
const self = $(this); const self = $(this);
const container = self.closest(".chat"); const container = self.closest(".chat");
const content = self.closest(".text") const content = self.closest(".content")
.find(`.preview[data-url="${self.data("url")}"] .toggle-content`); .find(`.preview[data-url="${self.data("url")}"] .toggle-content`);
const bottom = container.isScrollBottom(); const bottom = container.isScrollBottom();

View File

@ -1,6 +1,6 @@
{{> ../user_name nick=from}} {{> ../user_name nick=from}}
<span class="action-text">{{{parse text}}}</span> <span class="text">{{{parse text}}}</span>
{{#each links}} {{#each links}}
<div class="preview" data-url="{{this}}"></div> <div class="preview" data-url="{{this}}"></div>
{{/each}} {{/each}}

View File

@ -7,8 +7,8 @@
{{> user_name nick=from}} {{> user_name nick=from}}
{{/if}} {{/if}}
</span> </span>
<span class="text"> <span class="content">
{{{parse text}}} <span class="text">{{{parse text}}}</span>
{{#each links}} {{#each links}}
<div class="preview" data-url="{{this}}"></div> <div class="preview" data-url="{{this}}"></div>

View File

@ -3,5 +3,5 @@
{{tz time}} {{tz time}}
</span> </span>
<span class="from"></span> <span class="from"></span>
<span class="text"></span> <span class="content"></span>
</div> </div>

View File

@ -3,7 +3,7 @@
{{tz time}} {{tz time}}
</span> </span>
<span class="from">[{{command}}]</span> <span class="from">[{{command}}]</span>
<span class="text"> <span class="content">
{{#each params}} {{#each params}}
<span>{{this}}</span> <span>{{this}}</span>
{{/each}} {{/each}}