Skip to content

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

fix: subtoolbar popups are not correctly centered

thecodrr94d644c9f285
diff --git a/packages/editor/src/toolbar/toolbar.tsx b/packages/editor/src/toolbar/toolbar.tsx
index 50653f5a3..5da3245a9 100644
--- a/packages/editor/src/toolbar/toolbar.tsx
+++ b/packages/editor/src/toolbar/toolbar.tsx
@@ -24,7 +24,7 @@ import {
PopupRenderer,
} from "../components/popup-presenter/popuprenderer";
-type ToolbarProps = {
+type ToolbarProps = FlexProps & {
theme: Theme;
editor: Editor | null;
location: ToolbarLocation;
@@ -37,6 +37,8 @@ export function Toolbar(props: ToolbarProps) {
theme,
location,
tools = getDefaultPresets().default,
+ sx,
+ ...flexProps
} = props;
const setToolbarLocation = useToolbarStore(
(store) => store.setToolbarLocation
@@ -53,7 +55,12 @@ export function Toolbar(props: ToolbarProps) {
<PopupRenderer editor={editor}>
<Flex
className="editor-toolbar"
- sx={{ flexWrap: ["nowrap", "wrap"], overflowX: ["auto", "hidden"] }}
+ sx={{
+ ...sx,
+ flexWrap: ["nowrap", "wrap"],
+ overflowX: ["auto", "hidden"],
+ }}
+ {...flexProps}
>
{tools.map((tools) => {
return (
diff --git a/packages/editor/src/utils/position.ts b/packages/editor/src/utils/position.ts
index cc77c5140..034377fd4 100644
--- a/packages/editor/src/utils/position.ts
+++ b/packages/editor/src/utils/position.ts
@@ -78,7 +78,7 @@ export function getPosition(
}
if (width && target !== "mouse" && align === "center" && elementWidth > 0) {
- position.left -= elementWidth / 2 - width / 2;
+ position.left = (width - elementWidth) / 2;
} else if (
width &&
target !== "mouse" &&