Procházet zdrojové kódy

Editor: Fixed script editor title out-of-sync (#28413)

* sync script editor title

* no dispatching editScript, setValue is enough
ycw před 1 rokem
rodič
revize
a379e9a3b3
2 změnil soubory, kde provedl 22 přidání a 2 odebrání
  1. 20 0
      editor/js/Script.js
  2. 2 2
      editor/js/commands/SetScriptValueCommand.js

+ 20 - 0
editor/js/Script.js

@@ -429,6 +429,26 @@ function Script( editor ) {
 
 	} );
 
+	signals.objectChanged.add( function ( object ) {
+
+		if ( object === currentObject ) {
+
+			title.setValue( currentObject.name + ' / ' + currentScript.name );
+
+		}
+
+	} );
+
+	signals.scriptChanged.add( function ( script ) {
+
+		if ( script === currentScript ) {
+
+			title.setValue( currentObject.name + ' / ' + currentScript.name );
+
+		}
+
+	} );
+
 	return container;
 
 }

+ 2 - 2
editor/js/commands/SetScriptValueCommand.js

@@ -31,7 +31,7 @@ class SetScriptValueCommand extends Command {
 
 		this.script[ this.attributeName ] = this.newValue;
 
-		this.editor.signals.scriptChanged.dispatch();
+		this.editor.signals.scriptChanged.dispatch( this.script );
 
 	}
 
@@ -39,7 +39,7 @@ class SetScriptValueCommand extends Command {
 
 		this.script[ this.attributeName ] = this.oldValue;
 
-		this.editor.signals.scriptChanged.dispatch();
+		this.editor.signals.scriptChanged.dispatch( this.script );
 
 	}