mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-12-05 03:55:06 +01:00
Merge branch 'master' into mtolmacs/feat/fixed-point-simple-arrow-binding
This commit is contained in:
@@ -352,7 +352,10 @@ export const actionChangeStrokeColor = register<
|
||||
elements={elements}
|
||||
appState={appState}
|
||||
updateData={updateData}
|
||||
compactMode={appState.stylesPanelMode === "compact"}
|
||||
compactMode={
|
||||
appState.stylesPanelMode === "compact" ||
|
||||
appState.stylesPanelMode === "mobile"
|
||||
}
|
||||
/>
|
||||
</>
|
||||
),
|
||||
@@ -434,7 +437,10 @@ export const actionChangeBackgroundColor = register<
|
||||
elements={elements}
|
||||
appState={appState}
|
||||
updateData={updateData}
|
||||
compactMode={appState.stylesPanelMode === "compact"}
|
||||
compactMode={
|
||||
appState.stylesPanelMode === "compact" ||
|
||||
appState.stylesPanelMode === "mobile"
|
||||
}
|
||||
/>
|
||||
</>
|
||||
),
|
||||
@@ -539,9 +545,7 @@ export const actionChangeStrokeWidth = register<
|
||||
},
|
||||
PanelComponent: ({ elements, appState, updateData, app, data }) => (
|
||||
<fieldset>
|
||||
{appState.stylesPanelMode === "full" && (
|
||||
<legend>{t("labels.strokeWidth")}</legend>
|
||||
)}
|
||||
<legend>{t("labels.strokeWidth")}</legend>
|
||||
<div className="buttonList">
|
||||
<RadioSelection
|
||||
group="stroke-width"
|
||||
@@ -598,9 +602,7 @@ export const actionChangeSloppiness = register<ExcalidrawElement["roughness"]>({
|
||||
},
|
||||
PanelComponent: ({ elements, appState, updateData, app, data }) => (
|
||||
<fieldset>
|
||||
{appState.stylesPanelMode === "full" && (
|
||||
<legend>{t("labels.sloppiness")}</legend>
|
||||
)}
|
||||
<legend>{t("labels.sloppiness")}</legend>
|
||||
<div className="buttonList">
|
||||
<RadioSelection
|
||||
group="sloppiness"
|
||||
@@ -655,9 +657,7 @@ export const actionChangeStrokeStyle = register<
|
||||
},
|
||||
PanelComponent: ({ elements, appState, updateData, app, data }) => (
|
||||
<fieldset>
|
||||
{appState.stylesPanelMode === "full" && (
|
||||
<legend>{t("labels.strokeStyle")}</legend>
|
||||
)}
|
||||
<legend>{t("labels.strokeStyle")}</legend>
|
||||
<div className="buttonList">
|
||||
<RadioSelection
|
||||
group="strokeStyle"
|
||||
@@ -734,7 +734,7 @@ export const actionChangeFontSize = register<ExcalidrawTextElement["fontSize"]>(
|
||||
value,
|
||||
);
|
||||
},
|
||||
PanelComponent: ({ elements, appState, updateData, app }) => (
|
||||
PanelComponent: ({ elements, appState, updateData, app, data }) => (
|
||||
<fieldset>
|
||||
<legend>{t("labels.fontSize")}</legend>
|
||||
<div className="buttonList">
|
||||
@@ -793,7 +793,15 @@ export const actionChangeFontSize = register<ExcalidrawTextElement["fontSize"]>(
|
||||
? null
|
||||
: appState.currentItemFontSize || DEFAULT_FONT_SIZE,
|
||||
)}
|
||||
onChange={(value) => updateData(value)}
|
||||
onChange={(value) => {
|
||||
withCaretPositionPreservation(
|
||||
() => updateData(value),
|
||||
appState.stylesPanelMode === "compact" ||
|
||||
appState.stylesPanelMode === "mobile",
|
||||
!!appState.editingTextElement,
|
||||
data?.onPreventClose,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -1059,7 +1067,7 @@ export const actionChangeFontFamily = register<{
|
||||
|
||||
return result;
|
||||
},
|
||||
PanelComponent: ({ elements, appState, app, updateData, data }) => {
|
||||
PanelComponent: ({ elements, appState, app, updateData }) => {
|
||||
const cachedElementsRef = useRef<ElementsMap>(new Map());
|
||||
const prevSelectedFontFamilyRef = useRef<number | null>(null);
|
||||
// relying on state batching as multiple `FontPicker` handlers could be called in rapid succession and we want to combine them
|
||||
@@ -1136,7 +1144,7 @@ export const actionChangeFontFamily = register<{
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<fieldset>
|
||||
<>
|
||||
{appState.stylesPanelMode === "full" && (
|
||||
<legend>{t("labels.fontFamily")}</legend>
|
||||
)}
|
||||
@@ -1144,7 +1152,7 @@ export const actionChangeFontFamily = register<{
|
||||
isOpened={appState.openPopup === "fontFamily"}
|
||||
selectedFontFamily={selectedFontFamily}
|
||||
hoveredFontFamily={appState.currentHoveredFontFamily}
|
||||
compactMode={appState.stylesPanelMode === "compact"}
|
||||
compactMode={appState.stylesPanelMode !== "full"}
|
||||
onSelect={(fontFamily) => {
|
||||
withCaretPositionPreservation(
|
||||
() => {
|
||||
@@ -1156,7 +1164,8 @@ export const actionChangeFontFamily = register<{
|
||||
// defensive clear so immediate close won't abuse the cached elements
|
||||
cachedElementsRef.current.clear();
|
||||
},
|
||||
appState.stylesPanelMode === "compact",
|
||||
appState.stylesPanelMode === "compact" ||
|
||||
appState.stylesPanelMode === "mobile",
|
||||
!!appState.editingTextElement,
|
||||
);
|
||||
}}
|
||||
@@ -1232,7 +1241,8 @@ export const actionChangeFontFamily = register<{
|
||||
|
||||
// Refocus text editor when font picker closes if we were editing text
|
||||
if (
|
||||
appState.stylesPanelMode === "compact" &&
|
||||
(appState.stylesPanelMode === "compact" ||
|
||||
appState.stylesPanelMode === "mobile") &&
|
||||
appState.editingTextElement
|
||||
) {
|
||||
restoreCaretPosition(null); // Just refocus without saved position
|
||||
@@ -1240,7 +1250,7 @@ export const actionChangeFontFamily = register<{
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</fieldset>
|
||||
</>
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -1333,7 +1343,8 @@ export const actionChangeTextAlign = register<TextAlign>({
|
||||
onChange={(value) => {
|
||||
withCaretPositionPreservation(
|
||||
() => updateData(value),
|
||||
appState.stylesPanelMode === "compact",
|
||||
appState.stylesPanelMode === "compact" ||
|
||||
appState.stylesPanelMode === "mobile",
|
||||
!!appState.editingTextElement,
|
||||
data?.onPreventClose,
|
||||
);
|
||||
@@ -1432,7 +1443,8 @@ export const actionChangeVerticalAlign = register<VerticalAlign>({
|
||||
onChange={(value) => {
|
||||
withCaretPositionPreservation(
|
||||
() => updateData(value),
|
||||
appState.stylesPanelMode === "compact",
|
||||
appState.stylesPanelMode === "compact" ||
|
||||
appState.stylesPanelMode === "mobile",
|
||||
!!appState.editingTextElement,
|
||||
data?.onPreventClose,
|
||||
);
|
||||
@@ -1698,8 +1710,8 @@ export const actionChangeArrowProperties = register({
|
||||
PanelComponent: ({ elements, appState, updateData, app, renderAction }) => {
|
||||
return (
|
||||
<div className="selected-shape-actions">
|
||||
{renderAction("changeArrowType")}
|
||||
{renderAction("changeArrowhead")}
|
||||
{renderAction("changeArrowType")}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user