generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Tagging(closes #9) + customizable date format(closes #20) + template variables for filename, created date, description(closes #19) + making button row sticky in modal(closes #21) + visual identifier for articles where a note has been created(closes #11) ~ fixes bad check for read articles(closes #18)
- Loading branch information
Showing
21 changed files
with
995 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,5 @@ export default { | |
dedupe: ["svelte"], | ||
}), | ||
commonjs(), | ||
|
||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import {RssFeedItem} from "../parser/rssParser"; | ||
import {createNewNote, openInBrowser, pasteToNote} from "../functions"; | ||
import RssReaderPlugin from "../main"; | ||
import {htmlToMarkdown} from "obsidian"; | ||
import {copy} from "obsidian-community-lib"; | ||
import {TagModal} from "../modals/TagModal"; | ||
|
||
export default class Action { | ||
|
||
static CREATE_NOTE = new Action("create new note", "create-new", (plugin, item) : Promise<void> => { | ||
return createNewNote(plugin, item); | ||
}); | ||
|
||
static PASTE = new Action("paste to current note", "paste", (plugin, item) : Promise<void> => { | ||
return pasteToNote(plugin, item); | ||
}); | ||
static COPY = new Action("copy to clipboard", "feather-clipboard", ((plugin, item) : Promise<void> => { | ||
return copy(htmlToMarkdown(item.content)); | ||
})); | ||
static OPEN = new Action("open in browser", "open-elsewhere-glyph", ((plugin, item) : Promise<void> => { | ||
openInBrowser(item); | ||
return Promise.resolve(); | ||
})); | ||
static TAGS = new Action("edit tags", "tag-glyph", (((plugin, item) => { | ||
const modal = new TagModal(plugin, item.tags); | ||
|
||
modal.onClose = async () => { | ||
item.tags = modal.tags; | ||
const items = plugin.settings.items; | ||
await plugin.writeFeedContent(() => { | ||
return items; | ||
}); | ||
}; | ||
|
||
modal.open(); | ||
return Promise.resolve(); | ||
}))); | ||
|
||
static actions = Array.of(Action.TAGS, Action.CREATE_NOTE, Action.PASTE, Action.COPY, Action.OPEN); | ||
|
||
readonly name: string; | ||
readonly icon: string; | ||
readonly processor: (plugin: RssReaderPlugin, value: RssFeedItem) => Promise<void>; | ||
|
||
constructor(name: string, icon: string, processor: (plugin: RssReaderPlugin, item: RssFeedItem) => Promise<void>) { | ||
this.name = name; | ||
this.icon = icon; | ||
this.processor = processor; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.