Issue #1343💬 AnsweredOpened August 6, 2018by ploutos271 reactions

Current active functionality disable when option btn is clicked

快速解答by ploutos271

it seems like the problem fixed after I add: context: "sw-visibility", Thanks!

Read full answer below ↓

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)

ploutos27August 7, 2018

it seems like the problem fixed after I add: context: "sw-visibility",

Thanks!

lock[bot]September 17, 2019

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.

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.