Created
March 20, 2026 14:47
-
-
Save avrahamappel/ef1c2dc0feed4af51e324800cdc626cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapkey('P', '#1Paste from clipboard', function() { | |
| // Grab the latest clipboard entry | |
| const clipboardText = Clipboard.get(); | |
| // Get all input elements on the page | |
| const inputs = $$('input, textarea'); | |
| // Check how many inputs there are | |
| if (inputs.length === 0) { | |
| alert("No input fields found."); | |
| return; | |
| } | |
| // Create an array of hints | |
| const hints = inputs.map((input, index) => ({ | |
| hint: String(index + 1), | |
| element: input | |
| })); | |
| // If there is only one input, fill it automatically | |
| if (hints.length === 1) { | |
| hints[0].element.value = clipboardText; | |
| return; | |
| } | |
| // Show hints | |
| Hints.create(hints, function(hint) { | |
| hint.element.value = clipboardText; | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment