Skip to content

Commit a3a442a

Browse files
committed
fix: fix image message context menu cannot save image problem
1 parent f27ff46 commit a3a442a

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

client/web/plugins/com.msgbyte.bbcode/src/tags/ImgTag.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { getPopupContainer } from '@capital/common';
23
import { Image } from '@capital/component';
34
import type { TagProps } from '../bbcode/type';
45

@@ -44,14 +45,18 @@ export const ImgTag: React.FC<TagProps> = React.memo((props) => {
4445
const url = node.attrs.url ?? text;
4546

4647
return (
47-
<Image
48-
style={{
49-
...imageStyle,
50-
...parseImageAttr(node.attrs as any),
51-
}}
52-
preview={true}
53-
src={url}
54-
/>
48+
<div className="inline-block" onContextMenu={(e) => e.stopPropagation()}>
49+
<Image
50+
style={{
51+
...imageStyle,
52+
...parseImageAttr(node.attrs as any),
53+
}}
54+
preview={{
55+
getContainer: getPopupContainer,
56+
}}
57+
src={url}
58+
/>
59+
</div>
5560
);
5661
});
5762
ImgTag.displayName = 'ImgTag';

client/web/src/plugin/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export {
2222
export { Loadable } from '@/components/Loadable';
2323
export { useIsMobile } from '@/hooks/useIsMobile';
2424
export { isMobile } from '@/utils/device-helper';
25+
export { getPopupContainer } from '@/utils/dom-helper';
2526
export {
2627
getGlobalState,
2728
useGlobalSocketEvent,

0 commit comments

Comments
 (0)