迁移后台输入选中事件
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// 后台只读输入框选择事件代理,用于复制类配置项的一键选中文本。
|
||||
|
||||
let adminInputSelectionBound = false;
|
||||
|
||||
/**
|
||||
* 绑定后台只读输入框点击选中逻辑。
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
export function bindAdminInputSelection() {
|
||||
if (adminInputSelectionBound || typeof document === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
adminInputSelectionBound = true;
|
||||
|
||||
document.addEventListener("click", (event) => {
|
||||
if (!(event.target instanceof HTMLInputElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 回调地址等只读字段点击后直接选中,便于管理员复制。
|
||||
if (event.target.hasAttribute("data-admin-select-on-click")) {
|
||||
event.target.select();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { bindAdminFishingEventsControls } from './admin/fishing-events.js';
|
||||
import { bindAdminFormConfirmations } from './admin/form-confirmations.js';
|
||||
import { bindAdminGameConfigControls } from './admin/game-configs.js';
|
||||
import { bindAdminHolidayEventsControls } from './admin/holiday-events.js';
|
||||
import { bindAdminInputSelection } from './admin/input-selection.js';
|
||||
import { bindAdminOpsControls } from './admin/ops.js';
|
||||
import { bindAdminRoomControls } from './admin/rooms.js';
|
||||
import { bindAdminSignInRulesControls } from './admin/sign-in-rules.js';
|
||||
@@ -14,6 +15,7 @@ bindAdminFishingEventsControls();
|
||||
bindAdminFormConfirmations();
|
||||
bindAdminGameConfigControls();
|
||||
bindAdminHolidayEventsControls();
|
||||
bindAdminInputSelection();
|
||||
bindAdminOpsControls();
|
||||
bindAdminRoomControls();
|
||||
bindAdminSignInRulesControls();
|
||||
|
||||
Reference in New Issue
Block a user