scroll beyond last line in text/code editor, fixes #2728

This commit is contained in:
zadam
2023-08-15 22:50:13 +02:00
parent 90255ac55b
commit 0e16e48db6
7 changed files with 65 additions and 8 deletions

View File

@@ -0,0 +1,27 @@
import NoteContextAwareWidget from "./note_context_aware_widget.js";
const TPL = `<div class="scroll-padding-widget"></div>`;
export default class ScrollPaddingWidget extends NoteContextAwareWidget {
doRender() {
this.$widget = $(TPL);
this.contentSized();
this.$widget.on("click", () =>
this.triggerCommand('scrollToEnd', {ntxId: this.ntxId}));
}
initialRenderCompleteEvent() {
this.$scrollingContainer = this.$widget.closest(".scrolling-container");
new ResizeObserver(() => this.refreshHeight()).observe(this.$scrollingContainer[0]);
this.refreshHeight();
}
refreshHeight() {
const containerHeight = this.$scrollingContainer.height();
this.$widget.css("height", Math.round(containerHeight / 2));
}
}