feat: retain seed on shift-paste (#6509)

thanks for the review 👍
This commit is contained in:
David Luzar 2023-04-24 10:26:21 +02:00 committed by GitHub
parent 9d5cfbbfb7
commit d35386755f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 120 additions and 57 deletions

View file

@ -190,3 +190,24 @@ export const toggleMenu = (container: HTMLElement) => {
// open menu
fireEvent.click(container.querySelector(".dropdown-menu-button")!);
};
export const createPasteEvent = (
text:
| string
| /* getData function */ ((type: string) => string | Promise<string>),
files?: File[],
) => {
return Object.assign(
new Event("paste", {
bubbles: true,
cancelable: true,
composed: true,
}),
{
clipboardData: {
getData: typeof text === "string" ? () => text : text,
files: files || [],
},
},
);
};