mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
scroll beyond last line in text/code editor, fixes #2728
This commit is contained in:
27
src/public/app/widgets/scroll_padding.js
Normal file
27
src/public/app/widgets/scroll_padding.js
Normal 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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user