Browse Source

feat: use origin + pathname as libraryReturnUrl default (#3325)

David Luzar 4 years ago
parent
commit
1b626175de

+ 2 - 1
src/components/LayerUI.tsx

@@ -121,7 +121,8 @@ const LibraryMenuItems = ({
   const rows = [];
   const rows = [];
   let addedPendingElements = false;
   let addedPendingElements = false;
 
 
-  const referrer = libraryReturnUrl || window.location.origin;
+  const referrer =
+    libraryReturnUrl || window.location.origin + window.location.pathname;
 
 
   rows.push(
   rows.push(
     <div className="layer-ui__library-header" key="library-header">
     <div className="layer-ui__library-header" key="library-header">

+ 8 - 0
src/packages/excalidraw/CHANGELOG.md

@@ -12,6 +12,14 @@ The change should be grouped under one of the below section and must contain PR
 Please add the latest change on the top under the correct section.
 Please add the latest change on the top under the correct section.
 -->
 -->
 
 
+## Unreleased
+
+## Excalidraw API
+
+### Features
+
+- Append `location.pathname` to `libraryReturnUrl` default url [#3325](https://github.com/excalidraw/excalidraw/pull/3325).
+
 ## 0.5.0 (2021-03-21)
 ## 0.5.0 (2021-03-21)
 
 
 ## Excalidraw API
 ## Excalidraw API

+ 1 - 1
src/packages/excalidraw/README.md

@@ -545,7 +545,7 @@ This prop indicates whether the shows the grid. When supplied, the value takes p
 
 
 #### `libraryReturnUrl`
 #### `libraryReturnUrl`
 
 
-If supplied, this URL will be used when user tries to install a library from [libraries.excalidraw.com](https://libraries.excalidraw.com). Default to `window.location.origin`. To install the libraries in the same tab from which it was opened, you need to set `window.name` (to any alphanumeric string) — if it's not set it will open in a new tab.
+If supplied, this URL will be used when user tries to install a library from [libraries.excalidraw.com](https://libraries.excalidraw.com). Defaults to `window.location.origin + window.location.pathname`. To install the libraries in the same tab from which it was opened, you need to set `window.name` (to any alphanumeric string) — if it's not set it will open in a new tab.
 
 
 #### `theme`
 #### `theme`