Radeditor - double click on image opens editor

0 Answers 76 Views
UI for ASP.NET AJAX in ASP.NET MVC
Arthur
Top achievements
Rank 1
Arthur asked on 09 May 2023, 08:05 AM

I want to use the Radeditor to edit HTML data.  However, I have a special image editor that I want to execute when the user double clicks on certain images in the document.  Is this possible with Radeditor?  Can I execute Javascript in the editor?

Thanks,

Arthur

Rumen
Telerik team
commented on 11 May 2023, 09:15 AM

Hi Arthur,

You can see how to attach to the ondblclick event of the iframe-based content area of RadEditor in this article: Open Link in a New Window on Double Click, e.g.

<script type="text/javascript">
    function OnClientLoad(editor, args) {
        editor.attachEventHandler("ondblclick", function (e) {
            var sel = editor.getSelection().getParentElement(); //get the currently selected element
            var href = null;
            if (sel.tagName.toLowerCase() == "img") {
                alert("do something with the selected image");
                return false;
            }
        }
        );
    }
</script>
<telerik:RadEditor runat="server" ID="RadEditor1"
    OnClientLoad="OnClientLoad">
    <Content>
        Sample Content <img src="https://docs.telerik.com/devtools/aspnet-ajax/assets/Avatar-Ninja-big.svg" /> Sample Content  
    </Content>
</telerik:RadEditor>

No answers yet. Maybe you can help?

Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Arthur
Top achievements
Rank 1
Share this question
or