This settings for widgets not work on /category and /recent page
Set the topic IDs you want to display this widget on (separated by commas) Set the category IDs you want to display this widget on (separated by commas)Cat Typing GIF
I need to add a button in my formatting bar and I use in my file.js this:
require(['composer', 'composer/controls'], function(composer, controls) {
composer.addButton('fa fa-calendar', function(textarea, selectionStart, selectionEnd) {
if (selectionStart === selectionEnd) {
}
});
});
The problem is that when I add one time the "fa fa-calendar" it is work but when I recreate the formatting bar the code adds me another button with "fa fa-calendar" so I have two button with "fa fa-calendar". Anyone can help me?
That code should only ever run once. You just need to move this code out of whatever code you're running when the formatting bar is created.
@yariplus I have another question. This code is execute one time when the first page is loaded and attach the button to "edit form". My problem is that I want see the button only if the topic respect some specifics. So I would remove the button because the button it can't forever be seen . can you suggest something? Maybe with some method of composer?
During action:composer.loaded
, hide the button with css using the passed in post_uuid.
$('#cmp-uuid-' + post_uuid + ' .your-buttons-class').hide()
You should be checking the condition in the button callback, so even if the user manually unhides the button, it won't do anything.