Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Adding a Save All menu item under File #1208

Merged
merged 2 commits into from
Aug 2, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ define(function (require, exports, module) {
exports.FILE_OPEN = "file.open";
exports.FILE_OPEN_FOLDER = "file.openFolder";
exports.FILE_SAVE = "file.save";
exports.FILE_SAVE_ALL = "file.saveAll";
exports.FILE_CLOSE = "file.close";
exports.FILE_CLOSE_ALL = "file.close_all";
exports.FILE_CLOSE_WINDOW = "file.close_window"; // string must MATCH string in native code (brackets_extensions)
Expand Down
2 changes: 2 additions & 0 deletions src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.FILE_CLOSE, "Ctrl-W");
menu.addMenuDivider();
menu.addMenuItem(Commands.FILE_SAVE, "Ctrl-S");
menu.addMenuItem(Commands.FILE_SAVE_ALL, [{key: "Ctrl-Shift-S", platform: "win"},
{key: "Cmd-Alt-S", platform: "mac"}]);
menu.addMenuDivider();
menu.addMenuItem(Commands.FILE_LIVE_FILE_PREVIEW, "Ctrl-Alt-P");
menu.addMenuDivider();
Expand Down
9 changes: 9 additions & 0 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ define(function (require, exports, module) {
);
}

/**
* Saves all the unsaved files.
* @param None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to explicitly say this -- just leave off the @param line entirely.

* @return {$.Promise} a promise that is resolved after the save completes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want the exact same text as handleFileSave() here. Maybe something like this?
(based on the comment on saveAll())

"a promise that is resolved once ALL the saves have been completed; or rejected after all operations completed if any ONE of them failed"

*/
function handleFileSaveAll() {
return saveAll();
}
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space between the two functions

* Reverts the Document to the current contents of its file on disk. Discards any unsaved changes
* in the Document.
Expand Down Expand Up @@ -758,6 +766,7 @@ define(function (require, exports, module) {
// be called from a "+" button in the project
CommandManager.register(Strings.CMD_FILE_NEW, Commands.FILE_NEW, handleFileNewInProject);
CommandManager.register(Strings.CMD_FILE_SAVE, Commands.FILE_SAVE, handleFileSave);
CommandManager.register(Strings.CMD_FILE_SAVE_ALL, Commands.FILE_SAVE_ALL, handleFileSaveAll);

CommandManager.register(Strings.CMD_FILE_CLOSE, Commands.FILE_CLOSE, handleFileClose);
CommandManager.register(Strings.CMD_FILE_CLOSE_ALL, Commands.FILE_CLOSE_ALL, handleFileCloseAll);
Expand Down
1 change: 1 addition & 0 deletions src/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ define(function (require, exports, module) {
exports.CMD_FILE_CLOSE = "Close";
exports.CMD_FILE_CLOSE_ALL = "Close All";
exports.CMD_FILE_SAVE = "Save";
exports.CMD_FILE_SAVE_ALL = "Save All";
exports.CMD_LIVE_FILE_PREVIEW = "Live File Preview";
exports.CMD_QUIT = "Quit";

Expand Down