mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: add props.onDuplicate
(#9117)
* feat: add `props.onDuplicate` * docs * clarify docs * fix docs
This commit is contained in:
parent
9e49c9254b
commit
c8f4a4cb41
4 changed files with 51 additions and 4 deletions
|
@ -512,6 +512,22 @@ export interface ExcalidrawProps {
|
|||
data: ClipboardData,
|
||||
event: ClipboardEvent | null,
|
||||
) => Promise<boolean> | boolean;
|
||||
/**
|
||||
* Called when element(s) are duplicated so you can listen or modify as
|
||||
* needed.
|
||||
*
|
||||
* Called when duplicating via mouse-drag, keyboard, paste, library insert
|
||||
* etc.
|
||||
*
|
||||
* Returned elements will be used in place of the next elements
|
||||
* (you should return all elements, including deleted, and not mutate
|
||||
* the element if changes are made)
|
||||
*/
|
||||
onDuplicate?: (
|
||||
nextElements: readonly ExcalidrawElement[],
|
||||
/** excludes the duplicated elements */
|
||||
prevElements: readonly ExcalidrawElement[],
|
||||
) => ExcalidrawElement[] | void;
|
||||
renderTopRightUI?: (
|
||||
isMobile: boolean,
|
||||
appState: UIAppState,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue