add #shareRoot label to define an "index" note, closes #2567

This commit is contained in:
zadam
2022-01-17 23:13:56 +01:00
parent 1aff3db81f
commit 52b118df7f
12 changed files with 115 additions and 84 deletions

View File

@@ -32,7 +32,7 @@ export default class SharedInfoWidget extends NoteContextAwareWidget {
const syncServerHost = options.get("syncServerHost");
let link;
const shareId = note.getOwnedLabelValue('shareAlias') || note.noteId;
const shareId = this.getShareId(note);
if (syncServerHost) {
link = syncServerHost + "/share/" + shareId;
@@ -46,6 +46,14 @@ export default class SharedInfoWidget extends NoteContextAwareWidget {
this.$sharedLink.attr("href", link).text(link);
}
getShareId(note) {
if (note.hasOwnedLabel('shareRoot')) {
return '';
}
return note.getOwnedLabelValue('shareAlias') || note.noteId;
}
entitiesReloadedEvent({loadResults}) {
if (loadResults.getAttributes().find(attr => attr.name.startsWith("share") && attributeService.isAffecting(attr, this.note))) {
this.refresh();