fix: make path changeable even if linked to summary

This commit is contained in:
Ruben Fiszel
2023-08-10 00:17:19 +02:00
parent fff559a090
commit 219e0c2ced
2 changed files with 23 additions and 22 deletions
@@ -264,17 +264,6 @@
}
let path: Path | undefined = undefined
$: {
if (initialPath == '' && script.summary?.length > 0) {
path?.setName(
script.summary
.toLowerCase()
.replace(/[^a-z0-9_]/g, '_')
.replace(/-+/g, '_')
.replace(/^-|-$/g, '')
)
}
}
</script>
<svelte:window on:keydown={onKeyDown} />
@@ -289,6 +278,18 @@
autofocus
bind:value={script.summary}
placeholder="Short summary to be displayed when listed"
on:keydown={() => {
if (initialPath == '' && script.summary?.length > 0) {
console.log('FOO')
path?.setName(
script.summary
.toLowerCase()
.replace(/[^a-z0-9_]/g, '_')
.replace(/-+/g, '_')
.replace(/^-|-$/g, '')
)
}
}}
/>
<h2 class="border-b pb-1 mt-10 mb-4">Path</h2>
<Path
@@ -40,17 +40,6 @@
}
let path: Path | undefined = undefined
$: {
if (initialPath == '' && $flowStore.summary?.length > 0) {
path?.setName(
$flowStore.summary
.toLowerCase()
.replace(/[^a-z0-9_]/g, '_')
.replace(/-+/g, '_')
.replace(/^-|-$/g, '')
)
}
}
</script>
<div class="h-full overflow-hidden">
@@ -75,6 +64,17 @@
bind:value={$flowStore.summary}
placeholder="Short summary to be displayed when listed"
id="flow-summary"
on:keydown={() => {
if (initialPath == '' && $flowStore.summary?.length > 0) {
path?.setName(
$flowStore.summary
.toLowerCase()
.replace(/[^a-z0-9_]/g, '_')
.replace(/-+/g, '_')
.replace(/^-|-$/g, '')
)
}
}}
/>
</label>