v0.10.5 - fix focus and blur triggered same time

This commit is contained in:
defaultkavy 2024-10-19 14:46:33 +08:00
parent 5eb5ef289d
commit eb2cbf688a
Signed by: defaultkavy
GPG Key ID: DFBB22C4E69D7826
6 changed files with 8 additions and 6 deletions

File diff suppressed because one or more lines are too long

1
dist/assets/index-D9u7pURH.js vendored Normal file

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View File

@ -16,7 +16,7 @@
gtag('config', 'G-59HBGP98WR'); gtag('config', 'G-59HBGP98WR');
</script> </script>
<script type="module" crossorigin src="/assets/index-C9jgFl23.js"></script> <script type="module" crossorigin src="/assets/index-D9u7pURH.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BgVVzy-z.css"> <link rel="stylesheet" crossorigin href="/assets/index-BgVVzy-z.css">
</head> </head>
<body> <body>

View File

@ -2,7 +2,7 @@
"name": "danbooru-viewer", "name": "danbooru-viewer",
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",
"version": "0.10.4", "version": "0.10.5",
"scripts": { "scripts": {
"dev": "bun x vite", "dev": "bun x vite",
"build": "bun x vite build", "build": "bun x vite build",

View File

@ -87,12 +87,14 @@ export class $PostGrid extends $Layout<$PostGridEventMap> {
for (const post of posts) { for (const post of posts) {
if (!post.file_url) continue; if (!post.file_url) continue;
if (this.posts.has(post)) continue; if (this.posts.has(post)) continue;
const $post = new $PostTile(post); const $post = new $PostTile(post).on('$focus', (e, $post) => this.$focus.layer(100).focus($post));
this.$posts.set(post, $post); this.$posts.set(post, $post);
this.posts.add(post); this.posts.add(post);
} }
this.$focus.layer(100).elementSet.clear(); this.$focus.layer(100).elementSet.clear();
const $posts = [...this.orderMap.values()].map(post => this.$posts.get(post)?.self(this.$focus.layer(100).add)); const $posts = [...this.orderMap.values()].map(post => {
return this.$posts.get(post)?.self(this.$focus.layer(100).add)
});
this.content($posts).render(); this.content($posts).render();
return this; return this;
} }

View File

@ -58,7 +58,7 @@ export class $PostTile extends $Container {
if (!detailPanelEnable$.value) return; if (!detailPanelEnable$.value) return;
if (innerWidth <= 800) return $.open(this.post.pathname); if (innerWidth <= 800) return $.open(this.post.pathname);
if ($(document.activeElement) === this) $.open(this.post.pathname); if ($(document.activeElement) === this) $.open(this.post.pathname);
else this.focus(); else this.trigger('$focus');
}) })
} }