I am creating a button to work as follows:
1. User selects some text
2. Clicks button
3. Javascript edits the selection
4. Push the edited text back to the editor.
I know how to grab the selected text:
oContent = FCK.EditorDocument.selection
However, I don't know what to do with the oContent object.
If I try
FCK.InsertHTML(oContent)
I just get the word 'object' pasted to the editor.
I have tried oContent.value, oContent.innerText, and oContent.innerHTML.
I can't get the text pushed back to the editor.
If this question has already been answered, could someone please direct me to the correct thread (I have already searched hundreds).
Thanks in advance!
1. User selects some text
2. Clicks button
3. Javascript edits the selection
4. Push the edited text back to the editor.
I know how to grab the selected text:
oContent = FCK.EditorDocument.selection
However, I don't know what to do with the oContent object.
If I try
FCK.InsertHTML(oContent)
I just get the word 'object' pasted to the editor.
I have tried oContent.value, oContent.innerText, and oContent.innerHTML.
I can't get the text pushed back to the editor.
If this question has already been answered, could someone please direct me to the correct thread (I have already searched hundreds).
Thanks in advance!
RE: Edit and write back selected text
function updateEditor(newText){
frames[0].frames[0].document.body.innerHTML = newText;
}
If anyone has a nice, object orientated way of doing this, please let me know.
RE: Edit and write back selected text
FCK.InsertHTML(newText) will write new text to the editor. However, I don't know how to get the text out of the current selection so that I can edit it and write it to the editor.
RE: Edit and write back selected text
var oEditor = checkexists.FCK;
oEditor.EditorDocument.selection.createRange().text
I have been trying this code and it puts the selected text back into the editor. I don't know if this helps your issue.