Unable to remove trash icon from Panel
Question
This is my code in index.html. I'm using the grapesjs-preset-webpage
const panelManager=editor.Panels;
panelManager.removeButton('options','cmdImport');
Answers (3)
@sakshigarg9 I think I found what you wanted I had the same problem... Some buttons IDs are stored in a constant file :
import {
cmdImport,
cmdDeviceDesktop,
cmdDeviceTablet,
cmdDeviceMobile,
cmdClear
} from './../consts';
So when you look into this file, you'll be able to find the right IDs :
export const
cmdImport = 'gjs-open-import-webpage',
cmdDeviceDesktop = 'set-device-desktop',
cmdDeviceTablet = 'set-device-tablet',
cmdDeviceMobile = 'set-device-mobile',
cmdClear = 'canvas-clear';
And so to get the trash button : editor.Panels.getButton('options', 'canvas-clear')
Of course that worked but you should not do it that way. You are losing maintainability.
Either your panel does not have the id options or your button not the id cmdImport. Btw, the trash icon does not really sound like "importing". Maybe you have mixed that up. Other than that, please provide more code.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3444
removeButton() causing error
Hi, I'm trying to remove a button from panel using this code editor.Panels.removeButton('options', 'fullscreen') . It removes the button bu...
Issue #542
Calling render() on PanelManager breaks style manager
In lieu of #540, I'm trying to manually remove a button from the options panel, with this: This works ok, the button goes away, but the pnm...
Issue #1210
[Question] Replace Devices icon ASP.net / Javascript
Bonjour, I want replace icon for selected devices like in preset-webpage but i don't understand why this code doesn't work and nothing appe...
Issue #2958
BUG: editor.Panels.removeButton('options', 'preview') breaks View code
Version: 0.16.18 Are you able to reproduce the bug from the demo? No What is the expected behavior? I want to hide the default preview butt...
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.