Issue #2852Opened June 23, 2020by RJCAM1 reactions

[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: panel-button 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)

RJCAMJune 24, 20201 reactions

Thank you @Ju99ernaut , that's exactly what I needed.

Ju99ernautJune 23, 20200 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.