mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-04-07 18:56:00 +02:00
pageup/pagedown by page 'size'
This commit is contained in:
parent
b0b6f18cfb
commit
c4d45ef344
21
src/main.tsx
21
src/main.tsx
@ -44,6 +44,19 @@ function scrollDiv(div : any, amt : number) {
|
|||||||
div.scrollTo({top: newScrollTop, behavior: "smooth"});
|
div.scrollTo({top: newScrollTop, behavior: "smooth"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pageSize(div : any) : number {
|
||||||
|
if (div == null) {
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
|
let size = div.clientHeight;
|
||||||
|
if (size > 500) {
|
||||||
|
size = size - 100;
|
||||||
|
} else if (size > 200) {
|
||||||
|
size = size - 30;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
function interObsCallback(entries) {
|
function interObsCallback(entries) {
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
entries.forEach((entry) => {
|
entries.forEach((entry) => {
|
||||||
@ -473,8 +486,9 @@ class TextAreaInput extends React.Component<{}, {}> {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let infoScroll = GlobalModel.hasScrollingInfoMsg();
|
let infoScroll = GlobalModel.hasScrollingInfoMsg();
|
||||||
if (infoScroll) {
|
if (infoScroll) {
|
||||||
let div = document.querySelector(".cmd-iinput-info");
|
let div = document.querySelector(".cmd-input-info");
|
||||||
scrollDiv(div, (e.code == "PageUp" ? -500 : 500));
|
let amt = pageSize(div);
|
||||||
|
scrollDiv(div, (e.code == "PageUp" ? -amt : amt));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let win = GlobalModel.getActiveWindow();
|
let win = GlobalModel.getActiveWindow();
|
||||||
@ -483,7 +497,8 @@ class TextAreaInput extends React.Component<{}, {}> {
|
|||||||
}
|
}
|
||||||
let id = windowLinesDOMId(win.windowId);
|
let id = windowLinesDOMId(win.windowId);
|
||||||
let div = document.getElementById(id);
|
let div = document.getElementById(id);
|
||||||
scrollDiv(div, (e.code == "PageUp" ? -500 : 500));
|
let amt = pageSize(div);
|
||||||
|
scrollDiv(div, (e.code == "PageUp" ? -amt : amt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log(e.code, e.keyCode, e.key, event.which, ctrlMod, e);
|
// console.log(e.code, e.keyCode, e.key, event.which, ctrlMod, e);
|
||||||
|
Loading…
Reference in New Issue
Block a user