Skip to content

fix: respect geo-location settings when creating notes from templates#131

Open
sh1vam31 wants to merge 1 commit intojoplin:masterfrom
sh1vam31:fix/geo-location-settings-notes_#118
Open

fix: respect geo-location settings when creating notes from templates#131
sh1vam31 wants to merge 1 commit intojoplin:masterfrom
sh1vam31:fix/geo-location-settings-notes_#118

Conversation

@sh1vam31
Copy link
Contributor

Fixes #118

Notes created using templates did not include geo-location information (latitude, longitude, altitude), even when the "Save geo-location with notes" setting was enabled in Joplin preferences.

Fix

Added a new utility src/utils/geolocation.ts that:

  1. Reads Joplin's note.saveGeolocation global setting
  2. Fetches current GPS coordinates via navigator.geolocation
  3. Returns null gracefully if the setting is disabled or permission is denied

Updated src/actions.ts to attach latitude, longitude, and altitude
to the note payload when geo-location is enabled.

Testing

  • Enabled "Save geo-location with notes" in Joplin Preferences → Note
  • Created a note from template via Tools → Templates → Create note from template
  • Verified via Joplin REST API that the note has real GPS coordinates:

After Fix :
image

Copy link
Collaborator

@nishantwrp nishantwrp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic needs to exactly match what the main joplin app uses to figure out geolocation. this can quickly get out of sync.

I think the alternative should be either of

  • making joplin expose the geolocation via a plugin API
  • some changes to joplin's note creation api to automatically save geolocation if user has that setting enabled.

@sh1vam31
Copy link
Contributor Author

@nishantwrp, Thanks for the feedback! I understand the fix needs to happen in Joplin core. Would it be okay if I open an issue in the main Joplin repo requesting either a geolocation plugin API or auto-save in the note creation API?

@nishantwrp
Copy link
Collaborator

@sh1vam31 before opening the issue, i'd request you to explore joplin-core a bit to come up with some potential approaches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] respect geo-location settings when creating notes using templates

2 participants