Unable to remove trash icon from Panel
@sakshigarg9 I think I found what you wanted I had the same problem... Some buttons IDs are stored in a constant file : So when you look into this file, you'll be able to find the right IDs : And so to get the trash button : editor.Panels.getButton('options', 'canvas-clear')
Read full answer below ↓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 #3316
The editor does not remove the dead script blocks
Version: 0.16.34 Are you able to reproduce the bug from the demo? [ ] Yes [x ] No As I understand the code import dialog skips all the HTML...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.