Changeset 6174
- Timestamp:
- 12/06/10 19:24:30 (2 years ago)
- Location:
- CKEditor/branches/features/adobeair/_source/plugins
- Files:
-
- 1 deleted
- 3 edited
-
adobeair/assets (deleted)
-
adobeair/plugin.js (modified) (3 diffs)
-
clipboard/dialogs/paste.js (modified) (4 diffs)
-
wysiwygarea/plugin.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/branches/features/adobeair/_source/plugins/adobeair/plugin.js
r6160 r6174 102 102 // Body doesn't get default margin on AIR. 103 103 editor.addCss( 'body { padding: 8px }' ); 104 105 // Frame source from application sandbox to be consumed by 'wysiwyg' plugin.106 editor._.air_bootstrap_frame_url = this.path + '/assets/air_boostrap_frame.html?' + editor.name;107 104 108 105 editor.on( 'uiReady', function() … … 161 158 function( original_write ) 162 159 { 160 function appendElement( parent, tagName, fullTag, text ) 161 { 162 var node = parent.append( tagName ), 163 attrs = CKEDITOR.htmlParser.fragment.fromHtml( fullTag ).children[ 0 ].attributes; 164 attrs && node.setAttributes( attrs ); 165 text && node.append( parent.getDocument().createText( text ) ); 166 } 167 163 168 return function( html, mode ) 164 169 { … … 170 175 // We're taking the below extra work only because innerHTML 171 176 // on <html> element doesn't work as expected. 172 var doc = this; 173 174 // Grab all the <link> and <style>. 175 var styleSheetLinks = [], 176 styleTexts = []; 177 178 html.replace( /<style[^>]*>([\s\S]*?)<\/style>/gi, function ( match, styleText ) 179 { 180 styleTexts.push( styleText ); 181 }); 182 183 html.replace( /<link[^>]*?>/gi, function( linkHtml ) 184 { 185 styleSheetLinks.push( linkHtml ); 186 }); 187 188 if ( styleSheetLinks.length ) 189 { 190 // Inject the <head> HTML inside a <div>. 191 // Do that before getDocumentHead because WebKit moves 192 // <link css> elements to the <head> at this point. 193 var div = new CKEDITOR.dom.element( 'div', doc ); 194 div.setHtml( styleSheetLinks.join( '' ) ); 195 // Move the <div> nodes to <head>. 196 div.moveChildren( this.getHead( doc ) ); 197 } 198 199 // Create style nodes for inline css. 200 // ( <style> content doesn't applied when setting via innerHTML ) 201 var count = styleTexts.length; 202 if ( count ) 203 { 204 var head = this.getHead( doc ); 205 for ( var i = 0; i < count; i++ ) 206 { 207 var node = head.append( 'style' ); 208 node.setAttribute( "type", "text/css" ); 209 node.append( doc.createText( styleTexts[ i ] ) ); 210 } 211 } 212 213 // Copy the entire <body>. 214 doc.getBody().setAttributes( CKEDITOR.htmlParser.fragment.fromHtml( 215 // Separate body content and attributes. 216 html.replace( /(<body[^>]*>)([\s\S]*)(?=<\/body>)/i, 217 function( match, startTag, innerHTML ) 218 { 219 doc.getBody().setHtml( innerHTML ); 220 return startTag; 221 }) 222 ).children[ 0 ].attributes ); 177 var doc = this, 178 head = this.getHead( doc ); 179 180 // Create style nodes for inline css. ( <style> content doesn't applied when setting via innerHTML ) 181 html = html.replace( /(<style[^>]*>)([\s\S]*?)<\/style>/gi, 182 function ( match, startTag, styleText ) 183 { 184 appendElement( head, 'style', startTag, styleText ); 185 return ''; 186 }); 187 188 html = html.replace( /<base\b[^>]*\/>/i, 189 function( match ) 190 { 191 appendElement( head, 'base', match ); 192 return ''; 193 }); 194 195 html = html.replace( /<title>([\s\S]*)<\/title>/i, 196 function( match, title ) 197 { 198 doc.$.title = title; 199 return ''; 200 }); 201 202 // Move the rest of head stuff. 203 html = html.replace( /<head>([\s\S]*)<\/head>/i, 204 function( headHtml ) 205 { 206 // Inject the <head> HTML inside a <div>. 207 // Do that before getDocumentHead because WebKit moves 208 // <link css> elements to the <head> at this point. 209 var div = new CKEDITOR.dom.element( 'div', doc ); 210 div.setHtml( headHtml ); 211 // Move the <div> nodes to <head>. 212 div.moveChildren( head ); 213 return ''; 214 }); 215 216 html.replace( /(<body[^>]*>)([\s\S]*)(?=$|<\/body>)/i, 217 function( match, startTag, innerHTML ) 218 { 219 doc.getBody().setHtml( innerHTML ); 220 var attrs = CKEDITOR.htmlParser.fragment.fromHtml( startTag ).children[ 0 ].attributes; 221 attrs && doc.getBody().setAttributes( attrs ); 222 }); 223 223 } 224 224 else -
CKEditor/branches/features/adobeair/_source/plugins/clipboard/dialogs/paste.js
r6067 r6174 14 14 docElement = doc.$; 15 15 16 doc.getById( 'cke_actscrpt' ).remove(); 16 var script = doc.getById( 'cke_actscrpt' ); 17 script && script.remove(); 17 18 18 19 CKEDITOR.env.ie ? … … 81 82 ' allowTransparency="true"' + 82 83 // Support for custom document.domain in IE. 83 ( CKEDITOR.env.air ? ' src=" ' + editor._.air_bootstrap_frame_url + '"' :84 ( CKEDITOR.env.air ? ' src="javascript:void(0)"' : 84 85 ( isCustomDomain ? 85 86 ' src="javascript:void((function(){' + … … 94 95 '></iframe>' ); 95 96 96 if ( CKEDITOR.env.air ) 97 CKEDITOR._[ 'air_bootstrap_data' + editor.name ] = htmlToLoad; 98 else 99 { 100 iframe.on( 'load', function( e ) 101 { 102 e.removeListener(); 103 var doc = iframe.getFrameDocument().$; 97 iframe.on( 'load', function( e ) 98 { 99 e.removeListener(); 100 101 var doc; 102 103 if ( CKEDITOR.env.air ) 104 { 105 doc = iframe.getFrameDocument(); 106 doc.write( htmlToLoad ); 107 onPasteFrameLoad.call( this, doc.getWindow().$ ); 108 } 109 else 110 { 111 doc = iframe.getFrameDocument().$; 104 112 // Custom domain handling is needed after each document.open(). 105 113 doc.open(); … … 108 116 doc.write( htmlToLoad ); 109 117 doc.close(); 110 } , this );111 } 118 } 119 }, this ); 112 120 113 121 iframe.setCustomData( 'dialog', this ); -
CKEditor/branches/features/adobeair/_source/plugins/wysiwygarea/plugin.js
r6148 r6174 422 422 // for other browers, the 'src' attribute should be left empty to 423 423 // trigger iframe's 'load' event. 424 ' src="' + ( CKEDITOR.env.air ? editor._.air_bootstrap_frame_url: CKEDITOR.env.ie ? 'javascript:void(function(){' + encodeURIComponent( srcScript ) + '}())' : '' ) + '"' +424 ' src="' + ( CKEDITOR.env.air ? 'javascript:void(0)' : CKEDITOR.env.ie ? 'javascript:void(function(){' + encodeURIComponent( srcScript ) + '}())' : '' ) + '"' + 425 425 ' tabIndex="' + ( CKEDITOR.env.webkit? -1 : editor.tabIndex ) + '"' + 426 426 ' allowTransparency="true"' + 427 427 '></iframe>' ); 428 428 429 if ( CKEDITOR.env.air ) 430 { 431 CKEDITOR._[ 'air_bootstrap_data' + editor.name ] = data; 429 // Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689) 430 if ( document.location.protocol == 'chrome:' ) 431 CKEDITOR.event.useCapture = true; 432 433 // With FF, it's better to load the data on iframe.load. (#3894,#4058) 434 iframe.on( 'load', function( ev ) 435 { 432 436 frameLoaded = 1; 433 } 434 else 435 { 436 // Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689) 437 if ( document.location.protocol == 'chrome:' ) 438 CKEDITOR.event.useCapture = true; 439 440 // With FF, it's better to load the data on iframe.load. (#3894,#4058) 441 iframe.on( 'load', function( ev ) 442 { 443 frameLoaded = 1; 444 ev.removeListener(); 445 446 var doc = iframe.getFrameDocument().$; 447 448 // Don't leave any history log in IE. (#5657) 449 doc.open( "text/html","replace" ); 450 doc.write( data ); 451 doc.close(); 452 }); 453 } 437 ev.removeListener(); 438 439 var doc; 440 if ( CKEDITOR.env.air ) 441 { 442 doc = iframe.getFrameDocument(); 443 doc.write( data ); 444 contentDomReady( doc.getWindow().$ ); 445 } 446 else 447 { 448 doc = iframe.getFrameDocument().$; 449 // Don't leave any history log in IE. (#5657) 450 doc.open( "text/html", "replace" ); 451 doc.write( data ); 452 doc.close(); 453 } 454 }); 454 455 455 456 // Reset adjustment back to default (#5689) … … 506 507 // Remove this script from the DOM. 507 508 var script = domDocument.getElementById( "cke_actscrpt" ); 508 script .parentNode.removeChild( script );509 script && script.parentNode.removeChild( script ); 509 510 510 511 body.spellcheck = !editor.config.disableNativeSpellChecker;
Note: See TracChangeset
for help on using the changeset viewer.
