FenLanPHE wants to delete the default buttons in the toolbar class without using display: none; and also make their custom “dice” button toggle the text it adds, similar to the bold button. hawm suggests using CSS to hide the toolbar button and applying the applySurround method for the toggle functionality.
FenLanPHE shares their custom button code and asks for help with the toggle functionality. hawm recommends using the opts argument to achieve this, providing an example from the discourse-spoiler-alert repository.
I have added some custom buttons as shown below, but I want to know how to delete the buttons already added in TOOLBAR CLASS?
Also, my custom button function is a snippet of code for me to quickly add dice, I would like to know how to give this button the ability to make the text already added disappear when clicked again like the bold button?
Thanks for your reply! But I noticed that when I click the BOLD button, the code ** appears and then disappears when I click it again. My custom button does not have the ability to disappear the code when clicked again.
Do you have any solution for this? The code for my custom button is as follows: