fix(desktop): 画布尺寸改 ResizeObserver(放大窗口不再裁切)+ 新增默认下载文件夹设置
This commit is contained in:
1 parent
8a5d846617
commit
90c29920c0
4 files changed
+86
-6
No files matched your search
@@ -69,6 +69,30 @@
|
||||
return pluginsTab
|
||||
}
|
||||
|
||||
// 桌面端专属:默认下载文件夹。独立组件持有 useState ⇒ 不干扰 generalTab 的 hook 顺序。
|
||||
function DownloadDirBlock () {
|
||||
const D = (typeof window !== 'undefined') ? window.__IWB_DESKTOP__ : null
|
||||
const enabled = !!(D && D.isTauri && D.isTauri())
|
||||
const [dir, setDir] = React.useState(() => (enabled ? D.getDownloadDir() : ''))
|
||||
const [note, setNote] = React.useState('')
|
||||
if (!enabled) return null // 网页版没有这个概念:整块不渲染
|
||||
const pick = async () => {
|
||||
try { const d = await D.pickDownloadDir(); if (d) { setDir(d); setNote('已保存') } else setNote('已取消') }
|
||||
catch (e) { setNote('失败:' + String((e && e.message) || e)) }
|
||||
}
|
||||
const clear = () => { try { D.setDownloadDir('') } catch (e) { /* ignore */ } setDir(''); setNote('已清除,恢复为跟随系统') }
|
||||
return el('div', null,
|
||||
el('div', { className: 'iwb-section-sub' }, '下载(桌面版)'),
|
||||
el('div', { className: 'iwb-row' },
|
||||
el('label', { className: 'iwb-label' }, '默认下载文件夹'),
|
||||
el('input', { className: 'iwb-input iwb-grow', readOnly: true, placeholder: '未设置:跟随系统上次保存的位置', value: dir }),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: pick }, '选择文件夹'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: clear }, '清除'),
|
||||
),
|
||||
el('div', { className: 'iwb-hint' }, '「保存图片」等原生另存为对话框默认打开该文件夹;文件名仍按格式自动生成。' + (note ? '(' + note + ')' : '')),
|
||||
)
|
||||
}
|
||||
|
||||
function renderGeneralTab (ctx) {
|
||||
const { GEN_CONCURRENCY_DEFAULT, GEN_CONCURRENCY_MAX, GEN_CONCURRENCY_MIN, TASK_STALL_END_MAX, TASK_STALL_END_MIN, applyTheme, draft, setDraft, setTheme, theme } = ctx
|
||||
const generalTab = el('div', { className: 'iwb-section' },
|
||||
@@ -81,6 +105,8 @@
|
||||
),
|
||||
el('div', { className: 'iwb-section-sub' }, '画布'),
|
||||
el('div', { className: 'iwb-hint' }, '节点拖动采用自由定位,不使用网格吸附。'),
|
||||
// 桌面端专属设置(网页版自动隐藏)
|
||||
el(DownloadDirBlock, null),
|
||||
el('div', { className: 'iwb-section-sub' }, '生成并发'),
|
||||
el('div', { className: 'iwb-row' },
|
||||
el('label', { className: 'iwb-label' }, '同时请求数量'),
|
||||
|
||||
Reference in new issue
Block a user