expose paste events in components

pull/8675/merge^2
Matt Paras 2025-06-20 08:14:21 -07:00
parent b858f9f8d8
commit d4958e4a71
1 changed files with 35 additions and 0 deletions

View File

@ -1366,6 +1366,41 @@ value : any?
"#
);
// TODO: Register this differently so it doesn't clone the pasted text unnecessarily
register!(
"paste-event?",
|event: Event| { matches!(event, Event::Paste(_)) },
r#"Checks if the given event is a paste event.
```scheme
(paste-event? event) -> bool?
```
* event : Event?
"#
);
register!(
"paste-event-string",
|event: Event| {
if let Event::Paste(p) = event {
Some(p)
} else {
None
}
},
r#"Get the string from the paste event, if it is a paste event.
```scheme
(paste-event-string event) -> (or string? #false)
```
* event : Event?
"#
);
register!(
"key-event?",
|event: Event| { matches!(event, Event::Key(_)) },