fix: add confirm button for server url input
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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, '"') + '">';
|
item.innerHTML = '<input class="url-input" id="server-url-input" value="' + (current || '').replace(/"/g, '"') + '">' +
|
||||||
|
'<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 = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user