Changeset 2267
- Timestamp:
- 2008-07-23 12:03:16 (6 months ago)
- Location:
- FCKeditor/branches/features/new_samples
- Files:
-
- 11 modified
-
_dev/releaser/fckreleaser.php (modified) (8 diffs)
-
editor/_source/classes/fckeditingarea.js (modified) (1 diff)
-
editor/_source/commandclasses/fck_othercommands.js (modified) (1 diff)
-
editor/_source/internals/fckcommands.js (modified) (1 diff)
-
editor/_source/internals/fckdocumentprocessor.js (modified) (2 diffs)
-
editor/_source/internals/fck_gecko.js (modified) (2 diffs)
-
editor/_source/internals/fck_ie.js (modified) (1 diff)
-
editor/_source/internals/fck.js (modified) (2 diffs)
-
editor/_source/internals/fckselection_ie.js (modified) (1 diff)
-
fckconfig.js (modified) (1 diff)
-
_whatsnew.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/branches/features/new_samples/_dev/releaser/fckreleaser.php
r2040 r2267 82 82 { 83 83 $dirPath = str_replace( '\\', '/', $dirPath ) ; 84 84 85 85 if ( substr( $dirPath, -1, 1 ) != '/' ) 86 86 $dirPath .= '/' ; 87 87 88 88 return $dirPath ; 89 89 } … … 170 170 if ( isset( $releaseNode->Children[ 'IGNOREFILE' ] ) ) 171 171 { 172 $ignoreNodes = $releaseNode->Children[ 'IGNOREFILE' ] ; 172 $ignoreNodes = $releaseNode->Children[ 'IGNOREFILE' ] ; 173 173 foreach ( $ignoreNodes as $ignoreNode ) 174 174 { … … 181 181 if ( isset( $releaseNode->Children[ 'ORIGINALFILE' ] ) ) 182 182 { 183 $originalNodes = $releaseNode->Children[ 'ORIGINALFILE' ] ; 183 $originalNodes = $releaseNode->Children[ 'ORIGINALFILE' ] ; 184 184 foreach ( $originalNodes as $originalNode ) 185 185 { 186 $this->OriginalFiles[] = (object)array( 186 $this->OriginalFiles[] = (object)array( 187 187 'Source' => $originalNode->Attributes[ 'SOURCEPATH' ], 188 188 'Target' => $originalNode->Attributes[ 'TARGETPATH' ] ) ; … … 239 239 while ( $file = readdir( $sourceDirHandler ) ) 240 240 { 241 // Skip ".", ".." and hidden fields (Unix). 241 // Skip ".", ".." and hidden fields (Unix). 242 242 if ( substr( $file, 0, 1 ) == '.' ) 243 243 continue ; … … 327 327 // Project start time (registration at SourceForge, actually = 2003-03-01 18:20). 328 328 $startTime = gmmktime( 18, 20, 0, 3, 1, 2003 ) ; 329 329 330 330 $currentTime = time() ; 331 331 332 332 // Get the number of seconds since the project startup. 333 333 $seconds = $currentTime - $startTime ; … … 597 597 $script = $stringsProc->ProtectStrings( $script ) ; 598 598 599 // Remove "/* */" comments 600 $script = preg_replace( 601 '/(?<!\/)\/\*.*?\*\//s', 602 '', $script ) ; 603 599 604 // Remove "//" comments 600 605 $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 609 609 // Remove spaces before the ";" at the end of the lines 610 610 $script = preg_replace( … … 966 966 } 967 967 968 // Fix invalid line breaks (must be all CRLF). 969 $data = preg_replace( 970 '/(?:(?<!\r)\n)|(?:\r(?!\n))/im', 971 "\r\n", $data ) ; 972 968 973 return $data ; 969 974 } … … 985 990 function ProtectStrings( $source ) 986 991 { 992 // Catches string literals, regular expressions and conditional comments. 987 993 return preg_replace_callback( 988 '/(?:("|\').*?(?<!\\\\)\1 |(?<![\/\\\\])\/[^\/\*].*?(?<!\\\\)\/)/',994 '/(?:("|\').*?(?<!\\\\)\1)|(?:(?<![\*\/\\\\])\/[^\/\*].*?(?<!\\\\)\/(?=([\.\w])|(\s*[,;}\)])))|(?s:\/\*@(?:cc_on|if|elif|else|end).*?@\*\/)/', 989 995 array( &$this, '_ProtectStringsMatch' ), $source ) ; 990 996 } -
FCKeditor/branches/features/new_samples/editor/_source/classes/fckeditingarea.js
r2123 r2267 152 152 { 153 153 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 ) ; 166 171 } 167 172 else -
FCKeditor/branches/features/new_samples/editor/_source/commandclasses/fck_othercommands.js
r2229 r2267 614 614 } 615 615 } ; 616 617 // FCKRuleCommand 618 var FCKNbsp = function() 619 { 620 this.Name = 'Non Breaking Space' ; 621 } 622 623 FCKNbsp.prototype = 624 { 625 Execute : function() 626 { 627 FCK.InsertHtml( ' ' ) ; 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 81 81 case 'PageBreak' : oCommand = new FCKPageBreakCommand() ; break ; 82 82 case 'Rule' : oCommand = new FCKRuleCommand() ; break ; 83 case 'Nbsp' : oCommand = new FCKNbsp() ; break ; 83 84 84 85 case 'TextColor' : oCommand = new FCKTextColorCommand('ForeColor') ; break ; -
FCKeditor/branches/features/new_samples/editor/_source/internals/fckdocumentprocessor.js
r2123 r2267 143 143 } 144 144 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 145 158 return FCKTools.Merge( FCKDocumentProcessor.AppendNew(), 146 159 { … … 149 162 // Firefox 3 would sometimes throw an unknown exception while accessing EMBEDs and OBJECTs 150 163 // 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 ) ; 163 168 }, 164 169 -
FCKeditor/branches/features/new_samples/editor/_source/internals/fck_gecko.js
r2123 r2267 360 360 FCKUndo.SaveUndoStep() ; 361 361 362 if ( FCKBrowserInfo.IsGecko ) 363 { 362 var fakeNodes = false ; 363 var prevCharNodeValue ; 364 if ( FCKBrowserInfo.IsGecko && /^(?: | )+$/.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 364 397 // Using the following trick, present at the beginning and at 365 398 // the end of the HTML are preserved (#2248). 366 399 html = '<span id="__fakeFCKRemove1__" style="display:none;">fakeFCKRemove</span>' + html + '<span id="__fakeFCKRemove2__" style="display:none;">fakeFCKRemove</span>' ; 400 fakeNodes = true ; 367 401 } 368 402 … … 370 404 doc.execCommand( 'inserthtml', false, html ) ; 371 405 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 374 413 // Remove the fake nodes. 375 FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove1__')) ;414 FCKDomTools.RemoveNode( firstNode ) ; 376 415 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 ; 377 420 } 378 421 -
FCKeditor/branches/features/new_samples/editor/_source/internals/fck_ie.js
r2123 r2267 136 136 137 137 this.EditorDocument.attachEvent("ondblclick", Doc_OnDblClick ) ; 138 139 this.EditorDocument.attachEvent("onbeforedeactivate", function(){ FCKSelection.Save( true ) ; } ) ; 138 140 139 141 // Catch cursor selection changes. -
FCKeditor/branches/features/new_samples/editor/_source/internals/fck.js
r2229 r2267 1102 1102 { 1103 1103 for ( var i = 0 ; i < this.Elements.length ; i++ ) 1104 this.Elements[i] = this.Elements[i].outerHTML ; 1104 { 1105 this.Elements[i] = '<div> ' + this.Elements[i].outerHTML + '</div>' ; 1106 this.Elements[i].isHtml = true ; 1107 } 1105 1108 }, 1106 1109 … … 1110 1113 for ( var i = 0 ; i < this.Elements.length ; i++ ) 1111 1114 { 1112 if ( t ypeof( this.Elements[i] ) == 'string')1115 if ( this.Elements[i].isHtml ) 1113 1116 { 1114 1117 node.innerHTML = this.Elements[i] ; 1115 this.Elements[i] = node.firstChild ;1118 this.Elements[i] = node.firstChild.removeChild( node.firstChild.lastChild ) ; 1116 1119 } 1117 1120 } -
FCKeditor/branches/features/new_samples/editor/_source/internals/fckselection_ie.js
r2123 r2267 210 210 } 211 211 212 FCKSelection.Save = function( )212 FCKSelection.Save = function( noFocus ) 213 213 { 214 214 // Ensures the editor has the selection focus. (#1801) 215 FCK.Focus() ; 215 if ( !noFocus ) 216 FCK.Focus() ; 216 217 217 218 var editorDocument = FCK.EditorDocument ; -
FCKeditor/branches/features/new_samples/fckconfig.js
r2229 r2267 143 143 [ CTRL + 85 /*U*/, 'Underline' ], 144 144 [ CTRL + SHIFT + 83 /*S*/, 'Save' ], 145 [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ] 145 [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], 146 [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] 146 147 ] ; 147 148 -
FCKeditor/branches/features/new_samples/_whatsnew.html
r2229 r2267 47 47 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2252">#2252</a>] It's now possible to enable the 48 48 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 &nbsp; character.</li> 49 51 </ul> 50 52 <p> … … 92 94 multiple contiguous paragraphs to Formatted will now be merged into a single 93 95 <PRE> 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> 94 106 </ul> 95 107 <p>