Skip to content
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

feature: add advanced settings w/ book ID frontmatter population #62

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tyler-dot-earth
Copy link
Contributor

@tyler-dot-earth tyler-dot-earth commented Jun 7, 2024

SUGGESTION

Let's get #67 reviewed/merged first - it's more important - then i'll rebase this PR.

Context

This adds a good chunk of the functionality i suggested in this discord thread - primarily the ability to save the readwise book ID to frontmatter.

This is basically step 1 in improving the reliability of the plugin's sync functionality.

Issues with the current sync:

Other notes:

  • These changes do not use that ID for anything, it's purely for personal data management.
  • In a future PR, I intend to integrate the now-available frontmatter book ID from this PR into the rest of the plugin's functionality so it will be preferred over the frequently buggy/out-of-sync settings.bookIDsMap
  • I also intend to explore adding a Readwise: add book ID to document's frontmatter action for the command palette. I could make it appear only when the key is set in advanced settings.

Changes in this PR

  • adds an Advanced settings modal, accessed via a button in the main settings menu
  • adds 1 new setting: settings.frontmatterBookIdKey
    • this simply stores the frontmatter book ID the user sets in the data.json
    • this setting does NOT have a default value.
  • adds 1 new button in the Advanced settings modal: Populate
    • when used, this action populates the readwise-exported notes' frontmatter with the [settings.frontmatterBookIdKey]: bookId.
    • this action will not overwrite any existing values for the given settings.frontmatterBookIdKey
    • this button is disabled when the settings.frontmatterBookIdKey is not set
    • a notice will show when population is starting and has finished

IMPORTANT NOTE ❗ 👉 an even better solution than having the plugin set this field's value this would be to add a book_id variable to YAML Frontmatter template section on the Obsidian Export settings page. Then the plugin would just read from this field (not write). I'm just working with what i can do in plugin land.

Screenshots

image

image

image

src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
@tyler-dot-earth tyler-dot-earth force-pushed the advanced-features-book-id-frontmatter branch 3 times, most recently from 3389054 to 71eaa00 Compare June 7, 2024 22:57
src/main.ts Outdated Show resolved Hide resolved
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.

1 participant