feat & refactor: 支持app端签名的请求,支持右键操作书架书籍,逻辑大幅重构,更改默认的设备逻辑为自动注册,支持载入某些书籍内置的CSS、支持跳转正文注释等等

This commit is contained in:
naiy committed 2026-08-03 16:17:49 +08:00
1 parent 2f2ee606c0
commit 3586b01dbb
47 files changed
+3594 -243

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
// 设置面板的挂载/卸载。
// 面板是全局单例,从用户菜单里唤起。
import { createApp, h, type App } from 'vue'
import SettingsView from './views/SettingsView.vue'
import settingscss from './assets/settings.css?raw'
const CONTAINER_ID = 'fqa-settings-root'
const STYLE_ID = 'fqa-settings-style'
let app: App | null = null
let container: HTMLElement | null = null
function injectStyle() {
if (document.getElementById(STYLE_ID)) return
const style = document.createElement('style')
style.id = STYLE_ID
style.textContent = settingscss
document.head.appendChild(style)
}
export function closeSettings(): void {
app?.unmount()
app = null
container?.remove()
container = null
}
export function openSettings(): void {
if (app) return
injectStyle()
container = document.createElement('div')
container.id = CONTAINER_ID
document.body.appendChild(container)
app = createApp({
render: () => h(SettingsView, { onClose: closeSettings }),
})
app.config.errorHandler = (err, _instance, info) => {
console.error(`[fqa:settings] Vue error (${info}):`, err)
}
app.mount(container)
}
export function toggleSettings(): void {
if (app) closeSettings()
else openSettings()
}