sveltestrap
sveltestrap copied to clipboard
Hide modal instead of destroy
I have a modal that contains an iframe. When I show/hide the modal, the iframe is destroyed and recreated. It'd be great if the modal could be just hidden so that the iframe persists between toggles.
Hi @StevenClontz ,
Yes that sounds like a good idea. We've published [email protected] that supports this if you could please install (npm install [email protected]) and confirm it works for you. Note we had to bump to v4 since it requires a newer version of svelte to support this.
Please reply here and/or close and we can publish v4 release.
I actually decided to implement this feature in my app without a modal anyway. I'm happy to try the new feature out when I can anyway, but I don't want to block your release and cannot promise to get to it today. Thanks for addressing my request in any case!
No problem, thanks for heads up. Yes would be great if you could try when you get a chance, I'll leave open until then.
In my package.json, changing
"sveltestrap": "^3.13.0"
to
"sveltestrap": "4.0.0-alpha.1"
and an npm install introduces the following error without any other changes to my app:
codespace ➜ ~/workspace/checkit-svelte (straptest ✗) $ npm run dev
> [email protected] dev /home/codespace/workspace/checkit-svelte
> rollup -c -w
rollup v2.26.9
bundles src/main.ts → public/build/bundle.js...
[!] (plugin svelte) ParseError: Expected if, each or await
node_modules/sveltestrap/src/Modal.svelte
220: tabindex="-1"
221: {...$$restProps}>
222: {#key isOpen}
^
223: <div
224: transition:transitionType={transitionOptions}
ParseError: Expected if, each or await
at error (/home/codespace/workspace/checkit-svelte/node_modules/svelte/src/compiler/utils/error.ts:25:16)
at Parser$1.error (/home/codespace/workspace/checkit-svelte/node_modules/svelte/src/compiler/parse/index.ts:100:3)
at mustache (/home/codespace/workspace/checkit-svelte/node_modules/svelte/src/compiler/parse/state/mustache.ts:225:11)
at new Parser$1 (/home/codespace/workspace/checkit-svelte/node_modules/svelte/src/compiler/parse/index.ts:52:12)
at parse (/home/codespace/workspace/checkit-svelte/node_modules/svelte/src/compiler/parse/index.ts:215:17)
at compile (/home/codespace/workspace/checkit-svelte/node_modules/svelte/src/compiler/compile/index.ts:79:14)
at /home/codespace/workspace/checkit-svelte/node_modules/rollup-plugin-svelte/index.js:243:22
at ModuleLoader.addModuleSource (/home/codespace/workspace/checkit-svelte/node_modules/rollup/dist/shared/rollup.js:18159:30)
at ModuleLoader.fetchModule (/home/codespace/workspace/checkit-svelte/node_modules/rollup/dist/shared/rollup.js:18213:9)
at async Promise.all (index 50)
My app is based upon https://github.com/sveltejs/template
Hi, yes v4 has a peer dependency on svelte 3.28.0 or greater, and might need to update your rollup-svelte-plugin.
(#key syntax requires newer svelte, hence the major version change.)