Issue #814Opened January 29, 2018by vishal50330 reactions

[QUESTION] Disable selectable, hoverable and editable options when Mobile view is on.

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)

artfJanuary 30, 20180 reactions

Probably because you're passing a collection (wrapperChildren) to updateAll which expects a model

updateAll(editor.DomComponents.getWrapper());
lock[bot]September 18, 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.