Skip to content

Commit 72e18e4

Browse files
authored
Merge pull request #127 from AdobeDocs/barranca/doc-link
Barranca/doc link
2 parents c10e7f1 + 5a67fea commit 72e18e4

File tree

5 files changed

+57
-6
lines changed

5 files changed

+57
-6
lines changed

src/pages/guides/getting_started/changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ contributors:
2222

2323
# Changelog
2424

25+
## 2025-05-26
26+
27+
### Added
28+
29+
- Added support for retrieving published (shared) document links via the new [`LinkOptions`](../../references/addonsdk/addonsdk-constants.md) enumerable in `AddOnUISdk.app.document.link()`, along with the `documentPublishedLinkAvailable` event, which is triggered when the published link becomes available. Both updates are reflected in the [Document Metadata How-to Guide](../learn/how_to/document_metadata.md).
30+
31+
### Updates
32+
33+
- [`@adobe-ccwebext/ccweb-add-on-sdk-types`](https://github.com/adobe/create-ccweb-add-on/releases): Type Definitions for the CLI have been updated to version `1.17.0`.
34+
2535
## 2025-05-16
2636

2737
### Updated

src/pages/guides/learn/how_to/document_metadata.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ contributors:
2121

2222
# Use Document Metadata
2323

24-
## Get the Document ID and Title
24+
## Get the Document ID, Title, and Link
2525

2626
Through the [Add-on UI SDK Document object](../../../references/addonsdk/app-document.md), you can retrieve some information about the current document. Currently, there are asynchronous methods that allow you to retrieve the `id()` of the document and the `title()`. Also, associated events will let you listen for when the Document ID or the Document Title have changed, respectively via the `documentIdAvailable` and `documentTitleChange` events, which you can listen for with the [`addOnUISdk.app.on()`](../../../references/addonsdk/addonsdk-app.md#on) method.
2727

@@ -40,7 +40,7 @@ addOnUISdk.ready.then(() => {
4040
const docTitle = await addOnUISdk.app.document.title();
4141

4242
// Get the document Link
43-
const docLink = await addOnUISdk.app.document.link();
43+
const docLink = await addOnUISdk.app.document.link("document"); // or "published"
4444

4545
console.log(`Document ID: ${docId}; Document Title: ${docTitle}`; `Document Link: ${docLink}`);
4646

@@ -53,6 +53,16 @@ addOnUISdk.ready.then(() => {
5353
addOnUISdk.app.on("documentTitleChange", data => {
5454
console.log(`Document title changed to: ${data.documentTitle}`);
5555
});
56+
57+
// Listen for document link change
58+
addOnUISdk.app.on("documentLinkAvailable", data => {
59+
console.log(`Document ID changed to: ${data.documentLink}`);
60+
});
61+
62+
// Listen for document published link change
63+
addOnUISdk.app.on("documentPublishedLinkAvailable", data => {
64+
console.log(`Document ID changed to: ${data.documentPublishedLink}`);
65+
});
5666
});
5767
```
5868

src/pages/references/addonsdk/addonsdk-constants.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ A set of constants used throughout the add-on SDK. These constants are equal to
114114
<p>The type of link</p>
115115
<ul>
116116
<li><strong>document</strong></li>Link to the current document.
117+
<li><strong>published</strong></li>Link to the published document.
117118
</ul>
118119
</td>
119120
</tr>

src/pages/references/addonsdk/app-document.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ A resolved `Promise` containing a [`PageMetadata`](#pagemetadata) array containi
9292

9393
<CodeBlock slots="heading, code" repeat="2" languages="JavaScript, bash" />
9494

95-
## Usage
95+
#### Usage
9696

9797
```js
9898
import addOnUISdk from "https://express.adobe.com/static/add-on-sdk/sdk.js";
@@ -128,7 +128,7 @@ async function logMetadata() {
128128
}
129129
```
130130

131-
## Output
131+
#### Output
132132

133133
```bash
134134
Page id: 772dc4b6-0df5-469f-b477-2a0c5445a6ef
@@ -250,7 +250,7 @@ A resolved `Promise` containing the `link` of the document.
250250
251251
<InlineAlert slots="text" variant="info"/>
252252
253-
A `documentLinkAvailable` event is triggered when the document link is available in the application. You can listen for this event via the [`addOnUISdk.app.on()`](./addonsdk-app.md#on) method.
253+
A `documentLinkAvailable` or `documentPublishedLinkAvailable` event is triggered when the document link is available in the application. You can listen for this event via the [`addOnUISdk.app.on()`](./addonsdk-app.md#on) method.
254254
255255
#### Example
256256
@@ -263,13 +263,33 @@ import addOnUISdk from "https://express.adobe.com/static/add-on-sdk/sdk.js";
263263
264264
function setLink(link) { /* ... */ }
265265
266-
addOnUISdk.ready.then(() => setLink(await AddOnSDKAPI.app.document.link("document"));
266+
addOnUISdk.ready.then(
267+
() => setLink(await AddOnSDKAPI.app.document.link("document"))
268+
);
267269
268270
addOnUISdk.app.on("documentLinkAvailable", data => {
269271
setLink(data.documentLink);
270272
});
273+
274+
function setPublishedLink(link) { /* ... */ }
275+
276+
AddOnSDKAPI.ready.then(
277+
() => setPublishedLink(await AddOnSDKAPI.app.document.link("published"))
278+
);
279+
280+
AddOnSDKAPI.app.on("documentPublishedLinkAvailable", data => {
281+
setPublishedLink(data.documentPublishedLink);
282+
});
271283
```
272284
285+
#### `LinkOptions`
286+
287+
The options to pass into the link method.
288+
289+
| Name | Type | Description |
290+
| ------------- | -------- | -------------------------------------------------------- |
291+
| `linkOptions` | `string` | [`LinkOptions`](./addonsdk-constants.md) constant value. |
292+
273293
## Import Content Methods
274294
275295
### addImage()

src/pages/references/changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ contributors:
2222

2323
# Changelog
2424

25+
## 2025-05-26
26+
27+
### Added
28+
29+
- Added support for retrieving published (shared) document links via the new [`LinkOptions`](./addonsdk/addonsdk-constants.md) enumerable in `AddOnUISdk.app.document.link()`, along with the `documentPublishedLinkAvailable` event, which is triggered when the published link becomes available. Both updates are reflected in the [Document Metadata How-to Guide](../guides/learn/how_to/document_metadata.md).
30+
31+
### Updates
32+
33+
- [`@adobe-ccwebext/ccweb-add-on-sdk-types`](https://github.com/adobe/create-ccweb-add-on/releases): Type Definitions for the CLI have been updated to version `1.17.0`.
34+
2535
## 2025-05-16
2636

2737
### Updated

0 commit comments

Comments
 (0)