Changeset 1790
- Timestamp:
- 2008-03-25 08:23:55 (4 months ago)
- Location:
- FCKeditor/trunk
- Files:
-
- 6 modified
- 1 copied
-
editor/css/fck_internal.css (modified) (1 diff)
-
editor/css/images/fck_plugin.gif (copied) (copied from FCKeditor/branches/features/generic_plugin/editor/css/images/fck_plugin.gif)
-
editor/dialog/fck_flash/fck_flash.js (modified) (1 diff)
-
editor/_source/internals/fckconfig.js (modified) (1 diff)
-
editor/_source/internals/fckdocumentprocessor.js (modified) (3 diffs)
-
editor/_source/internals/fck.js (modified) (2 diffs)
-
_whatsnew.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/css/fck_internal.css
r1598 r1790 52 52 background-position: center center; 53 53 background-image: url(images/fck_flashlogo.gif); 54 background-repeat: no-repeat; 55 width: 80px; 56 height: 80px; 57 } 58 59 .FCK__UnknownObject 60 { 61 border: #a9a9a9 1px solid; 62 background-position: center center; 63 background-image: url(images/fck_plugin.gif); 54 64 background-repeat: no-repeat; 55 65 width: 80px; -
FCKeditor/trunk/editor/dialog/fck_flash/fck_flash.js
r1598 r1790 142 142 } 143 143 144 oEditor.FCK FlashProcessor.RefreshView( oFakeImage, oEmbed ) ;144 oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ; 145 145 146 146 return true ; -
FCKeditor/trunk/editor/_source/internals/fckconfig.js
r1628 r1790 177 177 178 178 // <noscript> tags (get lost in IE and messed up in FF). 179 /<noscript[\s\S]*?<\/noscript>/gi, 180 181 // Protect <object> tags. See #359. 182 /<object[\s\S]+?<\/object>/gi 179 /<noscript[\s\S]*?<\/noscript>/gi 183 180 ] ; 184 181 -
FCKeditor/trunk/editor/_source/internals/fckdocumentprocessor.js
r1565 r1790 34 34 FCKDocumentProcessor.Process = function( document ) 35 35 { 36 var bIsDirty = FCK.IsDirty() ; 36 37 var oProcessor, i = 0 ; 37 38 while( ( oProcessor = this._Items[i++] ) ) 38 39 oProcessor.ProcessDocument( document ) ; 40 if ( !bIsDirty ) 41 FCK.ResetIsDirty() ; 39 42 } 40 43 41 44 var FCKDocumentProcessor_CreateFakeImage = function( fakeClass, realElement ) 42 45 { 43 var oImg = FCK .EditorDocument.createElement( 'IMG' ) ;46 var oImg = FCKTools.GetElementDocument( realElement ).createElement( 'IMG' ) ; 44 47 oImg.className = fakeClass ; 45 48 oImg.src = FCKConfig.FullBasePath + 'images/spacer.gif' ; … … 119 122 } 120 123 121 // Flash Embeds. 122 var FCKFlashProcessor = FCKDocumentProcessor.AppendNew() ; 123 FCKFlashProcessor.ProcessDocument = function( document ) 124 { 125 /* 126 Sample code: 127 This is some <embed src="/UserFiles/Flash/Yellow_Runners.swf"></embed><strong>sample text</strong>. You are <a name="fred"></a> using <a href="http://www.fckeditor.net/">FCKeditor</a>. 128 */ 129 130 var bIsDirty = FCK.IsDirty() ; 131 132 var aEmbeds = document.getElementsByTagName( 'EMBED' ) ; 133 134 var oEmbed ; 135 var i = aEmbeds.length - 1 ; 136 while ( i >= 0 && ( oEmbed = aEmbeds[i--] ) ) 137 { 138 // IE doesn't return the type attribute with oEmbed.type or oEmbed.getAttribute("type") 139 // But it turns out that after accessing it then it doesn't gets copied later 140 var oType = oEmbed.attributes[ 'type' ] ; 141 142 // Check the extension and the type. Now it should be enough with just the type 143 // Opera doesn't return oEmbed.src so oEmbed.src.EndsWith will fail 144 if ( (oEmbed.src && oEmbed.src.EndsWith( '.swf', true )) || ( oType && oType.nodeValue == 'application/x-shockwave-flash' ) ) 145 { 146 var oCloned = oEmbed.cloneNode( true ) ; 147 148 var oImg = FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oCloned ) ; 149 oImg.setAttribute( '_fckflash', 'true', 0 ) ; 150 151 FCKFlashProcessor.RefreshView( oImg, oEmbed ) ; 152 153 oEmbed.parentNode.insertBefore( oImg, oEmbed ) ; 154 oEmbed.parentNode.removeChild( oEmbed ) ; 155 } 156 } 157 158 // Fix the IsDirty state (#1406). 159 if ( !bIsDirty ) 160 FCK.ResetIsDirty() ; 161 } 162 163 FCKFlashProcessor.RefreshView = function( placeHolderImage, originalEmbed ) 164 { 165 if ( originalEmbed.getAttribute( 'width' ) > 0 ) 166 placeHolderImage.style.width = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.getAttribute( 'width' ) ) ; 167 168 if ( originalEmbed.getAttribute( 'height' ) > 0 ) 169 placeHolderImage.style.height = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.getAttribute( 'height' ) ) ; 170 } 124 // EMBED and OBJECT tags. 125 FCKEmbedAndObjectProcessor = (function() 126 { 127 var customProcessors = [] ; 128 129 var processElement = function( el ) 130 { 131 var clone = el.cloneNode( true ) ; 132 var replaceElement ; 133 var fakeImg = replaceElement = FCKDocumentProcessor_CreateFakeImage( 'FCK__UnknownObject', clone ) ; 134 FCKEmbedAndObjectProcessor.RefreshView( fakeImg, el ) ; 135 136 for ( var i = 0 ; i < customProcessors.length ; i++ ) 137 replaceElement = customProcessors[i]( el, replaceElement ) || replaceElement ; 138 139 if ( replaceElement != fakeImg ) 140 FCKTempBin.RemoveElement( fakeImg.getAttribute( '_fckrealelement' ) ) ; 141 142 el.parentNode.replaceChild( replaceElement, el ) ; 143 } 144 145 return FCKTools.Merge( FCKDocumentProcessor.AppendNew(), 146 { 147 ProcessDocument : function( doc ) 148 { 149 // Firefox 3 would sometimes throw an unknown exception while accessing EMBEDs and OBJECTs 150 // 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 } ) ; 163 }, 164 165 RefreshView : function( placeHolder, original ) 166 { 167 if ( original.getAttribute( 'width' ) > 0 ) 168 placeHolder.style.width = FCKTools.ConvertHtmlSizeToStyle( original.getAttribute( 'width' ) ) ; 169 170 if ( original.getAttribute( 'height' ) > 0 ) 171 placeHolder.style.height = FCKTools.ConvertHtmlSizeToStyle( original.getAttribute( 'height' ) ) ; 172 }, 173 174 AddCustomHandler : function( func ) 175 { 176 customProcessors.push( func ) ; 177 } 178 } ) ; 179 } )() ; 171 180 172 181 FCK.GetRealElement = function( fakeElement ) … … 230 239 } 231 240 } 241 242 // Flash handler. 243 FCKEmbedAndObjectProcessor.AddCustomHandler( function( el, fakeImg ) 244 { 245 if ( ! ( el.nodeName.IEquals( 'embed' ) && ( el.type == 'application/x-shockwave-flash' || /\.swf($|#|\?)/i.test( el.src ) ) ) ) 246 return ; 247 fakeImg.className = 'FCK__Flash' ; 248 fakeImg.setAttribute( '_fckflash', 'true', 0 ); 249 } ) ; -
FCKeditor/trunk/editor/_source/internals/fck.js
r1775 r1790 364 364 // IE doesn't support <abbr> and it breaks it. Let's protect it. 365 365 if ( FCKBrowserInfo.IsIE ) 366 sTags += sTags.length > 0 ? '|ABBR|XML|EMBED ' : 'ABBR|XML|EMBED' ;366 sTags += sTags.length > 0 ? '|ABBR|XML|EMBED|OBJECT' : 'ABBR|XML|EMBED|OBJECT' ; 367 367 368 368 var oRegex ; … … 400 400 if ( FCKBrowserInfo.IsIE && FCK.EditorDocument ) 401 401 { 402 FCK.EditorDocument.detachEvent("onselectionchange", Doc_OnSelectionChange ) ;402 FCK.EditorDocument.detachEvent("onselectionchange", Doc_OnSelectionChange ) ; 403 403 } 404 404 -
FCKeditor/trunk/_whatsnew.html
r1778 r1790 124 124 command was throwing an error if executed in an editor where its relative button 125 125 is not present in the toolbar.</li> 126 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/922">#922</a>] Implemented a 127 generic document processor for <OBJECT> and <EMBED> tags.</li> 128 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1831">#1831</a>] Fixed the 129 issue where the placeholder icon for <EMBED> tags does not always show up 130 in IE7.</li> 126 131 </ul> 127 132 <h3>