diff --git a/src/components/ButtonSelect.tsx b/src/components/ButtonSelect.tsx index f7cc1a5d5..c47ff65e7 100644 --- a/src/components/ButtonSelect.tsx +++ b/src/components/ButtonSelect.tsx @@ -23,17 +23,7 @@ export const ButtonSelect = ({ onChange={() => onChange(option.value)} checked={value === option.value} /> - - {option.text} - + {option.text} ))} diff --git a/src/components/Subtypes.tsx b/src/components/Subtypes.tsx index def8b9675..2a9adb089 100644 --- a/src/components/Subtypes.tsx +++ b/src/components/Subtypes.tsx @@ -1,7 +1,6 @@ import { getShortcutKey, updateActiveTool } from "../utils"; import { t } from "../i18n"; import { Action } from "../actions/types"; -import { ToolButton } from "./ToolButton"; import clsx from "clsx"; import { Subtype, @@ -74,17 +73,13 @@ export const SubtypeButton = ( }, keyTest, PanelComponent: ({ elements, appState, updateData, data }) => ( - + > + { + + } + ), }; if (key === "") { diff --git a/src/components/ToolButton.tsx b/src/components/ToolButton.tsx index f3d7098f7..446d154df 100644 --- a/src/components/ToolButton.tsx +++ b/src/components/ToolButton.tsx @@ -43,7 +43,6 @@ type ToolButtonProps = type: "icon"; children?: React.ReactNode; onClick?(): void; - onContextMenu?: React.MouseEventHandler; }) | (ToolButtonBaseProps & { type: "radio"; @@ -121,7 +120,6 @@ export const ToolButton = React.forwardRef((props: ToolButtonProps, ref) => { aria-label={props["aria-label"]} type={type} onClick={onClick} - onContextMenu={props.type === "icon" ? props.onContextMenu : undefined} ref={innerRef} disabled={isLoading || props.isLoading} > diff --git a/src/packages/extensions/ts/mathjax/implementation.tsx b/src/packages/extensions/ts/mathjax/implementation.tsx index d3d23a39b..b271a9f6e 100644 --- a/src/packages/extensions/ts/mathjax/implementation.tsx +++ b/src/packages/extensions/ts/mathjax/implementation.tsx @@ -35,7 +35,7 @@ import { getNonDeletedElements, redrawTextBoundingBox, } from "../../../../element"; -import { ButtonSelect } from "../../../../components/ButtonSelect"; +import { ButtonIconSelect } from "../../../../components/ButtonIconSelect"; // Subtype imports import { @@ -1433,38 +1433,55 @@ const createMathActions = () => { commitToHistory: true, }; }, - PanelComponent: ({ elements, appState, updateData }) => ( -
- {t("labels.changeMathOnly")} - { - const el = hasBoundTextElement(element) - ? getBoundTextElement(element) - : element; - return isMathElement(el) - ? getMathProps.ensureMathProps(el.customData).mathOnly - : null; - }, - getMathProps.getMathOnly(appState), - )} - onChange={(value) => updateData(value)} - /> -
- ), + PanelComponent: ({ elements, appState, updateData }) => { + const textIcon = (text: string, selected: boolean) => { + const color = selected + ? "var(--button-color, var(--color-primary-darker))" + : "var(--button-color, var(--text-primary-color))"; + return ( +
+ + {text.replace(" ", "\n")} + +
+ ); + }; + const value = getFormValue( + elements, + appState, + (element) => { + const el = hasBoundTextElement(element) + ? getBoundTextElement(element) + : element; + return isMathElement(el) + ? getMathProps.ensureMathProps(el.customData).mathOnly + : null; + }, + getMathProps.getMathOnly(appState), + ); + return ( +
+ {t("labels.changeMathOnly")} + updateData(value)} + /> +
+ ); + }, predicate: (...rest) => rest[4] === undefined && enableActionChangeMathProps(rest[0], rest[1]), trackEvent: false,