fix: fix text cannot select part problem and url dont need context menu problem

pull/220/head
moonrailgun 11 months ago
parent a3a442a34f
commit a02ad80bf1

@ -214,7 +214,6 @@
"k872b58dd": "Send OTP code to email",
"k87a609ad": "Please do not install plugins from unknown sources, it may steal your personal information in Tailchat",
"k87dd7754": "Mention (@) your message will appear here",
"k887e1f4b": "Copy plain text succeeded",
"k8990744f": "Maximum number of uses",
"k89df1d1e": "The network is abnormal",
"k8abdba5c": "Has been sent",
@ -387,6 +386,7 @@
"ke03e2010": "No panel access",
"ke040edce": "No rendering method of this type found",
"ke071c620": "Allow members to manage users, such as banning, removing users, etc.",
"ke08ea159": "Copy selected text successfully",
"ke17b2c87": "Do not upload pictures that violate local laws and regulations",
"ke187440d": "Panel type cannot be empty",
"ke2431c67": "Plugin render function does not exist",
@ -394,6 +394,7 @@
"ke3d797fd": "Drop files to send into current converse",
"ke59ffe49": "Muted, there are {{remain}} left",
"ke6da074f": "The message was withdrawn successfully",
"keb053701": "Copy message text successfully",
"kec46a57f": "Add members",
"kecb51e2c": "Old password",
"kecbb0e45": "System",

@ -214,7 +214,6 @@
"k872b58dd": "向邮箱发送校验码",
"k87a609ad": "请不要安装不明来源的插件,这可能会盗取你在 Tailchat 的个人信息",
"k87dd7754": "提及(@)您的消息会在这里出现哦",
"k887e1f4b": "复制纯文本成功",
"k8990744f": "最大使用次数",
"k89df1d1e": "网络出现异常",
"k8abdba5c": "已发送",
@ -387,6 +386,7 @@
"ke03e2010": "没有面板访问权限",
"ke040edce": "没有找到该类型的渲染方式",
"ke071c620": "允许成员管理用户,如禁言、移除用户等操作",
"ke08ea159": "复制选中文本成功",
"ke17b2c87": "请勿上传违反当地法律法规的图片",
"ke187440d": "面板类型不能为空",
"ke2431c67": "插件渲染函数不存在",
@ -394,6 +394,7 @@
"ke3d797fd": "拖放文件以发送到当前会话",
"ke59ffe49": "禁言中, 还剩 {{remain}}",
"ke6da074f": "消息撤回成功",
"keb053701": "复制消息文本成功",
"kec46a57f": "添加成员",
"kecb51e2c": "旧密码",
"kecbb0e45": "系统",

@ -16,7 +16,7 @@ export const UrlTag: React.FC<TagProps> = React.memo((props) => {
if (url.startsWith('/')) {
// 内部地址,使用 react-router 进行导航
return (
<Link to={url}>
<Link to={url} onContextMenu={(e) => e.stopPropagation()}>
<UnderlineSpan>{text}</UnderlineSpan>
</Link>
);
@ -25,14 +25,23 @@ export const UrlTag: React.FC<TagProps> = React.memo((props) => {
if (url.startsWith(window.location.origin)) {
// 内部地址,使用 react-router 进行导航
return (
<Link to={url.replace(window.location.origin, '')}>
<Link
to={url.replace(window.location.origin, '')}
onContextMenu={(e) => e.stopPropagation()}
>
<UnderlineSpan>{text}</UnderlineSpan>
</Link>
);
}
return (
<a href={url} title={text} target="_blank" rel="noopener noreferrer">
<a
href={url}
title={text}
target="_blank"
rel="noopener noreferrer"
onContextMenu={(e) => e.stopPropagation()}
>
<UnderlineSpan>{text}</UnderlineSpan>
</a>
);

@ -36,8 +36,16 @@ export function useChatMessageItemAction(
);
const handleCopy = useCallback(() => {
const selection = window.getSelection();
if (selection && selection.toString().length > 0) {
// 复制选中的文本
copy(selection.toString());
showSuccessToasts(t('复制选中文本成功'));
return;
}
copy(getMessageTextDecorators().serialize(payload.content));
showSuccessToasts(t('复制纯文本成功'));
showSuccessToasts(t('复制消息文本成功'));
}, [payload.content]);
const [, handleRecallMessage] = useAsyncRequest(async () => {

Loading…
Cancel
Save