Issue #2312πŸ’¬ AnsweredOpened October 6, 2019by DamodarSojka1 reactions

More control over panel buttons, dynamic panel buttons

Quick answerby DamodarSojka❀ 1

Thank you for a very quick response, didn't know about the label property as it doesn't seem to be mentioned in the docs.

Read full answer below ↓

Question

Hi, I am trying to implement several more dynamic buttons for the panel, for example a save button that depending on some flag will show an animated loading spinner, save icon or "Saved" text. In order to achieve that I need to be able to dynamically set the content, potentially size and also use not only icons but also text. I am wondering if there is a better way than either removing the button and adding it back (I guess the order of the buttons would change and I would actually need to be adding and removing a whole set of them to keep the ordering same) or using DOM manipulation to chang...

Answers (2)

DamodarSojkaβ€’ October 6, 2019

Thank you for a very quick response, didn't know about the label property as it doesn't seem to be mentioned in the docs.

artfβ€’ October 6, 2019

Well you can change the attribute and the content in this way

const prevBtn = editor.Panels.getButton('options', 'preview');
prevBtn.set({ 
	attributes: {title: 'New title'}, 
	label: 'New content' 
})

for anything else more specific you can go with direct DOM manipulation

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.