0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/app/assets/stylesheets/common/base/history.scss
Régis Hanol 146e41b39a
UX: Explain why a revision diff can't be shown in the edit history (#41367)
Previously, when a post revision was hidden, the history modal showed a
completely blank diff area for the revisions next to it, with no
explanation — the diffs on either side of a hidden revision aren't
rendered because they can expose the hidden revision's content, but
users were left thinking the edit history was broken. Reported in
https://meta.discourse.org/t/diff-between-revisions-no-longer-visible-when-there-is-a-hidden-revision-in-between/406254.

This change shows an explanatory notice in place of the blank diff,
driven by the `previous_hidden`/`current_hidden` flags the serializer
already exposes for exactly these revisions. The `hiddenClasses` dimming
is skipped when the notice shows, since it exists to fade hidden content
staff can still see and would fade the notice in the inline view. It
also rewords the related `diff_too_complex` messages in the same plain
language, since "diff" and "revision" aren't words most users know.
2026-07-02 19:41:25 +02:00

334 lines
5 KiB
SCSS
Vendored

@use "lib/viewport";
// styles that apply to the popup that appears when you show the edit history of a post
.d-modal.history-modal {
.d-modal__footer {
justify-content: space-between;
}
#revision-numbers {
display: inline-block;
min-width: 7em;
text-align: center;
}
#revision {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 0.5em 0;
align-items: center;
padding-bottom: 0.5em;
overflow: auto;
border-bottom: 3px solid var(--primary-low);
@include viewport.until(md) {
padding-bottom: 0;
}
@include viewport.until(sm) {
padding-bottom: 0.5em;
}
}
#revision-details {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5em;
}
#display-modes {
.nav {
margin: 0;
padding: 0;
border: none;
}
@include viewport.until(md) {
width: 100%;
margin-top: 0.5em;
.nav-pills {
width: 100%;
li {
margin: 0;
flex: 1 1 auto;
}
a {
width: 100%;
justify-content: center;
}
}
}
}
.revision-details__user {
display: flex;
align-items: center;
gap: 0.25em;
}
.revision__title,
.revision__locale,
.body-diff,
table.markdown > tbody > tr,
.-tag-revisions {
--gap-width: 1rem;
display: flex;
gap: 0 var(--gap-width);
}
.mobile-view & {
.-tag-revisions {
display: block;
}
.discourse-tags {
display: inline;
font-size: var(--font-down-1);
}
}
.inline-diff {
width: 100%;
max-width: var(--modal-max-width);
}
pre {
display: flex;
}
pre code {
overflow-wrap: anywhere; // prevent long strings from breaking modal width
min-width: 0;
overflow: auto;
flex: 0 1 auto;
}
.revision__title {
margin: 0;
line-height: var(--line-height-medium);
}
.revision__locale {
font-size: var(--font-down-1);
color: var(--primary-high);
margin-top: 0.5em;
margin-bottom: 0.5em;
.diff-ins,
.diff-del {
width: fit-content;
}
}
.revision__hidden-notice {
display: flex;
align-items: center;
gap: 0.5em;
padding: 1em 0;
color: var(--primary-medium);
}
&:not(.--mode-inline) {
.-tag-revisions .tag-revision__wrapper {
flex: 0 1 50%;
min-width: 0;
align-self: start;
}
}
.revision-content {
flex: 0 1 50%;
min-width: 0;
}
.markdown {
font-family: var(--d-font-family--monospace);
width: 100%;
border-collapse: collapse;
border-spacing: 0;
td {
overflow-wrap: anywhere;
white-space: pre-wrap;
flex: 0 1 50%;
}
tbody {
border: none;
}
}
#revision-controls {
display: flex;
align-items: center;
.btn {
margin: 0;
}
@include viewport.until(md) {
width: 100%;
justify-content: space-between;
}
}
[class^="revision-controls--"] {
display: flex;
gap: 0 1em;
}
#revisions {
overflow-wrap: break-word;
table {
margin-top: 10px;
tr {
border: none;
}
}
.row:first-of-type {
margin-top: 10px;
}
.revision-content table {
thead {
th {
padding-bottom: 2px;
font-weight: bold;
color: var(--primary);
}
}
td {
padding: 3px 3px 3px 0.5em;
img {
max-width: none;
}
}
}
}
#revision-footer-buttons {
display: flex;
gap: 0.5em;
button {
margin: 0;
flex: 1 1 auto;
min-width: 0;
.d-button-label {
@include ellipsis;
}
}
@include viewport.until(md) {
width: 100%;
flex: 1 1 100%;
button {
font-size: var(--font-down-1);
}
}
}
img {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
ins,
.diff-ins,
del,
.diff-del {
color: var(--primary);
&:not(s, .bbcode-u, .bbcode-s) {
text-decoration: none;
}
code,
img {
border: 2px solid;
}
a {
text-decoration: none;
}
}
ins,
.diff-ins {
background: var(--success-low);
code,
img {
border-color: var(--success);
}
img {
opacity: 0.75;
filter: alpha(opacity=75);
}
a {
color: var(--success);
}
}
del,
.diff-del {
background: var(--danger-low);
code,
img {
border-color: var(--danger);
}
img {
opacity: 0.5;
filter: alpha(opacity=50);
}
a {
color: var(--danger);
}
}
span.date {
font-weight: bold;
}
span.edit-reason {
background-color: var(--highlight-bg);
}
.d-icon-ban {
color: var(--danger);
}
.hidden-revision-either {
opacity: 0.5;
}
.hidden-revision-previous .row {
.--previous {
opacity: 0.5;
}
}
.hidden-revision-current .row {
.--current {
opacity: 0.5;
}
}
}