edited notes doesn't wrap long note titles

This commit is contained in:
zadam 2021-02-01 20:55:35 +01:00
parent 9447d3f9b5
commit d406df48a8
2 changed files with 36 additions and 4 deletions

View file

@ -3,6 +3,23 @@ import linkService from "../../services/link.js";
import server from "../../services/server.js";
import treeCache from "../../services/tree_cache.js";
const TPL = `
<div class="edited-notes-widget">
<style>
.edited-notes-widget ul {
padding-left: 10px !important;
}
.edited-notes-widget ul li {
white-space: nowrap;
list-style-position:inside;
overflow-x: hidden;
text-overflow: ellipsis;
}
</style>
</div>
`;
export default class EditedNotesWidget extends CollapsibleWidget {
get widgetTitle() { return "Edited notes on this day"; }
@ -17,6 +34,11 @@ export default class EditedNotesWidget extends CollapsibleWidget {
&& this.note.hasOwnedLabel("dateNote");
}
async doRenderBody() {
this.$body.html(TPL);
this.$editedNotes = this.$body.find('.edited-notes-widget');
}
async refreshWithNote(note) {
// remember which title was when we found the similar notes
this.title = note.title;
@ -36,10 +58,15 @@ export default class EditedNotesWidget extends CollapsibleWidget {
const $list = $('<ul>');
for (const editedNote of editedNotes) {
const $item = $("<li>");
const $item = $('<li>');
if (editedNote.isDeleted) {
$item.append($("<i>").text(editedNote.title + " (deleted)"));
const title = editedNote.title + " (deleted)";
$item.append(
$("<i>")
.text(title)
.attr("title", title)
);
}
else {
$item.append(editedNote.notePath ? await linkService.createNoteLink(editedNote.notePath.join("/"), {showNotePath: true}) : editedNote.title);
@ -48,6 +75,6 @@ export default class EditedNotesWidget extends CollapsibleWidget {
$list.append($item);
}
this.$body.empty().append($list);
this.$editedNotes.empty().append($list);
}
}
}

View file

@ -7,6 +7,11 @@ import utils from "../services/utils.js";
const TPL = `
<div class="quick-search input-group input-group-sm" style="width: 250px;">
<style>
.quick-search {
margin-left: 10px;
margin-right: 10px;
}
.quick-search .dropdown-menu {
max-height: 600px;
max-width: 400px;