Fixed issue #10899: bugfixes for t3editor codecompletion (credits to Stephan Petzl...
authorTobias Liebig <mail@etobi.de>
Wed, 15 Apr 2009 20:01:20 +0000 (20:01 +0000)
committerTobias Liebig <mail@etobi.de>
Wed, 15 Apr 2009 20:01:20 +0000 (20:01 +0000)
* Fixed bug: inserting (return hit) at rootlevel throwed an error

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

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

index 27e9aed..775afe4 100644 (file)
@@ -571,9 +571,11 @@ var TsCodeCompletion = function(codeMirror,outerdiv) {
        function insertCurrWordAtCursor() {\r
                var word = proposals[currWord].word;\r
                var cursorNode = getCursorNode();\r
-               if(cursorNode.currentText != '.') {\r
-                       cursorNode.innerHTML = '';\r
-                       cursorNode.currentText = '';\r
+               if (cursorNode.currentText \r
+                          && cursorNode.currentText != '.' \r
+                          && cursorNode.currentText.strip() != '' ) {\r
+                  cursorNode.innerHTML = '';\r
+                   cursorNode.currentText = '';\r
                }\r
                mirror.replaceSelection(word);\r
                // set cursor behind the selection\r