Set default project name

This commit is contained in:
Israel Adura 2020-01-05 20:25:29 +00:00
parent 80b0b26f3f
commit 0705efa7bc
2 changed files with 7 additions and 7 deletions

View file

@ -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 });
}

View file

@ -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 = () => {