fix(ui): rename a step to a valid step id
This commit is contained in:
1 file changed
+6
-1
@@ -99,7 +99,12 @@ async function rename(): Promise<void> {
|
||||
function commitRename(event: Event): void {
|
||||
if (!renaming.value) return;
|
||||
renaming.value = false;
|
||||
const name = (event.target as HTMLInputElement).value.trim();
|
||||
// A step id is a stable identifier that template references name, so a
|
||||
// typed title becomes lowercase words joined by hyphens.
|
||||
const name = (event.target as HTMLInputElement).value
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^[^a-z]+|-+$/g, "");
|
||||
if (name !== (props.data.name ?? "")) props.data.onRename?.(name);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user