mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 07:46:09 +01:00
15 lines
513 B
TypeScript
15 lines
513 B
TypeScript
export const getCompressURL = (url: string) => {
|
|
if (url.startsWith("assets/") &&
|
|
(url.endsWith(".png") || url.endsWith(".jpg") || url.endsWith(".jpeg"))) {
|
|
return url + "?style=thumb";
|
|
}
|
|
return url;
|
|
};
|
|
|
|
export const removeCompressURL = (url: string) => {
|
|
if (url.startsWith("assets/") &&
|
|
(url.endsWith(".png?style=thumb") || url.endsWith(".jpg?style=thumb") || url.endsWith(".jpeg?style=thumb"))) {
|
|
return url.replace("?style=thumb", "");
|
|
}
|
|
return url;
|
|
};
|