[QUESTION]: Can't enable 2 panel buttons at the same time
Question
Hi, I'm trying to enable more than one custom panel button at the same time. I think when I create some custom panel button (using code below) they will have the same behavior as normal html radio inputs, meaning that you can only select one and not more then that. See the example below when I try to enable both buttons but one disables the other:
I want to enable both buttons at the same time, is there any property that I can add to do so?
Here is how I create the panel buttons.
cmdm.add('example_cmd1', {
run: function(editor) {
alert("Button 1 enabled");
},
stop: function(editor) {
alert("Button 1 disabled");
},
});
pnm.addButton('options', [{
id: 'button1',
className: 'fa fa-edit',
command: 'example_cmd1',
attributes: {
// ...'
}
}]);
cmdm.add('example_cmd2', {
run: function(editor) {
alert("Button 2 enabled");
},
stop: function(editor) {
alert("Button 2 disabled");
},
});
pnm.addButton('options', [{
id: 'button2',
className: 'fa fa-edit',
command: 'example_cmd2',
attributes: {
// ...'
}
}]);
Answers (2)
Thank you @Ju99ernaut , that's exactly what I needed.
You have to add a different context for each button
editor.Panels.addButton('options', [{
//...
context: 'some string',
// ...
}]);
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2814
[QUESTION] Custom panel button that dynamically Enable/Disable user scripts
Hello and thanks for sharing such a good project. I'm trying to customize some things in the editor but I have some questions that I would...
Issue #2312
[QUESTION] - More control over panel buttons, dynamic panel buttons
Hi, I am trying to implement several more dynamic buttons for the panel, for example a save button that depending on some flag will show an...
Issue #1787
[Question] Change HTML of Panel buttons from span to button
I have created some Panels and would like to change the element of panel buttons from span to button as its more appropriate and looks bett...
Issue #3044
[QUESTION]: New toolbar button works only for new added components and not for existing ones
Hi everybody, can somebody explain me please why when I create a new custom toolbar button this button shows only when I add a new componen...
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.