fix: Show more header options in edit mode
This commit is contained in:
@@ -104,7 +104,6 @@ function DocumentHeader({
|
|||||||
const { isDeleted, isTemplate } = document;
|
const { isDeleted, isTemplate } = document;
|
||||||
const can = usePolicy(document?.id);
|
const can = usePolicy(document?.id);
|
||||||
const canToggleEmbeds = team?.documentEmbeds;
|
const canToggleEmbeds = team?.documentEmbeds;
|
||||||
const canEdit = can.update && !isEditing;
|
|
||||||
const toc = (
|
const toc = (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
tooltip={ui.tocVisible ? t("Hide contents") : t("Show contents")}
|
tooltip={ui.tocVisible ? t("Hide contents") : t("Show contents")}
|
||||||
@@ -185,7 +184,7 @@ function DocumentHeader({
|
|||||||
actions={
|
actions={
|
||||||
<>
|
<>
|
||||||
{appearanceAction}
|
{appearanceAction}
|
||||||
{canEdit ? editAction : <div />}
|
{can.update && !isEditing ? editAction : <div />}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -250,45 +249,56 @@ function DocumentHeader({
|
|||||||
disabled={savingIsDisabled}
|
disabled={savingIsDisabled}
|
||||||
neutral={isDraft}
|
neutral={isDraft}
|
||||||
>
|
>
|
||||||
{isDraft ? t("Save Draft") : t("Done Editing")}
|
{isDraft ? t("Save draft") : t("Done editing")}
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Action>
|
</Action>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{canEdit && !team?.seamlessEditing && !isRevision && editAction}
|
{can.update &&
|
||||||
{canEdit && can.createChildDocument && !isRevision && !isMobile && (
|
!isEditing &&
|
||||||
<Action>
|
!team?.seamlessEditing &&
|
||||||
<NewChildDocumentMenu
|
!isRevision &&
|
||||||
document={document}
|
editAction}
|
||||||
label={(props) => (
|
{can.update &&
|
||||||
<Tooltip
|
can.createChildDocument &&
|
||||||
tooltip={t("New document")}
|
!isRevision &&
|
||||||
shortcut="n"
|
!isMobile && (
|
||||||
delay={500}
|
<Action>
|
||||||
placement="bottom"
|
<NewChildDocumentMenu
|
||||||
>
|
document={document}
|
||||||
<Button icon={<PlusIcon />} {...props} neutral>
|
label={(props) => (
|
||||||
{t("New doc")}
|
<Tooltip
|
||||||
</Button>
|
tooltip={t("New document")}
|
||||||
</Tooltip>
|
shortcut="n"
|
||||||
)}
|
delay={500}
|
||||||
/>
|
placement="bottom"
|
||||||
</Action>
|
>
|
||||||
)}
|
<Button icon={<PlusIcon />} {...props} neutral>
|
||||||
{canEdit && isTemplate && !isDraft && !isRevision && (
|
{t("New doc")}
|
||||||
<Action>
|
</Button>
|
||||||
<Button
|
</Tooltip>
|
||||||
icon={<PlusIcon />}
|
)}
|
||||||
as={Link}
|
/>
|
||||||
to={newDocumentPath(document.collectionId, {
|
</Action>
|
||||||
templateId: document.id,
|
)}
|
||||||
})}
|
{can.update &&
|
||||||
>
|
!isEditing &&
|
||||||
{t("New from template")}
|
isTemplate &&
|
||||||
</Button>
|
!isDraft &&
|
||||||
</Action>
|
!isRevision && (
|
||||||
)}
|
<Action>
|
||||||
|
<Button
|
||||||
|
icon={<PlusIcon />}
|
||||||
|
as={Link}
|
||||||
|
to={newDocumentPath(document.collectionId, {
|
||||||
|
templateId: document.id,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{t("New from template")}
|
||||||
|
</Button>
|
||||||
|
</Action>
|
||||||
|
)}
|
||||||
{revision && revision.createdAt !== document.updatedAt && (
|
{revision && revision.createdAt !== document.updatedAt && (
|
||||||
<Action>
|
<Action>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@@ -318,27 +328,23 @@ function DocumentHeader({
|
|||||||
{document.collectionId ? t("Publish") : `${t("Publish")}…`}
|
{document.collectionId ? t("Publish") : `${t("Publish")}…`}
|
||||||
</Button>
|
</Button>
|
||||||
</Action>
|
</Action>
|
||||||
{!isEditing && (
|
{!isDeleted && <Separator />}
|
||||||
<>
|
<Action>
|
||||||
{!isDeleted && <Separator />}
|
<DocumentMenu
|
||||||
<Action>
|
document={document}
|
||||||
<DocumentMenu
|
isRevision={isRevision}
|
||||||
document={document}
|
label={(props) => (
|
||||||
isRevision={isRevision}
|
<Button
|
||||||
label={(props) => (
|
icon={<MoreIcon />}
|
||||||
<Button
|
{...props}
|
||||||
icon={<MoreIcon />}
|
borderOnHover
|
||||||
{...props}
|
neutral
|
||||||
borderOnHover
|
|
||||||
neutral
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
showToggleEmbeds={canToggleEmbeds}
|
|
||||||
showDisplayOptions
|
|
||||||
/>
|
/>
|
||||||
</Action>
|
)}
|
||||||
</>
|
showToggleEmbeds={canToggleEmbeds}
|
||||||
)}
|
showDisplayOptions
|
||||||
|
/>
|
||||||
|
</Action>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -502,8 +502,8 @@
|
|||||||
"Switch to dark": "Switch to dark",
|
"Switch to dark": "Switch to dark",
|
||||||
"Switch to light": "Switch to light",
|
"Switch to light": "Switch to light",
|
||||||
"Archived": "Archived",
|
"Archived": "Archived",
|
||||||
"Save Draft": "Save Draft",
|
"Save draft": "Save draft",
|
||||||
"Done Editing": "Done Editing",
|
"Done editing": "Done editing",
|
||||||
"New from template": "New from template",
|
"New from template": "New from template",
|
||||||
"Restore version": "Restore version",
|
"Restore version": "Restore version",
|
||||||
"No history yet": "No history yet",
|
"No history yet": "No history yet",
|
||||||
|
|||||||
Reference in New Issue
Block a user