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

Commit 3978d7a

Browse files
committed
Merge pull request #7264 from adobe/pflynn/various-cleanups
Various small cleanups - largely docs
2 parents 8da0d08 + 7cf8486 commit 3978d7a

13 files changed

Lines changed: 63 additions & 19 deletions

File tree

src/document/DocumentCommandHandlers.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,9 +1560,6 @@ define(function (require, exports, module) {
15601560
// Register global commands
15611561
CommandManager.register(Strings.CMD_FILE_OPEN, Commands.FILE_OPEN, handleFileOpen);
15621562
CommandManager.register(Strings.CMD_ADD_TO_WORKING_SET, Commands.FILE_ADD_TO_WORKING_SET, handleFileAddToWorkingSet);
1563-
// TODO: (issue #274) For now, hook up File > New to the "new in project" handler. Eventually
1564-
// File > New should open a new blank tab, and handleFileNewInProject should
1565-
// be called from a "+" button in the project
15661563
CommandManager.register(Strings.CMD_FILE_NEW_UNTITLED, Commands.FILE_NEW_UNTITLED, handleFileNew);
15671564
CommandManager.register(Strings.CMD_FILE_NEW, Commands.FILE_NEW, handleFileNewInProject);
15681565
CommandManager.register(Strings.CMD_FILE_NEW_FOLDER, Commands.FILE_NEW_FOLDER, handleNewFolderInProject);

src/editor/InlineWidget.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ define(function (require, exports, module) {
9797
/**
9898
* Called once content is parented in the host editor's DOM. Useful for performing tasks like setting
9999
* focus or measuring content, which require htmlContent to be in the DOM tree.
100+
*
100101
* IMPORTANT: onAdded() MUST be overridden to call hostEditor.setInlineWidgetHeight() at least once to
101102
* set the initial height (required to animate it open). The widget will never open otherwise.
102103
*/

src/filesystem/Directory.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ define(function (require, exports, module) {
127127
}
128128

129129
/**
130-
* Read the contents of a Directory.
130+
* Read the contents of a Directory. If this Directory is under a watch root,
131+
* the listing will exclude any items filtered out by the watch root's filter
132+
* function.
131133
*
132134
* @param {Directory} directory Directory whose contents you want to get
133135
* @param {function (?string, Array.<FileSystemEntry>=, Array.<FileSystemStats>=, Object.<string, string>=)} callback

src/filesystem/File.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ define(function (require, exports, module) {
149149

150150
// Request a consistency check if the write is not blind
151151
if (!options.blind) {
152-
options.expectedHash = this._hash;
152+
options.expectedHash = this._hash;
153153
options.expectedContents = this._contents;
154154
}
155155

src/filesystem/FileSystem.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
* to meet these requirements)
5353
*
5454
* FileSystem dispatches the following events:
55+
* (NOTE: attach to these events via `FileSystem.on()` - not `$(FileSystem).on()`)
56+
*
5557
* change - Sent whenever there is a change in the file system. The handler
5658
* is passed up to three arguments: the changed entry and, if that changed entry
5759
* is a Directory, a list of entries added to the directory and a list of entries
@@ -262,6 +264,8 @@ define(function (require, exports, module) {
262264
commandName = shouldWatch ? "watchPath" : "unwatchPath";
263265

264266
if (recursiveWatch) {
267+
// The impl can watch the entire subtree with one call on the root (we also fall into this case for
268+
// unwatch, although that never requires us to do the recursion - see similar final case below)
265269
if (entry !== watchedRoot.entry) {
266270
// Watch and unwatch calls to children of the watched root are
267271
// no-ops if the impl supports recursiveWatch
@@ -315,6 +319,8 @@ define(function (require, exports, module) {
315319
});
316320
}, callback);
317321
} else {
322+
// Unwatching never requires enumerating the subfolders (which is good, since after a
323+
// delete/rename we may be unable to do so anyway)
318324
this._enqueueWatchRequest(function (requestCb) {
319325
impl.unwatchPath(entry.fullPath, requestCb);
320326
}, callback);

src/filesystem/impls/appshell/AppshellFileSystem.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,27 @@ define(function (require, exports, module) {
3535

3636
var FILE_WATCHER_BATCH_TIMEOUT = 200; // 200ms - granularity of file watcher changes
3737

38-
var _changeCallback, // Callback to notify FileSystem of watcher changes
39-
_offlineCallback, // Callback to notify FileSystem that watchers are offline
40-
_changeTimeout, // Timeout used to batch up file watcher changes
41-
_pendingChanges = {}; // Pending file watcher changes
38+
/**
39+
* Callback to notify FileSystem of watcher changes
40+
* @type {?function(string, FileSystemStats=)}
41+
*/
42+
var _changeCallback;
43+
44+
/**
45+
* Callback to notify FileSystem if watchers stop working entirely
46+
* @type {?function()}
47+
*/
48+
var _offlineCallback;
49+
50+
/** Timeout used to batch up file watcher changes (setTimeout() return value) */
51+
var _changeTimeout;
52+
53+
/**
54+
* Pending file watcher changes - map from fullPath to flag indicating whether we need to pass stats
55+
* to _changeCallback() for this path.
56+
* @type {!Object.<string, boolean>}
57+
*/
58+
var _pendingChanges = {};
4259

4360
var _bracketsPath = FileUtils.getNativeBracketsDirectoryPath(),
4461
_modulePath = FileUtils.getNativeModuleDirectoryPath(module),
@@ -48,6 +65,7 @@ define(function (require, exports, module) {
4865

4966
var _isRunningOnWindowsXP = navigator.userAgent.indexOf("Windows NT 5.") >= 0;
5067

68+
5169
// If the connection closes, notify the FileSystem that watchers have gone offline.
5270
$(_nodeDomain.connection).on("close", function (event, promise) {
5371
if (_offlineCallback) {
@@ -105,7 +123,7 @@ define(function (require, exports, module) {
105123
if (event === "change") {
106124
// Only register change events if filename is passed
107125
if (filename) {
108-
// an existing file was created; stats are needed
126+
// an existing file was modified; stats are needed
109127
change = path + filename;
110128
_enqueueChange(change, true);
111129
}

src/nls/fa-ir/urls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626

2727
define({
2828
// Relative to the samples folder
29-
"WEB_PLATFORM_DOCS_LICENSE" : "http://creativecommons.org/licenses/by/3.0/deed.fa",
29+
"WEB_PLATFORM_DOCS_LICENSE" : "http://creativecommons.org/licenses/by/3.0/deed.fa"
3030
});

src/project/ProjectManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ define(function (require, exports, module) {
103103
* https://github.com/adobe/brackets/issues/6781
104104
* @type {RegExp}
105105
*/
106-
var _exclusionListRegEx = /\.pyc$|^\.git$|^\.gitmodules$|^\.svn$|^\.DS_Store$|^Thumbs\.db$|^\.hg$|^CVS$|^\.hgtags$|^\.c9revisions|^\.SyncArchive|^\.SyncID|^\.SyncIgnore|\~$/;
106+
var _exclusionListRegEx = /\.pyc$|^\.git$|^\.gitmodules$|^\.svn$|^\.DS_Store$|^Thumbs\.db$|^\.hg$|^CVS$|^\.hgtags$|^\.idea$|^\.c9revisions$|^\.SyncArchive$|^\.SyncID$|^\.SyncIgnore$|\~$/;
107107

108108
/**
109109
* @private

src/project/SidebarView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ define(function (require, exports, module) {
5151
EditorManager = require("editor/EditorManager"),
5252
Global = require("utils/Global"),
5353
Resizer = require("utils/Resizer"),
54-
_ = require("thirdparty/lodash");
54+
_ = require("thirdparty/lodash");
5555

5656
// These vars are initialized by the htmlReady handler
5757
// below since they refer to DOM elements

src/utils/Resizer.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ define(function (require, exports, module) {
111111
}
112112

113113
/**
114-
* Adds resizing capabilities to a given html element.
114+
* Adds resizing and (optionally) expand/collapse capabilities to a given html element. The element's size
115+
* & visibility are automatically saved & restored as a view-state preference.
115116
*
116117
* Resizing can be configured in two directions:
117118
* - Vertical ("vert"): Resizes the height of the element
@@ -130,7 +131,8 @@ define(function (require, exports, module) {
130131
* - panelExpanded: When the panel gets expanded (or shown). Passed the initial size.
131132
* May occur without any resize events.
132133
*
133-
* @param {!DOMNode} element DOM element which should be made resizable.
134+
* @param {!DOMNode} element DOM element which should be made resizable. Must have an id attribute, for
135+
* use as a preferences key.
134136
* @param {!string} direction Direction of the resize action: one of the DIRECTION_* constants.
135137
* @param {!string} position Which side of the element can be dragged: one of the POSITION_* constants
136138
* (TOP/BOTTOM for vertical resizing or LEFT/RIGHT for horizontal).
@@ -159,6 +161,11 @@ define(function (require, exports, module) {
159161
resizerCSSPosition = direction === DIRECTION_HORIZONTAL ? "left" : "top",
160162
contentSizeFunction = direction === DIRECTION_HORIZONTAL ? $resizableElement.width : $resizableElement.height;
161163

164+
if (!elementID) {
165+
console.error("Resizable panels must have a DOM id to use as a preferences key:", element);
166+
return;
167+
}
168+
162169
if (minSize === undefined) {
163170
minSize = DEFAULT_MIN_SIZE;
164171
}

0 commit comments

Comments
 (0)