-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Initial implementation of file save #16
Conversation
Also, Cmd-S is not yet implemented. Use File > Save from the in-app menu bar (not the native menubar). |
…it more generic, driven by HTML. Added basic keymapping functions.
…ted logic of the open/save/close commands to take advantage of this.
Okay, now Cmd-S is implemented (as are Cmd-O and Cmd-W), using a new keybinding infrastructure. I also refactored the dialog code to make it more generic (so I could use it for the save file case). The most recent commit will likely be controversial. It makes all commands deal with asynchronicity using $.Deferred(). I think this is the most elegant way to deal with this (and I already have to deal with it because dialog handling is asynchronous), but it definitely introduces some complexity. We should discuss this tomorrow. Note that the selection in the file tree gets out of sync in various cases (e.g. if you make changes in one file, click on another file, then cancel out of the save changes dialog). We should discuss whether we need to handle this in this sprint. |
*/ | ||
brackets.showErrorDialog = function(title, message) { | ||
var dlg = $("#error-dialog"); | ||
brackets.showDialog = function(id, title, message, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be called showModalDialog instead?
…out the file handling code into a separate file. Simplified KeyBindingManager. Changed $.Deferred() to new $.Deferred().
return dirReader; | ||
}; | ||
|
||
NativeFileSystem.DirectoryEntry.prototype.getFile = function( path, options, successCallback, errorCallback ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add Google Closure comments to getFile() function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
}; | ||
|
||
// FileException constants | ||
Object.defineProperties(NativeFileSystem.FileException, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NJ originally had these constants defined as well and then decided to use the native ones and just wrap them. See the class FileError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see FileException when running in the console, so I added them here.
} | ||
else { | ||
doClose(); | ||
_editor.focus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code path doesn't return a Deferred
} | ||
|
||
// Make sure we can't undo back to the previous content. | ||
_editor.clearHistory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_editor.clearHistory() is already done on line 117
Initial implementation of file save
Hook up initial requirejs support.
Not ready for pulling into master--this is just for initial review.
File save and dirty bit management are implemented, but the save function is using the raw file API instead of the HTML API.
Prompting to save a dirty file on close is not yet implemented.