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

dynamic html insertions at content area

3 Answers 101 Views
Editor
This is a migrated thread and some comments may be shown as answers.
ryan dugenia
Top achievements
Rank 1
ryan dugenia asked on 24 Feb 2010, 05:57 AM
Hi Admin,

We are kinda new with using telerik. We are using a rad editor that overwrites the html type of field in moss. The requirement in our editor is that, on click of a custom toolbar button, it would insert/paste a piece of html code. But before that, there should be some sort of checking on where the current selection is. Meaning, the piece of html code to be inserted should only be pasted at specific types of elements (determined by their classes). I'm a having a hard time trying to navigate the dom and controling the position where i want to paste it. I want it to be pasted not just on the selected element, but maybe in its child nodes or sibling nodes.

Could you provide an example or references on what methods to combine or use in able to achieve this?

Thanks for your help!
ryan

3 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 26 Feb 2010, 01:04 PM
Hi ryan,

You can find information on how to implement custom buttons in the following online help article: Adding Your Own Buttons.

Regarding the pasting functionality you will need to make yourself familiar with text ranges in javascript. Here are some articles where you can find information on the matter.
http://www.wrox.com/WileyCDA/Section/JavaScript-DOM-Ranges-Page-2.id-292302.html
http://www.quirksmode.org/dom/range_intro.html
http://msdn.microsoft.com/en-us/library/ms535872%28VS.85%29.aspx

What I suggest for you is to implement your scenario with an editable IFRAME (the content area of RadEditor is an editable IFRAME) or editable DIV, using the Range object. If you succeed and implement it, send us the code and we will replace the IFRAME with RadEditor and integrate the code to work with the editor control.

Sincerely yours,
Stanimir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
ryan dugenia
Top achievements
Rank 1
answered on 26 Feb 2010, 01:40 PM
hi,

i have read the suggestions from you have given in a different thread in these forums, and as I was implementing it, it seems to be difficult and not that flexible.

As a followup question, is it possible to use jquery functions together with the rad editor? for example, i want to use the jquery functions to manipulate and control the html dom inside the editable IFrame of the Rad editor. Is this possible? Because I want to utilize the jquery traversing methods to add and manipulate the html content inside the rad editor.

Thanks!
Ryan
0
Stanimir
Telerik team
answered on 01 Mar 2010, 09:17 AM
Hi ryan,

In general you can use jquery with the RadEditor. However you should know that you might have a problem if you move the elements location in the DOM.


Best wishes,
Stanimir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
ryan dugenia
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
ryan dugenia
Top achievements
Rank 1
Share this question
or