Permalink
Browse files

Merge pull request #967 from adobe/jason-sanjose/issue935

Fix for #935
  • Loading branch information...
njx committed Jun 3, 2012
2 parents ccc03cd + 69ba096 commit cccbdc8cad19c9c2af44b796c969c33285b5a400
Showing with 21 additions and 5 deletions.
  1. +2 −2 src/document/DocumentCommandHandlers.js
  2. +19 −3 src/project/ProjectManager.js
@@ -740,8 +740,8 @@ define(function (require, exports, module) {
CommandManager.register(Strings.CMD_CLOSE_WINDOW, Commands.FILE_CLOSE_WINDOW, handleFileCloseWindow);
CommandManager.register(Strings.CMD_QUIT, Commands.FILE_QUIT, handleFileQuit);
CommandManager.register(Strings.CMD_REFRESH_WINDOW, Commands.DEBUG_REFRESH_WINDOW, handleFileReload);
- CommandManager.register(Strings.CMD_NEXT_DOC, Commands.NAVIGATE_NEXT_DOC, handleGoNextDoc);
- CommandManager.register(Strings.CMD_PREV_DOC, Commands.NAVIGATE_PREV_DOC, handleGoPrevDoc);
+ CommandManager.register(Strings.CMD_NEXT_DOC, Commands.NAVIGATE_NEXT_DOC, handleGoNextDoc);
+ CommandManager.register(Strings.CMD_PREV_DOC, Commands.NAVIGATE_PREV_DOC, handleGoPrevDoc);
KeyBindingManager.addBinding(Commands.NAVIGATE_NEXT_DOC, "Ctrl-Tab");
KeyBindingManager.addBinding(Commands.NAVIGATE_PREV_DOC, "Ctrl-Shift-Tab");
@@ -275,7 +275,8 @@ define(function (require, exports, module) {
* http://www.jstree.com/documentation/json_data
*/
function _renderTree(treeDataProvider) {
- var result = new $.Deferred();
+ var result = new $.Deferred(),
+ suppressToggleOpen = false;
// Instantiate tree widget
// (jsTree is smart enough to replace the old tree if there's already one there)
@@ -302,6 +303,17 @@ define(function (require, exports, module) {
}
}
)
+ .bind(
+ "before.jstree",
+ function (event, data) {
+ if (data.func === "toggle_node") {
+ // jstree will automaticaly select parent node when the parent is closed
+ // and any descendant is selected. Prevent the select_node handler from
+ // immediately toggling open again in this case.
+ suppressToggleOpen = _projectTree.jstree("is_open", data.args[0]);
+ }
+ }
+ )
.bind(
"select_node.jstree",
function (event, data) {
@@ -327,8 +339,13 @@ define(function (require, exports, module) {
_redraw(true);
// toggle folder open/closed
- _projectTree.jstree("toggle_node", data.rslt.obj);
+ // suppress if this selection was triggered by clicking the disclousre triangle
+ if (!suppressToggleOpen) {
+ _projectTree.jstree("toggle_node", data.rslt.obj);
+ }
}
+
+ suppressToggleOpen = false;
}
)
.bind(
@@ -365,7 +382,6 @@ define(function (require, exports, module) {
.bind(
"loaded.jstree open_node.jstree close_node.jstree",
function (event, data) {
-
if (event.type === "open_node") {
// select the current document if it becomes visible when this folder is opened
var curDoc = DocumentManager.getCurrentDocument();

0 comments on commit cccbdc8

Please sign in to comment.