pi-image-tools 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,21 @@
1
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
2
- import type { KeyId } from "@mariozechner/pi-tui";
3
-
4
- import type { PasteImageHandler } from "./types.js";
5
-
6
- const IMAGE_PASTE_SHORTCUTS: KeyId[] = ["alt+v", "ctrl+alt+v"];
7
-
8
- export function registerImagePasteKeybindings(pi: ExtensionAPI, handler: PasteImageHandler): void {
9
- for (const shortcut of IMAGE_PASTE_SHORTCUTS) {
10
- pi.registerShortcut(shortcut, {
11
- description: "Attach clipboard image to draft (send when ready)",
12
- handler,
13
- });
14
- }
15
- }
1
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
2
+ import type { KeyId } from "@mariozechner/pi-tui";
3
+
4
+ import type { PasteImageHandler } from "./types.js";
5
+
6
+ function getImagePasteShortcuts(platform: NodeJS.Platform = process.platform): KeyId[] {
7
+ if (platform === "win32") {
8
+ return ["alt+v", "ctrl+alt+v"];
9
+ }
10
+
11
+ return ["ctrl+v", "alt+v", "ctrl+alt+v"];
12
+ }
13
+
14
+ export function registerImagePasteKeybindings(pi: ExtensionAPI, handler: PasteImageHandler): void {
15
+ for (const shortcut of getImagePasteShortcuts()) {
16
+ pi.registerShortcut(shortcut, {
17
+ description: "Attach clipboard image to draft (send when ready)",
18
+ handler,
19
+ });
20
+ }
21
+ }