Skip to content

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

web: fix editor toolbar scroll styling (#7113)

01zulfi522940815685
diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx
index 36cb12abb..3f1b6d3c1 100644
--- a/apps/web/src/components/editor/tiptap.tsx
+++ b/apps/web/src/components/editor/tiptap.tsx
@@ -369,11 +369,7 @@ function TipTap(props: TipTapProps) {
<Toolbar
editor={editor}
location={"top"}
- sx={
- isTablet || isMobile
- ? { overflowX: "scroll", flexWrap: "nowrap" }
- : {}
- }
+ sx={isTablet || isMobile ? { flexWrap: "nowrap" } : {}}
tools={toolbarConfig}
defaultFontFamily={fontFamily}
defaultFontSize={fontSize}
diff --git a/packages/editor/src/toolbar/toolbar.tsx b/packages/editor/src/toolbar/toolbar.tsx
index 8d90a71dc..43c522feb 100644
--- a/packages/editor/src/toolbar/toolbar.tsx
+++ b/packages/editor/src/toolbar/toolbar.tsx
@@ -34,6 +34,7 @@ import {
useToolbarStore
} from "./stores/toolbar-store.js";
import { ToolbarDefinition } from "./types.js";
+import { ScrollContainer } from "@notesnook/ui";
type ToolbarProps = FlexProps & {
editor: Editor;
@@ -89,34 +90,44 @@ export function Toolbar(props: ToolbarProps) {
return (
<>
- <Flex
- className={["editor-toolbar", className].join(" ")}
- sx={{
- flexWrap: isMobile ? "nowrap" : "wrap",
- overflowX: isMobile ? "auto" : "hidden",
- bg: "background",
- borderRadius: isMobile ? "0px" : "default",
- ...sx
- }}
- {...flexProps}
- >
- {toolbarTools.map((tools) => {
- return (
- <ToolbarGroup
- key={tools.join("")}
- tools={tools}
- editor={editor}
- groupId={tools.join("")}
- sx={{
- borderRight: "1px solid var(--separator)",
- ":last-of-type": { borderRight: "none" },
- alignItems: "center"
- }}
- />
- );
+ <ScrollContainer
+ className="tabsScroll"
+ suppressScrollY
+ style={{ flex: 1 }}
+ trackStyle={() => ({
+ backgroundColor: "transparent",
+ pointerEvents: "none"
})}
- </Flex>
- <EditorFloatingMenus editor={editor} />
+ thumbStyle={() => ({ height: 3 })}
+ >
+ <Flex
+ className={["editor-toolbar", className].join(" ")}
+ sx={{
+ flexWrap: isMobile ? "nowrap" : "wrap",
+ bg: "background",
+ borderRadius: isMobile ? "0px" : "default",
+ ...sx
+ }}
+ {...flexProps}
+ >
+ {toolbarTools.map((tools) => {
+ return (
+ <ToolbarGroup
+ key={tools.join("")}
+ tools={tools}
+ editor={editor}
+ groupId={tools.join("")}
+ sx={{
+ borderRight: "1px solid var(--separator)",
+ ":last-of-type": { borderRight: "none" },
+ alignItems: "center"
+ }}
+ />
+ );
+ })}
+ </Flex>
+ <EditorFloatingMenus editor={editor} />
+ </ScrollContainer>
</>
);
}