fix: fix url problem about avatar url in popover

pull/90/head
moonrailgun 2 years ago
parent 3a328beb82
commit dcaa2799aa

@ -1,3 +1,4 @@
import { parseUrlStr } from 'node_modules/tailchat-shared';
import React, { useState } from 'react';
import { Avatar, AvatarProps } from '../Avatar';
import { Image } from '../Image';
@ -27,7 +28,7 @@ export const AvatarWithPreview: React.FC<AvatarProps> = React.memo((props) => {
<Image
preview={{
visible,
src: String(props.src),
src: parseUrlStr(String(props.src)),
onVisibleChange: (value) => {
setVisible(value);
},

@ -1,7 +1,7 @@
import { fetchImagePrimaryColor } from '@/utils/image-helper';
import React, { PropsWithChildren } from 'react';
import { AvatarWithPreview, getTextColorHex } from 'tailchat-design';
import { useAsync, UserBaseInfo } from 'tailchat-shared';
import { parseUrlStr, useAsync, UserBaseInfo } from 'tailchat-shared';
/**
*

@ -1,3 +1,5 @@
import { parseUrlStr } from 'tailchat-shared';
/**
*
*/
@ -6,7 +8,7 @@ async function loadImage(url: string): Promise<HTMLImageElement> {
return new Promise((resolve, reject) => {
el.onload = () => resolve(el);
el.onerror = reject;
el.src = url;
el.src = parseUrlStr(url);
el.crossOrigin = 'Anonymous';
});
}

Loading…
Cancel
Save