[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,
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)
Hi @PCPLTodd,
Here's an example of how you can remove the device switcher and view code button: https://jsfiddle.net/fjkk8w6k/2/
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();Thanks Ryan, that worked great! :D
Related Questions and Answers
Continue research with similar issue discussions.
Issue #507
uploadFile being called twice on drop file?
I have an editor initialized as so: If I add an image to the canvas and try to upload a new image by dragging it into the drop area in the...
Issue #998
[BUG] Asset Manager sends empty request when uploading image
Description: GrapesJS editor is initialized in an editor.html file as follows: localhost:9001 is a local IIS server running PHP5. The conte...
Issue #2245
save html with inline css server side
hello all , I am using version 0.15.3 and want to save html data with inline css to server side this is my code where I am storing html to...
Issue #2778
BUGS - Cannot read property 'querySelector' of null at r.getBody
Hi I was trying to use grapesjs on visualsource pages. Following is the init function - initEditor: function(){ var self = this; this.edito...
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.