diff options
author | zeripath <art27@cantab.net> | 2020-04-26 06:09:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-26 02:09:08 -0300 |
commit | 9f959ac0641821148e46d0899b74cc714c858879 (patch) | |
tree | f878ad83c9cd2c942aa0f99959cab7f248469ee1 /modules/markup/sanitizer.go | |
parent | f1f56da4d1339345ffea68d675e972648bd60a59 (diff) | |
download | gitea-9f959ac0641821148e46d0899b74cc714c858879.tar.gz gitea-9f959ac0641821148e46d0899b74cc714c858879.zip |
Make TaskCheckBox render correctly (#11214)
* Fix checkbox rendering
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Normalize checkbox rendering
Signed-off-by: Andrew Thornton <art27@cantab.net>
* set the checkboxes to readonly instead of disabled
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules/markup/sanitizer.go')
-rw-r--r-- | modules/markup/sanitizer.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 95c6eb0dc4..ddb5584e80 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -42,7 +42,7 @@ func ReplaceSanitizer() { // Checkboxes sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input") - sanitizer.policy.AllowAttrs("checked", "disabled").OnElements("input") + sanitizer.policy.AllowAttrs("checked", "disabled", "readonly").OnElements("input") // Custom URL-Schemes sanitizer.policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...) @@ -57,7 +57,11 @@ func ReplaceSanitizer() { sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`task-list`)).OnElements("ul") // Allow icons - sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^icon(\s+[\p{L}\p{N}_-]+)+$`)).OnElements("i", "span") + sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^icon(\s+[\p{L}\p{N}_-]+)+$`)).OnElements("i") + sanitizer.policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(ui checkbox)|(ui checked checkbox))$`)).OnElements("span") + + // Allow unlabelled labels + sanitizer.policy.AllowNoAttrs().OnElements("label") // Allow generally safe attributes generalSafeAttrs := []string{"abbr", "accept", "accept-charset", |