Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [EXT-2755] add save and (un)publish command #1040

Merged
merged 10 commits into from
Oct 26, 2021
9 changes: 9 additions & 0 deletions lib/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ export default function createEntry(
getSys() {
return sys
},
publish() {
return channel.call('callEntryMethod', 'publish')
},
unpublish() {
return channel.call('callEntryMethod', 'unpublish')
},
save() {
return channel.call('callEntryMethod', 'save')
},
onSysChanged(handler: Function) {
return sysChanged.attach(handler)
},
Expand Down
6 changes: 6 additions & 0 deletions lib/types/entry.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ export interface TaskAPI {
export interface EntryAPI extends TaskAPI {
/** Returns sys for an entry. */
getSys: () => ContentEntitySys
/** Publish the entry */
publish: () => Promise<void>
/** Unpublish the entry */
unpublish: () => Promise<void>
/** Saves the current changes of the entry */
save: () => Promise<void>
/** Calls the callback with sys every time that sys changes. */
onSysChanged: (callback: (sys: ContentEntitySys) => void) => () => void
/** Allows to control the values of all other fields in the current entry. */
Expand Down