Skip to content

Commit

Permalink
Editor: Fixed script editor title out-of-sync (#28413)
Browse files Browse the repository at this point in the history
* sync script editor title

* no dispatching editScript, setValue is enough
  • Loading branch information
ycw authored May 18, 2024
1 parent 6955746 commit a379e9a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions editor/js/Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Expand Down
4 changes: 2 additions & 2 deletions editor/js/commands/SetScriptValueCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class SetScriptValueCommand extends Command {

this.script[ this.attributeName ] = this.newValue;

this.editor.signals.scriptChanged.dispatch();
this.editor.signals.scriptChanged.dispatch( this.script );

}

undo() {

this.script[ this.attributeName ] = this.oldValue;

this.editor.signals.scriptChanged.dispatch();
this.editor.signals.scriptChanged.dispatch( this.script );

}

Expand Down

0 comments on commit a379e9a

Please sign in to comment.