BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Thanks,
I used an upload box to do this functionality and it works fine:
$("#UploadImage").ejUploadbox({
saveUrl: "/FileActions/SaveImage",
autoUpload: true,
buttonText: { browse: "Add image" },
multipleFilesSelection: false,
complete: function (args) {
console.log(args.files);
var editor = $("#ReplyContentHtml").data("ejRTE");
editor.executeCommand("inserthtml", "<img src='../InlineAttachments/" + args.files.name + "' alt='[image]' style='width:400px'>");
}
});
But I have problems to add it to custom tools... could you help me?
I know that I can set any javascript function to "Action" property in custom tool but I dont know how to open uploadbox then.
And can I do something to upload file without display this window?
Thanks for help !
@{Html.EJ().RTE("ReplyContentHtml").Width("100%") .Locale("en-US").ContentTemplate(@<p>
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
</p>).ShowFooter(true).ClientSideEvents(e=>e.PreRender("render")).Tools(tool => tool.Clear(clear).CustomTools(custom =>
custom.Name("uploadImage").Tooltip("Insert image without Dialog").Css("e-icon e-image_01").Action("showDialog").Add())).Render();} |
<script>
function showDialog(e) {
$("div#SaveImage_Upload").find('input[type=file]').trigger("click");
}
function render(args) {
var divEle = ej.buildTag("div#SaveImage_Upload", "", "", "");
this._rteToolbar.find("li#uploadImage").parent().append(divEle);
divEle.ejUploadbox({
multipleFilesSelection: false, width: "0px", height: "0px", autoUpload: true, showBrowseButton: false, showFileDetails: false, saveUrl: "SaveImage",
success: function (args) {
console.log(args.files);
var editor = $("#ReplyContentHtml").data("ejRTE");
editor.executeCommand("inserthtml", "<img src='../../FileExplorerContent/" + args.files.name + "' alt='[image]' style='width:400px'>");
}
});
divEle.addClass("e-browse-hide");
}
</script> |
Thank you very much, that is exactly what I wanted to acheive.
I added line to close the uploadbox after file upload complete, not just hide. This is better for my appliaction.
complete: function (args) { var editor = $("#ReplyContentHtml").data("ejRTE"); editor.executeCommand("inserthtml", "<img src='../InlineAttachments/" + args.files.name + "' alt='[image]' style='width:400px'>"); $("div#UploadImage").find('button').trigger("click"); } |
If there is any better way to do it - will be nice if you suggest me.
Anyway - thanks a lot!
complete: function (args) {
var editor = $("#ReplyContentHtml").data("ejRTE");
editor.executeCommand("inserthtml", "<img src='../InlineAttachments/" + args.files.name + "' alt='[image]' style='width:400px'>");
var uploadObj = $("#UploadImage").data("ejUploadBox")
uploadObj.diaObj.close(); // accessing dialog's instance from uploadbox's instance
} |