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