mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
Merge branch 'feat/shortcut-actions' into staging
This commit is contained in:
@@ -44,6 +44,25 @@ export function generateUUID(): string {
|
||||
);
|
||||
}
|
||||
|
||||
export function isDOMElement(el: any): el is HTMLElement {
|
||||
return !!el && (el instanceof Element || el instanceof HTMLElement);
|
||||
}
|
||||
|
||||
export function isTypableElement(el: HTMLElement): boolean {
|
||||
// If content editable, then it is editable
|
||||
if (el.isContentEditable) return true;
|
||||
|
||||
// If element is an input and the input is enabled, then it is typable
|
||||
if (el.tagName === "INPUT") {
|
||||
return !(el as HTMLInputElement).disabled;
|
||||
}
|
||||
// If element is a textarea and the input is enabled, then it is typable
|
||||
if (el.tagName === "TEXTAREA") {
|
||||
return !(el as HTMLTextAreaElement).disabled;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
export function isAppleDevice() {
|
||||
return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user