Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix behavior of editor action bar

Abdullah Atta3e0d9f92af45
diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsx
index ff4bb9be1..b90546763 100644
--- a/apps/web/src/components/editor/action-bar.tsx
+++ b/apps/web/src/components/editor/action-bar.tsx
@@ -82,19 +82,6 @@ export function EditorActionBar() {
enabled: true,
onClick: () => useEditorStore.getState().toggleEditorMargins()
},
- {
- title: isFocusMode ? "Normal mode" : "Focus mode",
- icon: isFocusMode ? FocusMode : NormalMode,
- enabled: true,
- hideOnMobile: true,
- onClick: () => {
- useAppStore.getState().toggleFocusMode();
- if (document.fullscreenElement) exitFullscreen();
- const id = useEditorStore.getState().activeSessionId;
- const editor = id && useEditorManager.getState().getEditor(id);
- if (editor) editor.editor?.focus();
- }
- },
{
title: isFullscreen ? "Exit fullscreen" : "Enter fullscreen",
icon: isFullscreen ? ExitFullscreen : Fullscreen,
@@ -110,13 +97,28 @@ export function EditorActionBar() {
setIsFullscreen((s) => !s);
}
},
+ {
+ title: isFocusMode ? "Normal mode" : "Focus mode",
+ icon: isFocusMode ? FocusMode : NormalMode,
+ enabled: true,
+ hideOnMobile: true,
+ onClick: () => {
+ useAppStore.getState().toggleFocusMode();
+ if (document.fullscreenElement) exitFullscreen();
+ const id = useEditorStore.getState().activeSessionId;
+ const editor = id && useEditorManager.getState().getEditor(id);
+ if (editor) editor.editor?.focus();
+ }
+ },
{
title: "Table of contents",
icon: TableOfContents,
enabled:
activeSession &&
activeSession.type !== "new" &&
- activeSession.type !== "locked",
+ activeSession.type !== "locked" &&
+ activeSession.type !== "diff" &&
+ activeSession.type !== "conflicted",
onClick: () => useEditorStore.getState().toggleTableOfContents()
},
{
@@ -126,7 +128,9 @@ export function EditorActionBar() {
activeSession &&
activeSession.type !== "new" &&
activeSession.type !== "locked" &&
- activeSession.type !== "readonly",
+ activeSession.type !== "readonly" &&
+ activeSession.type !== "diff" &&
+ activeSession.type !== "conflicted",
onClick: editor?.startSearch
},
{
@@ -135,9 +139,9 @@ export function EditorActionBar() {
enabled:
activeSession &&
activeSession.type !== "new" &&
- activeSession.type !== "readonly" &&
activeSession.type !== "locked" &&
activeSession.type !== "diff" &&
+ activeSession.type !== "conflicted" &&
!isFocusMode,
onClick: () => useEditorStore.getState().toggleProperties()
}