From 21dcde44a15354f060fad5f6c0e95f8187be8be0 Mon Sep 17 00:00:00 2001 From: Meier Lukas Date: Wed, 15 Nov 2023 06:39:40 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Notebook=20edit=20button=20place?= =?UTF-8?q?d=20above=20edit=20mode=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widgets/notebook/NotebookEditor.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/notebook/NotebookEditor.tsx b/src/widgets/notebook/NotebookEditor.tsx index 63ca613107e..a9faf7f2df7 100644 --- a/src/widgets/notebook/NotebookEditor.tsx +++ b/src/widgets/notebook/NotebookEditor.tsx @@ -52,6 +52,7 @@ import StarterKit from '@tiptap/starter-kit'; import { useSession } from 'next-auth/react'; import { useTranslation } from 'next-i18next'; import { Dispatch, SetStateAction, useState } from 'react'; +import { useEditModeStore } from '~/components/Dashboard/Views/useEditModeStore'; import { useConfigContext } from '~/config/provider'; import { useConfigStore } from '~/config/store'; import { api } from '~/utils/api'; @@ -62,9 +63,10 @@ import { INotebookWidget } from './NotebookWidgetTile'; export function Editor({ widget }: { widget: INotebookWidget }) { const [content, setContent] = useState(widget.properties.content); const [toSaveContent, setToSaveContent] = useState(content); + const isEditMode = useEditModeStore((x) => x.enabled); const { data: sessionData } = useSession(); - const enabled = !!sessionData?.user.isAdmin; + const enabled = !!sessionData?.user.isAdmin && !isEditMode; const [isEditing, setIsEditing] = useState(false); const { config, name: configName } = useConfigContext();