From: Aleksander Ɓukasz Date: Thu, 8 Aug 2013 09:42:14 +0000 (+0200) Subject: Hiding bullet point on list item containing nested list X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/9aa850ad8fb519b03bb854f3b731af32e42c54fa Hiding bullet point on list item containing nested list --- diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 0041f6c..48e4abf 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -604,7 +604,8 @@ $.extend(Canvas.prototype.list, { var toret; if(parent.is('list')) { - listElement.wrapWithNodeElement({tag: 'div', klass: 'item'}); + var item = listElement.wrapWithNodeElement({tag: 'div', klass: 'item'}); + item.exec('toggleBullet', false); toret = listElement.parent(); } else { toret = listElement; diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index 11e3471..4c09b75 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -109,6 +109,12 @@ $.extend(DocumentElement.prototype, { return this.parents().some(function(parent) { return parent.is('list'); }); + }, + + exec: function(method) { + var manager = this.data('_wlxmlManager'); + if(manager[method]) + return manager[method].apply(manager, Array.prototype.slice.call(arguments, 1)); } }); diff --git a/modules/documentCanvas/canvas/wlxmlManagers.js b/modules/documentCanvas/canvas/wlxmlManagers.js index b28b022..0aa9575 100644 --- a/modules/documentCanvas/canvas/wlxmlManagers.js +++ b/modules/documentCanvas/canvas/wlxmlManagers.js @@ -121,6 +121,21 @@ $.extend(FootnoteManager.prototype, { managers.set('aside', 'footnote', FootnoteManager); +var ListItemManager = function(wlxmlElement) { + this.el = wlxmlElement; +}; +$.extend(ListItemManager.prototype, { + setup: function() { + this.el.clearWidgets(); + this.el.addWidget(widgets.labelWidget(this.el.tag(), this.el.klass())); + this.el.documentElement._container().css({display: 'list-item'}); + }, + toggleBullet: function(toggle) { + this.el.documentElement._container().css({display : toggle ? 'list-item' : 'block'}); + } +}); +managers.set('div', 'item', ListItemManager); + return { getFor: function(documentElement) { var wlxmlElement = new DocumentElementWrapper(documentElement);