[BUGFIX] Pagetree - Selection state incorrect after a cancelled edit
authorStefan <stefan.galinski@gmail.com>
Wed, 2 Mar 2011 15:18:09 +0000 (16:18 +0100)
committerStefan Galinski <stefan.galinski@gmail.com>
Fri, 4 Mar 2011 14:06:36 +0000 (15:06 +0100)
Currently the selection state of a node is set to the wrong node if you cancel an inline edit.

Change-Id: I2d0af2a4e37c975ef7885ee3cc4ea872d5a405bc
Resolves: #M17828
Reviewed-on: http://review.typo3.org/979
Reviewed-by: Stefan Galinski <stefan.galinski@gmail.com>
Tested-by: Stefan Galinski <stefan.galinski@gmail.com>
t3lib/js/extjs/components/pagetree/javascript/actions.js
t3lib/js/extjs/components/pagetree/javascript/tree.js
t3lib/js/extjs/components/pagetree/javascript/treeeditor.js

index 1dbc853..856f14a 100644 (file)
@@ -689,6 +689,8 @@ TYPO3.Components.PageTree.Actions = {
         * @return {void}
         */
        singleClick: function(node, tree) {
+               tree.currentSelectedNode = node;
+
                var separator = '?';
                if (currentSubScript.indexOf('?') !== -1) {
                        separator = '&';
index 37cab1a..7319b02 100644 (file)
@@ -57,6 +57,13 @@ TYPO3.Components.PageTree.Tree = Ext.extend(Ext.tree.TreePanel, {
        treeEditor: null,
 
        /**
+        * Currently Selected Node
+        *
+        * @type {Ext.tree.TreeNode}
+        */
+       currentSelectedNode: null,
+
+       /**
         * Enable the drag and drop feature
         *
         * @cfg {Boolean}
index 46dfc6f..0d12e7d 100644 (file)
@@ -41,7 +41,7 @@ TYPO3.Components.PageTree.TreeEditor = Ext.extend(Ext.tree.TreeEditor, {
         *
         * @type {Boolean}
         */
-       ignoreNoChange: true,
+       ignoreNoChange: false,
 
        /**
         * Edit delay
@@ -74,7 +74,12 @@ TYPO3.Components.PageTree.TreeEditor = Ext.extend(Ext.tree.TreeEditor, {
 
                complete: {
                        fn: function(node, newValue, oldValue) {
-                               this.editNode.ownerTree.commandProvider.saveTitle(node, this.updatedValue, oldValue, this);
+                               if (newValue === oldValue) {
+                                       this.fireEvent('canceledit', this);
+                                       return false;
+                               }
+
+                               this.editNode.getOwnerTree().commandProvider.saveTitle(node, this.updatedValue, oldValue, this);
                        }
                },
 
@@ -82,6 +87,13 @@ TYPO3.Components.PageTree.TreeEditor = Ext.extend(Ext.tree.TreeEditor, {
                        fn: function(element, value) {
                                this.field.selectText();
                        }
+               },
+
+               canceledit: function() {
+                       var tree = this.editNode.getOwnerTree();
+                       if (tree.currentSelectedNode) {
+                               tree.currentSelectedNode.select();
+                       }
                }
        },