Current active functionality disable when option btn is clicked
Question
We are facing a small issue and unfortunately we are not able to figure out why is happening. We don;t want to make it with the wrong way so we thought a good idea to share the problem.
We have create and add successfully the buttons in the panelManager as the code below, but when save data or even click at any of the buttons, sw-visibitilty is disable and this is a problem for us. we want to make sure that border will always be active. Demo is working in that way so I guess there is something that I missed :) I would appreciate if someone helps :) thanks
....
panelManager.addButton('options',
[{
id: 'sw-visibility',
className: 'fa fa-square-o',
command: 'sw-visibility',
active: true,
disable: true,
},{
id: 'save',
className: 'fa fa-save',
command(editor) {
fetch('http://www.example.com/', {
method: 'post',
body: JSON.stringify(editor.getComponents())
})
.then(function (response) {
if (response.status >= 200 && response.status < 300) {
return response.text()
}
throw new Error(response.statusText)
})
.then(function (response) {
console.log(response);
})
},
},{
id: 'undo',
className: 'fa fa-undo icon-undo',
command: 'undo',
attributes: { title: 'Undo (CTRL/CMD + Z)' }
},{
id: 'redo',
className: 'fa fa-repeat icon-redo',
command: 'redo',
attributes: { title: 'Redo (CTRL/CMD + SHIFT + Z)' }
},{
id: 'clean-all',
className: 'fa fa-trash icon-blank',
command: 'clean-all',
attributes: { title: 'Empty canvas' }
}
]);
....
Answers (2)
it seems like the problem fixed after I add: context: "sw-visibility",
Thanks!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1565
Issue to create a "2 columns" block
Hi, Have a new problem, i'm following the tuto and i want to create the block "2 columns" (or more). I try to use (and understand, that's w...
Issue #1805
Define new Image component
I'm new to GrapesJs and am unable to figure out how to create an image component. For example, I have an img tag and have defined the src ,...
Issue #718
Add Description to trait
Is there way to add description to trait? we have below trait and want to add description so user understand what is purpose of it. traits:...
Issue #1966
[QUESTION] Loop over all components
Hi all, I want to create a socket for every button that I add to the canvas. This is working just fine. However, when I reload (using stora...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.