mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
much better ux
This commit is contained in:
parent
0253b54803
commit
a536b311e4
2 changed files with 21 additions and 4 deletions
|
@ -3059,6 +3059,7 @@ function Ace2Inner() {
|
||||||
const linesLength = rep.lines.length();
|
const linesLength = rep.lines.length();
|
||||||
|
|
||||||
if (isPageUp) {
|
if (isPageUp) {
|
||||||
|
top.console.log('page up');
|
||||||
// go to the top of the visible content
|
// go to the top of the visible content
|
||||||
rep.selStart[0] -= visibleLineRange[1] - visibleLineRange[0];
|
rep.selStart[0] -= visibleLineRange[1] - visibleLineRange[0];
|
||||||
rep.selEnd[0] -= visibleLineRange[1] - visibleLineRange[0];
|
rep.selEnd[0] -= visibleLineRange[1] - visibleLineRange[0];
|
||||||
|
@ -3070,11 +3071,19 @@ function Ace2Inner() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPageDown) {
|
if (isPageDown) {
|
||||||
|
top.console.log('pag edown');
|
||||||
// go to the bottom of the last visible content
|
// go to the bottom of the last visible content
|
||||||
rep.selStart[0] += visibleLineRange[1] - 1;
|
if(rep.selStart[0] === 0){
|
||||||
rep.selEnd[0] += visibleLineRange[1] - 1;
|
rep.selStart[0] += visibleLineRange[1] - visibleLineRange[0] - 1;
|
||||||
|
rep.selEnd[0] += visibleLineRange[1] - visibleLineRange[0] - 1;
|
||||||
|
}else{
|
||||||
|
// handle if we're on first line as it will do weird things.
|
||||||
|
rep.selStart[0] += visibleLineRange[1] - visibleLineRange[0];
|
||||||
|
rep.selEnd[0] += visibleLineRange[1] - visibleLineRange[0];
|
||||||
|
}
|
||||||
// if the new rep is beyond the viewport, put the caret on the last line
|
// if the new rep is beyond the viewport, put the caret on the last line
|
||||||
if (rep.selStart[0] > linesLength) {
|
if (rep.selStart[0] > linesLength) {
|
||||||
|
top.console.log('beyond scope');
|
||||||
rep.selStart = [linesLength - 1, 0];
|
rep.selStart = [linesLength - 1, 0];
|
||||||
rep.selEnd = [linesLength - 1, 0];
|
rep.selEnd = [linesLength - 1, 0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,11 +291,18 @@ Scroll.prototype.scrollNodeVerticallyIntoView = function (rep, innerHeight, isPa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPageDown) {
|
if (isPageDown) {
|
||||||
|
console.log(linePosition);
|
||||||
|
console.log(viewport);
|
||||||
// redraw entire page into view putting rep.selStart[0] at top left
|
// redraw entire page into view putting rep.selStart[0] at top left
|
||||||
this._scrollYPage(linePosition.top);
|
// this._scrollYPage(linePosition.top);
|
||||||
|
// redraw entire page into view putting rep.selStart[0] at top left
|
||||||
|
// const distanceOfTopOfViewport = linePosition.top - viewport.top;
|
||||||
|
// const pixelsToScroll =
|
||||||
|
// distanceOfTopOfViewport - this._getPixelsRelativeToPercentageOfViewport(innerHeight, true);
|
||||||
|
this._scrollYPage(viewport.bottom - viewport.top);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (linePosition) {
|
if (linePosition) {
|
||||||
const distanceOfTopOfViewport = linePosition.top - viewport.top;
|
const distanceOfTopOfViewport = linePosition.top - viewport.top;
|
||||||
const distanceOfBottomOfViewport = viewport.bottom - linePosition.bottom;
|
const distanceOfBottomOfViewport = viewport.bottom - linePosition.bottom;
|
||||||
|
@ -314,6 +321,7 @@ Scroll.prototype.scrollNodeVerticallyIntoView = function (rep, innerHeight, isPa
|
||||||
this.scrollWhenCaretIsInTheLastLineOfViewportWhenNecessary(rep, true, innerHeight);
|
this.scrollWhenCaretIsInTheLastLineOfViewportWhenNecessary(rep, true, innerHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
Scroll.prototype._partOfRepLineIsOutOfViewport = function (viewportPosition, rep) {
|
Scroll.prototype._partOfRepLineIsOutOfViewport = function (viewportPosition, rep) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue