-
Notifications
You must be signed in to change notification settings - Fork 116
Deadlines plugin #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deadlines plugin #361
Conversation
WuTheFWasThat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on this!
BTW, related plugin, in case you haven't seen: #300
never ended up merging it though
src/plugins/deadlines/index.tsx
Outdated
| } | ||
| } | ||
|
|
||
| private async getNodeWithText(root: Path, text: String): Promise<Path | null> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for efficiency, you could consider using the Marks feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think its worth it to change it since this function is used in other places for error checking. Nodes probably don't have many children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's only ever used to search for "deadlines" right?
some other benefits:
- you can have the deadlines node wherever you want, instead of at the document root
- uniqueness is guaranteed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're right. I'm having trouble figuring out how to check if the mark exists. I see theres a public method listMarks but I don't know how to call it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, yeah, sorry! I think I need to add something to PluginAPI so that you can access other plugins. let me try briefly, the daily notes plugin has a similar issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added a way to do this, see bb6c81e
let me know if you have questions, it's totally new so not very tested
src/plugins/deadlines/index.tsx
Outdated
| // check if row is in top level of deadlines | ||
| this.log('inDeadlines', row); | ||
| const root = await this.getDeadlinesRoot(); | ||
| const children = await this.getChildren(root); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be slightly better to check getParents of row instead
src/plugins/deadlines/index.tsx
Outdated
| private async setMark(path: Path, mark: string) { | ||
| this.log('setMark', path, mark); | ||
| let info = await this.api.session.document.getInfo(path.row); | ||
| if (info.pluginData && info.pluginData.marks && info.pluginData.marks.mark !== mark) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when would this happen?
|
took a quick look and this looks better now! is it ready for merge? |
|
yup thanks for the help! |
Plugin to keep track of deadlines
Creates a "Deadlines" node at the root.

All nodes with deadlines will be automatically cloned in the Deadlines node in sorted order
Add a deadline to a node by adding a child of the form "due YYYY-MM-DD" or "due MM-DD"