mirror of
https://github.com/Ellpeck/ObsidianJustSharePlease.git
synced 2024-11-26 12:18:35 +01:00
cleaned up view
This commit is contained in:
parent
0679f3add8
commit
7067957899
2 changed files with 28 additions and 25 deletions
|
@ -205,9 +205,8 @@ export default class JustSharePleasePlugin extends Plugin {
|
|||
text = text.replace(/^---\s*\n.*?\n---\s*\n(.*)$/s, "$1");
|
||||
|
||||
// include note name
|
||||
if (this.settings.includeNoteName) {
|
||||
if (this.settings.includeNoteName)
|
||||
text = `# ${file.basename}\n\n${text}`;
|
||||
}
|
||||
|
||||
// embed attachments directly
|
||||
let attachments = /!\[(.*)]\((.+)\)|!\[\[(.+)]]/g;
|
||||
|
|
|
@ -16,6 +16,7 @@ export class JSPView extends ItemView {
|
|||
public refresh(): void {
|
||||
this.contentEl.empty();
|
||||
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) {
|
||||
let file = this.plugin.app.vault.getAbstractFileByPath(shared.path) as TFile;
|
||||
let div = content.createDiv({cls: "just-share-please-shared-item"});
|
||||
|
@ -45,6 +46,9 @@ export class JSPView extends ItemView {
|
|||
.setIcon("trash")
|
||||
.onClick(async () => this.plugin.deleteFile(shared));
|
||||
}
|
||||
} else {
|
||||
content.createSpan({text: "You have not shared any items yet."});
|
||||
}
|
||||
}
|
||||
|
||||
public onload(): void {
|
||||
|
|
Loading…
Reference in a new issue