-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redactor's API doesn't work for image button #275
Comments
image
button
Can you try moving your code from the |
I'm using the following code currently.
Here, I tried move the code that I'm currently adding to Please let me know if you think there is an easy way around this. |
Strange. Craft is adding the button via the API provided, so I'm not sure why you'd have trouble finding that button. )https://github.com/craftcms/redactor/blob/v2/src/assets/field/src/js/PluginBase.js#L18-L66) |
Were you able to reproduce this issue at your end? Does the I feel like I've tried everything I could think of (even trying to change the content of the tooltip by modifying the Control Panel CSS) but the seemingly simple task of modifying the Image button tooltip is not getting done for me. Any ideas on what could work? Thanks and sorry for the trouble. |
I'm able to reproduce this. This happens because Craft does its button magic after Redactor has been initialized. One way to solve this would be to sprinkle some events throughout the Redactor field code and you could listen to those events. So, when the Craft Redactor JS code fires an event that it's done initializing, you could fix that button. Would that work for you? |
Yes, absolutely. I'm assuming that I can just refer to those events like the Also, because I am working on a client project on this, can you give me a rough ETA? Thanks. :) |
Does sometime next week work for you? |
Yes, it will. |
Just added an event to address this. You can make a plugin to listen to it, or you can just dump the following code wherever: Garnish.on(Craft.RedactorInput, 'afterInitializeRedactor', function(event) {
event.inputField.redactor.toolbar.getButton('image').setTooltip('Use dedicated image block');
}); |
Just cut the 2.8.2 release so you can pull this in! |
Description
Using Redactor's API to modify attributes of the
image
button doesn't work. The image button is not listed using thethis.toolbar.getButtons()
method.For context, here's the question I had posted earlied on the Craft CMS Discord.
Additional info
Craft version: 3.4.30
PHP version: 7.2.23
Database driver & version: MySQL 5.7.28
Redactor Plugin version: 2.6.1
Redactor Split version (additional plugin used): 1.1.0
The text was updated successfully, but these errors were encountered: