feat: support libraryReturnUrl when installing libraries (#3227)

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
David Luzar 2021-03-13 12:35:35 +01:00 committed by GitHub
parent 47c26cd4cf
commit 91c8b6ecbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 3 deletions

View file

@ -458,6 +458,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
showExitZenModeBtn={
typeof this.props?.zenModeEnabled === "undefined" && zenModeEnabled
}
libraryReturnUrl={this.props.libraryReturnUrl}
/>
<div className="excalidraw-textEditorContainer" />
{this.state.showStats && (
@ -588,7 +589,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
private importLibraryFromUrl = async (url: string) => {
window.history.replaceState({}, APP_NAME, window.location.origin);
try {
const request = await fetch(url);
const request = await fetch(decodeURIComponent(url));
const blob = await request.blob();
const json = JSON.parse(await blob.text());
if (!isValidLibrary(json)) {