id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc 13110,Bookmarks sometimes cause cursor to be placed incorrectly,Ehman,,"Our product uses CKEditor 4.4.6 for email creation. We recently had to begin using bookmarks, because (due to an add-on) when saving a draft the body of the email needs to be removed and replaced. Due to the nature of the add-on, the following code is not exactly the same, but serves the same purpose. {{{ function removeUnusableData () { var messageBody = getMessageBody(); //gets the body from the cke_1_contents iframe as html messageBody = $(""
"" + messageBody + ""
""); messageBody.find('div pre:contains(""Something related to the add-on"")').parents('div:first').remove(); messageBody.find('div pre:contains(""Something else related to the add-on"")').parents('div:first').remove(); return messageBody.html().trim(); } //replaces the email body with the passed string function swapBodyInput (str) { $('#cke_1_contents iframe').contents().find('body').html(str); $('#BodyHTML').val(str); } //str is only passed in if the add-on is enabled //the bug may occur whether or not the add-on is enabled function saveDraft (str) { var bookmarks = htmlEditor.getSelection().createBookmarks2(); if (str) { //This is only hit if the add-on is running swapBodyInput(str); } //hits when the add-on is running and CKEditor is enabled else if (!str && isHTML) { //users can choose to edit in plain/text if they so desire swapBodyInput(removeUnusableData()); } $.post(formURL, $('form').serialize(), saveDraftCallback, 'json'); //by the time we reach here, the body has already been removed and replaced htmlEditor.getSelection().selectBookmarks(bookmarks); } }}} Every now and then, the cursor will not be returned to the correct location. It's not every time, so I have yet to nail down precise steps to reproduce the issue. However, it has been reported repeatedly by one person, and a couple of times by another. I have seen it happen once while typing an email. ",Bug,closed,Normal,,Core : Selection,,invalid,,arron.caruth@…