You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Fixed scrolling and note loading issue
This commit is contained in:
@ -179,7 +179,10 @@ class AppGui {
|
|||||||
borderLeftWidth: 1,
|
borderLeftWidth: 1,
|
||||||
};
|
};
|
||||||
this.rootWidget_.connect(noteText, (state) => {
|
this.rootWidget_.connect(noteText, (state) => {
|
||||||
return { noteId: state.selectedNoteId };
|
return {
|
||||||
|
noteId: state.selectedNoteId,
|
||||||
|
notes: state.notes,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const noteMetadata = new NoteMetadataWidget();
|
const noteMetadata = new NoteMetadataWidget();
|
||||||
|
@ -7,6 +7,19 @@ class NoteWidget extends TextWidget {
|
|||||||
super();
|
super();
|
||||||
this.noteId_ = 0;
|
this.noteId_ = 0;
|
||||||
this.note_ = null;
|
this.note_ = null;
|
||||||
|
this.notes_ = [];
|
||||||
|
this.lastLoadedNoteId_ = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get notes() {
|
||||||
|
return this.notes_;
|
||||||
|
}
|
||||||
|
|
||||||
|
set notes(v) {
|
||||||
|
// If the note collection has changed it means the current note might
|
||||||
|
// have changed or has been deleted, so refresh the note.
|
||||||
|
this.notes_ = v;
|
||||||
|
this.reloadNote();
|
||||||
}
|
}
|
||||||
|
|
||||||
get noteId() {
|
get noteId() {
|
||||||
@ -16,14 +29,20 @@ class NoteWidget extends TextWidget {
|
|||||||
set noteId(v) {
|
set noteId(v) {
|
||||||
this.noteId_ = v;
|
this.noteId_ = v;
|
||||||
this.note_ = null;
|
this.note_ = null;
|
||||||
|
this.reloadNote();
|
||||||
|
}
|
||||||
|
|
||||||
|
reloadNote() {
|
||||||
if (this.noteId_) {
|
if (this.noteId_) {
|
||||||
this.doAsync('loadNote', async () => {
|
this.doAsync('loadNote', async () => {
|
||||||
this.note_ = await Note.load(this.noteId_);
|
this.note_ = await Note.load(this.noteId_);
|
||||||
this.text = this.note_ ? this.note_.title + "\n\n" + this.note_.body : '';
|
this.text = this.note_ ? this.note_.title + "\n\n" + this.note_.body : '';
|
||||||
|
if (this.lastLoadedNoteId_ !== this.noteId_) this.scrollTop = 0;
|
||||||
|
this.lastLoadedNoteId_ = this.noteId_;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.text = '';
|
this.text = '';
|
||||||
|
this.scrollTop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user