The answer is kinda buried in the source code. There are FCKeditor calls that will do what you want within the editor; unfortunately, I don't remember them and like most functions useful for programming extensions to the editor, they're not documented in the developer docs - the source is the documentation.
Hi Serenity I was facing the same problem last week.. I need to provide a way to catch selected text in the editor but there were no documentation at all!.. With the help of a javascript partner i succeded... Here is a workaround: <script type="text/javascript"> <![CDATA[function getContent (fck) { var editor = FCKeditorAPI.GetInstance(fck.id + "!ed"); var oDOM = editor.EditorDocument ; var iText ; if (document.all) { iText = editor.EditorDocument.selection.createRange().text; } else { iText = editor.EditorWindow.getSelection(); } alert(iText ); } ]]> </script>
Re: How to create FCKEditor Text selection from javascript
Re: How to create FCKEditor Text selection from javascript
I was facing the same problem last week.. I need to provide a way to catch selected text in the editor but there were no documentation at all!..
With the help of a javascript partner i succeded... Here is a workaround:
<script type="text/javascript">
<![CDATA[function getContent (fck) {
var editor = FCKeditorAPI.GetInstance(fck.id + "!ed");
var oDOM = editor.EditorDocument ;
var iText ;
if (document.all)
{
iText = editor.EditorDocument.selection.createRange().text;
}
else
{
iText = editor.EditorWindow.getSelection();
}
alert(iText );
} ]]>
</script>
Hope this helps!
-nat