Skip to content

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

fix: popup center alignment for web

thecodrra64d9fc05eef
diff --git a/packages/editor/dist/es/toolbar/components/moretools.js b/packages/editor/dist/es/toolbar/components/moretools.js
index 5be9b8cf1..9e9bfb587 100644
--- a/packages/editor/dist/es/toolbar/components/moretools.js
+++ b/packages/editor/dist/es/toolbar/components/moretools.js
@@ -16,7 +16,7 @@ export function MoreTools(props) {
target: isBottom ? getToolbarElement() : buttonRef.current || "mouse",
align: "center",
location: isBottom ? "top" : "below",
- yOffset: isBottom ? 10 : 5,
+ yOffset: 10,
}, autoCloseOnUnmount: autoCloseOnUnmount, focusOnRender: false, blocking: false, renderPopup: () => (_jsx(ToolbarGroup, { tools: tools, editor: editor, sx: {
flex: 1,
// this is intentionally set to a fixed value
diff --git a/packages/editor/dist/es/toolbar/tools/lists.js b/packages/editor/dist/es/toolbar/tools/lists.js
index 53fe30d76..85f0bd7ae 100644
--- a/packages/editor/dist/es/toolbar/tools/lists.js
+++ b/packages/editor/dist/es/toolbar/tools/lists.js
@@ -30,7 +30,7 @@ function _ListTool(props) {
target: isBottom ? getToolbarElement() : buttonRef.current || "mouse",
align: "center",
location: isBottom ? "top" : "below",
- yOffset: isBottom ? 10 : 5,
+ yOffset: 10,
}, onClosed: () => setIsOpen(false), renderPopup: () => (_jsx(Box, Object.assign({ sx: {
bg: "background",
display: "grid",
diff --git a/packages/editor/dist/es/utils/position.js b/packages/editor/dist/es/utils/position.js
index e836417af..bd6843f12 100644
--- a/packages/editor/dist/es/utils/position.js
+++ b/packages/editor/dist/es/utils/position.js
@@ -42,7 +42,7 @@ export function getPosition(element, options) {
position.top = y - elementHeight;
}
if (width && target !== "mouse" && align === "center" && elementWidth > 0) {
- position.left = (width - elementWidth) / 2;
+ position.left -= (elementWidth - width) / 2;
}
else if (width &&
target !== "mouse" &&
diff --git a/packages/editor/src/toolbar/components/more-tools.tsx b/packages/editor/src/toolbar/components/more-tools.tsx
index 3842586c8..6ac3602ae 100644
--- a/packages/editor/src/toolbar/components/more-tools.tsx
+++ b/packages/editor/src/toolbar/components/more-tools.tsx
@@ -37,7 +37,7 @@ export function MoreTools(props: MoreToolsProps) {
target: isBottom ? getToolbarElement() : buttonRef.current || "mouse",
align: "center",
location: isBottom ? "top" : "below",
- yOffset: isBottom ? 10 : 5,
+ yOffset: 10,
}}
autoCloseOnUnmount={autoCloseOnUnmount}
focusOnRender={false}
diff --git a/packages/editor/src/toolbar/tools/lists.tsx b/packages/editor/src/toolbar/tools/lists.tsx
index 3a9567f3d..5ef6daaca 100644
--- a/packages/editor/src/toolbar/tools/lists.tsx
+++ b/packages/editor/src/toolbar/tools/lists.tsx
@@ -53,7 +53,7 @@ function _ListTool<TListStyleTypes extends string>(
target: isBottom ? getToolbarElement() : buttonRef.current || "mouse",
align: "center",
location: isBottom ? "top" : "below",
- yOffset: isBottom ? 10 : 5,
+ yOffset: 10,
}}
onClosed={() => setIsOpen(false)}
renderPopup={() => (
diff --git a/packages/editor/src/utils/position.ts b/packages/editor/src/utils/position.ts
index 034377fd4..b4bde2367 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 = (width - elementWidth) / 2;
+ position.left -= (elementWidth - width) / 2;
} else if (
width &&
target !== "mouse" &&