Fixed #10380: (t3editor) Make use of the new CodeMirror API for updating line numbers
authorTobias Liebig <mail@etobi.de>
Tue, 10 Mar 2009 22:08:18 +0000 (22:08 +0000)
committerTobias Liebig <mail@etobi.de>
Tue, 10 Mar 2009 22:08:18 +0000 (22:08 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5178 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/t3editor/jslib/t3editor.js

index a9de598..fb31ead 100755 (executable)
@@ -206,26 +206,11 @@ T3editor.prototype = {
                
 
                // update the line numbers
-               updateLinenum: function(code) {
-                       var theMatch;
-                       if (!code) {
-                               // escape if editor is not yet loaded
-                               if (this.mirror.editor == undefined) {
-                                       return;
-                               }
-                               code = this.mirror.editor.container.innerHTML;
-                               theMatch = code.match(/<br/gi);
-                       } else {
-                               theMatch = code.match(/\n/gi);
-                       } 
-
-                       if (!theMatch) {
-                               theMatch = [1];
-                       } else if (Prototype.Browser.IE) {
-                               theMatch.push('1');
-                       }
-
-                       var bodyContentLineCount = theMatch.length;
+               updateLinenum: function() {
+                       // escape if editor is not yet loaded
+                       if (!this.mirror.editor) return;
+                       
+                       var bodyContentLineCount = this.mirror.lineNumber(this.mirror.lastLine());
                        disLineCount = this.linenum.childNodes.length;
                        while (disLineCount != bodyContentLineCount) {
                                if (disLineCount > bodyContentLineCount) {