1
mirror of https://github.com/xitanggg/open-resume synced 2024-11-03 09:19:21 +01:00

Extend BulletListTextareaFallback to Safari

This commit is contained in:
Xitang 2023-07-01 17:22:17 -07:00
parent c40f2e50a1
commit fc5325f8ae

View File

@ -1,3 +1,4 @@
import { useState, useEffect } from "react";
import ContentEditable from "react-contenteditable";
import { useAutosizeTextareaHeight } from "lib/hooks/useAutosizeTextareaHeight";
@ -83,7 +84,19 @@ export const Textarea = <T extends string>({
export const BulletListTextarea = <T extends string>(
props: InputProps<T, string[]> & { showBulletPoints?: boolean }
) => {
if (navigator.userAgent.includes("Firefox")) {
const [showFallback, setShowFallback] = useState(false);
useEffect(() => {
const isFirefox = navigator.userAgent.includes("Firefox");
const isSafari =
navigator.userAgent.includes("Safari") &&
!navigator.userAgent.includes("Chrome"); // Note that Chrome also includes Safari in its userAgent
if (isFirefox || isSafari) {
setShowFallback(true);
}
}, []);
if (showFallback) {
return <BulletListTextareaFallback {...props} />;
}
return <BulletListTextareaGeneral {...props} />;