Add 'Find and replace' option to menu on mobile (#6368)

This commit is contained in:
Tom Moor
2024-01-10 05:07:05 -08:00
committed by GitHub
parent 7d7d0fd9ca
commit 6e1347c2a7
4 changed files with 62 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
import { observer } from "mobx-react";
import { EditIcon, RestoreIcon } from "outline-icons";
import { EditIcon, RestoreIcon, SearchIcon } from "outline-icons";
import * as React from "react";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
@@ -64,6 +64,7 @@ type Props = {
showToggleEmbeds?: boolean;
showPin?: boolean;
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
onFindAndReplace?: () => void;
onRename?: () => void;
onOpen?: () => void;
onClose?: () => void;
@@ -76,6 +77,7 @@ function DocumentMenu({
showToggleEmbeds,
showDisplayOptions,
label,
onFindAndReplace,
onRename,
onOpen,
onClose,
@@ -259,6 +261,13 @@ function DocumentMenu({
actionToMenuItem(subscribeDocument, context),
actionToMenuItem(unsubscribeDocument, context),
...(isMobile ? [actionToMenuItem(shareDocument, context)] : []),
{
type: "button",
title: `${t("Find and replace")}`,
visible: !!onFindAndReplace && isMobile,
onClick: () => onFindAndReplace?.(),
icon: <SearchIcon />,
},
{
type: "separator",
},