mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-06-17 03:34:49 -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
|
@ -104,6 +104,7 @@
|
|||
"pad.chat.stick.title": "Stick chat to screen",
|
||||
"pad.chat.writeMessage.placeholder": "Write your message here",
|
||||
|
||||
"timeslider.followContents": "Follow pad content updates",
|
||||
"timeslider.pageTitle": "{{appTitle}} Timeslider",
|
||||
"timeslider.toolbar.returnbutton": "Return to pad",
|
||||
"timeslider.toolbar.authors": "Authors:",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -226,14 +226,20 @@
|
|||
|
||||
<div id="settings" class="popup"><div class="popup-content">
|
||||
<h1 data-l10n-id="pad.settings.padSettings"></h1>
|
||||
<label for="viewfontmenu" data-l10n-id="pad.settings.fontType">Font type:</label>
|
||||
<select id="viewfontmenu">
|
||||
<option value="" data-l10n-id="pad.settings.fontType.normal">Normal</option>
|
||||
<%= fonts = ["Quicksand", "Roboto", "Alegreya", "PlayfairDisplay", "Montserrat", "OpenDyslexic", "RobotoMono"] %>
|
||||
<% for(var i=0; i < fonts.length; i++) { %>
|
||||
<option value="<%=fonts[i]%>"><%=fonts[i]%></option>
|
||||
<% } %>
|
||||
</select>
|
||||
<p>
|
||||
<label for="viewfontmenu" data-l10n-id="pad.settings.fontType">Font type:</label>
|
||||
<select id="viewfontmenu">
|
||||
<option value="" data-l10n-id="pad.settings.fontType.normal">Normal</option>
|
||||
<%= fonts = ["Quicksand", "Roboto", "Alegreya", "PlayfairDisplay", "Montserrat", "OpenDyslexic", "RobotoMono"] %>
|
||||
<% for(var i=0; i < fonts.length; i++) { %>
|
||||
<option value="<%=fonts[i]%>"><%=fonts[i]%></option>
|
||||
<% } %>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" id="options-followContents" checked="checked">
|
||||
<label for="options-followContents" data-l10n-id="timeslider.followContents"></label>
|
||||
</p>
|
||||
</div></div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue