Skip to content

Commit

Permalink
Fix Clear All button to work with vscode-elements
Browse files Browse the repository at this point in the history
  • Loading branch information
shatakshiiii committed Jan 31, 2025
1 parent c09d204 commit eaa9bbd
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/webview/apps/contentCreator/addPluginPageApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -123,7 +135,7 @@ function openExplorer(event: any) {

if (selectedUri) {
if (source === "folder-explorer") {
collectionPathUrlTextField.value = selectedUri;
collectionPathUrlInputField.value = selectedUri;
initCollectionPathElement.innerHTML = selectedUri;
}
}
Expand All @@ -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;
Expand Down

0 comments on commit eaa9bbd

Please sign in to comment.