mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: blockly: draft
This commit is contained in:
1 parent
9a173e0d37
commit
9a67e81b10
5 files changed
+371
-5
No files matched your search
@@ -9,8 +9,11 @@ export const providers: Record<string, AvatarProvider> = {
|
||||
url: (url) => url,
|
||||
};
|
||||
|
||||
function avatar(src: string, size = 64) {
|
||||
const index = (src || '').indexOf(':');
|
||||
function avatar(src: string, size = 64, fallback = '') {
|
||||
src = src || fallback;
|
||||
let index = src.indexOf(':');
|
||||
if (index === -1) src = fallback;
|
||||
index = src.indexOf(':');
|
||||
if (index === -1) return providers.gravatar('', size);
|
||||
const [provider, str] = [src.substr(0, index), src.substr(index + 1, src.length)];
|
||||
if (!providers[provider] || !str) return providers.gravatar('', size);
|
||||
|
||||
Reference in new issue
Block a user