diff --git a/apps/client/src/ee/ai/components/editor/ai-menu/ai-menu.tsx b/apps/client/src/ee/ai/components/editor/ai-menu/ai-menu.tsx index 9ff1b7ac..1c1cd7e1 100644 --- a/apps/client/src/ee/ai/components/editor/ai-menu/ai-menu.tsx +++ b/apps/client/src/ee/ai/components/editor/ai-menu/ai-menu.tsx @@ -52,16 +52,34 @@ const EditorAiMenu = ({ editor }: EditorAiMenuProps): JSX.Element | null => { if (!editor || !showAiMenu) return; const { view } = editor; - const { to } = editor.state.selection; + const { from, to } = editor.state.selection; const editorRect = view.dom.getBoundingClientRect(); - const cursorCoords = view.coordsAtPos(to); + const fromCoords = view.coordsAtPos(from); + const toCoords = view.coordsAtPos(to); const topOffset = 8; const editorPadding = isSmBreakpoint ? 16 : 48; + const anchorBottom = + toCoords.bottom > 0 && toCoords.bottom < window.innerHeight + ? toCoords.bottom + : fromCoords.bottom; + + const menuMaxWidth = 600; + const editorLeft = editorRect.left + editorPadding; + const editorRight = editorRect.right - editorPadding; + const availableWidth = editorRight - editorLeft; + const menuWidth = Math.min(menuMaxWidth, availableWidth); + + let menuLeft = Math.max(editorLeft, fromCoords.left); + if (menuLeft + menuWidth > editorRight) { + menuLeft = editorRight - menuWidth; + } + menuLeft = Math.max(editorLeft, menuLeft); + setMenuPlacement({ - top: cursorCoords.bottom + topOffset + window.scrollY, - left: editorRect.left + editorPadding + window.scrollX, - width: editorRect.width - editorPadding * 2, + top: anchorBottom + topOffset + window.scrollY, + left: menuLeft + window.scrollX, + width: menuWidth, }); }, [editor, showAiMenu, isSmBreakpoint]); const resetMenu = useCallback(() => { diff --git a/apps/client/src/ee/licence/components/oss-details.tsx b/apps/client/src/ee/licence/components/oss-details.tsx index 9950bcbf..e08db649 100644 --- a/apps/client/src/ee/licence/components/oss-details.tsx +++ b/apps/client/src/ee/licence/components/oss-details.tsx @@ -3,12 +3,13 @@ import { IconCheck } from "@tabler/icons-react"; const enterpriseFeatures = [ "SSO (SAML, OIDC, LDAP)", - "Multi-factor Authentication", + "AI Integration (Search & Assistant)", "Page-level Permissions", "Audit Logs", "API Keys", - "AI Integration", "MCP Support", + "Multi-factor Authentication (2FA)", + "Enterprise Controls", "Advanced Search Engine Support", "Full-text Search in Attachments (PDF, DOCX)", "Resolve Comments", @@ -67,8 +68,7 @@ export default function OssDetails() { - Contact sales@docmost.com for - enquiries. + Contact sales@docmost.com to purchase an enterprise license.