#1845: Maintaining Cursor positioning in text area while switching views.
------------------------+---------------------------------------------------
Reporter: ramosl8029 | Type: Task
Status: new | Priority: Normal
Milestone: | Component: UI : Source View
Version: | Keywords:
------------------------+---------------------------------------------------
I have an implementation that allows for webpage editing using WYSIWYG.
When the view is switched to "Source" the cursor is positioned to the
beginning of the page forcing the user to manually scroll to the area of
interest.
I would like to have the cursor position maintained eliminating the nuance
of manually scrolling. For this I need a pointer to the element that
holds the editor text.
See the following code to obtain the cursor position on IE:
{{{
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JScript">
function saveCaret(elem)
{
if ( elem.isTextEdit )
elem.caretPos = document.selection.createRange();
}
function getCaretPos(elem)
{
if ( elem.isTextEdit && elem.caretPos )
{
var bookmark = "~";
var orig = elem.value;
var caretPos = elem.caretPos;
caretPos.text = bookmark;
var i = elem.value.search( bookmark );
window.status = "Caret is at character " + i;
elem.value = orig;
}
}
</SCRIPT>
</HEAD>
<BODY>
<INPUT NAME="txtInput" ONSELECT="saveCaret(this)"
ONCLICK="saveCaret(this)" ONKEYUP="saveCaret(this)" VALUE="Where are
you?">
<INPUT TYPE="button" VALUE="caret pos" ONCLICK="getCaretPos(txtInput)">
</BODY>
</HTML>
}}}
Can anyone tell me how to get a handle of the element that has the text in
the Editor?
--
Ticket URL: <http://dev.fckeditor.net/ticket/1845>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac