mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix: frame name field (#7457)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
parent
10bd08ef19
commit
626fe252ab
2 changed files with 3 additions and 5 deletions
|
@ -1299,10 +1299,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
const FRAME_NAME_EDIT_PADDING = 6;
|
const FRAME_NAME_EDIT_PADDING = 6;
|
||||||
|
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
if (f.name?.trim() === "") {
|
mutateElement(f, { name: f.name?.trim() || null });
|
||||||
mutateElement(f, { name: null });
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({ editingFrame: null });
|
this.setState({ editingFrame: null });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1325,6 +1322,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
name: e.target.value,
|
name: e.target.value,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
onFocus={(e) => e.target.select()}
|
||||||
onBlur={() => reset()}
|
onBlur={() => reset()}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
// for some inexplicable reason, `onBlur` triggered on ESC
|
// for some inexplicable reason, `onBlur` triggered on ESC
|
||||||
|
|
|
@ -746,7 +746,7 @@ export const getFrameLikeTitle = (
|
||||||
element: ExcalidrawFrameLikeElement,
|
element: ExcalidrawFrameLikeElement,
|
||||||
frameIdx: number,
|
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
|
return element.name === null
|
||||||
? isFrameElement(element)
|
? isFrameElement(element)
|
||||||
? `Frame ${frameIdx}`
|
? `Frame ${frameIdx}`
|
||||||
|
|
Loading…
Add table
Reference in a new issue