Issue #824✓ SolvedOpened January 31, 2018by anand-gopinath5 reactions

Is it possible to remove "views" of editor Panel

快速解答by ryandeba2

@anand-gopinath - this code works for me in a plugin: editor.Panels.removeButton("views", "open-layers"); It doesn't seem to work for me after the editor has fully loaded...I suspect that it needs to get removed before the view is rendered, but I haven't confirmed that.

Read full answer below ↓

Question

I wish to remove/hide the below mentioned "view" from the Panel. Is it possible via API or I need to externally hide using css ?

34

editor.Panels.getPanel("views").attributes.buttons.models[2].attributes.visible = false;

Answers (3)

👍 Most helpfulryandebaJanuary 31, 2018

@anand-gopinath - this code works for me in a plugin: editor.Panels.removeButton("views", "open-layers");

It doesn't seem to work for me after the editor has fully loaded...I suspect that it needs to get removed before the view is rendered, but I haven't confirmed that.

ryandebaJanuary 31, 2018

@anand-gopinath In case it's helpful, here's some code that I'm using to reorder those buttons (this also probably needs to run in a plugin):

var panelManager = editor.Panels;

// get the buttons
var styleManagerButton = panelManager.getButton("views", "open-sm");
var layersButton = panelManager.getButton("views", "open-layers");
var blocksButton = panelManager.getButton("views", "open-blocks");

// remove the buttons
panelManager.removeButton("views", "open-sm");
panelManager.removeButton("views", "open-layers");
panelManager.removeButton("views", "open-blocks");

// add the buttons back in a custom order
panelManager.addButton("views", blocksButton);
panelManager.addButton("views", styleManagerButton);
panelManager.addButton("views", layersButton);
artfFebruary 5, 2018

Thanks Ryan, I'll add a new listener, in the next release, which should fix the issue

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.