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

Add import and export buttons to the world info modal #90

Merged
merged 8 commits into from
Sep 10, 2024

Conversation

tjohnman
Copy link
Contributor

@tjohnman tjohnman commented Sep 5, 2024

Added buttons for exporting and importing the world info entries using the SillyTavern format to the world info modal.

For any parameters that are present in SillyTavern and not on MikuPad, it uses default values in the exported file, and ignores them when importing.

Exporting is done via a direct file download, while importing is done via a file chooser. When importing, if there are already entries in the session, the user is asked whether they want to replace them or import the new ones alongside the existing ones.

Partially addresses what is discussed in #41

@tjohnman tjohnman changed the title Feature/import export st worldinfo Add import and export buttons to the world info modal Sep 5, 2024
@tjohnman tjohnman marked this pull request as draft September 5, 2024 10:46
@tjohnman
Copy link
Contributor Author

tjohnman commented Sep 5, 2024

I changed this to a draft because I think having a textarea unnecessary. I will implement importing via a file chooser instead.

@tjohnman tjohnman marked this pull request as ready for review September 5, 2024 13:44
@tjohnman
Copy link
Contributor Author

tjohnman commented Sep 5, 2024

Since I could not see a mechanism to pass data from one modal to the other, I saved the JSON being imported in a global state object. Perhaps there could be a way to pass parameters to a modal via toggleModal to avoid this.

@lmg-anon
Copy link
Owner

Since I could not see a mechanism to pass data from one modal to the other, I saved the JSON being imported in a global state object. Perhaps there could be a way to pass parameters to a modal via toggleModal to avoid this.

That's understandable, I'm also still not sure how to tackle this kind of problem, but I'm leaning towards thinking that a way to share state between modals would be the best approach.

Anyway, LGTM, Thank you for your contribution!

@lmg-anon lmg-anon merged commit 757d0e1 into lmg-anon:main Sep 10, 2024
@tjohnman tjohnman deleted the feature/import-export-st-worldinfo branch September 10, 2024 14:27
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.

2 participants