Issue #1336Opened August 3, 2018by emilsedgh0 reactions

[Question] Can I make everything unselectable by default?

Question

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.

Answers (3)

YashPrinceAugust 4, 20180 reactions

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

});
emilsedghAugust 4, 20180 reactions

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.

lock[bot]September 17, 20190 reactions

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

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.