Is there a way to make the "Alternate Text" value required for the Image Browser. I have found a way to implement this functionality for the Insert button, but I cannot find a way for it to work for double-clicking the image. Note, I do consider the Insert button "solution" a hack and would prefer to implement a better solution if one exists.
// Editor definition
element.kendoEditor({
execute: handlers_editorExecute,
imageBrowser: {
apply: handlers_editorImageBrowserApply,
}
});
// This does not work for double-clicking the image because the image is inserted regardless of the return value
handlers_editorImageBrowserApply: function (e) {
var imageBrowser = $(".k-imagebrowser").data("kendoImageBrowser");
if (imageBrowser.value() != "") {
if ($(".k-filebrowser-dialog #k-editor-image-title").val() == "") {
alert("Alternate text is required.");
return false;
}
}
},
// This does work for clicking the Insert button and the apply function is not defined, but feels like a hack
handlers_editorExecute: function (e) {
if (e.name == "insertimage") {
setTimeout(function () {
var insertButton = $(".k-filebrowser-dialog .k-dialog-insert");
insertButton.unbind("click");
insertButton.click(function () {
var imageBrowser = $(".k-imagebrowser").data("kendoImageBrowser");
if (imageBrowser.value() != "") {
if ($(".k-filebrowser-dialog #k-editor-image-title").val() == "") {
alert("Alternate text is required.");
return false;
}
}
imageBrowser.trigger("apply");
});
});
}
},