Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9546 closed Bug (invalid)

CK Editor - Place cursor at the end of text

Reported by: Sridhar Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0.1
Keywords: Cc: spenuma@…

Description

Hi,

I need to place the cursor at the end of text in the textarea when page loads.

Contact Email Address:sridhar_raju2000@yahoo.com,spenuma@templeton.com

Thanks, Sridhara Raju

Attachments (1)

Issue.png (16.6 KB) - added by Sridhar 12 years ago.
Issue

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by Sridhar

Attachment: Issue.png added

Issue

comment:1 Changed 12 years ago by Sridhar

I have used focus() method. But its placing begining of the text and not at the end of text.

comment:2 Changed 12 years ago by Sridhar

I have used focus() method. But cursor placing begining of the text and not at the end of text. Is there any way to place the cursor at the end of text?

comment:3 Changed 12 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

Please note that the CKEditor development website is not the right place for support requests.

Please refer to the following article for information on where to get support for all issues related to CKEditor: http://docs.cksource.com/CKEditor_3.x/Howto/Support

Also try using our forums for advice: http://cksource.com/forums/

If you are looking for professional assistance, the CKEditor development team is available via a dedicated support channel that is included in all our commercial licenses: http://ckeditor.com/license


  1. First of all please use the latest version of editor. Current is 3.6.5 and 4.0 will soon be released.
  2. You have to focus editor, get document object, put it in range, collapse range (with false parameter), select body (with selectNodeContents), collapse it (with false parameter) and finally select range. It is best to do it all in instanceReady event.

http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.range.html
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#event:instanceReady

comment:4 Changed 12 years ago by Sridhar

I have used below code. But for HTML <LI> Tags its not working consistently. Please send me the sample code.

$(document).ready(function() {

CKEDITOR.on('instanceReady', function(ev) {

ev.editor.focus();

var s = ev.editor.getSelection(); getting selection var selected_ranges = s.getRanges(); getting ranges var node = selected_ranges[0].startContainer; selecting the starting node var parents = node.getParents(true);

node = parents[parents.length - 2].getFirst();

while (true) {

var x = node.getNext(); if (x == null) {

break;

} node = x;

}

s.selectElement(node); selected_ranges = s.getRanges(); selected_ranges[0].collapse(false); false collapses the range to the end of the selected node, true before the node. s.selectRanges(selected_ranges); putting the current selection there

}

});

comment:5 Changed 12 years ago by Jakub Ś

The above code puts cursor at the end of selected node not at the end of document. I have described how it can be done with pseudo code - please try to implement it.

One more thing this is not support site but place for reporting bugs!!!

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy