[fix] ios detection

This commit is contained in:
kwaroran
2023-11-25 17:50:11 +09:00
parent e1f5619d8b
commit c23782a3e3

View File

@@ -103,6 +103,9 @@ export const replacePlaceholders = (msg:string, name:string) => {
.replace(/(\{\{((set)|(get))var::.+?\}\})/gu,'') .replace(/(\{\{((set)|(get))var::.+?\}\})/gu,'')
} }
export function checkIsIos(){
return /(iPad|iPhone|iPod)/g.test(navigator.userAgent)
}
function selectFileByDom(allowedExtensions:string[], multiple:'multiple'|'single' = 'single') { function selectFileByDom(allowedExtensions:string[], multiple:'multiple'|'single' = 'single') {
return new Promise<null|File[]>((resolve) => { return new Promise<null|File[]>((resolve) => {
const fileInput = document.createElement('input'); const fileInput = document.createElement('input');
@@ -111,7 +114,8 @@ function selectFileByDom(allowedExtensions:string[], multiple:'multiple'|'single
if (allowedExtensions && allowedExtensions.length) { if (allowedExtensions && allowedExtensions.length) {
//check is iphone //check is iphone
if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){ if(checkIsIos()){
//allow all
fileInput.accept = '*/*'; fileInput.accept = '*/*';
} }
else{ else{