Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Locations refers to the position or the placement of the app (sidebar widget, cu
- **[AppConfigWidget](#AppConfigWidget)**: It's an object representing the current App configuration for the current App in the Contentstack UI.
- **[FieldModifierLocation](#FieldModifierLocation)**: It's an object representing the Field Modifier reference over the field in the Contentstack UI.
- **[ContentTypeSidebarWidget](#ContentTypeSidebarWidget)**: It's an object representing the Content Type Sidebar Widget in the Contentstack UI.
- **[GlobalFullPageWidget](#GlobalFullPageWidget)**: An object that represents the Global Full Page Widget in the Contentstack UI.

# External

Expand Down Expand Up @@ -150,6 +151,9 @@ ContentstackAppSDK.init().then(function (appSdk) {

// fetch entry information
var fieldData = await customField.entry.getData();

// fetch draft entry information (including unsaved changes)
var draftData = await customField.entry.getDraftData();
});
```

Expand All @@ -168,6 +172,9 @@ ContentstackAppSDK.init().then(function (location) {

// fetch entry information
var fieldData = await sidebarWidget.entry.getData();

// fetch draft entry information (including unsaved changes)
var draftData = await sidebarWidget.entry.getDraftData();
});
```

Expand Down Expand Up @@ -204,6 +211,9 @@ ContentstackAppSDK.init().then(function (appSdk) {

// fetch entry information
var fieldData = await fieldModifierLocation.entry.getData();

// fetch draft entry information (including unsaved changes)
var draftData = await fieldModifierLocation.entry.getDraftData();
});
```

Expand Down Expand Up @@ -500,6 +510,7 @@ This method gives you the entry, object which allows you to interact with the cu
- [.content_type](#entry) : <code>Object</code>
- [.locale](#entrylocale--string) : <code>string</code>
- [.getData()](#entrygetdata--object) ⇒ <code>Object</code>
- [.getDraftData()](#entrygetdraftdata--object) ⇒ <code>Object</code>
- [.getField(uid, options?)](#entrygetfielduid-options--object) ⇒ <code>Object</code>
- [.onSave(callback)](#entryonsavecallback)
- [.onChange(callback)](#Entry+onChange)
Expand Down Expand Up @@ -533,6 +544,24 @@ Gets data of the current entry.
**Kind**: instance method of [<code>Entry</code>](#Entry)
**Returns**: <code>Object</code> - Returns entry data.

<a name="FieldModifierLocation+Entry+getDraftData"></a>

#### entry.getDraftData() ⇒ <code>Object</code>

Gets the draft data of the current entry, including unsaved changes made in the editor.

**Kind**: instance method of [<code>Entry</code>](#Entry)
**Returns**: <code>Object</code> - Returns the draft data of the entry in the same format as getData(), but excludes metadata such as UID, version, publish information, and more.

**Note**: This method is especially useful for retrieving entry content that has not been saved yet, enabling apps to access what the user is currently typing in real time.

**Example**

```js
var draftData = await entry.getDraftData();
console.log("Draft Data:", draftData);
```

<a name="FieldModifierLocation+Entry+getField"></a>

#### entry.getField(uid, options?) ⇒ <code>Object</code>
Expand Down Expand Up @@ -743,6 +772,37 @@ sidebarWidget.onSave((updatedContentType) => {
});
```

## GlobalFullPageWidget

This is an object representing the Global Full Page Widget in the Contentstack UI.

**Kind**: The instance property of [GlobalFullPageWidget](#supported-locations)

### GlobalFullPage.currentOrganization ⇒ [Organization](#Organization)

This method retrieves the current organization's details.

**Kind**: instance method of [GlobalFullPageWidget](#GlobalFullPageWidget)

**Returns**: [Organization](#Organization) - The current organization data.

**Example**

```js
// javascript
ContentstackAppSDK.init().then(function (appSdk) {

var globalFullPageWidget = await appSdk.location.GlobalFullPageLocation;

// fetch app configuration
var appConfig = await appSdk.getConfig();

// fetch current organization information
var currentOrganization = globalFullPageWidget.currentOrganization;
console.log("Current Organization:", currentOrganization);
});
```

## frame

It is a class representing an iframe window from the Contentstack UI. Please note that it is not available for Custom Widgets.
Expand Down