Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAdd Text to TextEditor (via JS)Add Text to TextEditor (via JS)
Previous
 
Next
New Post
2/26/2012 11:42 AM
 

I need to add text to the  current cursor position in the texteditor (radeditor)... can someony give me a hint? In the Telerik Documentation is an example using the pasteHtml method, but i don't know how to get the clientid of the radeditor....

Thanks

Andi

 
New Post
2/26/2012 5:01 PM
 
Why don't you provider the content serverside, instead of trying to modify it in the editor from the client side?

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
3/21/2012 7:19 PM
 
So does that mean this isn't possible? I am needing this same exact thing. I have a DopDownList with values and a button underneath that. When the user clocks the button, I need the selected value to be "inserted" at the current cursor position.

Anyone??

Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
3/22/2012 4:28 AM
 
AFAIK you will need to do this client side, like some of the ckeditor extensions do.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
3/22/2012 8:44 AM
 

So, after spending several hours scouring the internet and testing all sorts of JavaScript code, I finally got it to work. I am posting my findings here so that others who need the same knowledge can find it. When using the DNN implementation of the RADEditor, one must realize (which I didn’t at first) that when later referencing the RAD Editor, you are in-fact referencing DNN’s wrapper control, not the actual RAD Editor directly. It wasn’t until I remembered/realized this, that I was able to make progress on getting the JavaScript to work. After looking into DNN’s source code on how they implemented their RADEditor, I saw that they gave it a double ID...meaning that when the control was finally rendered into HTML, the actual RADEditor control, used the parents control name twice. For example, if you named your editor “txtMyEditor”, then after rendering it would be "dnn_ctr###_PageName_txtMyEditor_txtMyEditor" (replace ### with your Module control’s number). Referencing just "dnn_ctr###_PageName_txtMyEditor" will get you a reference to the DNNEditor implementation (AKA The Wrapper Class), but not the actual RADEditor itself.

In my searching, I found that the Telerik RADEditor control actually exposes a method that allows you to insert code at the cursors position, it’s called “pasteHtml()”. So, without further ado, here is the JavaScript code I wrote. You could of course tweak it to suit your individual needs.



function js_InsertText(p_strPageID) {
//***************************************
// Initialize Variables
//***************************************
var cboAdvancedSettings_Tokens = document.getElementById(p_strPageID + '_' + 'cboAdvancedSettings_Tokens');
var strRADEditorControlID = 'txtAdvancedSettings_TemplateText';
var strTextToInsert = cboAdvancedSettings_Tokens.options[cboAdvancedSettings_Tokens.selectedIndex].value;

//***************************************
// Insert Text
//***************************************
var editor = $find(p_strPageID + "_" + strRADEditorControlID + "_" + strRADEditorControlID);
editor.pasteHtml(strTextToInsert);
}

 

I hope this helps others out there!


Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAdd Text to TextEditor (via JS)Add Text to TextEditor (via JS)


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out