Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

Fix for #935
  • Loading branch information...
commit cccbdc8cad19c9c2af44b796c969c33285b5a400 2 parents ccc03cd + 69ba096
@njx njx authored
View
4 src/document/DocumentCommandHandlers.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");
View
22 src/project/ProjectManager.js
@@ -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)
@@ -303,6 +304,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) {
var entry = data.rslt.obj.data("entry");
@@ -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();
Please sign in to comment.
Something went wrong with that request. Please try again.