|
|
|
@ -4,7 +4,13 @@ import { trackEvent } from "../analytics"; |
|
|
|
import { getDefaultAppState } from "../appState"; |
|
|
|
import { getDefaultAppState } from "../appState"; |
|
|
|
import { ErrorDialog } from "../components/ErrorDialog"; |
|
|
|
import { ErrorDialog } from "../components/ErrorDialog"; |
|
|
|
import { TopErrorBoundary } from "../components/TopErrorBoundary"; |
|
|
|
import { TopErrorBoundary } from "../components/TopErrorBoundary"; |
|
|
|
import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants"; |
|
|
|
import { |
|
|
|
|
|
|
|
APP_NAME, |
|
|
|
|
|
|
|
COOKIES, |
|
|
|
|
|
|
|
EVENT, |
|
|
|
|
|
|
|
TITLE_TIMEOUT, |
|
|
|
|
|
|
|
VERSION_TIMEOUT, |
|
|
|
|
|
|
|
} from "../constants"; |
|
|
|
import { loadFromBlob } from "../data/blob"; |
|
|
|
import { loadFromBlob } from "../data/blob"; |
|
|
|
import { |
|
|
|
import { |
|
|
|
ExcalidrawElement, |
|
|
|
ExcalidrawElement, |
|
|
|
@ -68,6 +74,10 @@ import { isBrowserStorageStateNewer } from "./data/tabSync"; |
|
|
|
import clsx from "clsx"; |
|
|
|
import clsx from "clsx"; |
|
|
|
import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library"; |
|
|
|
import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isExcalidrawPlusSignedUser = document.cookie.includes( |
|
|
|
|
|
|
|
COOKIES.AUTH_STATE_COOKIE, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const languageDetector = new LanguageDetector(); |
|
|
|
const languageDetector = new LanguageDetector(); |
|
|
|
languageDetector.init({ |
|
|
|
languageDetector.init({ |
|
|
|
languageUtils: { |
|
|
|
languageUtils: { |
|
|
|
@ -182,7 +192,7 @@ const initializeScene = async (opts: { |
|
|
|
return { scene: null, isExternalScene: false }; |
|
|
|
return { scene: null, isExternalScene: false }; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const PlusLinkJSX = ( |
|
|
|
const PlusLPLinkJSX = ( |
|
|
|
<p style={{ direction: "ltr", unicodeBidi: "embed" }}> |
|
|
|
<p style={{ direction: "ltr", unicodeBidi: "embed" }}> |
|
|
|
Introducing Excalidraw+ |
|
|
|
Introducing Excalidraw+ |
|
|
|
<br /> |
|
|
|
<br /> |
|
|
|
@ -196,6 +206,17 @@ const PlusLinkJSX = ( |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PlusAppLinkJSX = ( |
|
|
|
|
|
|
|
<a |
|
|
|
|
|
|
|
href={`${process.env.REACT_APP_PLUS_APP}/#excalidraw-redirect`} |
|
|
|
|
|
|
|
target="_blank" |
|
|
|
|
|
|
|
rel="noreferrer" |
|
|
|
|
|
|
|
className="plus-button" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
Go to Excalidraw+ |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const ExcalidrawWrapper = () => { |
|
|
|
const ExcalidrawWrapper = () => { |
|
|
|
const [errorMessage, setErrorMessage] = useState(""); |
|
|
|
const [errorMessage, setErrorMessage] = useState(""); |
|
|
|
let currentLangCode = languageDetector.detect() || defaultLang.code; |
|
|
|
let currentLangCode = languageDetector.detect() || defaultLang.code; |
|
|
|
@ -524,17 +545,16 @@ const ExcalidrawWrapper = () => { |
|
|
|
if (isMobile) { |
|
|
|
if (isMobile) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
width: "24ch", |
|
|
|
width: isExcalidrawPlusSignedUser ? "21ch" : "23ch", |
|
|
|
fontSize: "0.7em", |
|
|
|
fontSize: "0.7em", |
|
|
|
textAlign: "center", |
|
|
|
textAlign: "center", |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{/* <GitHubCorner theme={appState.theme} dir={document.dir} /> */} |
|
|
|
{isExcalidrawPlusSignedUser ? PlusAppLinkJSX : PlusLPLinkJSX} |
|
|
|
{/* FIXME remove after 2021-05-20 */} |
|
|
|
|
|
|
|
{PlusLinkJSX} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -586,12 +606,14 @@ const ExcalidrawWrapper = () => { |
|
|
|
marginTop: isTinyDevice ? 16 : undefined, |
|
|
|
marginTop: isTinyDevice ? 16 : undefined, |
|
|
|
marginLeft: "auto", |
|
|
|
marginLeft: "auto", |
|
|
|
marginRight: isTinyDevice ? "auto" : undefined, |
|
|
|
marginRight: isTinyDevice ? "auto" : undefined, |
|
|
|
padding: "4px 2px", |
|
|
|
padding: isExcalidrawPlusSignedUser ? undefined : "4px 2px", |
|
|
|
border: "1px dashed #aaa", |
|
|
|
border: isExcalidrawPlusSignedUser |
|
|
|
|
|
|
|
? undefined |
|
|
|
|
|
|
|
: "1px dashed #aaa", |
|
|
|
borderRadius: 12, |
|
|
|
borderRadius: 12, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{PlusLinkJSX} |
|
|
|
{isExcalidrawPlusSignedUser ? PlusAppLinkJSX : PlusLPLinkJSX} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
|