/* Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add('contextmenu',{requires:['menu'],beforeInit:function(a){a.contextMenu=new CKEDITOR.plugins.contextMenu(a);a.addCommand('contextMenu',{exec:function(){a.contextMenu.show(a.document.getBody());}});}});CKEDITOR.plugins.contextMenu=CKEDITOR.tools.createClass({$:function(a){this.id='cke_'+CKEDITOR.tools.getNextNumber();this.editor=a;this._.listeners=[];this._.functionId=CKEDITOR.tools.addFunction(function(b){this._.panel.hide();a.focus();a.execCommand(b);},this);},_:{onMenu:function(a,b,c,d){var e=this._.menu,f=this.editor;if(e){e.hide();e.removeAll();}else{e=this._.menu=new CKEDITOR.menu(f);e.onClick=CKEDITOR.tools.bind(function(o){var p=true;e.hide();if(CKEDITOR.env.ie)e.onEscape();if(o.onClick)o.onClick();else if(o.command)f.execCommand(o.command);p=false;},this);e.onEscape=function(){f.focus();if(CKEDITOR.env.ie)f.getSelection().unlock(true);};}var g=this._.listeners,h=[],i=this.editor.getSelection(),j=i&&i.getStartElement();if(CKEDITOR.env.ie)i.lock();e.onHide=CKEDITOR.tools.bind(function(){e.onHide=null;if(CKEDITOR.env.ie)f.getSelection().unlock();this.onHide&&this.onHide();},this);for(var k=0;k