Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: position of side menu controllers in rtl #922

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const SideMenuController = <
S extends StyleSchema = DefaultStyleSchema
>(props: {
sideMenu?: FC<SideMenuProps<BSchema, I, S>>;
dir?: "rtl" | "ltr";
}) => {
const editor = useBlockNoteEditor<BSchema, I, S>();

Expand All @@ -39,7 +40,7 @@ export const SideMenuController = <
state?.referencePos || null,
1000,
{
placement: "left-start",
placement: props.dir === "rtl" ? "right-start" : "left-start",
}
);

Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/editor/BlockNoteDefaultUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { TableHandlesController } from "../components/TableHandles/TableHandlesC
import { useBlockNoteEditor } from "../hooks/useBlockNoteEditor";

export type BlockNoteDefaultUIProps = {
dir?: "rtl" | "ltr";
formattingToolbar?: boolean;
linkToolbar?: boolean;
slashMenu?: boolean;
Expand All @@ -31,7 +32,7 @@ export function BlockNoteDefaultUI(props: BlockNoteDefaultUIProps) {
{props.slashMenu !== false && (
<SuggestionMenuController triggerCharacter="/" />
)}
{props.sideMenu !== false && <SideMenuController />}
{props.sideMenu !== false && <SideMenuController dir={props.dir} />}
{editor.filePanel && props.filePanel !== false && <FilePanelController />}
{editor.tableHandles && props.tableHandles !== false && (
<TableHandlesController />
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/editor/BlockNoteView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ function BlockNoteViewComponent<
<>
{children}
<BlockNoteDefaultUI
dir={props.dir}
formattingToolbar={formattingToolbar}
linkToolbar={linkToolbar}
slashMenu={slashMenu}
Expand Down
Loading