Command running multiple times
Question
Hello Folks,
I need your help.I created a custom button on the commands Panel to publish the site created from Grapes.When i click on it, it executes the command 2 times and I am not sure why
Here is my code snippet.Any help would be really appreciated.
//Get the default plugin set for all the blocks
plugins: ['gjs-preset-webpage'],
pluginsOpts: {
'gjs-preset-webpage': { /* options */ }
},
//Commands
commands: {
defaults: [{
id: 'publishContent',
run: function (editor, senderBtn) {
publish(editor.getHtml(), editor.getCss());
},
stop: function (editor, senderBtn) {},
}],
},
});
//Manipulate existing panels
var panelManager = editor.Panels;
//get Panel Object
var panelObj = panelManager.getPanel('options');
//publish button to publish the website
var publishButton = panelManager.addButton('options', {
id: 'publish',
className: 'fa fa-upload',
command: 'publishContent',
attributes: {
title: 'Publish Site'
},
active: false,
});`
Warm regards
MilapAnswers (3)
@artf Can you please help on this.
@milapshah15 please check @artf response and my response here
@shareefhiasat if you see my code, I guess that issue is different than what I am facing.Moreover, I see that I face the issue when I load website-preset plugin
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1672
[Bug] Item drop duplicates after opening Layers Panel.
Hi i'm a novice posting an issue for the first time. Please let me know if you need any more information for the query. grapesjs version:0....
Issue #921
[QUESTION] Select and focus an html element from a panel button
Hi everyone, Is it possible to set focus in a section html with Grapes, like as an anchor? I have a panel button and it just select the sec...
Issue #1661
I've created html table and cannot drag new elements to table cells
Hello. if I create html table with next block of code, everything works, I'm able to drop a Quote, for example, to any cell: But next code...
Issue #1639
[Question]: Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.