grapesjs
grapesjs copied to clipboard
disable/hide Style Manager
I want user to provide a component's id before they could edit it's styles. To do so i need to disable/ hide Style Manager for some component untill user goves it's i. How can i do it?
Hi @AH1N1 you could set up this
const sm = document.getElementById('gjs-sm-sectors');
const updateStyleManager = () => {
const model = editor.getSelected();
sm.style.display = model.getAttributes()['id'] ? 'block' : 'none';
}
// Triggers on component change
editor.on('component:selected', updateStyleManager);
// Triggers when you update component's attributes
editor.on('component:update:attributes', updateStyleManager);
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.