gpt4 book ai didi

javascript - window.alert() 后无法编辑输入文本字段

转载 作者:行者123 更新时间:2023-11-28 05:10:41 25 4
gpt4 key购买 nike

我有这个 Electron 应用程序(使用 NodeJS、Bootstrap、AngularJS),其中有一些可以编辑的文本输入字段。我有一个触发 window.alert() 的按钮触发后,文本输入字段不再可编辑。

点击应用的其他元素不会有任何改变。

单击另一个应用程序然后返回该应用程序可以解决问题。使用 Chrome 检查器单击其中一个文本输入字段也可以修复它。

这些是我的输入字段的一些 CSS 属性

element.style {
}
.form-control:focus {
color: #495057;
background-color: #fff;
border-color: #80bdff;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
.form-control {
background-color: inherit;
position: relative;
z-index: 10;
}
*:focus {
outline: 0;
}
.form-control {
display: block;
width: 100%;
height: calc(2.25rem + 2px);
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
*, ::after, ::before {
box-sizing: border-box;
}
input:focus, textarea:focus, select:focus {
outline-offset: -2px;
}
:focus {
outline: -webkit-focus-ring-color auto 5px;
}
input {
padding: 1px 0px;
}
input {
-webkit-appearance: textfield;
background-color: white;
-webkit-rtl-ordering: logical;
cursor: text;
padding: 1px;
border-width: 2px;
border-style: inset;
border-color: initial;
border-image: initial;
}
input, textarea, select, button {
text-rendering: auto;
color: initial;
letter-spacing: normal;
word-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
display: inline-block;
text-align: start;
margin: 0em;
font: 400 13.3333px Arial;
}
input, textarea, select, button, meter, progress {
-webkit-writing-mode: horizontal-tb !important;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent;
}
*, ::after, ::before {
box-sizing: border-box;
}
*, ::after, ::before {
box-sizing: border-box;
}

这是警报的代码。

Electron 弹出 elerem.dialog.showMessageBox(elerem.getCurrentWindow(), options) 没有引起问题,只有 window.alert("Your settings list is up to date ");

req.on("end", function () {
res = Buffer.concat(chunks).toString('utf8');
$scope.checkingForUpdate = false;
$scope.$apply();
if (res == fs.readFileSync(CONFIG_FILE_PATH, 'utf8')) {
window.alert("Your settings list is up to date");
} else {
let options = {
buttons: ["Yes", "No"],
message: "An updated settings list is available would you like to get it ? (You'll loose all unsaved settings)"
}
let response = elerem.dialog.showMessageBox(elerem.getCurrentWindow(), options)
if (response == 0) {
$scope.refresh = true;
config.writeToFile(res, CONFIG_FILE_PATH, function (err) {
if (err) {
window.console.log(err);
} else {
window.alert("Your settings list has been updated with success");
}
});
}
}
if ($scope.refresh) {
config.init();
$scope.$apply();
}
});

我希望 message.alert() 不会改变我的文本输入字段的行为。

最佳答案

根据 this post on StackOverflow alert 不受 Electron 支持,因为它在执行时会卡住线程。虽然你可以调用它,但如果可能的话,你可能想看看如何转移到 Electron 的 dialog 或页面内模态(如 MaterialUI 或 Bootstrap 模态)。

关于javascript - window.alert() 后无法编辑输入文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56805920/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com