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

Commit b3802bd

Browse files
committed
Merge pull request #4550 from adobe/pflynn/saveas-fixes-n-ws-sort-docs
Fix Save As confusion; update docs for working set event change
2 parents 830c83c + 5e803b4 commit b3802bd

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/command/DefaultMenus.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ define(function (require, exports, module) {
183183
project_cmenu.addMenuItem(Commands.FILE_NEW);
184184
project_cmenu.addMenuItem(Commands.FILE_NEW_FOLDER);
185185
project_cmenu.addMenuItem(Commands.FILE_RENAME);
186-
project_cmenu.addMenuItem(Commands.FILE_SAVE_AS);
187186
project_cmenu.addMenuItem(Commands.FILE_DELETE);
188187
project_cmenu.addMenuItem(Commands.NAVIGATE_SHOW_IN_OS);
189188
project_cmenu.addMenuDivider();

src/document/DocumentCommandHandlers.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -760,18 +760,19 @@ define(function (require, exports, module) {
760760
function handleFileSaveAs(commandData) {
761761
// Default to current document if doc is null
762762
var doc = null,
763-
activeEditor,
764763
settings;
765764

766765
if (commandData) {
767766
doc = commandData.doc;
768767
} else {
769-
activeEditor = EditorManager.getActiveEditor();
770-
doc = activeEditor.document;
771-
settings = {};
772-
settings.selection = activeEditor.getSelection();
773-
settings.cursorPos = activeEditor.getCursorPos();
774-
settings.scrollPos = activeEditor.getScrollPos();
768+
var activeEditor = EditorManager.getActiveEditor();
769+
if (activeEditor) {
770+
doc = activeEditor.document;
771+
settings = {};
772+
settings.selection = activeEditor.getSelection();
773+
settings.cursorPos = activeEditor.getCursorPos();
774+
settings.scrollPos = activeEditor.getScrollPos();
775+
}
775776
}
776777

777778
// doc may still be null, e.g. if no editors are open, but _doSaveAs() does a null check on

src/document/DocumentManager.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,20 @@
7070
* 2nd arg to the listener is the removed FileEntry.
7171
* - workingSetRemoveList -- When multiple files are removed from the working set (e.g. project close).
7272
* The 2nd arg to the listener is the array of removed FileEntry objects.
73-
* - workingSetSort -- When the workingSet array is sorted. Notifies the working set view to redraw
74-
* the new sorted list. Listener receives no arguments.
75-
* - workingSetDisableAutoSorting -- When working set is manually re-sorted via dragging and dropping
76-
* a file to disable automatic sorting. Listener receives no arguments.
73+
* - workingSetSort -- When the workingSet array is reordered without additions or removals.
74+
* Listener receives no arguments.
75+
*
76+
* - workingSetDisableAutoSorting -- Dispatched in addition to workingSetSort when the reorder was caused
77+
* by manual dragging and dropping. Listener receives no arguments.
7778
*
7879
* - fileNameChange -- When the name of a file or folder has changed. The 2nd arg is the old name.
7980
* The 3rd arg is the new name.
8081
* - pathDeleted -- When a file or folder has been deleted. The 2nd arg is the path that was deleted.
8182
*
8283
* These are jQuery events, so to listen for them you do something like this:
8384
* $(DocumentManager).on("eventname", handler);
85+
*
86+
* Document objects themselves also dispatch some events - see Document docs for details.
8487
*/
8588
define(function (require, exports, module) {
8689
"use strict";

0 commit comments

Comments
 (0)