Changeset 2267 for FCKeditor/branches

Show
Ignore:
Timestamp:
2008-07-23 12:03:16 (4 months ago)
Author:
martinkou
Message:

Merged all changes in trunk up to r2266.

Location:
FCKeditor/branches/features/new_samples
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/features/new_samples/_dev/releaser/fckreleaser.php

    r2040 r2267  
    8282{ 
    8383        $dirPath = str_replace( '\\', '/', $dirPath ) ; 
    84  
     84         
    8585        if ( substr( $dirPath, -1, 1 ) != '/' ) 
    8686                $dirPath .= '/' ; 
    87  
     87         
    8888        return $dirPath ; 
    8989} 
     
    170170                if ( isset( $releaseNode->Children[ 'IGNOREFILE' ] ) ) 
    171171                { 
    172                         $ignoreNodes = $releaseNode->Children[ 'IGNOREFILE' ] ; 
     172                        $ignoreNodes = $releaseNode->Children[ 'IGNOREFILE' ] ;  
    173173                        foreach ( $ignoreNodes as $ignoreNode ) 
    174174                        { 
     
    181181                if ( isset( $releaseNode->Children[ 'ORIGINALFILE' ] ) ) 
    182182                { 
    183                         $originalNodes = $releaseNode->Children[ 'ORIGINALFILE' ] ; 
     183                        $originalNodes = $releaseNode->Children[ 'ORIGINALFILE' ] ;      
    184184                        foreach ( $originalNodes as $originalNode ) 
    185185                        { 
    186                                 $this->OriginalFiles[] = (object)array( 
     186                                $this->OriginalFiles[] = (object)array(  
    187187                                        'Source' => $originalNode->Attributes[ 'SOURCEPATH' ], 
    188188                                        'Target' => $originalNode->Attributes[ 'TARGETPATH' ] ) ; 
     
    239239                while ( $file = readdir( $sourceDirHandler ) ) 
    240240                { 
    241                         // Skip ".", ".." and hidden fields (Unix). 
     241                        // Skip ".", ".." and hidden fields (Unix).  
    242242                        if ( substr( $file, 0, 1 ) == '.' ) 
    243243                                continue ; 
     
    327327                // Project start time (registration at SourceForge, actually = 2003-03-01 18:20). 
    328328                $startTime = gmmktime( 18, 20, 0, 3, 1, 2003 ) ; 
    329  
     329                 
    330330                $currentTime = time() ; 
    331  
     331                 
    332332                // Get the number of seconds since the project startup. 
    333333                $seconds = $currentTime - $startTime ; 
     
    597597                $script = $stringsProc->ProtectStrings( $script ) ; 
    598598 
     599                // Remove "/* */" comments 
     600                $script = preg_replace( 
     601                        '/(?<!\/)\/\*.*?\*\//s', 
     602                        '', $script ) ; 
     603 
    599604                // Remove "//" comments 
    600605                $script = preg_replace( 
    601                         '/\/\/.*$/m', 
    602                         '', $script ) ; 
    603  
    604                 // Remove "/* */" comments 
    605                 $script = preg_replace( 
    606                         '/(?m-s:^\s*\/\*).*?\*\//s', 
    607                         '', $script ) ; 
    608  
     606                                '/\/\/.*$/m', 
     607                                '', $script ) ; 
     608                 
    609609                // Remove spaces before the ";" at the end of the lines 
    610610                $script = preg_replace( 
     
    966966                } 
    967967 
     968                // Fix invalid line breaks (must be all CRLF). 
     969                $data = preg_replace( 
     970                        '/(?:(?<!\r)\n)|(?:\r(?!\n))/im', 
     971                        "\r\n", $data ) ; 
     972 
    968973                return $data ; 
    969974        } 
     
    985990        function ProtectStrings( $source ) 
    986991        { 
     992                // Catches string literals, regular expressions and conditional comments. 
    987993                return preg_replace_callback( 
    988                         '/(?:("|\').*?(?<!\\\\)\1|(?<![\/\\\\])\/[^\/\*].*?(?<!\\\\)\/)/', 
     994                        '/(?:("|\').*?(?<!\\\\)\1)|(?:(?<![\*\/\\\\])\/[^\/\*].*?(?<!\\\\)\/(?=([\.\w])|(\s*[,;}\)])))|(?s:\/\*@(?:cc_on|if|elif|else|end).*?@\*\/)/', 
    989995                        array( &$this, '_ProtectStringsMatch' ), $source ) ; 
    990996        } 
  • FCKeditor/branches/features/new_samples/editor/_source/classes/fckeditingarea.js

    r2123 r2267  
    152152                { 
    153153                        var editArea = this ; 
    154                         ( oIFrame.onreadystatechange = function() 
    155                         { 
    156                                 if ( oIFrame.readyState == 'complete' ) 
    157                                 { 
    158                                         oIFrame.onreadystatechange = null ; 
    159                                         editArea.Window._FCKEditingArea = editArea ; 
    160                                         FCKEditingArea_CompleteStart.call( editArea.Window ) ; 
    161                                 } 
    162                         // It happened that IE changed the state to "complete" after the 
    163                         // "if" and before the "onreadystatechange" assignement, making we 
    164                         // lost the event call, so we do a manual call just to be sure. 
    165                         } )() ; 
     154                         
     155                        // Using a IE alternative for DOMContentLoaded, similar to the 
     156                        // solution proposed at http://javascript.nwbox.com/IEContentLoaded/ 
     157                        setTimeout( function() 
     158                                        { 
     159                                                try  
     160                                                { 
     161                                                        editArea.Window.document.documentElement.doScroll("left") ; 
     162                                                } 
     163                                                catch(e) 
     164                                                { 
     165                                                        setTimeout( arguments.callee, 0 ) ; 
     166                                                        return ; 
     167                                                } 
     168                                                editArea.Window._FCKEditingArea = editArea ; 
     169                                                FCKEditingArea_CompleteStart.call( editArea.Window ) ; 
     170                                        }, 0 ) ; 
    166171                } 
    167172                else 
  • FCKeditor/branches/features/new_samples/editor/_source/commandclasses/fck_othercommands.js

    r2229 r2267  
    614614        } 
    615615} ; 
     616 
     617// FCKRuleCommand 
     618var FCKNbsp = function() 
     619{ 
     620        this.Name = 'Non Breaking Space' ; 
     621} 
     622 
     623FCKNbsp.prototype = 
     624{ 
     625        Execute : function() 
     626        { 
     627                FCK.InsertHtml( '&nbsp;' ) ; 
     628        }, 
     629 
     630        GetState : function() 
     631        { 
     632                return ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_DISABLED : FCK_TRISTATE_OFF ) ; 
     633        } 
     634} ; 
  • FCKeditor/branches/features/new_samples/editor/_source/internals/fckcommands.js

    r2229 r2267  
    8181                case 'PageBreak'        : oCommand = new FCKPageBreakCommand() ; break ; 
    8282                case 'Rule'                     : oCommand = new FCKRuleCommand() ; break ; 
     83                case 'Nbsp'                     : oCommand = new FCKNbsp() ; break ; 
    8384 
    8485                case 'TextColor'        : oCommand = new FCKTextColorCommand('ForeColor') ; break ; 
  • FCKeditor/branches/features/new_samples/editor/_source/internals/fckdocumentprocessor.js

    r2123 r2267  
    143143        } 
    144144 
     145        var processElementsByName = function( elementName, doc ) 
     146        { 
     147                var aObjects = doc.getElementsByTagName( elementName ); 
     148                for ( var i = aObjects.length - 1 ; i >= 0 ; i-- ) 
     149                        processElement( aObjects[i] ) ; 
     150        } 
     151 
     152        var processObjectAndEmbed = function( doc ) 
     153        { 
     154                processElementsByName( 'object', doc ); 
     155                processElementsByName( 'embed', doc ); 
     156        } 
     157 
    145158        return FCKTools.Merge( FCKDocumentProcessor.AppendNew(), 
    146159                       { 
     
    149162                                        // Firefox 3 would sometimes throw an unknown exception while accessing EMBEDs and OBJECTs 
    150163                                        // without the setTimeout(). 
    151                                         FCKTools.RunFunction( function() 
    152                                                 { 
    153                                                         // Process OBJECTs first, since EMBEDs can sometimes go inside OBJECTS (e.g. Flash). 
    154                                                         var aObjects = doc.getElementsByTagName( 'object' ); 
    155                                                         for ( var i = aObjects.length - 1 ; i >= 0 ; i-- ) 
    156                                                                 processElement( aObjects[i] ) ; 
    157  
    158                                                         // Now process any EMBEDs left. 
    159                                                         var aEmbeds = doc.getElementsByTagName( 'embed' ) ; 
    160                                                         for ( var i = aEmbeds.length - 1 ; i >= 0 ; i-- ) 
    161                                                                 processElement( aEmbeds[i] ) ; 
    162                                                 } ) ; 
     164                                        if ( FCKBrowserInfo.IsGecko ) 
     165                                                FCKTools.RunFunction( processObjectAndEmbed, this, [ doc ] ) ; 
     166                                        else 
     167                                                processObjectAndEmbed( doc ) ; 
    163168                                }, 
    164169 
  • FCKeditor/branches/features/new_samples/editor/_source/internals/fck_gecko.js

    r2123 r2267  
    360360        FCKUndo.SaveUndoStep() ; 
    361361 
    362         if ( FCKBrowserInfo.IsGecko ) 
    363         { 
     362        var fakeNodes = false ; 
     363        var prevCharNodeValue ; 
     364        if ( FCKBrowserInfo.IsGecko && /^(?:&nbsp;|&#160;)+$/.test( html ) ) 
     365        { 
     366                // Get the previous character's text node value, if any. 
     367                var selection = FCK.EditorWindow.getSelection() ; 
     368                var range = selection && selection.rangeCount > 0 && selection.getRangeAt( 0 ) ; 
     369                var startNode, prevCharNode ; 
     370                if ( range )  
     371                { 
     372                        if ( range.startContainer.nodeType == 1 ) 
     373                                startNode = range.startContainer.childNodes[ range.startOffset ] ; 
     374                        else if ( range.startContainer.nodeType == 3 ) 
     375                                startNode = range.startContainer ; 
     376                } 
     377                if ( startNode ) 
     378                { 
     379                        if ( range.startContainer.nodeType == 1 ) 
     380                        { 
     381                                var node = startNode.previousSibling ; 
     382                                while ( node && node.nodeType == 3 && node.length < 1 ) 
     383                                        node = node.previousSibling ; 
     384                                if ( node && node.nodeType == 3 ) 
     385                                        prevCharNode = node ; 
     386                        } 
     387                        else 
     388                                prevCharNode = startNode ; 
     389                } 
     390                if ( prevCharNode ) 
     391                { 
     392                        prevCharNodeValue = prevCharNode.nodeValue ; 
     393                        if ( range.startContainer.nodeType == 3 ) 
     394                                prevCharNodeValue = prevCharNodeValue.substr( 0, range.startOffset ) ; 
     395                } 
     396 
    364397                // Using the following trick, &nbsp; present at the beginning and at 
    365398                // the end of the HTML are preserved (#2248). 
    366399                html = '<span id="__fakeFCKRemove1__" style="display:none;">fakeFCKRemove</span>' + html + '<span id="__fakeFCKRemove2__" style="display:none;">fakeFCKRemove</span>' ; 
     400                fakeNodes = true ; 
    367401        } 
    368402 
     
    370404        doc.execCommand( 'inserthtml', false, html ) ; 
    371405 
    372         if ( FCKBrowserInfo.IsGecko ) 
    373         { 
     406        if ( fakeNodes ) 
     407        { 
     408                // Retrieve the text node before the newly inserted text node. 
     409                // Note that this is a different node to the prevCharNode earlier. 
     410                var firstNode = doc.getElementById( '__fakeFCKRemove1__' ) ; 
     411                var textNode = firstNode.previousSibling ; 
     412 
    374413                // Remove the fake nodes. 
    375                 FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove1__') ) ; 
     414                FCKDomTools.RemoveNode( firstNode ) ; 
    376415                FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove2__') ) ; 
     416 
     417                // Restore the previous character's text node value, if any. 
     418                if ( prevCharNodeValue && textNode && textNode.nodeType == 3 ) 
     419                        textNode.nodeValue = prevCharNodeValue ; 
    377420        } 
    378421 
  • FCKeditor/branches/features/new_samples/editor/_source/internals/fck_ie.js

    r2123 r2267  
    136136 
    137137        this.EditorDocument.attachEvent("ondblclick", Doc_OnDblClick ) ; 
     138 
     139        this.EditorDocument.attachEvent("onbeforedeactivate", function(){ FCKSelection.Save( true ) ; } ) ; 
    138140 
    139141        // Catch cursor selection changes. 
  • FCKeditor/branches/features/new_samples/editor/_source/internals/fck.js

    r2229 r2267  
    11021102        { 
    11031103                for ( var i = 0 ; i < this.Elements.length ; i++ ) 
    1104                         this.Elements[i] = this.Elements[i].outerHTML ; 
     1104                { 
     1105                        this.Elements[i] = '<div>&nbsp;' + this.Elements[i].outerHTML + '</div>' ; 
     1106                        this.Elements[i].isHtml = true ; 
     1107                } 
    11051108        }, 
    11061109 
     
    11101113                for ( var i = 0 ; i < this.Elements.length ; i++ ) 
    11111114                { 
    1112                         if ( typeof( this.Elements[i] ) == 'string' ) 
     1115                        if ( this.Elements[i].isHtml ) 
    11131116                        { 
    11141117                                node.innerHTML = this.Elements[i] ; 
    1115                                 this.Elements[i] = node.firstChild ; 
     1118                                this.Elements[i] = node.firstChild.removeChild( node.firstChild.lastChild ) ; 
    11161119                        } 
    11171120                } 
  • FCKeditor/branches/features/new_samples/editor/_source/internals/fckselection_ie.js

    r2123 r2267  
    210210} 
    211211 
    212 FCKSelection.Save = function() 
     212FCKSelection.Save = function( noFocus ) 
    213213{ 
    214214        // Ensures the editor has the selection focus. (#1801) 
    215         FCK.Focus() ; 
     215        if ( !noFocus ) 
     216                FCK.Focus() ; 
    216217 
    217218        var editorDocument = FCK.EditorDocument ; 
  • FCKeditor/branches/features/new_samples/fckconfig.js

    r2229 r2267  
    143143        [ CTRL + 85 /*U*/, 'Underline' ], 
    144144        [ CTRL + SHIFT + 83 /*S*/, 'Save' ], 
    145         [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ] 
     145        [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], 
     146        [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] 
    146147] ; 
    147148 
  • FCKeditor/branches/features/new_samples/_whatsnew.html

    r2229 r2267  
    4747                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2252">#2252</a>] It's now possible to enable the 
    4848                        browsers default menu using the configuration file (FCKConfig.BrowserContextMenu option).</li>  
     49                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2247">#2247</a>] The SHIFT+SPACE 
     50                        keystroke will now produce a &amp;nbsp; character.</li> 
    4951        </ul> 
    5052        <p> 
     
    9294                        multiple contiguous paragraphs to Formatted will now be merged into a single  
    9395                        &lt;PRE&gt; block.</li> 
     96                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2363">#2363</a>] There 
     97                        were some sporadic "Permission Denied" errors with IE on some situations.</li> 
     98                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2135">#2135</a>] Fixed a  
     99                        data loss bug in IE when there are @import statements in the editor's CSS files, 
     100                        and IE's cache is set to "Check for newer versions on every visit".</li> 
     101                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2376">#2376</a>] FCK.InsertHtml() 
     102                        will now insert to the last selected position after the user has selected things outside 
     103                        of FCKeditor, in IE.</li> 
     104                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2368">#2368</a>] Fixed broken protect  
     105                        source logic for comments in IE.</li> 
    94106        </ul> 
    95107        <p>