diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js
index 1dea4daf6..9c345baa7 100644
--- a/apps/documenteditor/main/app/controller/Toolbar.js
+++ b/apps/documenteditor/main/app/controller/Toolbar.js
@@ -103,6 +103,7 @@ define([
this.diagramEditor = null;
this._isAddingShape = false;
this.editMode = true;
+ this.binding = {};
this.addListeners({
'Toolbar': {
@@ -2562,8 +2563,7 @@ define([
fillTextArt: function() {
if (!this.toolbar.btnInsertTextArt.rendered) return;
-
- var me = this;
+
if (this.toolbar.mnuTextArtPicker) {
var models = this.getApplication().getCollection('Common.Collections.TextArt').models,
count = this.toolbar.mnuTextArtPicker.store.length;
@@ -2575,31 +2575,36 @@ define([
} else {
this.toolbar.mnuTextArtPicker.store.reset(models);
}
- } else {
- this.toolbar.mnuTextArtPicker = new Common.UI.DataView({
- el: $('#id-toolbar-menu-insart'),
- store: this.getApplication().getCollection('Common.Collections.TextArt'),
- parentMenu: this.toolbar.btnInsertTextArt.menu,
- showLast: false,
- itemTemplate: _.template('

')
- });
+ } else if (!this.binding.onShowBeforeTextArt) {
+ var me = this;
+ me.binding.onShowBeforeTextArt = function(menu) {
+ me.toolbar.mnuTextArtPicker = new Common.UI.DataView({
+ el: $('#id-toolbar-menu-insart'),
+ store: me.getApplication().getCollection('Common.Collections.TextArt'),
+ parentMenu: menu,
+ showLast: false,
+ itemTemplate: _.template('
')
+ });
- this.toolbar.mnuTextArtPicker.on('item:click', function(picker, item, record, e) {
- if (me.api) {
- if (record) {
- me.toolbar.fireEvent('inserttextart', me.toolbar);
- me.api.AddTextArt(record.get('data'));
+ me.toolbar.mnuTextArtPicker.on('item:click', function(picker, item, record, e) {
+ if (me.api) {
+ if (record) {
+ me.toolbar.fireEvent('inserttextart', me.toolbar);
+ me.api.AddTextArt(record.get('data'));
+ }
+
+ if (me.toolbar.btnInsertShape.pressed)
+ me.toolbar.btnInsertShape.toggle(false, true);
+
+ if (e.type !== 'click')
+ me.toolbar.btnInsertTextArt.menu.hide();
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt);
+ Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
}
-
- if (me.toolbar.btnInsertShape.pressed)
- me.toolbar.btnInsertShape.toggle(false, true);
-
- if (e.type !== 'click')
- me.toolbar.btnInsertTextArt.menu.hide();
- Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt);
- Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
- }
- });
+ });
+ menu.off('show:before', me.binding.onShowBeforeTextArt);
+ };
+ me.toolbar.btnInsertTextArt.menu.on('show:before', me.binding.onShowBeforeTextArt);
}
},
diff --git a/apps/documenteditor/main/app/view/TextArtSettings.js b/apps/documenteditor/main/app/view/TextArtSettings.js
index 663bd9537..721610be5 100644
--- a/apps/documenteditor/main/app/view/TextArtSettings.js
+++ b/apps/documenteditor/main/app/view/TextArtSettings.js
@@ -985,15 +985,17 @@ define([
},
createDelayedElements: function() {
+ this._initSettings = false;
this.createDelayedControls();
this.UpdateThemeColors();
this.fillTransform(this.api.asc_getPropertyEditorTextArts());
- this._initSettings = false;
+ this.fillTextArt();
},
fillTextArt: function() {
+ if (this._initSettings) return;
+
var me = this;
-
if (!this.cmbTextArt) {
this.cmbTextArt = new Common.UI.ComboDataView({
itemWidth: 50,
@@ -1132,7 +1134,6 @@ define([
this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this));
this.btnBackColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor));
}
-
this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js
index b1b73fd35..043d257e7 100644
--- a/apps/presentationeditor/main/app/view/TextArtSettings.js
+++ b/apps/presentationeditor/main/app/view/TextArtSettings.js
@@ -1294,6 +1294,7 @@ define([
},
createDelayedElements: function() {
+ this._initSettings = false;
this.createDelayedControls();
var global_hatch_menu_map = [
@@ -1327,8 +1328,8 @@ define([
this.PatternFillType = this.patternViewData[0].type;
}
this.UpdateThemeColors();
+ this.fillTextArt();
this.fillTransform(this.api.asc_getPropertyEditorTextArts());
- this._initSettings = false;
},
onInitStandartTextures: function(texture) {
@@ -1395,6 +1396,7 @@ define([
},
fillTextArt: function() {
+ if (this._initSettings) return;
var me = this;
if (!this.cmbTextArt) {
this.cmbTextArt = new Common.UI.ComboDataView({
diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js
index f17fedeee..647553c3f 100644
--- a/apps/presentationeditor/main/app/view/Toolbar.js
+++ b/apps/presentationeditor/main/app/view/Toolbar.js
@@ -113,6 +113,7 @@ define([
me._state = {
hasCollaborativeChanges: undefined
};
+ me.binding = {};
Common.NotificationCenter.on('app:ready', me.onAppReady.bind(this));
return this;
@@ -1461,21 +1462,25 @@ define([
} else {
btn.textartPicker.store.reset( collection.models );
}
- } else {
- btn.textartPicker = new Common.UI.DataView({
- el: $('#view-insert-art', btn.menu.$el),
- store: collection,
- parentMenu: btn.menu,
- showLast: false,
- itemTemplate: _.template('
')
- });
+ } else if (!this.binding.onShowBeforeTextArt) {
+ me.binding.onShowBeforeTextArt = function(menu) {
+ btn.textartPicker = new Common.UI.DataView({
+ el: $('#view-insert-art', btn.menu.$el),
+ store: collection,
+ parentMenu: btn.menu,
+ showLast: false,
+ itemTemplate: _.template('
')
+ });
- btn.textartPicker.on('item:click', function(picker, item, record, e) {
- if (record)
- me.fireEvent('insert:textart', [record.get('data')]);
+ btn.textartPicker.on('item:click', function(picker, item, record, e) {
+ if (record)
+ me.fireEvent('insert:textart', [record.get('data')]);
- if (e.type !== 'click') btn.menu.hide();
- });
+ if (e.type !== 'click') btn.menu.hide();
+ });
+ menu.off('show:before', me.binding.onShowBeforeTextArt);
+ };
+ me.btnInsertTextArt.menu.on('show:before', me.binding.onShowBeforeTextArt);
}
},
diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
index 6f2da378b..24de6a67f 100644
--- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js
+++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
@@ -173,6 +173,7 @@ define([
pgorient: undefined,
lock_doc: undefined
};
+ this.binding = {};
var checkInsertAutoshape = function(e, action) {
var cmp = $(e.target),
@@ -2620,8 +2621,6 @@ define([
fillTextArt: function() {
if (!this.toolbar.btnInsertTextArt.rendered) return;
- var me = this;
-
if ( this.toolbar.mnuTextArtPicker ) {
var models = this.getApplication().getCollection('Common.Collections.TextArt').models,
count = this.toolbar.mnuTextArtPicker.store.length;
@@ -2633,31 +2632,36 @@ define([
} else {
this.toolbar.mnuTextArtPicker.store.reset(models);
}
- } else {
- this.toolbar.mnuTextArtPicker = new Common.UI.DataView({
- el: $('#id-toolbar-menu-insart'),
- store: this.getApplication().getCollection('Common.Collections.TextArt'),
- parentMenu: this.toolbar.btnInsertTextArt.menu,
- showLast: false,
- itemTemplate: _.template('
')
- });
+ } else if (!this.binding.onShowBeforeTextArt) {
+ var me = this;
+ me.binding.onShowBeforeTextArt = function(menu) {
+ me.toolbar.mnuTextArtPicker = new Common.UI.DataView({
+ el: $('#id-toolbar-menu-insart'),
+ store: me.getApplication().getCollection('Common.Collections.TextArt'),
+ parentMenu: menu,
+ showLast: false,
+ itemTemplate: _.template('
')
+ });
- this.toolbar.mnuTextArtPicker.on('item:click',
- function(picker, item, record, e) {
- if (record) {
- me.toolbar.fireEvent('inserttextart', me.toolbar);
- me.api.asc_addTextArt(record.get('data'));
+ me.toolbar.mnuTextArtPicker.on('item:click',
+ function(picker, item, record, e) {
+ if (record) {
+ me.toolbar.fireEvent('inserttextart', me.toolbar);
+ me.api.asc_addTextArt(record.get('data'));
+ }
+ if ( me.toolbar.btnInsertShape.pressed )
+ me.toolbar.btnInsertShape.toggle(false, true);
+
+ if ( e.type !== 'click' )
+ me.toolbar.btnInsertTextArt.menu.hide();
+
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt);
+ Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
}
- if ( me.toolbar.btnInsertShape.pressed )
- me.toolbar.btnInsertShape.toggle(false, true);
-
- if ( e.type !== 'click' )
- me.toolbar.btnInsertTextArt.menu.hide();
-
- Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt);
- Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
- }
- );
+ );
+ menu.off('show:before', me.binding.onShowBeforeTextArt);
+ };
+ me.toolbar.btnInsertTextArt.menu.on('show:before', me.binding.onShowBeforeTextArt);
}
},
diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js
index 8eef92f8b..dc5699307 100644
--- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js
+++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js
@@ -1298,6 +1298,7 @@ define([
},
createDelayedElements: function() {
+ this._initSettings = false;
this.createDelayedControls();
var global_hatch_menu_map = [
@@ -1332,8 +1333,8 @@ define([
}
this.UpdateThemeColors();
+ this.fillTextArt();
this.fillTransform(this.api.asc_getPropertyEditorTextArts());
- this._initSettings = false;
},
onInitStandartTextures: function(texture) {
@@ -1399,8 +1400,8 @@ define([
},
fillTextArt: function() {
+ if (this._initSettings) return;
var me = this;
-
if (!this.cmbTextArt) {
this.cmbTextArt = new Common.UI.ComboDataView({
itemWidth: 50,