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