Skip to content

Commit

Permalink
fix: fix image message context menu cannot save image problem
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Apr 13, 2024
1 parent f27ff46 commit a3a442a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
21 changes: 13 additions & 8 deletions client/web/plugins/com.msgbyte.bbcode/src/tags/ImgTag.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { getPopupContainer } from '@capital/common';
import { Image } from '@capital/component';
import type { TagProps } from '../bbcode/type';

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

return (
<Image
style={{
...imageStyle,
...parseImageAttr(node.attrs as any),
}}
preview={true}
src={url}
/>
<div className="inline-block" onContextMenu={(e) => e.stopPropagation()}>
<Image
style={{
...imageStyle,
...parseImageAttr(node.attrs as any),
}}
preview={{
getContainer: getPopupContainer,
}}
src={url}
/>
</div>
);
});
ImgTag.displayName = 'ImgTag';
1 change: 1 addition & 0 deletions client/web/src/plugin/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export {
export { Loadable } from '@/components/Loadable';
export { useIsMobile } from '@/hooks/useIsMobile';
export { isMobile } from '@/utils/device-helper';
export { getPopupContainer } from '@/utils/dom-helper';
export {
getGlobalState,
useGlobalSocketEvent,
Expand Down

0 comments on commit a3a442a

Please sign in to comment.