mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Newly inserted scripts are automatically assigned id
This commit is contained in:
parent
632d9a666e
commit
f0940308ea
1 changed files with 7 additions and 0 deletions
|
@ -39,6 +39,13 @@ module.exports = class ScriptsTabView extends CocoView
|
|||
|
||||
onScriptsChanged: (e) =>
|
||||
@level.set 'scripts', @scriptsTreema.data
|
||||
lastAction = @scriptsTreema.trackedActions[@scriptsTreema.trackedActions.length - 1]
|
||||
|
||||
if lastAction.action is 'insert' and lastAction.parentPath is '/'
|
||||
newScript = @scriptsTreema.get lastAction.path
|
||||
if newScript.id is undefined
|
||||
@scriptsTreema.set lastAction.path+'/id', 'Script-' + @scriptsTreema.data.length
|
||||
@scriptTreema.refreshDisplay()
|
||||
|
||||
onScriptSelected: (e, selected) =>
|
||||
selected = if selected.length > 1 then selected[0].getLastSelectedTreema() else selected[0]
|
||||
|
|
Loading…
Reference in a new issue