From b148c8dbd6e89c9feb70669ea3d7a67ee2876688 Mon Sep 17 00:00:00 2001 From: Sharif Naas Date: Sat, 6 Jun 2020 00:11:24 -0700 Subject: [PATCH] edit_history: Highlight topic edit diffs by using correct CSS selector. Previously, topic edit diffs in the edit history modal were not highlighted in the same way as content diffs because the highlighting CSS rules were inside a .rendered_markdown block. So they affected the content diffs, which are classed as such, but not the topic diffs. This commit moves the highlight rules to a .message_edit_history_content block inside the already existing #message-edit-history block. .message_edit_history_content had already existed in the edit history template message_edit_history.hbs, and is assigned to both the content and topic diffs. The ability to see topic edits in the edit history was added in March 2019 in 38be5ea74394d2fd8586038de6ac447b4bbfbf67; the highlighting worked at that time. It broke four mounths later in July 2019 in 38ffde37e573385df92fc7007810e5e4098c8b56 when the highlight rules were moved into a .rendered_markdown block after having been global. (As a further aside, .rendered_markdown was only added to the content diffs in April 2019 in 5c36918c17f30bf7293e9708904d1559b71ed40c. .message_edit_history_content had been first added, to the content diffs, in February 2019 in 7d42d7b4dbe6eb144a148135db50ad35efc01295.) Aside from fixing topic edit diffs, this change is just more correct; the highlight rules don't belong under .rendered_markdown, and they don't need to be applied globally. --- static/styles/message_edit_history.scss | 25 +++++++++++++------------ static/styles/night_mode.scss | 20 ++++++++++++-------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/static/styles/message_edit_history.scss b/static/styles/message_edit_history.scss index 4fabce2dfc..8f013ece64 100644 --- a/static/styles/message_edit_history.scss +++ b/static/styles/message_edit_history.scss @@ -17,19 +17,20 @@ .messagebox-content { padding: 0px 10px; } -} -.rendered_markdown { - /* Highlighting for message edit history */ - .highlight_text_inserted { - color: hsl(122, 72%, 30%); - background-color: hsl(120, 64%, 95%); - } + .message_edit_history_content { + .highlight_text_inserted { + color: hsl(122, 72%, 30%); + background-color: hsl(120, 64%, 95%); + } - .highlight_text_deleted { - color: hsl(0, 100%, 50%); - background-color: hsl(7, 90%, 92%); - text-decoration: line-through; - word-break: break-all; + .highlight_text_deleted { + color: hsl(0, 100%, 50%); + background-color: hsl(7, 90%, 92%); + text-decoration: line-through; + word-break: break-all; + } } } + + diff --git a/static/styles/night_mode.scss b/static/styles/night_mode.scss index fc34989f13..66e5981f48 100644 --- a/static/styles/night_mode.scss +++ b/static/styles/night_mode.scss @@ -479,16 +479,20 @@ on a dark background, and don't change the dark labels dark either. */ background-color: hsla(355, 37%, 31%, 1); box-shadow: 0px 0px 0px 1px hsla(330, 40%, 20%, 1); } + } - .highlight_text_inserted { - color: hsl(122, 100%, 81%); - background-color: hsla(120, 64%, 95%, 0.3); - } + #message-edit-history { + .message_edit_history_content { + .highlight_text_inserted { + color: hsl(122, 100%, 81%); + background-color: hsla(120, 64%, 95%, 0.3); + } - .highlight_text_deleted { - text-decoration: line-through; - background-color: hsla(7, 54%, 62%, 0.38); - color: hsl(0, 90%, 67%); + .highlight_text_deleted { + color: hsl(0, 90%, 67%); + background-color: hsla(7, 54%, 62%, 0.38); + text-decoration: line-through; + } } }