fix(ui): Enter in a workflow field no longer publishes (#1943)

This commit is contained in:
sam committed 2026-11-13 13:51:50 +11:00
1 parent a0ee8e3f2e
commit 757c3016ae
1 file changed
+6 -3
+6 -3
View File
@@ -261,6 +261,7 @@ async function save(next: WorkflowDefinitionCollection): Promise<boolean> {
}
async function publish(): Promise<void> {
if (publishBlocked.value || state.value.saving) return;
// The id is the one the YAML declares; renaming is editing it there.
const nextID = parsed.value.ok ? parsed.value.id : "";
if (!nextID) return;
@@ -391,7 +392,9 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
</script>
<template>
<form class="space-y-4 max-md:flex max-md:min-h-0 max-md:flex-1 max-md:flex-col" @submit.prevent="publish">
<!-- Not a form: implicit submission turned Enter in any field, and every
button without a type, into a publish. Publish is its own button. -->
<div class="space-y-4 max-md:flex max-md:min-h-0 max-md:flex-1 max-md:flex-col">
<Tabs v-model="view" class="space-y-1.5 max-md:min-h-0 max-md:flex-1">
<div class="workflow-editor-toolbar flex shrink-0 flex-wrap items-center gap-2 max-sm:grid max-sm:grid-cols-[1fr_auto]">
<div v-if="$slots.title" class="flex min-w-0 shrink items-center gap-2 max-lg:hidden"><slot name="title" /></div>
@@ -439,7 +442,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
</PopoverContent>
</Popover>
<span v-if="view === 'canvas' || view === 'yaml'" class="shrink-0" :title="publishBlocked">
<Button type="submit" size="sm" class="disabled:bg-muted disabled:text-fg-muted disabled:opacity-100" :disabled="state.saving || !!publishBlocked">
<Button type="button" size="sm" class="disabled:bg-muted disabled:text-fg-muted disabled:opacity-100" :disabled="state.saving || !!publishBlocked" @click="publish">
<Spinner v-if="state.saving" data-icon="inline-start" />Publish</Button>
</span>
<MoreMenu>
@@ -606,7 +609,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</form>
</div>
</template>
<style scoped>