chore: Move document embed switching to toggle

This commit is contained in:
Tom Moor
2022-04-16 21:22:45 -07:00
parent b1aba32b62
commit 1e1a57d246

View File

@ -14,7 +14,6 @@ import {
ImportIcon,
NewDocumentIcon,
DownloadIcon,
BuildingBlocksIcon,
RestoreIcon,
CrossIcon,
} from "outline-icons";
@ -410,20 +409,6 @@ function DocumentMenu({
visible: can.permanentDelete,
icon: <CrossIcon />,
},
{
type: "button",
title: t("Enable embeds"),
onClick: document.enableEmbeds,
visible: !!showToggleEmbeds && document.embedsDisabled,
icon: <BuildingBlocksIcon />,
},
{
type: "button",
title: t("Disable embeds"),
onClick: document.disableEmbeds,
visible: !!showToggleEmbeds && !document.embedsDisabled,
icon: <BuildingBlocksIcon />,
},
{
type: "separator",
},
@ -452,21 +437,38 @@ function DocumentMenu({
},
]}
/>
{showDisplayOptions && !isMobile && (
{(showDisplayOptions || showToggleEmbeds) && (
<>
<Separator />
<Style>
<ToggleMenuItem
width={26}
height={14}
label={t("Full width")}
checked={document.fullWidth}
onChange={(ev) => {
document.fullWidth = ev.currentTarget.checked;
document.save();
}}
/>
</Style>
{showToggleEmbeds && (
<Style>
<ToggleMenuItem
width={26}
height={14}
label={t("Enable embeds")}
checked={!document.embedsDisabled}
onChange={
document.embedsDisabled
? document.enableEmbeds
: document.disableEmbeds
}
/>
</Style>
)}
{showDisplayOptions && !isMobile && (
<Style>
<ToggleMenuItem
width={26}
height={14}
label={t("Full width")}
checked={document.fullWidth}
onChange={(ev) => {
document.fullWidth = ev.currentTarget.checked;
document.save();
}}
/>
</Style>
)}
</>
)}
</ContextMenu>