Skip to content

Commit d6ddb87

Browse files
deadlyjackAjit Kumar
andauthored
fix: update addSource function to accept parameters and improve button onclick handler (#2011)
Co-authored-by: Ajit Kumar <dellevenjack@gmail>
1 parent 767907e commit d6ddb87

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/sidebarApps/extensions/index.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ const $header = (
4848
<button type="button" className="icon-button" onclick={filterPlugins}>
4949
<span className="icon tune" />
5050
</button>
51-
<button type="button" className="icon-button" onclick={addSource}>
51+
<button
52+
type="button"
53+
className="icon-button"
54+
onclick={() => addSource()}
55+
>
5256
<span className="icon add" />
5357
</button>
5458
</div>
@@ -362,17 +366,19 @@ async function filterPlugins() {
362366
}
363367
}
364368

365-
async function addSource() {
366-
const sourceOption = [
367-
["remote", strings.remote],
368-
["local", strings.local],
369-
];
370-
const sourceType = await select("Select Source", sourceOption);
369+
async function addSource(sourceType, value = "https://") {
370+
if (!sourceType) {
371+
const sourceOption = [
372+
["remote", strings.remote],
373+
["local", strings.local],
374+
];
375+
sourceType = await select("Select Source", sourceOption);
376+
}
371377

372378
if (!sourceType) return;
373379
let source;
374380
if (sourceType === "remote") {
375-
source = await prompt("Enter plugin source", "https://", "url");
381+
source = await prompt("Enter plugin source", value, "url");
376382
} else {
377383
source = (await FileBrowser("file", "Select plugin source")).url;
378384
}

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
"declaration": false,
1616
"allowJs": true,
1717
"checkJs": false,
18-
"baseUrl": "./src",
1918
"paths": {
20-
"*": ["*"]
19+
"*": ["./src/*"]
2120
},
2221
"jsx": "preserve",
2322
"types": ["node"]

0 commit comments

Comments
 (0)