Skip to content

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

editor: show (empty) toolbar in readonly mode

Abdullah Attad1b532a4aecc
diff --git a/packages/editor/src/toolbar/floating-menus/search-replace.tsx b/packages/editor/src/toolbar/floating-menus/search-replace.tsx
index 657e162bf..501706085 100644
--- a/packages/editor/src/toolbar/floating-menus/search-replace.tsx
+++ b/packages/editor/src/toolbar/floating-menus/search-replace.tsx
@@ -21,7 +21,7 @@ import { useLayoutEffect } from "react";
import { FloatingMenuProps } from "./types";
import { SearchReplacePopup } from "../popups/search-replace";
import { ResponsivePresenter } from "../../components/responsive";
-import { getEditorContainer, getToolbarElement } from "../utils/dom";
+import { getToolbarElement } from "../utils/dom";
import { useEditorSearchStore } from "../stores/search-store";
export function SearchReplaceFloatingMenu(props: FloatingMenuProps) {
@@ -41,11 +41,11 @@ export function SearchReplaceFloatingMenu(props: FloatingMenuProps) {
isOpen={isSearching}
onClose={() => editor.commands.endSearch()}
position={{
- target: editor.isEditable ? getToolbarElement() : getEditorContainer(),
+ target: getToolbarElement(),
isTargetAbsolute: true,
- location: editor.isEditable ? "below" : "top",
+ location: "below",
align: "end",
- yOffset: editor.isEditable ? 5 : -50
+ yOffset: 5
}}
blocking={false}
focusOnRender={false}
diff --git a/packages/editor/src/toolbar/toolbar.tsx b/packages/editor/src/toolbar/toolbar.tsx
index 4b06da6f4..59e69b767 100644
--- a/packages/editor/src/toolbar/toolbar.tsx
+++ b/packages/editor/src/toolbar/toolbar.tsx
@@ -61,7 +61,9 @@ export function Toolbar(props: ToolbarProps) {
? editor.isEditable
? [...MOBILE_STATIC_TOOLBAR_GROUPS, ...tools]
: READONLY_MOBILE_STATIC_TOOLBAR_GROUPS
- : [...STATIC_TOOLBAR_GROUPS, ...tools],
+ : editor.isEditable
+ ? [...STATIC_TOOLBAR_GROUPS, ...tools]
+ : [],
[tools, editor.isEditable, isMobile]
);