CKEDITOR.plugins.add('sourcearea',{requires:['editingblock'],init:function(a){var b=CKEDITOR.plugins.sourcearea,c=CKEDITOR.document.getWindow();a.on('editingBlockReady',function(){var d,e;a.addMode('source',{load:function(f,g){if(CKEDITOR.env.ie&&CKEDITOR.env.version<8)f.setStyle('position','relative');a.textarea=d=new CKEDITOR.dom.element('textarea');d.setAttributes({dir:'ltr',tabIndex:CKEDITOR.env.webkit?-1:a.tabIndex,role:'textbox','aria-label':a.lang.editorTitle.replace('%1',a.name)});d.addClass('cke_source');d.addClass('cke_enable_context_menu');a.readOnly&&d.setAttribute('readOnly','readonly');var h={width:CKEDITOR.env.ie7Compat?'99%':'100%',height:'100%',resize:'none',outline:'none','text-align':'left'};if(CKEDITOR.env.ie){e=function(){d.hide();d.setStyle('height',f.$.clientHeight+'px');d.setStyle('width',f.$.clientWidth+'px');d.show();};a.on('resize',e);c.on('resize',e);setTimeout(e,0);}f.setHtml('');f.append(d);d.setStyles(h);a.fire('ariaWidget',d);d.on('blur',function(){a.focusManager.blur();});d.on('focus',function(){a.focusManager.focus();});a.mayBeDirty=true;this.loadData(g);var i=a.keystrokeHandler;if(i)i.attach(d);setTimeout(function(){a.mode='source';a.fire('mode');},CKEDITOR.env.gecko||CKEDITOR.env.webkit?100:0);},loadData:function(f){d.setValue(f);a.fire('dataReady');},getData:function(){return d.getValue();},getSnapshotData:function(){return d.getValue();},unload:function(f){d.clearCustomData();a.textarea=d=null;if(e){a.removeListener('resize',e);c.removeListener('resize',e);}if(CKEDITOR.env.ie&&CKEDITOR.env.version<8)f.removeStyle('position');},focus:function(){d.focus();}});});a.on('readOnly',function(){if(a.mode=='source')if(a.readOnly)a.textarea.setAttribute('readOnly','readonly');else a.textarea.removeAttribute('readOnly');});a.addCommand('source',b.commands.source);if(a.ui.addButton)a.ui.addButton('Source',{label:a.lang.source,command:'source'});a.on('mode',function(){a.getCommand('source').setState(a.mode=='source'?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF);});}});CKEDITOR.plugins.sourcearea={commands:{source:{modes:{wysiwyg:1,source:1},editorFocus:false,readOnly:1,exec:function(a){if(a.mode=='wysiwyg')a.fire('saveSnapshot');a.getCommand('source').setState(CKEDITOR.TRISTATE_DISABLED);a.setMode(a.mode=='source'?'wysiwyg':'source');},canUndo:false}}};
