fix: add confirm button for server url input

This commit is contained in:
2026-08-17 19:11:37 +08:00
parent 811e2c9716
commit d9a0342271
2 changed files with 24 additions and 3 deletions
+17
View File
@@ -718,6 +718,23 @@ body.webapp-active [data-page="webapplist"] {
outline: none; outline: none;
} }
/* 服务器地址确认按钮 */
/* Server URL save button */
.url-save {
flex: none;
padding: 6px 14px;
border: none;
border-radius: 8px;
background: var(--accent);
color: #fff;
font-size: 13px;
cursor: pointer;
}
.url-save:active {
opacity: 0.7;
}
/* 右侧箭头:弱化色 */ /* 右侧箭头:弱化色 */
/* Trailing arrow: dim color */ /* Trailing arrow: dim color */
.st-item .arrow { .st-item .arrow {
+7 -3
View File
@@ -191,17 +191,21 @@ function setupServerUrl(page) {
const startEdit = (current) => { const startEdit = (current) => {
editing = true; editing = true;
item.innerHTML = '<input class="url-input" id="server-url-input" value="' + (current || '').replace(/"/g, '&quot;') + '">'; item.innerHTML = '<input class="url-input" id="server-url-input" value="' + (current || '').replace(/"/g, '&quot;') + '">' +
'<button class="url-save" id="server-url-save">确认</button>';
const input = item.querySelector('#server-url-input'); const input = item.querySelector('#server-url-input');
const saveBtn = item.querySelector('#server-url-save');
input.focus(); input.focus();
const save = () => { const save = () => {
bridge.call('setServerUrl', input.value.trim()).then(() => { const v = input.value.trim();
if (!v) return;
bridge.call('setServerUrl', v).then(() => {
editing = false; editing = false;
refresh(); refresh();
}).catch(() => {}); }).catch(() => {});
}; };
saveBtn.onclick = save;
input.onkeydown = (e) => { if (e.key === 'Enter') save(); }; input.onkeydown = (e) => { if (e.key === 'Enter') save(); };
input.onblur = () => { save(); };
}; };
const refresh = () => { const refresh = () => {