fix: 修复迁移遗留的按钮无响应、头像框层级及构建错误
迁移收尾修复:
- heartbeat.js: 移除 export { } 中重复的 startHeartbeat/stopHeartbeat(已通过 export function 导出)
- scripts.blade.php: 移除 JS 注释中的 {{ }} 避免 Blade 编译为 e() 导致 PHP 解析错误
- preferences-status.js: 补全 6 个缺失的 window.* 赋值(toggleBlockMenu/toggleFeatureMenu 等),
实现迁移中丢失的 updateDailyStatus/clearDailyStatus,修复 handleFeatureLocalClear 清屏回调
- toolbar.js: 补全 window.runFeatureShortcut 赋值
头像框样式修复(chat-decorations.css):
- z-index 互换:头像降至 1,框升至 3,使框边缘可遮挡头像外围
- 使用 CSS mask(radial-gradient)挖环形替代旧 ::before 实心圆遮挡方案
- clip-path: circle(50%) 硬裁剪确保圆形,不受 chat.css border-radius: 2px 覆盖
- 特异性提升至 .user-item .avatar-frame-wrapper .user-head
新 Vite 模块(从 Blade 迁移):
- chat-state.js / message-renderer.js / user-list.js / chat-events.js
- composer.js(重写)/ heartbeat.js / admin-commands.js
- vip-presence.js / chat-decorations.css
This commit is contained in:
@@ -2,10 +2,31 @@
|
||||
|
||||
let welcomeMenuEventsBound = false;
|
||||
|
||||
/**
|
||||
* 切换欢迎语下拉浮层的显示/隐藏。
|
||||
*/
|
||||
function toggleWelcomeMenu(event) {
|
||||
event.stopPropagation();
|
||||
const menu = document.getElementById("welcome-menu");
|
||||
const adminMenu = document.getElementById("admin-menu");
|
||||
const blockMenu = document.getElementById("block-menu");
|
||||
const featureMenu = document.getElementById("feature-menu");
|
||||
const dailyStatusEditor = document.getElementById("daily-status-editor-overlay");
|
||||
|
||||
if (!menu) return;
|
||||
|
||||
[adminMenu, blockMenu, featureMenu, dailyStatusEditor].forEach((el) => {
|
||||
if (el) el.style.display = "none";
|
||||
});
|
||||
|
||||
menu.style.display = menu.style.display === "none" ? "block" : "none";
|
||||
}
|
||||
|
||||
// 挂载到 window 供 Blade 脚本及其他模块使用。
|
||||
window.toggleWelcomeMenu = toggleWelcomeMenu;
|
||||
|
||||
/**
|
||||
* 绑定欢迎语菜单按钮、菜单内点击拦截与模板发送事件。
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
export function bindWelcomeMenuControls() {
|
||||
if (welcomeMenuEventsBound || typeof document === "undefined") {
|
||||
@@ -19,32 +40,28 @@ export function bindWelcomeMenuControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 欢迎语菜单外部点击关闭仍由主脚本处理,这里只负责菜单按钮与菜单内部。
|
||||
const toggleButton = event.target.closest("[data-chat-welcome-menu-toggle]");
|
||||
if (toggleButton) {
|
||||
event.preventDefault();
|
||||
window.toggleWelcomeMenu?.(event);
|
||||
|
||||
toggleWelcomeMenu(event);
|
||||
return;
|
||||
}
|
||||
|
||||
const menu = event.target.closest("[data-chat-welcome-menu]");
|
||||
if (!menu) {
|
||||
return;
|
||||
}
|
||||
if (!menu) return;
|
||||
|
||||
// 阻止菜单内部点击冒泡,避免选择模板时被外层关闭逻辑抢先处理。
|
||||
// 阻止菜单内部点击冒泡。
|
||||
event.stopPropagation();
|
||||
|
||||
const item = event.target.closest("[data-chat-welcome-template]");
|
||||
if (!item || !menu.contains(item)) {
|
||||
return;
|
||||
}
|
||||
if (!item || !menu.contains(item)) return;
|
||||
|
||||
const template = item.getAttribute("data-chat-welcome-template") || "";
|
||||
// 模板内容只从 data 属性读取,实际发送仍交给旧的 sendWelcomeTpl。
|
||||
// sendWelcomeTpl 仍由 Blade 维护(依赖 sendMessage),这里通过 window 调用。
|
||||
if (template && typeof window.sendWelcomeTpl === "function") {
|
||||
window.sendWelcomeTpl(template);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { toggleWelcomeMenu };
|
||||
|
||||
Reference in New Issue
Block a user