Closed gabrielcursino closed 5 months ago
@lolcabanon, i will test this!
Hey @gabrielcursino !
Thanks for the follow-up.
It seems like it works as-is. See this REPL.
I will try it in my project with the new version and keep you updated! :smiley:
Ok, it looks like it work at first, but then crashes when calling mask.instance.destroy()
.
See updated REPL. Uncomment the code in the "Without mask" section and click "Remount" to trigger a rerender.
I guess solutions are either to return early or to mask?.instance.destroy()
. I prefer the early return since it avoid calling the Mask
function unnecessarily.
@lolcabanon Check the latest release 0.3.0, i've added dynamic masking, this version fixes the mask destroy call as well.
You can see here the example:
https://svelte.dev/repl/5cdffa2a1da8481d894941cef0014d30?version=4.2.12
Wow cool!
Should you clear the mask when parameters = null
? Or trim()
?
Should you clear the mask when
parameters = null
? Ortrim()
?
Or I can probably just :
$: parameters === null && clearMask();
I think the input value could be cleared by you. But i can think better alternatives for future releases.
I've updated the REPL with this example:
https://svelte.dev/repl/5cdffa2a1da8481d894941cef0014d30?version=4.2.12
I think the input value could be cleared by you.
Yeah I also think its safer to let the user handle the clear. It would be a risk of loosing value otherwise.
:)
I think the input value could be cleared by you.
Yeah I also think its safer to let the user handle the clear. It would be a risk of loosing value otherwise.
:)
Yeah, exactly! I agree!
The benefit is that I can put the
use:mask={maskOptions}
inside a component and use it directly from a+page.svelte
. If this line is not there, it will throw an error.TextInput.svelte :
+page.svelte :
Originally posted by @lolcabanon in https://github.com/ionited/mask-svelte/issues/1#issuecomment-2045346721