Hide preview button unless collection supports preview and content is published (#70)
* Hide preview button unless collection supports preview and content is published * Remove isPublished check --------- Co-authored-by: Matt Kane <mkane@cloudflare.com>
This commit is contained in:
@@ -122,6 +122,8 @@ export interface ContentEditorProps {
|
||||
supportsDrafts?: boolean;
|
||||
/** Whether this collection supports revisions */
|
||||
supportsRevisions?: boolean;
|
||||
/** Whether this collection supports preview */
|
||||
supportsPreview?: boolean;
|
||||
/** Current user (for permission checks) */
|
||||
currentUser?: CurrentUserInfo;
|
||||
/** Available users for author selection (only shown to editors+) */
|
||||
@@ -190,6 +192,7 @@ export function ContentEditor({
|
||||
isScheduling,
|
||||
supportsDrafts = false,
|
||||
supportsRevisions = false,
|
||||
supportsPreview = false,
|
||||
currentUser,
|
||||
users,
|
||||
onAuthorChange,
|
||||
@@ -523,7 +526,7 @@ export function ContentEditor({
|
||||
<ArrowsOutSimple className="h-4 w-4" aria-hidden="true" />
|
||||
</Button>
|
||||
)}
|
||||
{!isNew && (
|
||||
{!isNew && supportsPreview && (
|
||||
<Button
|
||||
variant="outline"
|
||||
type="button"
|
||||
|
||||
@@ -832,6 +832,7 @@ function ContentEditPage() {
|
||||
isDeleting={deleteMutation.isPending}
|
||||
supportsDrafts={collectionConfig.supports.includes("drafts")}
|
||||
supportsRevisions={collectionConfig.supports.includes("revisions")}
|
||||
supportsPreview={collectionConfig.supports.includes("preview")}
|
||||
currentUser={currentUser}
|
||||
users={usersData?.items}
|
||||
onAuthorChange={handleAuthorChange}
|
||||
|
||||
Reference in New Issue
Block a user