Skip to content

Commit

Permalink
feat: revert input element
Browse files Browse the repository at this point in the history
  • Loading branch information
mitosagi committed Oct 16, 2023
1 parent 73c8498 commit a2089a3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/renderer/main/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ async function checkLatestVersion(instPath: string) {

/**
* Shows a dialog to select installation path and set it.
* @param {HTMLInputElement} installationPath - A HTMLElement of input.
* @param {HTMLInputElement} input - A HTMLElement of input.
*/
async function selectInstallationPath(installationPath: HTMLSpanElement) {
const originalPath = installationPath.innerText;
async function selectInstallationPath(input: HTMLInputElement) {
const originalPath = input.value;
const selectedPath = await openDirDialog(
'インストール先フォルダを選択',
originalPath,
Expand All @@ -267,7 +267,7 @@ async function selectInstallationPath(installationPath: HTMLSpanElement) {

const instPath = selectedPath[0];
await changeInstallationPath(instPath);
installationPath.innerText = instPath;
input.value = instPath;
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/renderer/main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@
id="addon-wrapping"
>
<i class="bi bi-folder2 me-3"></i>
<span id="installation-path"></span>
<input
class="form-control-plaintext"
id="installation-path"
type="text"
placeholder="AviUtlフォルダ"
aria-label="Installation path"
readonly
/>
</div>
<button
type="button"
Expand Down
18 changes: 9 additions & 9 deletions src/renderer/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ window.addEventListener('DOMContentLoaded', async () => {
}
const installationPath = document.getElementById(
'installation-path',
) as HTMLSpanElement;
installationPath.innerText = instPath;
) as HTMLInputElement;
installationPath.value = instPath;
const dataURL = document.getElementById('data-url') as HTMLInputElement;
dataURL.value = modList.getDataUrl();
const extraDataURL = document.getElementById(
Expand Down Expand Up @@ -89,12 +89,12 @@ window.addEventListener('DOMContentLoaded', async () => {
window.addEventListener('load', () => {
const installationPath = document.getElementById(
'installation-path',
) as HTMLSpanElement;
) as HTMLInputElement;

// core
const checkCoreVersionBtn = document.getElementById('check-core-version');
checkCoreVersionBtn.addEventListener('click', async () => {
await core.checkLatestVersion(installationPath.innerText);
await core.checkLatestVersion(installationPath.value);
});

const selectInstallationPathBtn = document.getElementById(
Expand All @@ -106,23 +106,23 @@ window.addEventListener('load', () => {

const batchInstallBtn = document.getElementById('batch-install');
batchInstallBtn.addEventListener('click', async () => {
await core.batchInstall(installationPath.innerText);
await core.batchInstall(installationPath.value);
});

// packages
const checkPackagesListBtn = document.getElementById('check-packages-list');
checkPackagesListBtn.addEventListener('click', async () => {
await packageMain.checkPackagesList(installationPath.innerText);
await packageMain.checkPackagesList(installationPath.value);
});

const installPackageBtn = document.getElementById('install-package');
installPackageBtn.addEventListener('click', async () => {
await packageMain.installPackage(installationPath.innerText);
await packageMain.installPackage(installationPath.value);
});

const uninstallPackageBtn = document.getElementById('uninstall-package');
uninstallPackageBtn.addEventListener('click', async () => {
await packageMain.uninstallPackage(installationPath.innerText);
await packageMain.uninstallPackage(installationPath.value);
});

const openPackageFolderBtn = document.getElementById('open-package-folder');
Expand Down Expand Up @@ -150,7 +150,7 @@ window.addEventListener('load', () => {

const sharePackagesBtn = document.getElementById('share-packages');
sharePackagesBtn.addEventListener('click', async () => {
await packageMain.sharePackages(installationPath.innerText);
await packageMain.sharePackages(installationPath.value);
});

// nicommons ID
Expand Down

0 comments on commit a2089a3

Please sign in to comment.