summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebzwo0i <webzwo0i@c3d2.de>2014-12-29 16:12:07 +0100
committerwebzwo0i <webzwo0i@c3d2.de>2014-12-29 16:12:07 +0100
commite1c683be3f47a350e6bac3146507bd2d7d7478f6 (patch)
tree9f68e2136470ea465cd193838933807173506aff
parent565097efb466abbb06b1ecc9e18bded707b14216 (diff)
downloadetherpad-lite-e1c683be3f47a350e6bac3146507bd2d7d7478f6.zip
differentiate between indents and bullets in unordered lists
-rw-r--r--src/static/js/contentcollector.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js
index a378d2c2..b33b1e6e 100644
--- a/src/static/js/contentcollector.js
+++ b/src/static/js/contentcollector.js
@@ -518,9 +518,24 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
}
if (tname == "ul" || tname == "ol")
{
- var type;
+ var type = node.attribs.class;
var rr = cls && /(?:^| )list-([a-z]+[12345678])\b/.exec(cls);
- type = rr && rr[1] || (tname == "ul" ? "bullet" : "number") + String(Math.min(_MAX_LIST_LEVEL, (state.listNesting || 0) + 1));
+ // lists do not need to have a type, so before we make a wrong guess, check if we find a better hint within the node's children
+ if(!rr && !type){
+ for (var i in node.children){
+ if(node.children[i] && node.children[i].name=='ul'){
+ type = node.children[i].attribs.class
+ if(type){
+ break
+ }
+ }
+ }
+ }
+ if(rr && rr[1]){
+ type = rr[1]
+ } else {
+ type = (tname == "ul" ? (type.match("indent") || node.attribs.class && node.attribs.class.match("indent") ? "indent" : "bullet") : "number") + String(Math.min(_MAX_LIST_LEVEL, (state.listNesting || 0) + 1));
+ }
oldListTypeOrNull = (_enterList(state, type) || 'none');
}
else if ((tname == "div" || tname == "p") && cls && cls.match(/(?:^| )ace-line\b/))