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