Support drag-and-drop configuration

This commit is contained in:
Tw93
2025-08-31 15:29:28 +08:00
parent c68daf6ed6
commit bd764f5f5f
9 changed files with 54 additions and 6 deletions

10
bin/cli.ts vendored
View File

@@ -125,7 +125,10 @@ program
.hideHelp(),
)
.addOption(
new Option('--hide-on-close', 'Hide window on close instead of exiting (default: true for macOS, false for others)')
new Option(
'--hide-on-close',
'Hide window on close instead of exiting (default: true for macOS, false for others)',
)
.default(DEFAULT.hideOnClose)
.hideHelp(),
)
@@ -140,6 +143,11 @@ program
.default(DEFAULT.wasm)
.hideHelp(),
)
.addOption(
new Option('--enable-drag-drop', 'Enable drag and drop functionality')
.default(DEFAULT.enableDragDrop)
.hideHelp(),
)
.addOption(
new Option('--installer-language <string>', 'Installer language')
.default(DEFAULT.installerLanguage)

1
bin/defaults.ts vendored
View File

@@ -25,6 +25,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
hideOnClose: undefined, // Platform-specific: true for macOS, false for others
incognito: false,
wasm: false,
enableDragDrop: false,
};
// Just for cli development

View File

@@ -61,12 +61,13 @@ export async function mergeConfig(
incognito,
title,
wasm,
enableDragDrop,
} = options;
const { platform } = process;
// Platform-specific hide_on_close behavior: macOS keeps true, others default to false
const platformHideOnClose = hideOnClose ?? (platform === 'darwin');
const platformHideOnClose = hideOnClose ?? platform === 'darwin';
// Set Windows parameters.
const tauriConfWindowOptions = {
@@ -83,6 +84,7 @@ export async function mergeConfig(
incognito: incognito,
title: title || null,
enable_wasm: wasm,
enable_drag_drop: enableDragDrop,
};
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });

3
bin/types.ts vendored
View File

@@ -81,6 +81,9 @@ export interface PakeCliOptions {
// Enable WebAssembly support (Flutter Web, etc.), default false
wasm: boolean;
// Enable drag and drop functionality, default false
enableDragDrop: boolean;
}
export interface PakeAppOptions extends PakeCliOptions {