mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 15:57:57 +01:00
Fix bug #93 the hacky way, thanks to Conrad Irwin for the patch.
This commit is contained in:
@@ -636,6 +636,10 @@ function Editor() //{{{
|
||||
// readFromClipboard would return 'undefined' if not checked
|
||||
// dunno about .setSelectionRange
|
||||
{
|
||||
// This is a hacky fix - but it works.
|
||||
let curTop = elem.scrollTop;
|
||||
let curLeft = elem.scrollLeft;
|
||||
|
||||
let rangeStart = elem.selectionStart; // caret position
|
||||
let rangeEnd = elem.selectionEnd;
|
||||
let tempStr1 = elem.value.substring(0, rangeStart);
|
||||
@@ -644,6 +648,9 @@ function Editor() //{{{
|
||||
elem.value = tempStr1 + tempStr2 + tempStr3;
|
||||
elem.selectionStart = rangeStart + tempStr2.length;
|
||||
elem.selectionEnd = elem.selectionStart;
|
||||
|
||||
elem.scrollTop = curTop;
|
||||
elem.scrollLeft = curLeft;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user