mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: make clipboard more robust and reintroduce contextmenu actions (#7198)
This commit is contained in:
parent
ec2de7205f
commit
ea677d4581
17 changed files with 611 additions and 193 deletions
14
src/utils.ts
14
src/utils.ts
|
@ -917,3 +917,17 @@ export const isRenderThrottlingEnabled = (() => {
|
|||
return false;
|
||||
};
|
||||
})();
|
||||
|
||||
/** Checks if value is inside given collection. Useful for type-safety. */
|
||||
export const isMemberOf = <T extends string>(
|
||||
/** Set/Map/Array/Object */
|
||||
collection: Set<T> | readonly T[] | Record<T, any> | Map<T, any>,
|
||||
/** value to look for */
|
||||
value: string,
|
||||
): value is T => {
|
||||
return collection instanceof Set || collection instanceof Map
|
||||
? collection.has(value as T)
|
||||
: "includes" in collection
|
||||
? collection.includes(value as T)
|
||||
: collection.hasOwnProperty(value);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue