Importation du code de ckeditor 4.3.4 en conservant les développements Plinn et en...
[ckeditor.git] / skins / ckeditor / _source / plugins / adobeair / plugin.js
diff --git a/skins/ckeditor/_source/plugins/adobeair/plugin.js b/skins/ckeditor/_source/plugins/adobeair/plugin.js
deleted file mode 100644 (file)
index 8cd799b..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-(function()\r
-{\r
-       var eventNameList = [ 'click', 'keydown', 'mousedown', 'keypress', 'mouseover', 'mouseout' ];\r
-\r
-       // Inline event callbacks assigned via innerHTML/outerHTML, such as\r
-       // onclick/onmouseover, are ignored in AIR.\r
-       // Use DOM2 event listeners to substitue inline handlers instead.\r
-       function convertInlineHandlers( container )\r
-       {\r
-               // TODO: document.querySelectorAll is not supported in AIR.\r
-               var children = container.getElementsByTag( '*' ),\r
-                       count = children.count(),\r
-                       child;\r
-\r
-               for ( var i = 0; i < count; i++ )\r
-               {\r
-                       child = children.getItem( i );\r
-\r
-                       (function( node )\r
-                       {\r
-                               for ( var j = 0; j < eventNameList.length; j++ )\r
-                               {\r
-                                       (function( eventName )\r
-                                       {\r
-                                               var inlineEventHandler = node.getAttribute( 'on' + eventName );\r
-                                               if ( node.hasAttribute( 'on' + eventName ) )\r
-                                               {\r
-                                                       node.removeAttribute( 'on' + eventName );\r
-                                                       node.on( eventName, function( evt )\r
-                                                       {\r
-                                                               var callFunc = /(return\s*)?CKEDITOR\.tools\.callFunction\(([^)]+)\)/.exec( inlineEventHandler ),\r
-                                                                       hasReturn = callFunc && callFunc[ 1 ],\r
-                                                                       callFuncArgs = callFunc &&  callFunc[ 2 ].split( ',' ),\r
-                                                                       preventDefault = /return false;/.test( inlineEventHandler );\r
-\r
-                                                               if ( callFuncArgs )\r
-                                                               {\r
-                                                                       var nums = callFuncArgs.length,\r
-                                                                               argName;\r
-\r
-                                                                       for ( var i = 0; i < nums; i++ )\r
-                                                                       {\r
-                                                                               // Trim spaces around param.\r
-                                                                               callFuncArgs[ i ] = argName = CKEDITOR.tools.trim( callFuncArgs[ i ] );\r
-\r
-                                                                               // String form param.\r
-                                                                               var strPattern = argName.match( /^(["'])([^"']*?)\1$/ );\r
-                                                                               if ( strPattern )\r
-                                                                               {\r
-                                                                                       callFuncArgs[ i ] = strPattern[ 2 ];\r
-                                                                                       continue;\r
-                                                                               }\r
-\r
-                                                                               // Integer form param.\r
-                                                                               if ( argName.match( /\d+/ ) )\r
-                                                                               {\r
-                                                                                       callFuncArgs[ i ] = parseInt( argName, 10 );\r
-                                                                                       continue;\r
-                                                                               }\r
-\r
-                                                                               // Speical variables.\r
-                                                                               switch( argName )\r
-                                                                               {\r
-                                                                                       case 'this' :\r
-                                                                                               callFuncArgs[ i ] = node.$;\r
-                                                                                               break;\r
-                                                                                       case 'event' :\r
-                                                                                               callFuncArgs[ i ] = evt.data.$;\r
-                                                                                               break;\r
-                                                                                       case 'null' :\r
-                                                                                               callFuncArgs [ i ] = null;\r
-                                                                                               break;\r
-                                                                               }\r
-                                                                       }\r
-\r
-                                                                       var retval = CKEDITOR.tools.callFunction.apply( window, callFuncArgs );\r
-                                                                       if ( hasReturn && retval === false )\r
-                                                                                preventDefault = 1;\r
-                                                               }\r
-\r
-                                                               if ( preventDefault )\r
-                                                                       evt.data.preventDefault();\r
-                                                       });\r
-                                               }\r
-                                       })( eventNameList[ j ] );\r
-                               }\r
-                       })( child );\r
-               }\r
-       }\r
-\r
-       CKEDITOR.plugins.add( 'adobeair',\r
-       {\r
-               init : function( editor )\r
-               {\r
-                       if ( !CKEDITOR.env.air )\r
-                               return;\r
-\r
-                       // Body doesn't get default margin on AIR.\r
-                       editor.addCss( 'body { padding: 8px }' );\r
-\r
-                       editor.on( 'uiReady', function()\r
-                               {\r
-                                       convertInlineHandlers( editor.container );\r
-\r
-                                       if ( editor.sharedSpaces )\r
-                                       {\r
-                                               for ( var space in editor.sharedSpaces )\r
-                                                       convertInlineHandlers( editor.sharedSpaces[ space ] );\r
-                                       }\r
-\r
-                                       editor.on( 'elementsPathUpdate', function( evt ) { convertInlineHandlers( evt.data.space ); } );\r
-                               });\r
-\r
-                       editor.on( 'contentDom', function()\r
-                               {\r
-                                       // Hyperlinks are enabled in editable documents in Adobe\r
-                                       // AIR. Prevent their click behavior.\r
-                                       editor.document.on( 'click', function( ev )\r
-                                               {\r
-                                                       ev.data.preventDefault( true );\r
-                                               });\r
-                               });\r
-               }\r
-       });\r
-\r
-       CKEDITOR.ui.on( 'ready', function( evt )\r
-               {\r
-                       var ui = evt.data;\r
-                       // richcombo, panelbutton and menu\r
-                       if ( ui._.panel )\r
-                       {\r
-                               var panel = ui._.panel._.panel,\r
-                                               holder;\r
-\r
-                               ( function()\r
-                               {\r
-                                       // Adding dom event listeners off-line are not supported in AIR,\r
-                                       // waiting for panel iframe loaded.\r
-                                       if ( !panel.isLoaded )\r
-                                       {\r
-                                               setTimeout( arguments.callee, 30 );\r
-                                               return;\r
-                                       }\r
-                                       holder = panel._.holder;\r
-                                       convertInlineHandlers( holder );\r
-                               })();\r
-                       }\r
-                       else if ( ui instanceof CKEDITOR.dialog )\r
-                               convertInlineHandlers( ui._.element );\r
-               });\r
-})();\r
-\r
-CKEDITOR.dom.document.prototype.write = CKEDITOR.tools.override( CKEDITOR.dom.document.prototype.write,\r
-       function( original_write )\r
-       {\r
-               function appendElement( parent, tagName, fullTag, text )\r
-               {\r
-                       var node = parent.append( tagName ),\r
-                               attrs = CKEDITOR.htmlParser.fragment.fromHtml( fullTag ).children[ 0 ].attributes;\r
-                       attrs && node.setAttributes( attrs );\r
-                       text && node.append( parent.getDocument().createText( text ) );\r
-               }\r
-\r
-               return function( html, mode )\r
-                       {\r
-                               // document.write() or document.writeln() fail silently after\r
-                               // the page load event in Adobe AIR.\r
-                               // DOM manipulation could be used instead.\r
-                               if ( this.getBody() )\r
-                               {\r
-                                       // We're taking the below extra work only because innerHTML\r
-                                       // on <html> element doesn't work as expected.\r
-                                       var doc = this,\r
-                                               head = this.getHead();\r
-\r
-                                       // Create style nodes for inline css. ( <style> content doesn't applied when setting via innerHTML )\r
-                                       html = html.replace( /(<style[^>]*>)([\s\S]*?)<\/style>/gi,\r
-                                               function ( match, startTag, styleText )\r
-                                               {\r
-                                                       appendElement( head, 'style', startTag, styleText );\r
-                                                       return '';\r
-                                               });\r
-\r
-                                       html = html.replace( /<base\b[^>]*\/>/i,\r
-                                               function( match )\r
-                                               {\r
-                                                       appendElement( head, 'base', match );\r
-                                                       return '';\r
-                                               });\r
-\r
-                                       html = html.replace( /<title>([\s\S]*)<\/title>/i,\r
-                                               function( match, title )\r
-                                               {\r
-                                                       doc.$.title = title;\r
-                                                       return '';\r
-                                               });\r
-\r
-                                       // Move the rest of head stuff.\r
-                                       html = html.replace( /<head>([\s\S]*)<\/head>/i,\r
-                                               function( headHtml )\r
-                                               {\r
-                                                       // Inject the <head> HTML inside a <div>.\r
-                                                       // Do that before getDocumentHead because WebKit moves\r
-                                                       // <link css> elements to the <head> at this point.\r
-                                                       var div = new CKEDITOR.dom.element( 'div', doc );\r
-                                                       div.setHtml( headHtml );\r
-                                                       // Move the <div> nodes to <head>.\r
-                                                       div.moveChildren( head );\r
-                                                       return '';\r
-                                               });\r
-\r
-                                       html.replace( /(<body[^>]*>)([\s\S]*)(?=$|<\/body>)/i,\r
-                                               function( match, startTag, innerHTML )\r
-                                               {\r
-                                                       doc.getBody().setHtml( innerHTML );\r
-                                                       var attrs = CKEDITOR.htmlParser.fragment.fromHtml( startTag ).children[ 0 ].attributes;\r
-                                                       attrs && doc.getBody().setAttributes( attrs );\r
-                                               });\r
-                               }\r
-                               else\r
-                                       original_write.apply( this, arguments );\r
-                       };\r
-       });\r