mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
editor: enable preview attachment button on desktop
This commit is contained in:
committed by
Abdullah Atta
parent
85484b1762
commit
cc9141c981
@@ -87,7 +87,11 @@ export function AttachmentComponent(
|
||||
{selected && (
|
||||
<ToolbarGroup
|
||||
editor={editor}
|
||||
tools={["removeAttachment", "downloadAttachment"]}
|
||||
tools={[
|
||||
"removeAttachment",
|
||||
"downloadAttachment",
|
||||
"previewAttachment"
|
||||
]}
|
||||
sx={{
|
||||
boxShadow: "menu",
|
||||
borderRadius: "default",
|
||||
|
||||
@@ -351,6 +351,7 @@ export function getDefaultPresets() {
|
||||
return defaultPresets;
|
||||
}
|
||||
|
||||
export const MOBILE_ONLY_TOOLS: ToolbarDefinition = [["previewAttachment"]];
|
||||
export const STATIC_TOOLBAR_GROUPS: ToolbarDefinition = [
|
||||
[
|
||||
"insertBlock",
|
||||
@@ -358,7 +359,6 @@ export const STATIC_TOOLBAR_GROUPS: ToolbarDefinition = [
|
||||
"cellProperties",
|
||||
"imageSettings",
|
||||
"embedSettings",
|
||||
"previewAttachment",
|
||||
"attachmentSettings",
|
||||
"linkSettings",
|
||||
"codeRemove",
|
||||
|
||||
@@ -22,7 +22,11 @@ import { Editor } from "../types";
|
||||
import { Flex, FlexProps } from "@theme-ui/components";
|
||||
import { ThemeProvider } from "@emotion/react";
|
||||
import { EditorFloatingMenus } from "./floating-menus";
|
||||
import { getDefaultPresets, STATIC_TOOLBAR_GROUPS } from "./tool-definitions";
|
||||
import {
|
||||
getDefaultPresets,
|
||||
STATIC_TOOLBAR_GROUPS,
|
||||
MOBILE_ONLY_TOOLS
|
||||
} from "./tool-definitions";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import {
|
||||
ToolbarLocation,
|
||||
@@ -56,12 +60,14 @@ export function Toolbar(props: ToolbarProps) {
|
||||
sx,
|
||||
...flexProps
|
||||
} = props;
|
||||
const toolbarTools = useMemo(
|
||||
() => [...STATIC_TOOLBAR_GROUPS, ...tools],
|
||||
[tools]
|
||||
);
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
const toolbarTools = useMemo(
|
||||
() =>
|
||||
isMobile
|
||||
? [...STATIC_TOOLBAR_GROUPS, ...MOBILE_ONLY_TOOLS, ...tools]
|
||||
: [...STATIC_TOOLBAR_GROUPS, ...tools],
|
||||
[tools, isMobile]
|
||||
);
|
||||
|
||||
const setToolbarLocation = useToolbarStore(
|
||||
(store) => store.setToolbarLocation
|
||||
|
||||
Reference in New Issue
Block a user