mirror of
https://github.com/writefreely/writefreely
synced 2024-11-24 17:43:05 +00:00
Merge pull request #147 from writeas/support-audio
Support <audio> element
This commit is contained in:
commit
740282b7b7
2 changed files with 8 additions and 2 deletions
|
@ -108,9 +108,13 @@ body {
|
|||
code {
|
||||
.article-code;
|
||||
}
|
||||
img, video {
|
||||
img, video, audio {
|
||||
max-width: 100%;
|
||||
}
|
||||
audio {
|
||||
width: 100%;
|
||||
white-space: initial;
|
||||
}
|
||||
pre {
|
||||
.code-block;
|
||||
|
||||
|
|
|
@ -156,10 +156,12 @@ func friendlyPostTitle(content, friendlyId string) string {
|
|||
|
||||
func getSanitizationPolicy() *bluemonday.Policy {
|
||||
policy := bluemonday.UGCPolicy()
|
||||
policy.AllowAttrs("src", "style").OnElements("iframe", "video")
|
||||
policy.AllowAttrs("src", "style").OnElements("iframe", "video", "audio")
|
||||
policy.AllowAttrs("src", "type").OnElements("source")
|
||||
policy.AllowAttrs("frameborder", "width", "height").Matching(bluemonday.Integer).OnElements("iframe")
|
||||
policy.AllowAttrs("allowfullscreen").OnElements("iframe")
|
||||
policy.AllowAttrs("controls", "loop", "muted", "autoplay").OnElements("video")
|
||||
policy.AllowAttrs("controls", "loop", "muted", "autoplay", "preload").OnElements("audio")
|
||||
policy.AllowAttrs("target").OnElements("a")
|
||||
policy.AllowAttrs("style", "class", "id").Globally()
|
||||
policy.AllowURLSchemes("http", "https", "mailto", "xmpp")
|
||||
|
|
Loading…
Reference in a new issue