mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 09:56:15 -04:00
bugfix: only try to go to a line if the line actually exists
This commit is contained in:
parent
c361df52d2
commit
73a8d593bb
1 changed files with 9 additions and 7 deletions
|
@ -173,6 +173,7 @@ const loadBroadcastJS = (socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
||||||
const goToLineNumber = (lineNumber) => {
|
const goToLineNumber = (lineNumber) => {
|
||||||
// Sets the Y scrolling of the browser to go to this line
|
// Sets the Y scrolling of the browser to go to this line
|
||||||
const line = $('#innerdocbody').find(`div:nth-child(${lineNumber + 1})`);
|
const line = $('#innerdocbody').find(`div:nth-child(${lineNumber + 1})`);
|
||||||
|
if (line) {
|
||||||
const newY = $(line)[0].offsetTop;
|
const newY = $(line)[0].offsetTop;
|
||||||
const ecb = document.getElementById('editorcontainerbox');
|
const ecb = document.getElementById('editorcontainerbox');
|
||||||
// Chrome 55 - 59 bugfix
|
// Chrome 55 - 59 bugfix
|
||||||
|
@ -181,6 +182,7 @@ const loadBroadcastJS = (socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
||||||
} else {
|
} else {
|
||||||
$('#editorcontainerbox').scrollTop(newY);
|
$('#editorcontainerbox').scrollTop(newY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
goToLineNumber(lineChanged);
|
goToLineNumber(lineChanged);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue