UNPKG

@sanity/scheduled-publishing

Version:

> [!IMPORTANT] > As of [v3.39.0](https://www.sanity.io/changelog/e6013ee5-8214-4e03-9593-f7b19124b8a3) of Sanity Studio, this plugin has been deprecated and the Scheduled Publishing functionality has been moved into the core studio package. > Read more an

18 lines (15 loc) 551 B
import {DocumentActionComponent} from 'sanity' import {ScheduleAction} from './documentActions/schedule' type Action = DocumentActionComponent export default function resolveDocumentActions(existingActions: Action[]): Action[] { // Add schedule action after default publish action const index = existingActions.findIndex((a) => a.action === 'publish') if (index < 0) { return [ScheduleAction, ...existingActions] } return [ ...existingActions.slice(0, index + 1), ScheduleAction, ...existingActions.slice(index + 1), ] }