Issue #2312Opened October 6, 2019by DamodarSojka1 reactions

[QUESTION] - More control over panel buttons, dynamic panel buttons

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 change it's content.

Thank you in advance

Answers (2)

DamodarSojkaOctober 6, 20191 reactions

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.

artfOctober 6, 20190 reactions

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

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.