cleaned up view

This commit is contained in:
Ell 2023-08-17 17:25:24 +02:00
parent 0679f3add8
commit 7067957899
2 changed files with 28 additions and 25 deletions

View file

@ -205,9 +205,8 @@ export default class JustSharePleasePlugin extends Plugin {
text = text.replace(/^---\s*\n.*?\n---\s*\n(.*)$/s, "$1"); text = text.replace(/^---\s*\n.*?\n---\s*\n(.*)$/s, "$1");
// include note name // include note name
if (this.settings.includeNoteName) { if (this.settings.includeNoteName)
text = `# ${file.basename}\n\n${text}`; text = `# ${file.basename}\n\n${text}`;
}
// embed attachments directly // embed attachments directly
let attachments = /!\[(.*)]\((.+)\)|!\[\[(.+)]]/g; let attachments = /!\[(.*)]\((.+)\)|!\[\[(.+)]]/g;

View file

@ -16,6 +16,7 @@ export class JSPView extends ItemView {
public refresh(): void { public refresh(): void {
this.contentEl.empty(); this.contentEl.empty();
let content = this.contentEl.createDiv({cls: "just-share-please-view"}); let content = this.contentEl.createDiv({cls: "just-share-please-view"});
if (this.plugin.settings.shared.length > 0) {
for (let shared of this.plugin.settings.shared) { for (let shared of this.plugin.settings.shared) {
let file = this.plugin.app.vault.getAbstractFileByPath(shared.path) as TFile; let file = this.plugin.app.vault.getAbstractFileByPath(shared.path) as TFile;
let div = content.createDiv({cls: "just-share-please-shared-item"}); let div = content.createDiv({cls: "just-share-please-shared-item"});
@ -45,6 +46,9 @@ export class JSPView extends ItemView {
.setIcon("trash") .setIcon("trash")
.onClick(async () => this.plugin.deleteFile(shared)); .onClick(async () => this.plugin.deleteFile(shared));
} }
} else {
content.createSpan({text: "You have not shared any items yet."});
}
} }
public onload(): void { public onload(): void {