I've always had problems trying to insert some text
replacing the selection with IE, the text many times
didn't get inserted in exactly the place of the
selection, but just at the place where the next
character started (inside that new node, so the
insertion became nested where it shouldn't)
Just today I seem to have found a fix for that, in
FCK.InsertHtml get a reference to the range before it
is cleared and so the caret doesn't move when you
latter paste the new html in.
Although in my tests the call to oSel.clear() ; isn't
neccesary so the fix could also be to remove those two
lines.
FCK.InsertHtml = function( html )
{
FCK.Focus() ;
FCKUndo.SaveUndoStep() ;
// Gets the actual selection.
var oSel = FCK.EditorDocument.selection ;
//Alfonso-> get the range before clearing it
var oRange=oSel.createRange();
// Deletes the actual selection contents.
if ( oSel.type.toLowerCase() != "none" )
oSel.clear() ;
//Alfonso->reuse the saved range
// Insert the HTML.
oRange.pasteHTML( html ) ;
}
Logged In: YES
user_id=1356422
Sorry, that breaks inserting things when an object is selected.
This code seems to work a little better:
FCK.InsertHtml = function( html )
{
FCK.Focus() ;
FCKUndo.SaveUndoStep() ;
// Gets the actual selection.
var oSel = FCK.EditorDocument.selection ;
// Deletes the actual selection contents.
if ( oSel.type.toLowerCase() == "control" )
oSel.clear() ;
// Insert the HTML.
oSel.createRange().pasteHTML( html ) ;
}
Logged In: YES
user_id=572424
Hi,
This patch, or a similar implementation, has been included in
FCKeditor and has been committed in the SVN. It will be
available in the next release.
For more information about the FCKeditor SVN system, please use
the following URL:
https://sourceforge.net/svn/?group_id=75348
Best regards,
FredCK
http://www.fckeditor.net
"Support Open Source Software... What about a donation today?"
PS.: This is a canned response.