fix: 输出类文件字段改用保存对话框
- 目标文件路径/输出目录这类字段指向将来才生成的文件, 原先的打开文件对话框只能选已存在文件, 导致截屏保存位置无法选择 - 字段键/标签命中 输出|保存|另存|导出|目标文件|output/save/export 等关键词时改用保存对话框, 可直接输入新文件名 - 输入类字段保持打开对话框不变
This commit is contained in:
parent
e5f64c21e2
commit
c11e1d1527
@ -526,6 +526,22 @@ function FieldControl({
|
||||
|
||||
const pickPath = async (directories: boolean) => {
|
||||
try {
|
||||
if (!directories) {
|
||||
// 输出类字段(保存/输出/目标文件等)指向将来才生成的文件,用「保存」对话框允许输入新文件名;
|
||||
// 输入类字段保持「打开」对话框,只能选择已存在的文件。
|
||||
const isOutputField = /输出|保存|另存|导出|目标文件|文件名|output|save|export|dest|target/i.test(
|
||||
`${field.key} ${field.label ?? ""}`
|
||||
);
|
||||
if (isOutputField) {
|
||||
const selected = await window.rpa.dialog.save({
|
||||
title: field.label,
|
||||
defaultPath: textOf(raw) || undefined,
|
||||
filters: fileFiltersFor(node.componentId, field)
|
||||
});
|
||||
if (selected) onChange(field.key, selected);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const selected = await window.rpa.dialog.open({
|
||||
title: field.label,
|
||||
directories,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user