迁移后台输入选中事件
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();
|
||||
|
||||
@@ -320,7 +320,7 @@
|
||||
@if (Auth::id() === 1)
|
||||
<form action="{{ route('admin.positions.destroy', $pos->id) }}"
|
||||
method="POST" class="inline"
|
||||
onsubmit="return confirm('确定删除职务【{{ $pos->name }}】?')">
|
||||
data-admin-confirm="确定删除职务【{{ $pos->name }}】?">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit"
|
||||
class="text-xs bg-red-50 text-red-600 font-bold px-2 py-1 rounded hover:bg-red-600 hover:text-white transition">
|
||||
|
||||
@@ -86,14 +86,14 @@
|
||||
<div>
|
||||
<label class="block text-sm font-bold text-amber-900 mb-2">同步返回地址</label>
|
||||
<input type="text" value="{{ $syncReturnUrl }}" readonly
|
||||
onclick="this.select();"
|
||||
data-admin-select-on-click
|
||||
class="w-full border-amber-200 rounded-md shadow-sm p-2.5 bg-white border text-gray-700 font-mono text-sm cursor-pointer">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-bold text-amber-900 mb-2">异步通知地址</label>
|
||||
<input type="text" value="{{ $asyncNotifyUrl }}" readonly
|
||||
onclick="this.select();"
|
||||
data-admin-select-on-click
|
||||
class="w-full border-amber-200 rounded-md shadow-sm p-2.5 bg-white border text-gray-700 font-mono text-sm cursor-pointer">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user