From f1fcd16894e562903caf02b30ac238592dac0bf8 Mon Sep 17 00:00:00 2001 From: Joas Souza Date: Wed, 3 Jan 2018 18:57:28 -0300 Subject: Add settings to scroll on edition out of viewport (#3282) * Add scroll when it edits a line out of viewport By default, when there is an edition of a line, which is out of the viewport, Etherpad scrolls the minimum necessary to make this line visible. This makes that the line stays either on the top or the bottom of the viewport. With this commit, we add a setting to make possible to scroll to a position x% pixels from the viewport. Besides of that, we add a setting to make an animation of this scroll. If nothing is changed on settings.json the Etherpad default behavior is kept --- src/node/handler/PadMessageHandler.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/node/handler/PadMessageHandler.js') diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index b7ec7cb2..060bca7b 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -1216,6 +1216,15 @@ function handleClientReady(client, message) "parts": plugins.parts, }, "indentationOnNewLine": settings.indentationOnNewLine, + "scrollWhenFocusLineIsOutOfViewport": { + "percentage" : { + "editionAboveViewport": settings.scrollWhenFocusLineIsOutOfViewport.percentage.editionAboveViewport, + "editionBelowViewport": settings.scrollWhenFocusLineIsOutOfViewport.percentage.editionBelowViewport, + }, + "duration": settings.scrollWhenFocusLineIsOutOfViewport.duration, + "scrollWhenCaretIsInTheLastLineOfViewport": settings.scrollWhenFocusLineIsOutOfViewport.scrollWhenCaretIsInTheLastLineOfViewport, + "percentageToScrollWhenUserPressesArrowUp": settings.scrollWhenFocusLineIsOutOfViewport.percentageToScrollWhenUserPressesArrowUp, + }, "initialChangesets": [] // FIXME: REMOVE THIS SHIT } -- cgit v1.2.3