Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: frame name field (#7457)

Andran1k626fe252ab0c
diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx
index 30f86c24ee..71bfaa5d55 100644
--- a/packages/excalidraw/components/App.tsx
+++ b/packages/excalidraw/components/App.tsx
@@ -1299,10 +1299,7 @@ class App extends React.Component<AppProps, AppState> {
const FRAME_NAME_EDIT_PADDING = 6;
const reset = () => {
- if (f.name?.trim() === "") {
- mutateElement(f, { name: null });
- }
-
+ mutateElement(f, { name: f.name?.trim() || null });
this.setState({ editingFrame: null });
};
@@ -1325,6 +1322,7 @@ class App extends React.Component<AppProps, AppState> {
name: e.target.value,
});
}}
+ onFocus={(e) => e.target.select()}
onBlur={() => reset()}
onKeyDown={(event) => {
// for some inexplicable reason, `onBlur` triggered on ESC
diff --git a/packages/excalidraw/frame.ts b/packages/excalidraw/frame.ts
index 1457c4ecf7..c4a5a259da 100644
--- a/packages/excalidraw/frame.ts
+++ b/packages/excalidraw/frame.ts
@@ -746,7 +746,7 @@ export const getFrameLikeTitle = (
element: ExcalidrawFrameLikeElement,
frameIdx: number,
) => {
- // TODO name frames AI only is specific to AI frames
+ // TODO name frames "AI" only if specific to AI frames
return element.name === null
? isFrameElement(element)
? `Frame ${frameIdx}`