grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

disable/hide Style Manager

Open AH1N1 opened this issue 8 years ago • 2 comments

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?

AH1N1 avatar Dec 15 '17 13:12 AH1N1

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);

artf avatar Dec 18 '17 23:12 artf

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.

lock[bot] avatar Sep 18 '19 04:09 lock[bot]