Fixed cursor position on cut

This commit is contained in:
benweet 2018-04-15 16:06:12 +01:00
parent 8997b0940e
commit 642a0a0078

View File

@ -90,7 +90,8 @@ function cledit(contentElt, scrollEltOpt, isMarkdown = false) {
function replace(selectionStart, selectionEnd, replacement) {
undoMgr.setDefaultMode('single');
replaceContent(selectionStart, selectionEnd, replacement);
const endOffset = selectionStart + replacement.length;
const startOffset = Math.min(selectionStart, selectionEnd);
const endOffset = startOffset + replacement.length;
selectionMgr.setSelectionStartEnd(endOffset, endOffset);
selectionMgr.updateCursorCoordinates(true);
}