From 1c8ea0b75c01b73ea1184fc07df18f6d744bbcd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Thu, 20 Jul 2017 01:58:04 -0400 Subject: [PATCH] Fix preserved whitespace-related issues for previews by separating them from main text --- client/css/style.css | 26 +++++++++++++------------- client/js/render.js | 4 ++-- client/js/renderPreview.js | 2 +- client/views/actions/action.tpl | 4 ++-- client/views/msg.tpl | 4 ++-- client/views/msg_action.tpl | 2 +- client/views/msg_unhandled.tpl | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index b8f3c155..0f90db98 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -943,7 +943,7 @@ kbd { #chat .time, #chat .from, -#chat .text { +#chat .content { display: block; padding: 2px 0; flex: 0 0 auto; @@ -965,7 +965,7 @@ kbd { position: relative; } -#chat .text { +#chat .content { flex: 1 1 auto; overflow: hidden; } @@ -1024,7 +1024,7 @@ kbd { #chat.colored-nicks .user.color-31 { color: #ff4846; } #chat.colored-nicks .user.color-32 { color: #ff199b; } -#chat .text { +#chat .content { padding-left: 10px; padding-right: 6px; } @@ -1093,14 +1093,14 @@ kbd { display: none !important; } -#chat .join .text, -#chat .kick .text, -#chat .mode .text, -#chat .nick .text, -#chat .part .text, -#chat .quit .text, -#chat .topic .text, -#chat .topic_set_by .text { +#chat .join .content, +#chat .kick .content, +#chat .mode .content, +#chat .nick .content, +#chat .part .content, +#chat .quit .content, +#chat .topic .content, +#chat .topic_set_by .content { color: #999; } @@ -1978,7 +1978,7 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */ #chat .time, #chat .from, - #chat .text { + #chat .content { border: 0; display: inline; padding: 0; @@ -2097,7 +2097,7 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */ #chat .part-reason, #chat .quit-reason, #chat .new-topic, -#chat .action-text, +#chat .action .text, #chat table.channel-list .topic { white-space: pre-wrap; } diff --git a/client/js/render.js b/client/js/render.js index 721dd603..57f4da61 100644 --- a/client/js/render.js +++ b/client/js/render.js @@ -71,10 +71,10 @@ function buildChatMessage(data) { } const msg = $(templates[template](data.msg)); - const text = msg.find(".text"); + const content = msg.find(".content"); if (template === "msg_action") { - text.html(templates.actions[type](data.msg)); + content.html(templates.actions[type](data.msg)); } data.msg.previews.forEach((preview) => { diff --git a/client/js/renderPreview.js b/client/js/renderPreview.js index c6f6d21d..947ebd02 100644 --- a/client/js/renderPreview.js +++ b/client/js/renderPreview.js @@ -34,7 +34,7 @@ function renderPreview(preview, msg) { $("#chat").on("click", ".toggle-button", function() { const self = $(this); const container = self.closest(".chat"); - const content = self.closest(".text") + const content = self.closest(".content") .find(`.preview[data-url="${self.data("url")}"] .toggle-content`); const bottom = container.isScrollBottom(); diff --git a/client/views/actions/action.tpl b/client/views/actions/action.tpl index 0f7c2133..396d8be7 100644 --- a/client/views/actions/action.tpl +++ b/client/views/actions/action.tpl @@ -1,6 +1,6 @@ {{> ../user_name nick=from}} -{{{parse text}}} +{{{parse text}}} {{#each links}} -
+
{{/each}} diff --git a/client/views/msg.tpl b/client/views/msg.tpl index b28c1ba0..a3019185 100644 --- a/client/views/msg.tpl +++ b/client/views/msg.tpl @@ -7,8 +7,8 @@ {{> user_name nick=from}} {{/if}} - - {{{parse text}}} + + {{{parse text}}} {{#each links}}
diff --git a/client/views/msg_action.tpl b/client/views/msg_action.tpl index 02187a3f..c3d5c772 100644 --- a/client/views/msg_action.tpl +++ b/client/views/msg_action.tpl @@ -3,5 +3,5 @@ {{tz time}}
- + diff --git a/client/views/msg_unhandled.tpl b/client/views/msg_unhandled.tpl index 69ad3fe5..0316676e 100644 --- a/client/views/msg_unhandled.tpl +++ b/client/views/msg_unhandled.tpl @@ -3,7 +3,7 @@ {{tz time}}
[{{command}}] - + {{#each params}} {{this}} {{/each}}