mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 09:56:15 -04:00
Feature: Timeslider follow (#4133)
When new edits come in changes are followed in the time slider.
This commit is contained in:
parent
a785914aa4
commit
bf24063234
4 changed files with 80 additions and 8 deletions
|
@ -255,6 +255,11 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
debugLog(e);
|
||||
}
|
||||
|
||||
var lineNumber = Changeset.opIterator(Changeset.unpack(changeset).ops).next().lines;
|
||||
if($('#options-followContents').is(":checked") || $('#options-followContents').prop("checked")){
|
||||
goToLineNumber(lineNumber);
|
||||
}
|
||||
|
||||
Changeset.mutateTextLines(changeset, padContents);
|
||||
padContents.currentRevision = revision;
|
||||
padContents.currentTime += timeDelta * 1000;
|
||||
|
@ -585,6 +590,14 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
receiveAuthorData(clientVars.collab_client_vars.historicalAuthorData);
|
||||
|
||||
return changesetLoader;
|
||||
|
||||
function goToLineNumber(lineNumber){
|
||||
// Sets the Y scrolling of the browser to go to this line
|
||||
var line = $('#innerdocbody').find("div:nth-child("+(lineNumber+1)+")");
|
||||
var newY = $(line)[0].offsetTop;
|
||||
let ecb = document.getElementById('editorcontainerbox');
|
||||
ecb.scrollTo({top: newY, behavior: 'smooth'});
|
||||
}
|
||||
}
|
||||
|
||||
exports.loadBroadcastJS = loadBroadcastJS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue