From 3da352c6e71066450cc83f58dfc179f685f4c699 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Thu, 7 Sep 2017 17:55:30 +0300 Subject: [PATCH] [Common] debug for 'preview' mode --- apps/common/main/lib/controller/Plugins.js | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 399666501..3ad0c88bf 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -175,24 +175,28 @@ define([ onAddPlugin: function (model) { var me = this; - var btn = me.panelPlugins.createPluginButton(model); + if ( me.$toolbarPanelPlugins ) { + var btn = me.panelPlugins.createPluginButton(model); - var _group = $('> .group', me.$toolbarPanelPlugins); - var $slot = $('').appendTo(_group); - btn.render($slot); + var _group = $('> .group', me.$toolbarPanelPlugins); + var $slot = $('').appendTo(_group); + btn.render($slot); + } }, onResetPlugins: function (collection) { var me = this; - me.$toolbarPanelPlugins.empty(); + if ( me.$toolbarPanelPlugins ) { + me.$toolbarPanelPlugins.empty(); - var _group = $('
'); - collection.each(function (model) { - var $slot = $('').appendTo(_group); - me.panelPlugins.createPluginButton(model).render($slot); - }); + var _group = $('
'); + collection.each(function (model) { + var $slot = $('').appendTo(_group); + me.panelPlugins.createPluginButton(model).render($slot); + }); - _group.appendTo(me.$toolbarPanelPlugins); + _group.appendTo(me.$toolbarPanelPlugins); + } }, onSelectPlugin: function(picker, item, record, e){