Compare commits
2 Commits
2c1190d8fb
...
d826afbe15
| Author | SHA1 | Date | |
|---|---|---|---|
| d826afbe15 | |||
| b045a1b978 |
@ -37,7 +37,7 @@ governor = { version = "0.8", optional = true }
|
||||
md-5 = { version = "0.10", optional = true }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
web-sys = { version = "0.3", features = ["Document", "Window", "Storage", "Element", "DomTokenList", "MediaQueryList", "HtmlImageElement", "MouseEvent", "KeyboardEvent", "Node", "EventTarget", "Navigator"] }
|
||||
web-sys = { version = "0.3", features = ["Document", "Window", "Storage", "Element", "HtmlElement", "DomTokenList", "MediaQueryList", "HtmlImageElement", "MouseEvent", "KeyboardEvent", "Node", "EventTarget", "Navigator"] }
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
js-sys = "0.3"
|
||||
|
||||
@ -31,6 +31,8 @@ pub fn ImageViewer(
|
||||
// 打开灯箱时聚焦关闭按钮,并监听 Escape 键关闭。
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
use wasm_bindgen::{closure::Closure, JsCast};
|
||||
|
||||
use_effect(move || {
|
||||
if !is_open() {
|
||||
return;
|
||||
@ -43,6 +45,7 @@ pub fn ImageViewer(
|
||||
.and_then(|w| w.document())
|
||||
.and_then(|d| d.query_selector(".image-viewer-close").ok())
|
||||
.flatten()
|
||||
.and_then(|e| e.dyn_into::<web_sys::HtmlElement>().ok())
|
||||
{
|
||||
let _ = btn.focus();
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
use std::sync::LazyLock;
|
||||
use std::time::Duration;
|
||||
|
||||
use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod};
|
||||
use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod, Runtime};
|
||||
use tokio_postgres::NoTls;
|
||||
|
||||
/// 全局数据库连接池,基于 `DATABASE_URL` 环境变量延迟初始化。
|
||||
@ -35,6 +35,7 @@ pub static DB_POOL: LazyLock<Pool> = LazyLock::new(|| {
|
||||
.wait_timeout(Some(Duration::from_secs(10)))
|
||||
.create_timeout(Some(Duration::from_secs(10)))
|
||||
.recycle_timeout(Some(Duration::from_secs(5)))
|
||||
.runtime(Runtime::Tokio1)
|
||||
.build()
|
||||
.expect("Failed to create database connection pool")
|
||||
});
|
||||
|
||||
@ -20,7 +20,6 @@ mod db;
|
||||
#[cfg(feature = "server")]
|
||||
mod highlight;
|
||||
mod hooks;
|
||||
#[cfg(feature = "server")]
|
||||
mod models;
|
||||
mod pages;
|
||||
mod router;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user