Issue #974Opened March 21, 2018by ghost5 reactions

[Question] Removing the deviceManager and ViewCode buttons

Question

I'm playing with the default init to try and remove the deviceManager and ViewCode buttons...

` var editor = grapesjs.init({ showOffsets: 1, noticeOnUnload: 0, container: '#gjs', height: '100%', fromElement: true,

Code SnippetTEXT
assetManager: { upload: false },
            storageManager: { autoload: 0 },
            styleManager: {
                sectors: [{
                    name: 'General',
                    open: false,
                    buildProps: ['float', 'display', 'position', 'top', 'right', 'left', 'bottom']
                }, {
                    name: 'Dimension',
                    open: false,
                    buildProps: ['width', 'height', 'max-width', 'min-height', 'margin', 'padding'],
                }, {
                    name: 'Typography',
                    open: false,
                    buildProps: ['font-family', 'font-size', 'font-weight', 'letter-spacing', 'color', 'line-height', 'text-shadow'],
                }, {
                    name: 'Decorations',
                    open: false,
                    buildProps: ['border-radius-c', 'background-color', 'border-radius', 'border', 'box-shadow', 'background'],
                }, {
                    name: 'Extra',
                    open: false,
                    buildProps: ['transition', 'perspective', 'transform'],
                }
                ],
            },
        });`

All I can do is remove all the toolbars by inserting a panel:{[]} option. Everything I out in to try and get back the other buttons doesn't work.

Suggestions?

Answers (3)

ryandebaMarch 22, 20184 reactions

Hi @PCPLTodd,

Here's an example of how you can remove the device switcher and view code button: https://jsfiddle.net/fjkk8w6k/2/

hlo2109May 11, 20251 reactions
Code SnippetTEXT
Hi, I know it's late, but this is how I did it right now:
editor.Panels.removeButton('devices-c', 'set-device-desktop');
editor.Panels.removeButton('devices-c', 'set-device-tablet');
editor.Panels.removeButton('devices-c', 'set-device-mobile');
editor.DeviceManager.getAll().reset();
ghostMarch 22, 20180 reactions

Thanks Ryan, that worked great! :D

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.