Skip to content

Commit 2d79cb5

Browse files
nullptr-zhy
authored andcommitted
fix: 修复文档图片加载问题
1 parent 48b2c95 commit 2d79cb5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

website/src/component/Preview/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ const getBooleanValue = (param, field, defaultValue) => {
4040

4141
const Preview = ({ path, ...mdData }) => {
4242
const $dom = useRef(null);
43+
44+
const transformImageUri = (url) => {
45+
const callback = (path) => {
46+
const reqImage = require.context(path, true, /\.(png|gif|jpg|svg)$/);
47+
const urlImage = reqImage(url);
48+
return urlImage;
49+
};
50+
return mdData.transformImageUriPath(callback);
51+
};
52+
4353
return (
4454
<Wrapper ref={$dom}>
4555
<Markdown

0 commit comments

Comments
 (0)