mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Set default project name
This commit is contained in:
parent
80b0b26f3f
commit
0705efa7bc
2 changed files with 7 additions and 7 deletions
|
@ -20,6 +20,10 @@ export default class EditableText extends Component<Props, InputState> {
|
|||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(props: Props) {
|
||||
this.setState({ value: props.value });
|
||||
}
|
||||
|
||||
private handleEdit(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
this.setState({ value: e.target.value });
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ const LOCAL_STORAGE_KEY_STATE = "excalidraw-state";
|
|||
|
||||
const elements = Array.of<ExcalidrawElement>();
|
||||
|
||||
const DEFAULT_PROJECT_NAME = `excalidraw-${getDateTime()}`;
|
||||
|
||||
let skipHistory = false;
|
||||
const stateHistory: string[] = [];
|
||||
function generateHistoryCurrentEntry() {
|
||||
|
@ -991,12 +993,6 @@ class App extends React.Component<{}, AppState> {
|
|||
if (savedState) {
|
||||
this.setState(savedState);
|
||||
}
|
||||
|
||||
// set default name
|
||||
if (!(savedState && savedState.name)) {
|
||||
const name = `excalidraw-${getDateTime()}`;
|
||||
this.setState({ name });
|
||||
}
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
|
@ -1015,7 +1011,7 @@ class App extends React.Component<{}, AppState> {
|
|||
viewBackgroundColor: "#ffffff",
|
||||
scrollX: 0,
|
||||
scrollY: 0,
|
||||
name: ""
|
||||
name: DEFAULT_PROJECT_NAME
|
||||
};
|
||||
|
||||
private onResize = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue