flekschas / svelte-simple-modal

A simple, small, and content-agnostic modal for Svelte v3 and v4
https://svelte.dev/repl/b95ce66b0ef34064a34afc5c0249f313
MIT License
422 stars 30 forks source link

Is it possible to hide (close) the Modal without losing it's edited content? #98

Open forna opened 1 year ago

forna commented 1 year ago

I have a Modal with some editable fields in it. I would like to know if it's possible to keep the modal content, so basically just hide it when the Close button is clicked. Currently when I close and reopen the Modal the editable fields content is lost. I cannot simply save the Modal's form content because there are some <input type="file"> fields that cannot be instantiated again unless the user uploads the same files again. Thank you.

flekschas commented 1 year ago

There are many ways to achieve this. The easiest is to store the form content with svelte stores.

forna commented 1 year ago

I have tested another svelte modal based on micromodal called "svelte-micromodal", with that it works out of the box. So I opt for that solution, thanks anyway.

https://user-images.githubusercontent.com/1431006/232429597-fe2d12c5-db07-46f6-91f3-6d72ab763dce.mp4