Disable selectable, hoverable and editable options when Mobile view is on.
Probably because you're passing a collection (wrapperChildren) to updateAll which expects a model
Read full answer below ↓Question
Hi,
I want to disable to select, hover or edit the components of the editor when the Mobile view is on. I have tried using below code. But it removes all the components from the editor.
commands.add('set-device-mobile', {
run: function (editor) {
editor.setDevice('Mobile portrait');
const updateAll = model => {
model.set({editable: false,selectable:false,hoverable:false});
model.get('components').each(model => updateAll(model));
}
var domComponents = editor.DomComponents;
var wrapperChildren = domComponents.getComponents();
for (var i = 0; i < wrapperChildren.models.length; i++) {
updateAll(wrapperChildren);
}
}
});
Can you please help me out?
Thanks,
Answers (2)
Probably because you're passing a collection (wrapperChildren) to updateAll which expects a model
updateAll(editor.DomComponents.getWrapper());
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 #1463
how to disable gjs-hoverable class from elements
hi @artf i am using your boilerplate plugin and i want to disable hoverable property from all the elements as screenshot below yellow area...
Issue #1487
Load from Database
I've got an issue with loading the lory-slider from my mysql db. When i load it back in, the functionality is gone, i cant slide left or ri...
Issue #1322
Disable editing in Preview Mode.
@artf How can we disable editing in the preview mode and re-enable it when preview mode off. I want to remove editor and hide toolbar in th...
Issue #460
When the component's view modifies the HTML, text components are no longer editable
I'm trying to build a custom component that contains some lorem ipsum text in the content, for editing once it's on the canvas. But I also...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.