witten
/
luminotes
Archived
1
0
Fork 0

Making cursor positioning work in WebKit, at least for positioning the cursor at the end of an iframe.

This commit is contained in:
Dan Helfman 2009-01-24 15:13:44 -08:00
parent 73e8ea878c
commit 366382dd20
1 changed files with 9 additions and 2 deletions

View File

@ -364,7 +364,11 @@ Editor.prototype.position_cursor = function ( div_range ) {
// if requested, move the text cursor to a specific location
if ( div_range && this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
// position the cursor by using a bookmarked text range
var selection = this.iframe.contentWindow.getSelection();
if ( WEBKIT )
var selection = window.getSelection();
else
var selection = this.iframe.contentWindow.getSelection();
if ( selection.rangeCount > 0 )
var range = selection.getRangeAt( 0 );
else
@ -423,7 +427,10 @@ Editor.prototype.position_cursor = function ( div_range ) {
// otherwise, just move the text cursor to the end of the text
if ( this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
var selection = this.iframe.contentWindow.getSelection();
if ( WEBKIT )
var selection = window.getSelection();
else
var selection = this.iframe.contentWindow.getSelection();
var last_node = this.document.body.lastChild;
if ( selection.rangeCount > 0 )