This is a migrated thread and some comments may be shown as answers.

RadEditor - dynamically pops tooltip on clicked word in text

2 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chuck
Top achievements
Rank 1
Chuck asked on 16 Aug 2018, 07:17 PM

Hello,

(Looking for a dynamic solution, not a hard-coded one...)

What is the best way for formatted text (content) keywords that are being previewed in the RadEditor able to pop a Tooltip when clicked?

Ideally, a row in a SQL table would describe all the Tooltip keywords and properties... possibly some Find/Replace process could update the content document by encapsulating the keyword with hyperlink tags and update - saved separately in SQL to be future selected (that is, when I'm given a document never seen before, I run a  process that tags any keywords already defined in my SQL table - which prepares the document for deployment ...) Then at runtime of RadEditor preview the tag'd words run the SQL lookup when clicked and pop this dynamic Tooltip... not sure if a custom tag is possible...Tooltip must be dynamic and not hard coded (as this allows the tag'd document to drive the process effortlessly).

I'm sure this is something that has been done before - so only inquiring such that I am not re-inventing the wheel (not asking for anyone to do the work for me, just seeking some advice).

If there is a code example somewhere that I could be directed to and/or some best practices shared, that would be great.

Chuck

 

 

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 17 Aug 2018, 08:55 AM
Hello Chuck,

You can use the $telerik.addExternalHandler(element, "click", functionName()) method of RadEditor to attach to the click event of its content area, which will allow you to inspect the clicked word and for example open a tooltip or dialog which will call a service or server code to show information about the word:

<script type="text/javascript">
    function OnClientLoad(editor, args)
    {
        var element = document.all ? editor.get_document().body : editor.get_document();
        $telerik.addExternalHandler(element, "click", function (e)
        {
            var selectedElm = editor.getSelectedElement();
            if (selectedElm) {
                alert(selectedElm.outerHTML);
                //call here the dialog or the tooltip
            }
        });
    }
</script>
<telerik:RadEditor RenderMode="Lightweight" runat="server" OnClientLoad="OnClientLoad" ID="RadEditor1">
</telerik:RadEditor>


Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Chuck
Top achievements
Rank 1
answered on 17 Aug 2018, 01:55 PM

Thank you Rumen I appreciate your reply, I will review - handler makes it easy.

Chuck

Tags
General Discussions
Asked by
Chuck
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Chuck
Top achievements
Rank 1
Share this question
or