From af4079f1c03eddc68fec77b731688b25f633a88d Mon Sep 17 00:00:00 2001 From: ymayarajan3 Date: Wed, 7 Aug 2024 00:49:45 -0400 Subject: [PATCH] text input --- extensions/src/doodlebot/FileArgument.svelte | 40 +++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/extensions/src/doodlebot/FileArgument.svelte b/extensions/src/doodlebot/FileArgument.svelte index e5351a4a8..589002f9c 100644 --- a/extensions/src/doodlebot/FileArgument.svelte +++ b/extensions/src/doodlebot/FileArgument.svelte @@ -39,14 +39,52 @@ if (input.files && input.files[0]) { const file = input.files[0]; const blobUrl = URL.createObjectURL(file); + // Set the file name to the text input and the full value + document.getElementById("textInput").value = file.name; value = file.name + "---name---" + blobUrl; text = file.name; } }); + + // Handle text input change + document.getElementById("textInput")?.addEventListener("input", (event) => { + const input = event.target as HTMLInputElement; + // Update the value with the current text input value and maintain the blob URL + const blobUrl = document.querySelector("#fileInput").files[0] + ? URL.createObjectURL(document.querySelector("#fileInput").files[0]) + : ""; + value = input.value + "---name---" + blobUrl; + text = input.value; + }); }); - +
+ + +