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

Functionality support

1 Answer 56 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 28 Dec 2012, 07:34 AM
Hi,

I am trying and looking forward for telerik radeditor control which is a part of AJAX toolkit. While trying i have come across following queries i.e. - 

1. Regex based find and replace API

2. Remove element API to remove existing tags programmatically

3. Multilingual spell check apart from english, german and french

4. Copy & Paste API

5. Select Element API to select an element

Kindly let me know the solution or any other alternative.

Thanks.
Vikas G.


1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 02 Jan 2013, 11:48 AM
Hello,

Straight to the points:
1) Regex based find and replace API - this feature is not offered by RadEditor. Are you aware of any JavaScript and HTML based WYSIWYG editor that offer the requested regexp search functionality?

2) Remove element API to remove existing tags programmatically - here is a basic example:

var ctrl = editor.get_document().getElementsByTagName("div")[0];
removeChildNodes(ctrl);
          
function removeChildNodes(ctrl)
{
          while (ctrl.childNodes[0])
          {
                   ctrl.removeChild(ctrl.childNodes[0]);
          }
}

3) Multilingual spell check apart from English, German and French - You can test the following live demo on the subject: AJAX Spell Checker.

4) Copy & Paste API - the different browsers offer limited abilities for programmatically copy and paste of selected content. This is due to security restrictions of the browsers. Please, note that to protect users' private information, unprivileged scripts cannot invoke the Cut, Copy, and Paste commands in the Mozilla, Safari / Chrome and Opera rich text editor, so the corresponding buttons will not work. You can cut and paste content in Firefox, Safari / Chrome and Opera only using the Ctrl+X and Ctrl+V shortcut or the Paste from Word dialog. You can also paste content from the browsers menu: Edit -> Paste. More information is available in this help article: Cleaning Word Formatting.

The Cut, Copy and Paste commands could be executed by JavaScript code under Internet Explorer only.

The Cut, Copy and Paste commands could be executed by JavaScript code under Internet Explorer only.
You can use the code below to fire these commands in IE:

<telerik:RadEditor ID="RadEditor1" Runat="server">
<Content> test content </Content>
</telerik:RadEditor>
<input type="button"value="Cut"onclick="OnClientCommandExecuting('Cut')"/>
<input type="button"value="Copy"onclick="OnClientCommandExecuting('Copy')"/>
<input type="button"value="Paste"onclick="OnClientCommandExecuting('Paste')"/>

<script type="text/javascript">
function OnClientCommandExecuting(command) {
var editor = $find("<%=RadEditor1.ClientID %>");
switch(command) {
case "Cut":
editor.get_document().execCommand(command);
break;
case "Copy":
editor.get_document().execCommand(command);
break;
case "Paste":
//editor.get_document().execCommand(command); - does not work
//use instead
editor.getToolByName("Paste").get_element().click();
break;
}
}
</script>

5) Select Element API to select an element - See these articles:



Best regards,
Rumen
the Telerik team
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 their blog feed now.
Tags
Editor
Asked by
Vikas
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or