Skip to content

Commit 474286f

Browse files
committed
fix share link
1 parent 393f889 commit 474286f

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

.changeset/many-showers-wave.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@learningmap/learningmap": patch
3+
"@learningmap/web-component": patch
4+
---
5+
6+
Fix sharing link

docs/book/changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ If you need a new feature, open an [issue](https://github.com/openpatch/learning
3939
::::
4040
-->
4141

42+
## v0.2.1
43+
44+
::::tabs
45+
46+
:::tab{title="Fixed :bug:" id="fixed"}
47+
48+
- Fix share link.
49+
50+
:::
51+
52+
::::
53+
4254
## v0.2.0
4355

4456
::::tabs

packages/learningmap/src/ShareDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function ShareDialog() {
2222
if (!open) return null;
2323

2424
// Generate both edit and learn links
25-
const editLink = shareLink;
25+
const editLink = shareLink.replace(/(#json=.+)/, '/create$1');
2626
const learnLink = shareLink.replace(/(#json=.+)/, '/learn$1');
2727

2828
const handleCopyEditLink = async () => {

packages/learningmap/src/useJsonStore.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ export const useJsonStore = () => {
3838
})
3939
.then((r) => r.json())
4040
.then((json) => {
41-
const link =
42-
window.location.origin +
43-
window.location.pathname +
44-
"#json=" +
45-
json.id;
41+
const link = window.location.origin + "#json=" + json.id;
4642
setShareLink(link);
4743
setShareDialogOpen(true);
4844
})

0 commit comments

Comments
 (0)