mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Fix click while renaming project item and warning when name is not changed
This commit is contained in:
@@ -561,7 +561,7 @@ class MainFrame extends React.Component<Props, State> {
|
||||
const { i18n } = this.props;
|
||||
if (!currentProject) return;
|
||||
|
||||
if (!currentProject.hasLayoutNamed(oldName)) return;
|
||||
if (!currentProject.hasLayoutNamed(oldName) || newName === oldName) return;
|
||||
|
||||
if (currentProject.hasLayoutNamed(newName)) {
|
||||
showWarningBox(i18n._(t`Another scene with this name already exists.`));
|
||||
@@ -585,7 +585,8 @@ class MainFrame extends React.Component<Props, State> {
|
||||
const { i18n } = this.props;
|
||||
if (!currentProject) return;
|
||||
|
||||
if (!currentProject.hasExternalLayoutNamed(oldName)) return;
|
||||
if (!currentProject.hasExternalLayoutNamed(oldName) || newName === oldName)
|
||||
return;
|
||||
|
||||
if (currentProject.hasExternalLayoutNamed(newName)) {
|
||||
showWarningBox(
|
||||
@@ -614,7 +615,8 @@ class MainFrame extends React.Component<Props, State> {
|
||||
const { i18n } = this.props;
|
||||
if (!currentProject) return;
|
||||
|
||||
if (!currentProject.hasExternalEventsNamed(oldName)) return;
|
||||
if (!currentProject.hasExternalEventsNamed(oldName) || newName === oldName)
|
||||
return;
|
||||
|
||||
if (currentProject.hasExternalEventsNamed(newName)) {
|
||||
showWarningBox(
|
||||
@@ -644,7 +646,11 @@ class MainFrame extends React.Component<Props, State> {
|
||||
const { eventsFunctionWriter } = this.props;
|
||||
if (!currentProject) return;
|
||||
|
||||
if (!currentProject.hasEventsFunctionsExtensionNamed(oldName)) return;
|
||||
if (
|
||||
!currentProject.hasEventsFunctionsExtensionNamed(oldName) ||
|
||||
newName === oldName
|
||||
)
|
||||
return;
|
||||
|
||||
if (currentProject.hasEventsFunctionsExtensionNamed(newName)) {
|
||||
showWarningBox(
|
||||
|
@@ -218,7 +218,13 @@ class Item extends React.Component<ItemProps, {||}> {
|
||||
onContextMenu={this._onContextMenu}
|
||||
primaryText={label}
|
||||
rightIconButton={rightIconButton}
|
||||
onClick={this.props.onEdit}
|
||||
onClick={() => {
|
||||
// It's essential to discard clicks when editing the name,
|
||||
// to avoid weird opening of an editor (accompanied with a
|
||||
// closing of the project manager) when clicking on the text
|
||||
// field.
|
||||
if (!this.props.editingName) this.props.onEdit();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</ThemeConsumer>
|
||||
|
Reference in New Issue
Block a user