-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
…anager to start to decouple different parts of the app.
…anager to start to decouple different parts of the app.
…open-file-from-tree
/** | ||
* Registers a global command. | ||
* | ||
* @param id {string} The ID of the command. |
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.
Fwiw, the official Closure docs put the type before the parameter name. I don't know if it also accepts this reverse order (which I actually think is nicer... so maybe it's worth testing whether this will work?)
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.
Let's follow the official docs.
…in file open command. Small code review fixes.
FYI, this is not yet ready for master--waiting on finalizing Ty's pull request for the open file API. |
* Copyright 2011 Adobe Systems Incorporated. All Rights Reserved. | ||
*/ | ||
|
||
// List of constants for global command IDs. |
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.
We should use JSDoc comment style for top-level declarations
editor.setValue(event.target.result); | ||
editor.clearHistory(); | ||
|
||
// In the titlebar, show the project-relative path (if the file is inside the current project) |
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.
The first time I read this I thought it meant the browser title bar... should we call it something different to disambiguate?
} | ||
|
||
reader.readAsText(file, "utf8"); | ||
}); |
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.
Does our FileEntry.file() take an error callback as a 2nd arg, like the PhoneGap one? If so, I wonder if we should add a "TODO" error callback like you did above with the reader. That way we'll have TODOs for all known cases of missing error handling.
Open file from tree - looks good!
merging latest Brackets (Sprint 26) master
Implemented opening a file by clicking on it in the file tree, and also implemented File > Open to show a file dialog that the user can select from.
As part of this, I created a simple CommandManager to start to decouple parts of the UI from each other. When a file in the tree is clicked, the ProjectManager tells the CommandManager to execute the "file.open" command. This command is registered in brackets.js as part of the boot sequence.
Eventually we can add things like key binding, and perhaps undo/redo handling, to the CommandManager. Also, we should consider factoring out some of the code in brackets.js out into a more formal application controller.