Hi,
Could someone tell me how can I get the caret position (in Firefox) with
the CKeditor API ?
In my plugin I tried:
but the start variable desperatly remains "undefined".
Is there any methode, trick, to do this simple thing ?
Thanks.
Could someone tell me how can I get the caret position (in Firefox) with
the CKeditor API ?
In my plugin I tried:
var editor = this; var start = editor.element.selectionStart;
but the start variable desperatly remains "undefined".
Is there any methode, trick, to do this simple thing ?
Thanks.

Re: Get the caret position ?
Re: Get the caret position ?
editor.getSelection();
Hope this helps.
/bob
Re: Get the caret position ?
function doGetCaretPosition (ctrl) { var CaretPos = 0; // IE Support if (document.selection) { ctrl.focus (); var Sel = document.selection.createRange (); Sel.moveStart ('character', -ctrl.value.length); CaretPos = Sel.text.length; } // Firefox support else if (ctrl.selectionStart || ctrl.selectionStart == '0') CaretPos = ctrl.selectionStart; return (CaretPos); }Re: Get the caret position ?
Re: Get the caret position ?
var editor = CKEDITOR.instances[id]; //get your CKEDITOR instance here var dummyElement = editor.document.createElement( 'img', { attributes : { src : 'null', width : 0, height : 0 } }); editor.insertElement( dummyElement ); var obj = dummyElement.$; var cursor = { x : 0, y : 0 } cursor.keydown = false; while (obj.offsetParent) { cursor.x += obj.offsetLeft; cursor.y += obj.offsetTop; obj = obj.offsetParent; } cursor.x += obj.offsetLeft; cursor.y += obj.offsetTop; cursor.keydown = true; dummyElement.remove();cursr position
hey
Acctually i want the exact cursor position but all above function not returning me that.
I want to replace the whole content with with some changes so any body please help me.
I tried startOffset bt that is not sufficient.
i need a replacement for selectionStrart in jquery