Issue #1839Opened February 27, 2019by sakshigarg95 reactions

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)

hpruvotJune 3, 20193 reactions

@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, 20192 reactions

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

NicoEnglerFebruary 28, 20190 reactions

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

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.