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

@@ -142,7 +142,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
this.$widget.toggleClass("full-height",
(
!this.noteContext.hasNoteList()
&& ['editableText', 'editableCode', 'canvas', 'webView', 'noteMap'].includes(this.type)
&& ['canvas', 'webView', 'noteMap'].includes(this.type)
&& this.mime !== 'text/x-sqlite;schema=trilium'
)
|| this.noteContext.viewScope.viewMode === 'attachments'
@@ -191,12 +191,27 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
}
async focusOnDetailEvent({ntxId}) {
if (this.noteContext.ntxId === ntxId) {
await this.refresh();
if (this.noteContext.ntxId !== ntxId) {
return;
}
const widget = this.getTypeWidget();
await widget.initialized;
widget.focus();
await this.refresh();
const widget = this.getTypeWidget();
await widget.initialized;
widget.focus();
}
async scrollToEndEvent({ntxId}) {
if (this.noteContext.ntxId !== ntxId) {
return;
}
await this.refresh();
const widget = this.getTypeWidget();
await widget.initialized;
if (widget.scrollToEnd) {
widget.scrollToEnd();
}
}