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

Custom Intellisence in Editor

1 Answer 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lakeisha
Top achievements
Rank 1
Lakeisha asked on 06 Jun 2013, 09:59 AM
Hi ,

In one of our application, which uses html editor, we have a functionality where at the particular cursor position if user enters "[[" shown Brackets, it will populate all the Business specific words which are stored in our database and upon selection of particular word from the populated words list, It wll be displayed in the cursor position of the editor.

To populate these words we are calling the web service and binding it to the Div tag and displaying a Pop up as shown in the attachment.

.Now as we have decided to go with RadEditor Control, We need to achieve same functionality as users are very much habituated to this.  Please help us to achieve this. Appreciate your speed help.

Thanks & Regards
Lakiesha

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 10 Jun 2013, 02:24 PM
Hi Lakeisha,

I have already answered your support ticket on the subject, but for convenience I will paste my answer here as well:

The RadEditor does not provide such functionality out of the box, but you can achieve a similar behavior by attaching a handler to the the "keydown" event, where to check what is the currently pressed button.

You can use a similar approach in order to count the pressed brackets and then to show your Intellisense div. Note, that this is a sample code, which will work only if the brackets are written one after another and  (most probably) you will need to customize it additionally:

<telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">
</telerik:RadEditor>
<script type="text/javascript">
    var counter = 0;
    function OnClientLoad(editor, args) {
        editor.get_contentArea().onkeydown = showIntelliSense;
    }
  
    function showIntelliSense(e) {
        //var editor = $find("RadEditor1");
          
        if (e.keyCode == "219") {
            counter++;
            if (counter == 2) {
                //your custom show intellisense logic here
                alert("Show intellisense");
                counter = 0;
            }
        }
        else {
            counter = 0;
        }
    }
</script>

I hope this would be helpful.

Regards,
Veselina Raykova
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
General Discussions
Asked by
Lakeisha
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or