This adds a new `showSaveDraftButton` option to the `versions.drafts.autosave` config for collections and globals. By default, the "Save as draft" button is hidden when autosave is enabled. This new option allows the button to remain visible for manual saves while autosave is active. Also updates the admin UI logic to conditionally render the button when this flag is set, and updates the documentation with an example usage.
27 lines
535 B
TypeScript
27 lines
535 B
TypeScript
import type { GlobalConfig } from 'payload'
|
|
|
|
import { autosaveWithDraftButtonGlobal } from '../slugs.js'
|
|
|
|
const AutosaveWithDraftButtonGlobal: GlobalConfig = {
|
|
slug: autosaveWithDraftButtonGlobal,
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
localized: true,
|
|
required: true,
|
|
},
|
|
],
|
|
label: 'Autosave with Draft Button Global',
|
|
versions: {
|
|
drafts: {
|
|
autosave: {
|
|
showSaveDraftButton: true,
|
|
interval: 1000,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
export default AutosaveWithDraftButtonGlobal
|