Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix video width overflow in markdown, and other changes to match img #24834

Merged
merged 2 commits into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/markup/sanitizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func createDefaultPolicy() *bluemonday.Policy {
"div", "ins", "del", "sup", "sub", "p", "ol", "ul", "table", "thead", "tbody", "tfoot", "blockquote",
"dl", "dt", "dd", "kbd", "q", "samp", "var", "hr", "ruby", "rt", "rp", "li", "tr", "td", "th", "s", "strike", "summary",
"details", "caption", "figure", "figcaption",
"abbr", "bdo", "cite", "dfn", "mark", "small", "span", "time", "wbr",
"abbr", "bdo", "cite", "dfn", "mark", "small", "span", "time", "video", "wbr",
}

policy.AllowAttrs(generalSafeAttrs...).OnElements(generalSafeElements...)
Expand Down
24 changes: 17 additions & 7 deletions web_src/css/markup/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,25 +301,32 @@
background-color: var(--color-markup-table-row);
}

.markup img {
.markup img,
.markup video {
max-width: 100%;
box-sizing: initial;
}

/* this background ensures images can break <hr>. We can only do this on
cases where the background is known and not transparent. */
.markup.file-view img,
.markup.file-view video,
.comment-body .markup img, /* regular comment */
.comment-body .markup video,
.comment-content .markup img, /* code comment */
.wiki .markup img {
.comment-content .markup video,
.wiki .markup img,
.wiki .markup video {
background: var(--color-box-body);
}

.markup img[align="right"] {
.markup img[align="right"],
.markup video[align="right"] {
padding-left: 20px;
}

.markup img[align="left"] {
.markup img[align="left"],
.markup video[align="left"] {
padding-right: 20px;
}

Expand All @@ -343,7 +350,8 @@
border: 1px solid var(--color-secondary);
}

.markup span.frame span img {
.markup span.frame span img,
.markup span.frame span video {
display: block;
float: left;
}
Expand All @@ -368,7 +376,8 @@
text-align: center;
}

.markup span.align-center span img {
.markup span.align-center span img
.markup span.align-center span video {
margin: 0 auto;
text-align: center;
}
Expand All @@ -386,7 +395,8 @@
text-align: right;
}

.markup span.align-right span img {
.markup span.align-right span img,
.markup span.align-right span video {
margin: 0;
text-align: right;
}
Expand Down