|
| 1 | +diff --git a/node_modules/@wordpress/components/build-module/form-file-upload/index.js b/node_modules/@wordpress/components/build-module/form-file-upload/index.js |
| 2 | +index 9f1440e..e256971 100644 |
| 3 | +--- a/node_modules/@wordpress/components/build-module/form-file-upload/index.js |
| 4 | ++++ b/node_modules/@wordpress/components/build-module/form-file-upload/index.js |
| 5 | +@@ -55,12 +55,23 @@ export function FormFileUpload({ |
| 6 | + ...props, |
| 7 | + children: children |
| 8 | + }); |
| 9 | ++ const isSafari = typeof window !== "undefined" && |
| 10 | ++ !!window.document?.createElement && |
| 11 | ++ /mac|iphone|ipad|ipod/i.test( window?.navigator?.platform ) && |
| 12 | ++ /apple/i.test(window?.navigator?.vendor); |
| 13 | ++ let compatAccept = accept; |
| 14 | + // @todo: Temporary fix a bug that prevents Chromium browsers from selecting ".heic" files |
| 15 | + // from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4. |
| 16 | + // This can be removed once the Chromium fix is in the stable channel. |
| 17 | + // Prevent Safari from adding "image/heic" and "image/heif" to the accept attribute. |
| 18 | +- const isSafari = globalThis.window?.navigator.userAgent.includes('Safari') && !globalThis.window?.navigator.userAgent.includes('Chrome') && !globalThis.window?.navigator.userAgent.includes('Chromium'); |
| 19 | +- const compatAccept = !isSafari && !!accept?.includes('image/*') ? `${accept}, image/heic, image/heif` : accept; |
| 20 | ++ if (!isSafari && !!accept?.includes('image/*')) { |
| 21 | ++ compatAccept = `${accept}, image/heic, image/heif`; |
| 22 | ++ } |
| 23 | ++ // iOS Safari's `accept` attribute lacks wildcard `audio/*` support. |
| 24 | ++ // https://stackoverflow.com/a/66859581 |
| 25 | ++ if (isSafari && !!accept?.includes('audio/*')) { |
| 26 | ++ compatAccept = `${accept}, audio/mp3, audio/x-m4a, audio/x-m4b, audio/x-m4p, audio/x-wav, audio/webm`; |
| 27 | ++ } |
| 28 | + return /*#__PURE__*/_jsxs("div", { |
| 29 | + className: "components-form-file-upload", |
| 30 | + children: [ui, /*#__PURE__*/_jsx("input", { |
0 commit comments