[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)
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());
});
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.
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.
Issue #1374
Default Component Properties
Is there any way I can change the default properties of components? I want almost everything to be copyable: false, resizable: false, dragg...
Issue #865
[QUESTION] How can I set default tagName
Hi ! I want to set tagName tr for all components(or specific component in use). Is there any predefined function to set tagName ?
Issue #1902
[QUESTIONS] Disable/change build-in components behavior
Hey, Trying to get GrapesJs work for a project I'm currently working on. But is there a way to disable the built-in components that convert...
Issue #1639
[Question]: Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.