Added support for input/checkbox

pull/214/head
M66B 10 months ago
parent 3f81a56ce8
commit 42ac5fdcba

@ -540,12 +540,14 @@ public class HtmlHelper {
sheets = parseStyles(parsed.head().select("style")); sheets = parseStyles(parsed.head().select("style"));
Safelist safelist = Safelist.relaxed() Safelist safelist = Safelist.relaxed()
.addTags("hr", "abbr", "big", "font", "dfn", "ins", "del", "s", "tt", "mark", "address") .addTags("hr", "abbr", "big", "font", "dfn", "ins", "del", "s", "tt", "mark", "address", "input")
.addAttributes(":all", "class") .addAttributes(":all", "class")
.addAttributes(":all", "style") .addAttributes(":all", "style")
.addAttributes("span", "dir") .addAttributes("span", "dir")
.addAttributes("li", "dir") .addAttributes("li", "dir")
.addAttributes("div", "x-plain") .addAttributes("div", "x-plain")
.addAttributes("input", "type")
.addAttributes("input", "checked")
.removeTags("col", "colgroup") .removeTags("col", "colgroup")
.removeTags("thead", "tbody", "tfoot") .removeTags("thead", "tbody", "tfoot")
.addAttributes("td", "width") .addAttributes("td", "width")
@ -3781,6 +3783,12 @@ public class HtmlHelper {
setSpan(ssb, new ImageSpanEx(d, element), start, start + 1); setSpan(ssb, new ImageSpanEx(d, element), start, start + 1);
} }
break; break;
case "input":
String type = element.attr("type");
boolean checked = element.hasAttr("checked");
if ("checkbox".equalsIgnoreCase(type))
ssb.append(checked ? "\u2611" : "\u2610");
break;
case "li": case "li":
if (start == 0 || ssb.charAt(start - 1) != '\n') if (start == 0 || ssb.charAt(start - 1) != '\n')
ssb.insert(start++, "\n"); ssb.insert(start++, "\n");

Loading…
Cancel
Save