feat: shorten image url length

This commit is contained in:
boojack 2021-12-16 22:51:44 +08:00
parent ee3c753c99
commit 3fc74490de
2 changed files with 3 additions and 3 deletions

View file

@ -73,8 +73,8 @@ const Editor = forwardRef((props: Props, ref: React.ForwardedRef<EditorRefAction
return;
}
const resource = await resourceService.upload(file);
const url = `https://memos.justsven.top/r/${resource.id}/${resource.filename}`;
const image = await resourceService.upload(file);
const url = `/r/${image.id}/${image.filename}`;
const prevValue = editorRef.current.value;
editorRef.current.value =

View file

@ -17,7 +17,7 @@ export const TAG_REG = /#\s(.+?)\s/g;
export const LINK_REG = /(https?:\/\/[^\s<\\*>']+)/g;
// 图片 正则
export const IMAGE_URL_REG = /(https?:\/\/[^\s<\\*>']+\.(jpeg|jpg|gif|png|svg))/g;
export const IMAGE_URL_REG = /([^\s<\\*>']+\.(jpeg|jpg|gif|png|svg))/g;
// memo 关联正则
export const MEMO_LINK_REG = /\[@(.+?)\]\((.+?)\)/g;