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:
<script type="text/discourse-plugin" version="0.8">
const currentLocale = I18n.currentLocale();
if (!I18n.translations[currentLocale].js.composer) {
I18n.translations[currentLocale].js.composer = {};
}
I18n.translations[currentLocale].js.composer.ttl_spoiler_text = "Insert hidden content";
I18n.translations[currentLocale].js.ttl_dice_title = "ttl-spoiler";
api.onToolbarCreate(function(toolbar) {
toolbar.addButton({
id: "ttl-spoiler",
icon: "ttl-spoiler-icon",
group: "extras",
preventFocus: true,
trimLeading: true,
perform: (e) => e.applySurround("[spoiler]", "[/spoiler]", "ttl_spoiler_text")
});
});
</script>