From d48d909ce3387c52b329b96ff62fa936886a830d Mon Sep 17 00:00:00 2001 From: thecodrr Date: Thu, 31 Dec 2020 16:07:37 +0500 Subject: [PATCH] fix: properties should not be usable when no note is open --- apps/web/src/components/editor/toolbar.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/editor/toolbar.js b/apps/web/src/components/editor/toolbar.js index a06027945..35148a6d5 100644 --- a/apps/web/src/components/editor/toolbar.js +++ b/apps/web/src/components/editor/toolbar.js @@ -77,10 +77,27 @@ function Toolbar(props) { title: "Properties", icon: Icon.Properties, enabled: true, - onClick: toggleProperties, + onClick: () => { + if (!sessionId) { + showToast( + "error", + "Please start writing a note to use properties." + ); + return; + } + toggleProperties(); + }, }, ], - [quill, redoable, undoable, toggleFocusMode, toggleProperties, isFocusMode] + [ + quill, + redoable, + undoable, + toggleFocusMode, + toggleProperties, + isFocusMode, + sessionId, + ] ); return (