This patch fixes a bug:
BUG
To reproduce the bug: Create a list with a list item "AA" and with a nested list item "BB". Select a text without paragraphs such as "Hello" in a web browsers such as Firefox, press Control + C, place the cursor between the two As, and paste the text by pressing Control + V. The text is pasted as it should, but the cursor, after the pasting, is positioned between the two Bs.
The bug does not occur if the list item "AA" has no nested list item.
PATCH
To fix the bug, place the following text at the very end of the method SHTMLEditorPane.pasteHTML:
// We are somewhere else inside the paragraph to insert at.
String newHtml = pastedHTMLText.splitPaste(sDocument, characterElement, paragraphElement,
position, pasteHtmlTextModified, HTMLText.containsParagraphTags(pasteHtmlTextModified));
int paragraphOldEndOffset = paragraphElement.getEndOffset();
int oldCaretPosition = getCaretPosition();
sDocument.setOuterHTML(paragraphElement, newHtml);
Element newParagraphElement = getSHTMLDocument().getParagraphElement(oldCaretPosition);
// Place the caret after the pasted text
setCaretPosition(oldCaretPosition + newParagraphElement.getEndOffset() - paragraphOldEndOffset);
}
Patch
I am attaching the patch as an attachment; the directly pasted patch looks odd.
File Added: Pasting patch.txt
Integrated in version 0.13.1.