()
| 251 | } |
| 252 | |
| 253 | export async function getImagePathFromClipboard(): Promise<string | null> { |
| 254 | const { commands } = getClipboardCommands() |
| 255 | |
| 256 | try { |
| 257 | // Try to get text from clipboard |
| 258 | const result = await execa(commands.getPath, { |
| 259 | shell: true, |
| 260 | reject: false, |
| 261 | }) |
| 262 | if (result.exitCode !== 0 || !result.stdout) { |
| 263 | return null |
| 264 | } |
| 265 | return result.stdout.trim() |
| 266 | } catch (e) { |
| 267 | logError(e as Error) |
| 268 | return null |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * Regex pattern to match supported image file extensions. Kept in sync with |
no test coverage detected