diff --git a/client/shared/i18n/langs/en-US/translation.json b/client/shared/i18n/langs/en-US/translation.json index a7e7e5fb5e0..a0829389c0d 100644 --- a/client/shared/i18n/langs/en-US/translation.json +++ b/client/shared/i18n/langs/en-US/translation.json @@ -317,6 +317,7 @@ "kbe20d511": "The user information was not found, there may be some exceptions", "kbef193d": "Invitation link copied to clipboard", "kbef5b92e": "Copy Link", + "kbf38b110": "Close message context menu", "kc14b2ea3": "Back", "kc161f3a6": "1 hour", "kc1a5303e": "Panel-based group space, highly customizable", diff --git a/client/shared/i18n/langs/zh-CN/translation.json b/client/shared/i18n/langs/zh-CN/translation.json index 9526a825cee..76d234151e2 100644 --- a/client/shared/i18n/langs/zh-CN/translation.json +++ b/client/shared/i18n/langs/zh-CN/translation.json @@ -317,6 +317,7 @@ "kbe20d511": "没有找到该用户信息, 可能出现了一些异常", "kbef193d": "邀请链接已复制到剪切板", "kbef5b92e": "复制链接", + "kbf38b110": "关闭消息右键菜单", "kc14b2ea3": "返回", "kc161f3a6": "1小时", "kc1a5303e": "基于面板的群组空间, 可高度自定义化", diff --git a/client/shared/model/user.ts b/client/shared/model/user.ts index 0d54d1df39d..47fcd54f8bc 100644 --- a/client/shared/model/user.ts +++ b/client/shared/model/user.ts @@ -37,6 +37,11 @@ export interface UserSettings { */ groupOrderList?: string[]; + /** + * 是否关闭消息右键菜单 + */ + disableMessageContextMenu?: boolean; + /** * 其他的设置项 */ diff --git a/client/web/src/components/ChatBox/ChatMessageList/Item.tsx b/client/web/src/components/ChatBox/ChatMessageList/Item.tsx index af91c1b0763..545a0ca2050 100644 --- a/client/web/src/components/ChatBox/ChatMessageList/Item.tsx +++ b/client/web/src/components/ChatBox/ChatMessageList/Item.tsx @@ -10,6 +10,7 @@ import { showMessageTime, useUserInfoList, UserBaseInfo, + useUserSettings, } from 'tailchat-shared'; import { useRenderPluginMessageInterpreter } from './useRenderPluginMessageInterpreter'; import { getMessageRender, pluginMessageExtraParsers } from '@/plugin/common'; @@ -66,6 +67,7 @@ export const NormalMessage: React.FC = React.memo( const { showAvatar, payload, hideAction = false } = props; const userInfo = useCachedUserInfo(payload.author ?? ''); const [isActionBtnActive, setIsActionBtnActive] = useState(false); + const { settings } = useUserSettings(); const reactions = useMessageReactions(payload); @@ -124,6 +126,7 @@ export const NormalMessage: React.FC = React.memo( menu={moreActions} placement="bottomLeft" trigger={['contextMenu']} + disabled={settings['disableMessageContextMenu']} onOpenChange={setIsActionBtnActive} >
{ } /> + + setSettings({ + disableMessageContextMenu: checked, + }) + } + /> + } + /> + {pluginSettings .filter((item) => item.position === 'system') .map((item) => {