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;
|
supportsDrafts?: boolean;
|
||||||
/** Whether this collection supports revisions */
|
/** Whether this collection supports revisions */
|
||||||
supportsRevisions?: boolean;
|
supportsRevisions?: boolean;
|
||||||
|
/** Whether this collection supports preview */
|
||||||
|
supportsPreview?: boolean;
|
||||||
/** Current user (for permission checks) */
|
/** Current user (for permission checks) */
|
||||||
currentUser?: CurrentUserInfo;
|
currentUser?: CurrentUserInfo;
|
||||||
/** Available users for author selection (only shown to editors+) */
|
/** Available users for author selection (only shown to editors+) */
|
||||||
@@ -190,6 +192,7 @@ export function ContentEditor({
|
|||||||
isScheduling,
|
isScheduling,
|
||||||
supportsDrafts = false,
|
supportsDrafts = false,
|
||||||
supportsRevisions = false,
|
supportsRevisions = false,
|
||||||
|
supportsPreview = false,
|
||||||
currentUser,
|
currentUser,
|
||||||
users,
|
users,
|
||||||
onAuthorChange,
|
onAuthorChange,
|
||||||
@@ -523,7 +526,7 @@ export function ContentEditor({
|
|||||||
<ArrowsOutSimple className="h-4 w-4" aria-hidden="true" />
|
<ArrowsOutSimple className="h-4 w-4" aria-hidden="true" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!isNew && (
|
{!isNew && supportsPreview && (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -832,6 +832,7 @@ function ContentEditPage() {
|
|||||||
isDeleting={deleteMutation.isPending}
|
isDeleting={deleteMutation.isPending}
|
||||||
supportsDrafts={collectionConfig.supports.includes("drafts")}
|
supportsDrafts={collectionConfig.supports.includes("drafts")}
|
||||||
supportsRevisions={collectionConfig.supports.includes("revisions")}
|
supportsRevisions={collectionConfig.supports.includes("revisions")}
|
||||||
|
supportsPreview={collectionConfig.supports.includes("preview")}
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
users={usersData?.items}
|
users={usersData?.items}
|
||||||
onAuthorChange={handleAuthorChange}
|
onAuthorChange={handleAuthorChange}
|
||||||
|
|||||||
Reference in New Issue
Block a user