jodit / jodit-react

React wrapper for Jodit
MIT License
363 stars 120 forks source link

How to programmatically control the visibility of custom toolbar button #267

Open rastermechanism opened 3 months ago

rastermechanism commented 3 months ago

Jodit Version: 3.4.xxxxx

Browser: Chrome OS: Windows Is React App: True

buttons: [
            {
                name: 'Mycustombutton1',
                tooltip: 'Mycustombutton1',
                icon: `<svg path></svg>`,
                exec: async (instance) => {                                     
                    // need way to remove Mycustombutton1 button from toolbar
                    // something like instance.editor.remove etc 
                }
            },
            '|', 'bold', 'italic',
            '|', 'table', '|', 'image',
        ],

This is to limit the user to click Mycustombutton1 only once. I thought removing would be easy but seems tough, if that is not possible then even disabling would be also acceptable, just give me some pointer.