diff --git a/package.json b/package.json index 90d191b..83a0fc2 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "prop-types": "^15.6.0", "react": "^16.3.2", "react-aria-menubutton": "^5.1.1", - "react-aria-modal": "^2.12.1", + "react-aria-modal": "^3.0.0", "react-autobind": "^1.0.6", "react-autocomplete": "^1.7.2", "react-codemirror2": "^4.2.1", diff --git a/src/components/modals/OpenModal.jsx b/src/components/modals/OpenModal.jsx index 5d9901f..7afbb61 100644 --- a/src/components/modals/OpenModal.jsx +++ b/src/components/modals/OpenModal.jsx @@ -76,7 +76,10 @@ class OpenModal extends React.Component { onStyleSelect = (styleUrl) => { this.clearError(); + const requestController = new AbortController(); + const activeRequest = fetch(styleUrl, { + signal: requestController.signal, mode: 'cors', credentials: "same-origin" }) @@ -165,49 +168,53 @@ class OpenModal extends React.Component { ); } - return this.onOpenToggle()} - title={'Open Style'} - > - {errorElement} -
-

Upload Style

-

Upload a JSON style from your computer.

- - - -
+ return ( +
+ this.onOpenToggle()} + title={'Open Style'} + > + {errorElement} +
+

Upload Style

+

Upload a JSON style from your computer.

+ + + +
-
-

Load from URL

-

- Load from a URL. Note that the URL must have CORS enabled. -

- this.styleUrlElement = input} className="maputnik-input" placeholder="Enter URL..."/> -
- -
-
+
+

Load from URL

+

+ Load from a URL. Note that the URL must have CORS enabled. +

+ this.styleUrlElement = input} className="maputnik-input" placeholder="Enter URL..."/> +
+ +
+
-
-

Gallery Styles

-

- Open one of the publicly available styles to start from. -

-
- {styleOptions} -
-
+
+

Gallery Styles

+

+ Open one of the publicly available styles to start from. +

+
+ {styleOptions} +
+
+
- this.onCancelActiveRequest(e)} - message={"Loading: "+this.state.activeRequestUrl} - /> - + this.onCancelActiveRequest(e)} + message={"Loading: "+this.state.activeRequestUrl} + /> +
+ ) } }