Fixed issue #10899: bugfixes for t3editor codecompletion (credits to Stephan Petzl...
authorTobias Liebig <mail@etobi.de>
Wed, 15 Apr 2009 19:59:17 +0000 (19:59 +0000)
committerTobias Liebig <mail@etobi.de>
Wed, 15 Apr 2009 19:59:17 +0000 (19:59 +0000)
* Copy bug, copying of absolute and relative paths

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5317 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/t3editor/jslib/ts_codecompletion/tsparser.js

index e0ecf9d..0c77024 100644 (file)
@@ -139,7 +139,8 @@ var TsParser = function(tsRef,extTsObjTree){
 \r
        }\r
 \r
-       var tsTree; // = new TreeNode("_L_");\r
+       // the top level treenode\r
+       var tsTree = new TreeNode("_L_");\r
        var currentLine = "";\r
 \r
 \r
@@ -384,10 +385,12 @@ var TsParser = function(tsRef,extTsObjTree){
                                subTree[pathSeg].parent = parent;\r
                                //subTree[pathSeg].extTsObjTree = extTsObjTree;\r
                                // the extPath has to be set, so the TreeNode can retrieve the respecting node in the external templates\r
-                               if(currentNodePath)             \r
-                                       currentNodePath += '.';\r
-                               currentNodePath += pathSeg;                             \r
-                               subTree[pathSeg].extPath = currentNodePath;\r
+                               var extPath = parent.extPath;\r
+                               if(extPath) {\r
+                                       extPath += '.';\r
+                               }\r
+                               extPath += pathSeg;\r
+                               subTree[pathSeg].extPath = extPath;\r
                        } \r
                        if(i==aPath.length-1){\r
                                return subTree[pathSeg];\r
@@ -458,12 +461,15 @@ var TsParser = function(tsRef,extTsObjTree){
                        var myNewObj = new Object();\r
 \r
                        for(var i in myObj){\r
+                               // disable recursive cloning for parent object -> copy by reference\r
                                if(i != "parent"){\r
                                        if (typeof myObj[i] == 'object') {\r
                                                myNewObj[i] = clone(myObj[i]);\r
                                        } else {\r
                                                myNewObj[i] = myObj[i];\r
                                        }\r
+                               } else {\r
+                                       myNewObj.parent = myObj.parent;\r
                                }\r
                        }\r
                        return myNewObj;\r