Flatten list for editor

pull/207/head
M66B 3 years ago
parent 00e54f0b08
commit e643271f13

@ -1269,8 +1269,8 @@ public class HtmlHelper {
// Lists
for (Element e : document.select("ol,ul,blockquote")) {
Element parent = e.parent();
if (view) {
Element parent = e.parent();
if ("blockquote".equals(e.tagName()) || parent == null ||
!("li".equals(parent.tagName()) ||
"ol".equals(parent.tagName()) ||
@ -1299,6 +1299,20 @@ public class HtmlHelper {
}
e.attr("dir", rtl > ltr ? "rtl" : "ltr");
}
// Flatten list for editor
if (parent != null && "li".equals(parent.tagName())) {
List<Node> children = parent.childNodes();
for (Node child : children) {
child.remove();
if (child instanceof Element &&
"ol".equals(child.nodeName()) || "ul".equals(child.nodeName()))
parent.before(child);
else
parent.before(document.createElement("li").appendChild(child));
}
parent.remove();
}
}
}

Loading…
Cancel
Save