Skip to content

Commit a7de09d

Browse files
committed
Merge pull request #13296 from owncloud/feat/share-links-and-passswords
feat: share links and passwords in embed mode
1 parent 51b2e30 commit a7de09d

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

embed-mode/_index.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ To maintain uniformity and ease of handling, each event encapsulates the same st
3535
| Name | Data | Description |
3636
| --- | --- | --- |
3737
| **owncloud-embed:select** | Resource[] | Gets emitted when user selects resources or location via the select action |
38-
| **owncloud-embed:share** | string[] | Gets emitted when user selects resources and shares them via the "Share links" action |
38+
| **owncloud-embed:share** | string[] | **DEPRECATED**: Gets emitted when user selects resources and shares them via the "Share links" action. Use `owncloud-embed:share-links` instead. |
39+
| **owncloud-embed:share-links** | Array<{ url: string; password?: string }> | Gets emitted when user selects resources and shares them via the "Share link(s)" or "Share link(s) and password(s)" action. Each object contains the link URL and optionally the password (when shared with password). |
3940
| **owncloud-embed:cancel** | null | Gets emitted when user attempts to close the embedded instance via "Cancel" action |
4041

4142
### Example
4243

44+
#### Selecting resources
45+
4346
```html
4447
<iframe src="https://my-owncloud-web-instance?embed=true"></iframe>
4548

@@ -58,6 +61,28 @@ To maintain uniformity and ease of handling, each event encapsulates the same st
5861
</script>
5962
```
6063
64+
#### Sharing links with password
65+
66+
```html
67+
<iframe src="https://my-owncloud-web-instance?embed=true"></iframe>
68+
69+
<script>
70+
function shareLinksEventHandler(event) {
71+
if (event.data?.name !== 'owncloud-embed:share-links') {
72+
return
73+
}
74+
75+
const links = event.data.data // Array<{ url: string; password?: string }>
76+
77+
links.forEach(link => console.log("Link", link.url, "Password", link.password))
78+
79+
doSomethingWithSharedLinks(links)
80+
}
81+
82+
window.addEventListener('message', shareLinksEventHandler)
83+
</script>
84+
```
85+
6186
## Location picker
6287
6388
By default, the Embed mode allows users to select resources. In certain cases (e.g. uploading a file), this needs to be changed to allow selecting a location. This can be achieved by running the embed mode with additional parameter `embed-target=location`. With this parameter, resource selection is disabled and the selected resources array always includes the current folder as the only item.

releasing/deprecations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The following features are deprecated and **will be removed** in the next major
1818

1919
| Component/Feature | Deprecated | Migration | Reference | Reasoning |
2020
|---|---|---|---|---|---|
21+
| `owncloud-embed:share` event | November 12, 2025 | Use `owncloud-embed:share-links` event instead | [PR #13296](https://github.com/owncloud/web/pull/13296) | New event provides structured data with both URL and optional password |
2122

2223
## Migration History
2324

0 commit comments

Comments
 (0)