obsidian-releases icon indicating copy to clipboard operation
obsidian-releases copied to clipboard

Adding the Day Planner with Templates Plugin

Open amykhar opened this issue 2 years ago • 1 comments

I am submitting a new Community Plugin

Repo URL

Link to my plugin: https://github.com/amykhar/obsidian-day-planner-with-templates

Release Checklist

  • [x] I have tested the plugin on
    • [ ] Windows
    • [x] macOS
    • [ ] Linux
    • [ ] Android (if applicable)
    • [ ] iOS (if applicable)
  • [x] My GitHub release contains all required files
    • [x] main.js
    • [x] manifest.json
    • [x] styles.css (optional)
  • [x] GitHub release name matches the exact version number specified in my manifest.json (Note: Use the exact version number, don't include a prefix v)
  • [x] The id in my manifest.json matches the id in the community-plugins.json file.
  • [x] My README.md describes the plugin's purpose and provides clear usage instructions.
  • [x] I have read the tips in https://github.com/obsidianmd/obsidian-releases/blob/master/plugin-review.md and have self-reviewed my plugin to avoid these common pitfalls.
  • [x] I have added a license in the LICENSE file.
  • [x] My project respects and is compatible with the original license of any code from other plugins that I'm using. I have given proper attribution to these other projects in my README.md.

amykhar avatar Apr 08 '22 21:04 amykhar

https://github.com/amykhar/obsidian-day-planner-with-templates/blob/07b797d3b5006cb84a9fc60a2fe57dd9a979d826/src/main.ts#L100 I know this is similar in the original day planner but I highly recommend against re-reading the day planner file from disk every 2 seconds and do a full parsing on it. You should instead react to vault.on('modified') event and only re-parse the daily note when the changed file is the daily note.

https://github.com/amykhar/obsidian-day-planner-with-templates/blob/07b797d3b5006cb84a9fc60a2fe57dd9a979d826/src/main.ts#L144 Should just use view.file here.

https://github.com/amykhar/obsidian-day-planner-with-templates/blob/07b797d3b5006cb84a9fc60a2fe57dd9a979d826/src/main.ts#L39 Settings are loaded from disk as a JSON object, and not as a class object. You should not store or use typed objects here because it will become regular js objects on subsequent loads. Same applies here. (You should just type them as interfaces instead of classes)

https://github.com/amykhar/obsidian-day-planner-with-templates/blob/07b797d3b5006cb84a9fc60a2fe57dd9a979d826/src/planner-md.ts#L34 Since you're working with the editor already, I suggest using the editor's file and contents instead of pulling together some information from the file (vault.read/vault.write) and some from the editor (getCursor().line). For example, here you can simply do editor.replaceSelection(contents) instead of reading and writing the file.

https://github.com/amykhar/obsidian-day-planner-with-templates/blob/07b797d3b5006cb84a9fc60a2fe57dd9a979d826/src/planner-md.ts#L110 Missing null check for the return object of getActiveViewOfType, and also should use view.file instead of view.getState().file.

https://github.com/amykhar/obsidian-day-planner-with-templates/blob/07b797d3b5006cb84a9fc60a2fe57dd9a979d826/src/status-bar.ts#L152 innerHTML causes DOM injection vulnerability: https://github.com/obsidianmd/obsidian-releases/blob/master/plugin-review.md#avoid-innerhtml-outerhtml-and-insertadjacenthtml

lishid avatar Apr 18 '22 16:04 lishid

Hi there, to keep things tidy, we're going to temporarily close plugin PRs after a month of inactivity.

Feel free to tell us to re-open it when you're ready to continue. Thanks for your understanding!

ericaxu avatar Nov 09 '22 01:11 ericaxu