|
Rank: Member Groups: Member
Joined: 11/23/2009 Posts: 27
|
Hello, Hopefully and easy one to answer.
I understand I can use the getSelection javascript method to get the selected html (or cursor position?) from the editor contents. I'd then like to change this selection and replace the editor content. Do I use the setHtml method for this?
The idea is, I'll have a droplist of non standard keyboard html characters, e.g. bullet, copyright etc. which on selection from the droplist should drop in at the selected position in the editor contents.
I can invoke the javascript on the droplist selection and get the selected character, and can get the selected html content, but how do I replace the selected content and update the content?
Many thanks s.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,200
|
Hi, You won't be able to get/set cursor position. However you can use getSelection to get the current selected text and calling execCommand with "InsertHTML" command to insert any text into the editor. If there is selection, it will replace the selection, otherwise it inserts the text. Please see here for more details: http://doc.essentialobjects.com/library/1/jsdoc.public.editor.execcommand.aspxThanks
|
|
Rank: Member Groups: Member
Joined: 11/23/2009 Posts: 27
|
Many thanks, I'm now able to insert html within the editor contents.
Now next, I'd like to be able to replace all of the html content. Should setHtml do this? I'm doing the following in javascript;
varOText = document.getElementById("HiddenText").value; var editor = eo_GetObject("TextBoxEditor"); editor.setHtml = varOText;
where "HiddenText" is an asp:textbox with the text to replace the editor contents with and "TextBoxEditor" is the eo:editor to replace.
Am I missing something from the setHtml?
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,200
|
Hi,
setHtml is a function. So you would call it as a function, not to set it as a property.
Thanks
|
|