I am using tiny MCE version 5.8.2, sometimes the writers don't add the alternative description when they upload an image. So I would like to make the field required, so that to add the picture the alt must be filled.
I tried the a11y_advanced_options, but it's not what I want, this check are done after the image is added, I want that the form is not submitable until the field is not filled.
I'm thinking about writing a plugin to do it, but I don't know if it's the right solution.
How would you do it ?
A solution that might be effective, and make use of TinyMCE's existing APIs so you don't need to write anything custom, could be:
The save button in the image dialog has a class of 'tox-button' and responds to the click event, so there may be a way to run the toggleaudit() method when these events happen. However, writing a short script to test this is reaching my knowledge limits.
It's a good question though, and quite possibly something that should be added as a design feature.
You don't describe how a user upload an image
If you use a filemanager get the filename and post with window.parent.postMessage
The in the file_picker_callback function add
// Provide image and alt text for the image dialog
if (meta.filetype == 'image') {
callback(details.content, {alt: details.info.substr(0, details.info.lastIndexOf('.'))});
}