A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: apply font family to font family menu
thecodrr342692436f57
diff --git a/packages/editor/src/components/menu/menu-button.tsx b/packages/editor/src/components/menu/menu-button.tsxindex f0caf4d03..5dd00d0e7 100644--- a/packages/editor/src/components/menu/menu-button.tsx+++ b/packages/editor/src/components/menu/menu-button.tsx@@ -16,8 +16,17 @@ type MenuButtonProps = {export function MenuButton(props: MenuButtonProps) {const { item, isFocused, onMouseEnter, onMouseLeave, onClick } = props;- const { title, key, icon, tooltip, isDisabled, isChecked, menu, modifier } =- item;+ const {+ title,+ key,+ icon,+ tooltip,+ isDisabled,+ isChecked,+ menu,+ modifier,+ styles,+ } = item;const itemRef = useRef<HTMLButtonElement>(null);const toolbarLocation = useToolbarLocation();const isBottom = toolbarLocation === "bottom";@@ -40,6 +49,7 @@ export function MenuButton(props: MenuButtonProps) {disabled={isDisabled}onClick={onClick}sx={{+ ...styles,bg: isFocused && !isBottom ? "hover" : "transparent",display: "flex",alignItems: "center",@@ -49,7 +59,7 @@ export function MenuButton(props: MenuButtonProps) {},}}>- <Flex>+ <Flex sx={{ fontSize: "inherit", fontFamily: "inherit" }}>{icon && (<Iconpath={Icons[icon]}@@ -58,7 +68,11 @@ export function MenuButton(props: MenuButtonProps) {sx={{ mr: 2 }}/>)}- <Text as="span" variant={"body"} sx={{ fontSize: "inherit" }}>+ <Text+ as="span"+ variant={"body"}+ sx={{ fontSize: "inherit", fontFamily: "inherit" }}+ >{title}</Text></Flex>diff --git a/packages/editor/src/components/menu/types.ts b/packages/editor/src/components/menu/types.tsindex 30858eba8..9a4d30be4 100644--- a/packages/editor/src/components/menu/types.ts+++ b/packages/editor/src/components/menu/types.ts@@ -1,3 +1,4 @@+import { SxStyleProp } from "rebass";import { IconNames } from "../../toolbar/icons";type MenuItemComponentProps = {@@ -26,6 +27,7 @@ export type MenuButton = BaseMenuItem<"button"> & {isChecked?: boolean;modifier?: string;menu?: { title: string; items: MenuItem[] };+ styles?: SxStyleProp;};export type MenuItem = MenuButton | MenuSeperator | MenuPopup;diff --git a/packages/editor/src/toolbar/tools/font.tsx b/packages/editor/src/toolbar/tools/font.tsxindex 30b8301f8..2e29530b2 100644--- a/packages/editor/src/toolbar/tools/font.tsx+++ b/packages/editor/src/toolbar/tools/font.tsx@@ -78,6 +78,9 @@ function toMenuItems(editor: Editor, currentFontFamily: string): MenuItem[] {title: key,isChecked: key === currentFontFamily,onClick: () => editor.current?.chain().focus().setFontFamily(value).run(),+ styles: {+ fontFamily: value,+ },});}return menuItems;