We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Get image in RTE on TreeGrid click

Thread ID:

Created:

Updated:

Platform:

Replies:

130506 May 16,2017 07:51 AM May 19,2017 04:38 AM Angular 1
loading
Tags: ejRTE
Agne
Asked On May 16, 2017 07:51 AM

Hello,

is there a possibility on button/grid cell click show image in ReachTextEditor? Now I am able just to show that picture as background image, but I want to have it like normal picture, but added from other source (clicking grid), not only using image tool / imageBrowser property.

Now my function looks like this (it shows picture getting from database like base64 like background in rich text editor):
 onTreeGridClick(args) {
      var img = new Image();
     img.src = args.row[0].attributes[2].ownerElement.lastElementChild.firstElementChild.currentSrc;
     $("RichTextEditor").ejRTE({
          iframeAttributes:{ style: "background: url(" + img.src + ") no-repeat;" }
     });
}

Prince Oliver [Syncfusion]
Replied On May 19, 2017 04:38 AM

Hi Agne,   
   
Thank you for contacting Syncfusion support.   
   
To insert an image in RTE control on button click, we can use the setHtml method and set image to RTE using image tag with src attribute set to the location of the image. Kindly refer to the following code snippet.   
 
<script> 
       function btn1click() { 
           var rteObj = $("#rteSample").data("ejRTE"); 
           rteObj.setHtml("<img src='https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png' />"); 
       } 
</script> 
 
Refer to the following link for Playground Sample: http://jsplayground.syncfusion.com/avgcko1g 
 
Regards, 
Prince 


CONFIRMATION

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;