refactor: remove unnecessary if condition for linear element onKeyDown (#5486)

* refactor: remove unnecessary if condition for linear element onKeyDown

* fix
This commit is contained in:
Aakansha Doshi 2022-07-26 16:33:13 +05:30 committed by GitHub
parent f8b4bb66b4
commit 339212e563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1872,13 +1872,12 @@ class App extends React.Component<AppProps, AppState> {
this.state, this.state,
); );
if ( if (selectedElements.length === 1) {
selectedElements.length === 1 && if (isLinearElement(selectedElements[0])) {
isLinearElement(selectedElements[0])
) {
if ( if (
!this.state.editingLinearElement || !this.state.editingLinearElement ||
this.state.editingLinearElement.elementId !== selectedElements[0].id this.state.editingLinearElement.elementId !==
selectedElements[0].id
) { ) {
this.history.resumeRecording(); this.history.resumeRecording();
this.setState({ this.setState({
@ -1888,10 +1887,7 @@ class App extends React.Component<AppProps, AppState> {
), ),
}); });
} }
} else if ( } else {
selectedElements.length === 1 &&
!isLinearElement(selectedElements[0])
) {
const selectedElement = selectedElements[0]; const selectedElement = selectedElements[0];
this.startTextEditing({ this.startTextEditing({
@ -1902,6 +1898,7 @@ class App extends React.Component<AppProps, AppState> {
event.preventDefault(); event.preventDefault();
return; return;
} }
}
} else if ( } else if (
!event.ctrlKey && !event.ctrlKey &&
!event.altKey && !event.altKey &&