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