Skip to content

Commit

Permalink
Fix plugin order execution
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jul 5, 2017
1 parent 7632e08 commit 2c7de13
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/grapesjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@
c.el = document.querySelector(els);
var editor = new Editor(c).init();

// Execute all plugins
// Execute plugins
var plugs = plugins.getAll();
for (var id in plugs){
// Check if plugin is requested
if(c.plugins.indexOf(id) < 0)
continue;

var opts = c.pluginsOpts[id] || {};
var plug = plugins.get(id);
plug(editor, opts);
}

c.plugins.forEach((pluginId) => {
let plugin = plugins.get(pluginId);

if (plugin) {
plugin(editor, c.pluginsOpts[pluginId] || {});
} else {
console.warn(`Plugin ${pluginId} not found`);
}
});

if(c.autorender)
editor.render();
Expand Down

0 comments on commit 2c7de13

Please sign in to comment.