mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Add onPaste prop to customise clipboard paste event (#3420)
* Add Awaited type util * Expose onPasteFromClipboard props * Add `event` as second param for advanced usages * Add support for async flows * Extract ClipboardData type * Rename `onPasteFromClipboard` to `onPaste` * Remove unused type helper * Add `onPaste` documentation * tweak docs * fix Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
parent
89472c14ed
commit
d91950bd03
6 changed files with 39 additions and 8 deletions
|
@ -1188,6 +1188,11 @@ class App extends React.Component<AppProps, AppState> {
|
|||
return;
|
||||
}
|
||||
const data = await parseClipboard(event);
|
||||
if (this.props.onPaste) {
|
||||
if (await this.props.onPaste(data, event)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (data.errorMessage) {
|
||||
this.setState({ errorMessage: data.errorMessage });
|
||||
} else if (data.spreadsheet) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue