grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

[Question] Can I make everything unselectable by default?

Open emilsedgh opened this issue 8 years ago • 3 comments

Currently all components are selectable/hoverable by default.

And if you want you can change that behavior by providing data-gjs-hoverable=fase in the template.

Is there any way to change this so selectable/hoverable is false by default, unless data-gjs-hoverable=true is provided?

Thank you btw. Grapes is amazing.

emilsedgh avatar Aug 03 '18 18:08 emilsedgh

Hello @emilsedgh Please check the below code it may help you.

editor.on('load', function()
{
    const updateAll = model => {
        model.set({editable: false,selectable:false,hoverable:false});
        model.get('components').each(model => updateAll(model));
    }
    updateAll(editor.DomComponents.getWrapper());

});

yashvirsoftobiz avatar Aug 04 '18 07:08 yashvirsoftobiz

Thank you very much @YashPrince

I suppose I can use a custom data attribute to exclude the ones I want to be editable right?

Feel free to close this question btw. Thanks for answering.

emilsedgh avatar Aug 04 '18 08:08 emilsedgh

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 17 '19 08:09 lock[bot]