Merge plugins list from editor config and from server (don't add duplicated plugins).
This commit is contained in:
parent
d614acfe1b
commit
5ac475ca92
|
@ -846,10 +846,7 @@ define([
|
||||||
application.getController('Common.Controllers.ExternalMergeEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
|
application.getController('Common.Controllers.ExternalMergeEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
|
||||||
|
|
||||||
pluginsController.setApi(me.api);
|
pluginsController.setApi(me.api);
|
||||||
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
|
me.requestPlugins('../../../../plugins.json');
|
||||||
me.updatePlugins(me.plugins, false);
|
|
||||||
else
|
|
||||||
me.requestPlugins('../../../../plugins.json');
|
|
||||||
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
|
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
|
||||||
|
|
||||||
documentHolderController.setApi(me.api);
|
documentHolderController.setApi(me.api);
|
||||||
|
@ -1870,7 +1867,13 @@ define([
|
||||||
requestPlugins: function(pluginsPath) { // request plugins
|
requestPlugins: function(pluginsPath) { // request plugins
|
||||||
if (!pluginsPath) return;
|
if (!pluginsPath) return;
|
||||||
|
|
||||||
this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false );
|
var config_plugins = (this.plugins && this.plugins.pluginsData && this.plugins.pluginsData.length>0) ? this.updatePlugins(this.plugins, false) : null, // return plugins object
|
||||||
|
request_plugins = this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false );
|
||||||
|
|
||||||
|
this.updatePluginsList({
|
||||||
|
autostart: (config_plugins&&config_plugins.autostart ? config_plugins.autostart : []).concat(request_plugins&&request_plugins.autostart ? request_plugins.autostart : []),
|
||||||
|
pluginsData: (config_plugins ? config_plugins.pluginsData : []).concat(request_plugins ? request_plugins.pluginsData : [])
|
||||||
|
}, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePlugins: function(plugins, uiCustomize) { // plugins from config
|
updatePlugins: function(plugins, uiCustomize) { // plugins from config
|
||||||
|
@ -1901,10 +1904,15 @@ define([
|
||||||
autostart = [autostart];
|
autostart = [autostart];
|
||||||
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
|
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
|
||||||
|
|
||||||
this.updatePluginsList({
|
if (uiCustomize)
|
||||||
|
this.updatePluginsList({
|
||||||
|
autostart: autostart,
|
||||||
|
pluginsData: arr
|
||||||
|
}, !!uiCustomize);
|
||||||
|
else return {
|
||||||
autostart: autostart,
|
autostart: autostart,
|
||||||
pluginsData: arr
|
pluginsData: arr
|
||||||
}, !!uiCustomize);
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1914,6 +1922,10 @@ define([
|
||||||
if (plugins) {
|
if (plugins) {
|
||||||
var arr = [], arrUI = [];
|
var arr = [], arrUI = [];
|
||||||
plugins.pluginsData.forEach(function(item){
|
plugins.pluginsData.forEach(function(item){
|
||||||
|
if (uiCustomize!==undefined && _.find(arr, function(arritem) {
|
||||||
|
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
||||||
|
})) return;
|
||||||
|
|
||||||
var variationsArr = [],
|
var variationsArr = [],
|
||||||
pluginVisible = false;
|
pluginVisible = false;
|
||||||
item.variations.forEach(function(itemVar){
|
item.variations.forEach(function(itemVar){
|
||||||
|
|
|
@ -632,10 +632,7 @@ define([
|
||||||
application.getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
|
application.getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});
|
||||||
|
|
||||||
pluginsController.setApi(me.api);
|
pluginsController.setApi(me.api);
|
||||||
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
|
me.requestPlugins('../../../../plugins.json');
|
||||||
me.updatePlugins(me.plugins, false);
|
|
||||||
else
|
|
||||||
me.requestPlugins('../../../../plugins.json');
|
|
||||||
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
|
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
|
||||||
|
|
||||||
documentHolderController.setApi(me.api);
|
documentHolderController.setApi(me.api);
|
||||||
|
@ -1638,7 +1635,13 @@ define([
|
||||||
requestPlugins: function(pluginsPath) { // request plugins
|
requestPlugins: function(pluginsPath) { // request plugins
|
||||||
if (!pluginsPath) return;
|
if (!pluginsPath) return;
|
||||||
|
|
||||||
this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false );
|
var config_plugins = (this.plugins && this.plugins.pluginsData && this.plugins.pluginsData.length>0) ? this.updatePlugins(this.plugins, false) : null,
|
||||||
|
request_plugins = this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false );
|
||||||
|
|
||||||
|
this.updatePluginsList({
|
||||||
|
autostart: (config_plugins&&config_plugins.autostart ? config_plugins.autostart : []).concat(request_plugins&&request_plugins.autostart ? request_plugins.autostart : []),
|
||||||
|
pluginsData: (config_plugins ? config_plugins.pluginsData : []).concat(request_plugins ? request_plugins.pluginsData : [])
|
||||||
|
}, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -1670,10 +1673,15 @@ define([
|
||||||
autostart = [autostart];
|
autostart = [autostart];
|
||||||
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
|
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
|
||||||
|
|
||||||
this.updatePluginsList({
|
if (uiCustomize)
|
||||||
|
this.updatePluginsList({
|
||||||
|
autostart: autostart,
|
||||||
|
pluginsData: arr
|
||||||
|
}, !!uiCustomize);
|
||||||
|
else return {
|
||||||
autostart: autostart,
|
autostart: autostart,
|
||||||
pluginsData: arr
|
pluginsData: arr
|
||||||
}, !!uiCustomize);
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1683,14 +1691,14 @@ define([
|
||||||
if (plugins) {
|
if (plugins) {
|
||||||
var arr = [], arrUI = [];
|
var arr = [], arrUI = [];
|
||||||
plugins.pluginsData.forEach(function(item){
|
plugins.pluginsData.forEach(function(item){
|
||||||
if (uiCustomize!==undefined && (pluginStore.findWhere({baseUrl : item.baseUrl}) || pluginStore.findWhere({guid : item.guid}))) return;
|
if (uiCustomize!==undefined && _.find(arr, function(arritem) {
|
||||||
|
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
||||||
|
})) return;
|
||||||
|
|
||||||
var variations = item.variations,
|
var variationsArr = [],
|
||||||
variationsArr = [],
|
|
||||||
pluginVisible = false;
|
pluginVisible = false;
|
||||||
variations.forEach(function(itemVar){
|
item.variations.forEach(function(itemVar){
|
||||||
var isSupported = itemVar.EditorsSupport.includes('slide'),
|
var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'slide');
|
||||||
visible = isSupported && (isEdit || itemVar.isViewer);
|
|
||||||
if ( visible ) pluginVisible = true;
|
if ( visible ) pluginVisible = true;
|
||||||
|
|
||||||
var icons = itemVar.icons;
|
var icons = itemVar.icons;
|
||||||
|
|
|
@ -621,10 +621,7 @@ define([
|
||||||
|
|
||||||
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
|
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
|
||||||
pluginsController.setApi(me.api);
|
pluginsController.setApi(me.api);
|
||||||
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
|
me.requestPlugins('../../../../plugins.json');
|
||||||
me.updatePlugins(me.plugins, false);
|
|
||||||
else
|
|
||||||
me.requestPlugins('../../../../plugins.json');
|
|
||||||
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
|
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1834,7 +1831,13 @@ define([
|
||||||
requestPlugins: function(pluginsPath) { // request plugins
|
requestPlugins: function(pluginsPath) { // request plugins
|
||||||
if (!pluginsPath) return;
|
if (!pluginsPath) return;
|
||||||
|
|
||||||
this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false );
|
var config_plugins = (this.plugins && this.plugins.pluginsData && this.plugins.pluginsData.length>0) ? this.updatePlugins(this.plugins, false) : null, // return plugins object
|
||||||
|
request_plugins = this.updatePlugins( Common.Utils.getConfigJson(pluginsPath), false );
|
||||||
|
|
||||||
|
this.updatePluginsList({
|
||||||
|
autostart: (config_plugins&&config_plugins.autostart ? config_plugins.autostart : []).concat(request_plugins&&request_plugins.autostart ? request_plugins.autostart : []),
|
||||||
|
pluginsData: (config_plugins ? config_plugins.pluginsData : []).concat(request_plugins ? request_plugins.pluginsData : [])
|
||||||
|
}, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePlugins: function(plugins, uiCustomize) { // plugins from config
|
updatePlugins: function(plugins, uiCustomize) { // plugins from config
|
||||||
|
@ -1865,10 +1868,15 @@ define([
|
||||||
autostart = [autostart];
|
autostart = [autostart];
|
||||||
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
|
plugins.autoStartGuid && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
|
||||||
|
|
||||||
this.updatePluginsList({
|
if (uiCustomize)
|
||||||
|
this.updatePluginsList({
|
||||||
|
autostart: autostart,
|
||||||
|
pluginsData: arr
|
||||||
|
}, !!uiCustomize);
|
||||||
|
else return {
|
||||||
autostart: autostart,
|
autostart: autostart,
|
||||||
pluginsData: arr
|
pluginsData: arr
|
||||||
}, !!uiCustomize);
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1878,13 +1886,14 @@ define([
|
||||||
if (plugins) {
|
if (plugins) {
|
||||||
var arr = [], arrUI = [];
|
var arr = [], arrUI = [];
|
||||||
plugins.pluginsData.forEach(function(item){
|
plugins.pluginsData.forEach(function(item){
|
||||||
if (uiCustomize!==undefined && (pluginStore.findWhere({baseUrl : item.baseUrl}) || pluginStore.findWhere({guid : item.guid}))) return;
|
if (uiCustomize!==undefined && _.find(arr, function(arritem) {
|
||||||
|
return (arritem.get('baseUrl') == item.baseUrl || arritem.get('guid') == item.guid);
|
||||||
|
})) return;
|
||||||
|
|
||||||
var variations = item.variations,
|
var variationsArr = [],
|
||||||
variationsArr = [],
|
|
||||||
pluginVisible = false;
|
pluginVisible = false;
|
||||||
variations.forEach(function(itemVar){
|
item.variations.forEach(function(itemVar){
|
||||||
var visible = (isEdit || itemVar.isViewer) && itemVar.EditorsSupport.includes('cell');
|
var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'cell');
|
||||||
if ( visible ) pluginVisible = true;
|
if ( visible ) pluginVisible = true;
|
||||||
|
|
||||||
var icons = itemVar.icons;
|
var icons = itemVar.icons;
|
||||||
|
|
Loading…
Reference in a new issue