Flatten list for editor

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

@ -1269,8 +1269,8 @@ public class HtmlHelper {
// Lists // Lists
for (Element e : document.select("ol,ul,blockquote")) { for (Element e : document.select("ol,ul,blockquote")) {
if (view) {
Element parent = e.parent(); Element parent = e.parent();
if (view) {
if ("blockquote".equals(e.tagName()) || parent == null || if ("blockquote".equals(e.tagName()) || parent == null ||
!("li".equals(parent.tagName()) || !("li".equals(parent.tagName()) ||
"ol".equals(parent.tagName()) || "ol".equals(parent.tagName()) ||
@ -1299,6 +1299,20 @@ public class HtmlHelper {
} }
e.attr("dir", rtl > ltr ? "rtl" : "ltr"); 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