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

New Widget: File navigator

Open rafaelveiga opened this issue 11 months ago • 4 comments

I'm requesting help for a new widget in Obsidian Widgets: The file navigator

This widget is intended for daily note navigation. Here is an example of the widget:

Screenshot from 2024-03-23 15-30-37

This component currently does the following:

  • Grabs the current open file that the widget was instantiated
  • Parses the date using moment.js
  • Subtracts and adds a day to get the filenames for previous and next notes
  • Uses Obsidian URI to open the previous and next files on click

Currently I need to support:

  • Multiple date formats, even in multiple languages (2023-01-09, 2023/01/09, 01/09/2023, January 9th 2023)
  • Check if the file clicked exists, if not create it, if it does, open it

My proposal for the implementation of both items listed above would be:

  • Accept a format paramenter following the Display API of moment.js in the widget settings, which would be used in moment.js formatting and in parsing the next and previous files
  • Dig through Obsidian's internal API to check if a file exists, and create it/open it

This widget is current being developed in the branch for the issue #11

rafaelveiga avatar Mar 23 '24 18:03 rafaelveiga