diff --git a/resources/js/chat-room.js b/resources/js/chat-room.js index ccbc1b6..dc759fe 100644 --- a/resources/js/chat-room.js +++ b/resources/js/chat-room.js @@ -1,5 +1,6 @@ // 聊天室 Vite 入口,集中导出从 Blade 内联脚本迁移出的纯前端工具。 +// 统一转发各子模块导出,方便测试或后续模块继续复用同一组工具。 export { escapeHtml, escapeHtmlWithLineBreaks } from "./chat-room/html.js"; export { bindGlobalDialogControls } from "./chat-room/dialog.js"; export { applyFontSize, bindChatFontSizeControl, CHAT_FONT_SIZE_STORAGE_KEY, restoreChatFontSize } from "./chat-room/font-size.js"; @@ -69,6 +70,7 @@ import { import { createMessageQueue } from "./chat-room/message-queue.js"; if (typeof window !== "undefined") { + // 保留聚合入口,给仍在 Blade 内的存量脚本按需读取已迁移工具。 window.ChatRoomTools = { escapeHtml, escapeHtmlWithLineBreaks, @@ -111,12 +113,15 @@ if (typeof window !== "undefined") { createMessageQueue, }; + // 兼容存量 Blade 调用点,避免一次性重构所有 window.* 入口。 window.closeChatImageLightbox = closeChatImageLightbox; window.openChatImageLightbox = openChatImageLightbox; window.closeFriendPanel = closeFriendPanel; window.friendSearch = friendSearch; window.openFriendPanel = openFriendPanel; window.applyFontSize = applyFontSize; + + // 页面加载后立即注册事件委托,具体业务逻辑仍由各子模块负责。 bindGlobalDialogControls(); bindChatFontSizeControl(); bindChatImageUploadControl();