mirror of
https://github.com/Ellpeck/ObsidianJustSharePlease.git
synced 2024-11-23 10:58:36 +01:00
added JSP commands
This commit is contained in:
parent
a5f20a15f2
commit
6c4b1022b0
1 changed files with 53 additions and 1 deletions
52
src/main.ts
52
src/main.ts
|
@ -42,6 +42,58 @@ export default class JustSharePleasePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this.addCommand({
|
||||||
|
id: "share",
|
||||||
|
name: "Share current file to JSP",
|
||||||
|
editorCheckCallback: (checking, _, ctx) => {
|
||||||
|
if (!this.settings.shared.find(i => i.path == ctx.file.path)) {
|
||||||
|
if (!checking)
|
||||||
|
this.shareFile(ctx.file);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.addCommand({
|
||||||
|
id: "copy",
|
||||||
|
name: "Copy current file's JSP link",
|
||||||
|
editorCheckCallback: (checking, _, ctx) => {
|
||||||
|
let shared = this.settings.shared.find(i => i.path == ctx.file.path);
|
||||||
|
if (shared) {
|
||||||
|
if (!checking)
|
||||||
|
this.copyShareLink(shared);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.addCommand({
|
||||||
|
id: "update",
|
||||||
|
name: "Update current file in JSP",
|
||||||
|
editorCheckCallback: (checking, _, ctx) => {
|
||||||
|
let shared = this.settings.shared.find(i => i.path == ctx.file.path);
|
||||||
|
if (shared) {
|
||||||
|
if (!checking)
|
||||||
|
this.updateFile(shared, ctx.file);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.addCommand({
|
||||||
|
id: "delete",
|
||||||
|
name: "Delete current file from JSP",
|
||||||
|
editorCheckCallback: (checking, _, ctx) => {
|
||||||
|
let shared = this.settings.shared.find(i => i.path == ctx.file.path);
|
||||||
|
if (shared) {
|
||||||
|
if (!checking)
|
||||||
|
this.deleteFile(shared);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadSettings(): Promise<void> {
|
async loadSettings(): Promise<void> {
|
||||||
|
|
Loading…
Reference in a new issue