Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Modify 'editor.file.dirty' event handler to accept 'isDirty' parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
himchev committed Feb 15, 2022
1 parent e44c1ee commit 7ab674b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ide/index.html
Expand Up @@ -109,8 +109,22 @@
alert(msg.data);
},
'editor.file.dirty': function (msg) {
dirtyFiles.push(msg.data);
Layouts.manager.setEditorDirty(msg.data, true);
var file, isDirty;
if (typeof msg.data === 'string') {
file = msg.data;
isDirty = true;
} else {
file = msg.data.file;
isDirty = msg.data.isDirty;
}

if (isDirty) {
dirtyFiles.push(file);
} else {
dirtyFiles = dirtyFiles.filter(e => e !== file);
}

Layouts.manager.setEditorDirty(file, isDirty);
},
'editor.file.saved': function (msg) {
dirtyFiles = dirtyFiles.filter(e => e !== msg.data);
Expand Down

0 comments on commit 7ab674b

Please sign in to comment.