Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145045 | Jun 4,2019 07:27 AM UTC | Jun 7,2019 06:17 AM UTC | ASP.NET Core - EJ 2 | 3 |
![]() |
Tags: Rich Text Editor |
Index.cshtml
<ejs-richtexteditor id="default" actionComplete="actionComplete"></ejs-richtexteditor>
<script type="text/javascript">
function actionComplete(args) { // Triggered when every action is completed
if (args.requestType == "Image") { // Check image actionComplete
imgelement = args.elements[0];
toBase64(imgelement.src, function (dataUrl) {
imgelement.setAttribute('src', dataUrl) // Set converted base64 image into RTE
})
}
}
function toBase64(url, callback) {
var httpRequest = new XMLHttpRequest();
httpRequest.onload = function () {
var fileReader = new FileReader();
fileReader.onloadend = function () { // Triggered each time the rendering operation complete
callback(fileReader.result);
}
fileReader.readAsDataURL(httpRequest.response); // Read the content of the specified file or Blob
};
httpRequest.open('GET', url);
httpRequest.responseType = 'blob';
httpRequest.send();
}
</script> |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.