Issue #1839✓ SolvedOpened February 27, 2019by sakshigarg95 reactions

Unable to remove trash icon from Panel

快速解答by hpruvot3

@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)

👍 Most helpfulhpruvotJune 3, 2019

@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')

NicoEnglerMarch 1, 2019

Of course that worked but you should not do it that way. You are losing maintainability.

NicoEnglerFebruary 28, 2019

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.

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.