From eaa9bbda32ede6fcaa22f37ac8f9927f0253a2da Mon Sep 17 00:00:00 2001 From: shatakshiiii Date: Fri, 31 Jan 2025 12:19:24 +0530 Subject: [PATCH] Fix Clear All button to work with vscode-elements --- .../apps/contentCreator/addPluginPageApp.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/webview/apps/contentCreator/addPluginPageApp.ts b/src/webview/apps/contentCreator/addPluginPageApp.ts index 670840979..5e47380a2 100644 --- a/src/webview/apps/contentCreator/addPluginPageApp.ts +++ b/src/webview/apps/contentCreator/addPluginPageApp.ts @@ -20,6 +20,9 @@ window.addEventListener("load", main); let pluginNameTextField: VscodeTextfield; let pluginTypeDropdown: VscodeSingleSelect; +let pluginNameInputField: HTMLInputElement; +let collectionPathUrlInputField: HTMLInputElement; + let collectionPathUrlTextField: VscodeTextfield; let folderExplorerIcon: VscodeIcon; @@ -71,6 +74,15 @@ function main() { "open-folder-button", ) as VscodeButton; + // Workaround for vscode-elements .value limitations for text fields + pluginNameInputField = pluginNameTextField.shadowRoot?.querySelector( + "#input", + ) as HTMLInputElement; + collectionPathUrlInputField = + collectionPathUrlTextField.shadowRoot?.querySelector( + "#input", + ) as HTMLInputElement; + pluginNameTextField.addEventListener("input", toggleCreateButton); collectionPathUrlTextField.addEventListener("input", toggleCreateButton); @@ -123,7 +135,7 @@ function openExplorer(event: any) { if (selectedUri) { if (source === "folder-explorer") { - collectionPathUrlTextField.value = selectedUri; + collectionPathUrlInputField.value = selectedUri; initCollectionPathElement.innerHTML = selectedUri; } } @@ -133,9 +145,9 @@ function openExplorer(event: any) { } function handleInitClearClick() { - pluginNameTextField.value = ""; + pluginNameInputField.value = ""; pluginTypeDropdown.value = "filter"; - collectionPathUrlTextField.value = ""; + collectionPathUrlInputField.value = ""; initCollectionPathElement.innerHTML = collectionPathUrlTextField.placeholder as string;