Opened 13 years ago

Closed 12 years ago

#3245 closed defect (fixed)

problem with placeCursorAtEnd() in Richtext.js

Reported by: guest Owned by: liucougar
Priority: low Milestone: 0.9
Component: Editor Version: 0.9
Keywords: Cc: dvinod@…
Blocked By: Blocking:

Description

We have been using Dojo Toolkit 0.4.1-minimal version. For one of the requirement we had to use the function placeCursorAtEnd() defined in RichText?.js. We found that in IE 6.0 that the function did not place the cursor at end. It was selecting the text but the cursor was not placed at end and also the cursor was not visible. I got rid of the problem with my getaround. Please have a look at that.

placeCursorAtEnd: function(){

summary: place the cursor at the end of the editing area this.focus();

In mozilla, if last child is not a text node, we have to use selectElementChildren on this.editNode.lastChild otherwise the cursor would be placed at the end of the closing tag of this.editNode.lastChild var isvalid=false; if(dojo.render.html.moz){

var last=this.editNode.lastChild; while(last){

if(last.nodeType == 3){

if(dojo.string.trim(last.nodeValue).length>0){

isvalid=true; dojo.withGlobal(this.window, "selectElement",dojo.html.selection, [last]); break;

}

}else if(last.nodeType == 1){

isvalid=true; if(last.lastChild){

dojo.withGlobal(this.window, "selectElement",dojo.html.selection, [last.lastChild]);

}else{

dojo.withGlobal(this.window, "selectElement",dojo.html.selection, [last]);

} break;

} last = last.previousSibling;

}

}else{

Proposed Solution -- Adding the below line

isvalid = true;

dojo.withGlobal(this.window, "selectElementChildren",dojo.html.selection, [this.editNode]);

} if(isvalid){

dojo.withGlobal(this.window, "collapse", dojo.html.selection, [false]);

}

},

Change History (4)

comment:1 Changed 13 years ago by bill

Component: GeneralEditor
Milestone: 1.0
Owner: changed from anonymous to liucougar

comment:2 Changed 12 years ago by liucougar

can you provide a sample content where the current placeCursorAtEnd() fails?

comment:3 Changed 12 years ago by liucougar

Milestone: 1.00.9

comment:4 Changed 12 years ago by liucougar

Resolution: fixed
Status: newclosed

(In [9894]) fixes #3245: problem with placeCursorAtEnd() in Richtext.js

Note: See TracTickets for help on using tickets.