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