|
|
|
@ -145,6 +145,7 @@ const changeFontSize = (
|
|
|
|
|
elements: readonly ExcalidrawElement[],
|
|
|
|
|
appState: AppState,
|
|
|
|
|
getNewFontSize: (element: ExcalidrawTextElement) => number,
|
|
|
|
|
fallbackValue?: ExcalidrawTextElement["fontSize"],
|
|
|
|
|
) => {
|
|
|
|
|
const newFontSizes = new Set<number>();
|
|
|
|
|
|
|
|
|
@ -182,7 +183,7 @@ const changeFontSize = (
|
|
|
|
|
currentItemFontSize:
|
|
|
|
|
newFontSizes.size === 1
|
|
|
|
|
? [...newFontSizes][0]
|
|
|
|
|
: appState.currentItemFontSize,
|
|
|
|
|
: fallbackValue ?? appState.currentItemFontSize,
|
|
|
|
|
},
|
|
|
|
|
commitToHistory: true,
|
|
|
|
|
};
|
|
|
|
@ -520,7 +521,7 @@ export const actionChangeOpacity = register({
|
|
|
|
|
export const actionChangeFontSize = register({
|
|
|
|
|
name: "changeFontSize",
|
|
|
|
|
perform: (elements, appState, value) => {
|
|
|
|
|
return changeFontSize(elements, appState, () => value);
|
|
|
|
|
return changeFontSize(elements, appState, () => value, value);
|
|
|
|
|
},
|
|
|
|
|
PanelComponent: ({ elements, appState, updateData }) => (
|
|
|
|
|
<fieldset>
|
|
|
|
@ -532,21 +533,25 @@ export const actionChangeFontSize = register({
|
|
|
|
|
value: 16,
|
|
|
|
|
text: t("labels.small"),
|
|
|
|
|
icon: <FontSizeSmallIcon theme={appState.theme} />,
|
|
|
|
|
testId: "fontSize-small",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 20,
|
|
|
|
|
text: t("labels.medium"),
|
|
|
|
|
icon: <FontSizeMediumIcon theme={appState.theme} />,
|
|
|
|
|
testId: "fontSize-medium",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 28,
|
|
|
|
|
text: t("labels.large"),
|
|
|
|
|
icon: <FontSizeLargeIcon theme={appState.theme} />,
|
|
|
|
|
testId: "fontSize-large",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 36,
|
|
|
|
|
text: t("labels.veryLarge"),
|
|
|
|
|
icon: <FontSizeExtraLargeIcon theme={appState.theme} />,
|
|
|
|
|
testId: "fontSize-veryLarge",
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
value={getFormValue(
|
|
|
|
|