Fixed saveInfo and restoreInfo might not get correct window size
This commit is contained in:
parent
e0ff287652
commit
3ab04d4f02
1 changed files with 6 additions and 7 deletions
|
@ -1685,8 +1685,8 @@ editor.on('blur', function (cm) {
|
||||||
|
|
||||||
function saveInfo() {
|
function saveInfo() {
|
||||||
var scrollbarStyle = editor.getOption('scrollbarStyle');
|
var scrollbarStyle = editor.getOption('scrollbarStyle');
|
||||||
var left = $(document.body).scrollLeft();
|
var left = $(window).scrollLeft();
|
||||||
var top = $(document.body).scrollTop();
|
var top = $(window).scrollTop();
|
||||||
switch (currentMode) {
|
switch (currentMode) {
|
||||||
case modeType.edit:
|
case modeType.edit:
|
||||||
if (scrollbarStyle == 'native') {
|
if (scrollbarStyle == 'native') {
|
||||||
|
@ -1716,12 +1716,11 @@ function restoreInfo() {
|
||||||
var line = lastInfo.edit.cursor.line;
|
var line = lastInfo.edit.cursor.line;
|
||||||
var ch = lastInfo.edit.cursor.ch;
|
var ch = lastInfo.edit.cursor.ch;
|
||||||
editor.setCursor(line, ch);
|
editor.setCursor(line, ch);
|
||||||
|
|
||||||
switch (currentMode) {
|
switch (currentMode) {
|
||||||
case modeType.edit:
|
case modeType.edit:
|
||||||
if (scrollbarStyle == 'native') {
|
if (scrollbarStyle == 'native') {
|
||||||
$(document.body).scrollLeft(lastInfo.edit.scroll.left);
|
$(window).scrollLeft(lastInfo.edit.scroll.left);
|
||||||
$(document.body).scrollTop(lastInfo.edit.scroll.top);
|
$(window).scrollTop(lastInfo.edit.scroll.top);
|
||||||
} else {
|
} else {
|
||||||
var left = lastInfo.edit.scroll.left;
|
var left = lastInfo.edit.scroll.left;
|
||||||
var top = lastInfo.edit.scroll.top;
|
var top = lastInfo.edit.scroll.top;
|
||||||
|
@ -1730,8 +1729,8 @@ function restoreInfo() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case modeType.view:
|
case modeType.view:
|
||||||
$(document.body).scrollLeft(lastInfo.view.scroll.left);
|
$(window).scrollLeft(lastInfo.view.scroll.left);
|
||||||
$(document.body).scrollTop(lastInfo.view.scroll.top);
|
$(window).scrollTop(lastInfo.view.scroll.top);
|
||||||
break;
|
break;
|
||||||
case modeType.both:
|
case modeType.both:
|
||||||
var left = lastInfo.edit.scroll.left;
|
var left = lastInfo.edit.scroll.left;
|
||||||
|
|
Loading…
Reference in a new issue