feat: shorten image url length

pull/14/head
boojack 3 years ago
parent ee3c753c99
commit 3fc74490de

@ -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 =

@ -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;

Loading…
Cancel
Save