plugins-functionality #43

Merged
argiro.kokogiannaki merged 86 commits from plugins-functionality into develop 2024-06-13 09:14:22 +02:00
1 changed files with 16 additions and 22 deletions
Showing only changes of commit 50ae910b26 - Show all commits

View File

@ -143,33 +143,30 @@ export class PluginsComponent implements OnInit {
} }
let self = this; let self = this;
this.pluginTemplates.forEach(_ => { this.pluginTemplates.forEach(_ => {
console.log("pl template", _.code, _.custom)
let plugin: Plugin = null; let plugin: Plugin = null;
if(!_.custom) {
for (let pl of plugins) { for (let pl of plugins) {
if (pl.templateId == _._id) { if (pl.templateId == _._id) {
plugin = pl; plugin = pl;
} }
} }
if (!plugin && !_.custom) { if (!plugin) {
plugin = new Plugin(this.selectedPageId, this.selectedCommunityPid, _); plugin = new Plugin(this.selectedPageId, this.selectedCommunityPid, _);
this.plugins.push(plugin); this.plugins.push(plugin);
} }
if (plugin) { if (plugin) {
console.log("plugin found", plugin.custom)
if (plugin.custom) {
console.log(plugin, _)
}
plugin.object = PluginUtils.initializeObjectAndCompare(_.code, plugin.object) plugin.object = PluginUtils.initializeObjectAndCompare(_.code, plugin.object)
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _, openPreview: false}); this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _, openPreview: false});
} }
}
}); });
/* console.log("________", )
//add custom plugins in the list //add custom plugins in the list
this.plugins.forEach(_ => { this.plugins.forEach(_ => {
if(_.custom){ if(_.custom){
console.log("custom plugin", _.templateCode)
let customTemplate = null; let customTemplate = null;
this.pluginTemplates.forEach(template => { this.pluginTemplates.forEach(template => {
if (_.templateId == template._id) { if (_.templateId == template._id) {
@ -177,13 +174,10 @@ export class PluginsComponent implements OnInit {
} }
}); });
if(customTemplate){ if(customTemplate){
console.log("template found!")
this.pluginsByPlacement.get(customTemplate.placement).push({plugin: _, template: customTemplate, openPreview: false}); this.pluginsByPlacement.get(customTemplate.placement).push({plugin: _, template: customTemplate, openPreview: false});
} }
} }
});*/ });
let availablePlacements = []; let availablePlacements = [];
for (let placement of this.pluginUtils.placementsOptions) { for (let placement of this.pluginUtils.placementsOptions) {
if (this.pluginsByPlacement.get(placement.value).length > 0) { if (this.pluginsByPlacement.get(placement.value).length > 0) {