fix edited notes widget note transitions, fixes #1672

This commit is contained in:
zadam 2021-02-21 22:45:32 +01:00
parent 6008dc891f
commit ddf8438b22
3 changed files with 14 additions and 10 deletions

View File

@ -12,6 +12,10 @@ const TPL = `
text-overflow: ellipsis;
}
</style>
<div class="no-edited-notes-found">No edited notes on this day yet ...</div>
<div class="edited-notes-list"></div>
</div>
`;
@ -31,18 +35,20 @@ export default class EditedNotesWidget extends CollapsibleWidget {
async doRenderBody() {
this.$body.html(TPL);
this.$editedNotes = this.$body.find('.edited-notes-widget');
this.$list = this.$body.find('.edited-notes-list');
this.$noneFound = this.$body.find('.no-edited-notes-found');
}
async refreshWithNote(note) {
// remember which title was when we found the similar notes
this.title = note.title;
let editedNotes = await server.get('edited-notes/' + note.getLabelValue("dateNote"));
editedNotes = editedNotes.filter(n => n.noteId !== note.noteId);
this.$list.empty();
this.$noneFound.hide();
if (editedNotes.length === 0) {
this.$body.text("No edited notes on this day yet ...");
this.$noneFound.show();
return;
}
@ -50,8 +56,6 @@ export default class EditedNotesWidget extends CollapsibleWidget {
await treeCache.getNotes(noteIds, true); // preload all at once
const $list = $('<div>'); // not using <ul> because it's difficult to style correctly with text-overflow
for (const editedNote of editedNotes) {
const $item = $('<div class="edited-note-line">');
@ -67,9 +71,7 @@ export default class EditedNotesWidget extends CollapsibleWidget {
$item.append(editedNote.notePath ? await linkService.createNoteLink(editedNote.notePath.join("/"), {showNotePath: true}) : editedNote.title);
}
$list.append($item);
this.$list.append($item);
}
this.$editedNotes.empty().append($list);
}
}

View File

@ -19,6 +19,8 @@ class SearchResult {
computeScore(tokens) {
this.score = 0;
// matches in attributes don't get extra points and thus are implicitly valued less than note path matches
const chunks = this.notePathTitle.toLowerCase().split(" ");
for (const chunk of chunks) {

View File

@ -101,7 +101,7 @@ async function doLogin() {
});
if (sourceIdService.isLocalSourceId(resp.sourceId)) {
throw new Error(`Sync server has source ID ${resp.sourceId} which is also local. Your sync setup is probably trying to connect to itself.`);
throw new Error(`Sync server has source ID ${resp.sourceId} which is also local. This usually happens when the sync client is (mis)configured to sync with itself (URL points back to client) instead of the correct sync server.`);
}
syncContext.sourceId = resp.sourceId;