Fix bug with plugin groups (don't separate groups without plugins)

This commit is contained in:
Julia Radzhabova 2018-05-15 11:15:35 +03:00
parent 902f5d2f5f
commit 14426a4b04

View file

@ -195,19 +195,22 @@ define([
me.$toolbarPanelPlugins.empty();
var _group = $('<div class="group"></div>'),
rank = -1;
rank = -1,
rank_plugins = 0;
collection.each(function (model) {
var new_rank = model.get('groupRank');
if (new_rank!==rank && rank>-1) {
if (new_rank!==rank && rank>-1 && rank_plugins>0) {
_group.appendTo(me.$toolbarPanelPlugins);
$('<div class="separator long"></div>').appendTo(me.$toolbarPanelPlugins);
_group = $('<div class="group"></div>');
rank_plugins = 0;
}
var btn = me.panelPlugins.createPluginButton(model);
if (btn) {
var $slot = $('<span class="slot"></span>').appendTo(_group);
btn.render($slot);
rank_plugins++;
}
rank = new_rank;
});