/* * Aloha Editor * Author & Copyright (c) 2010 Gentics Software GmbH * aloha-sales@gentics.com * Licensed unter the terms of http://www.aloha-editor.com/license.html */ GENTICS.Aloha.PastePlugin=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.Paste");GENTICS.Aloha.PastePlugin.pasteHandlers=[];GENTICS.Aloha.PastePlugin.init=function(){var that=this;this.pasteDiv=jQuery('
');this.pasteDiv.attr("contentEditable","true");jQuery("body").append(this.pasteDiv);GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableCreated",function(event,editable){if(jQuery.browser.msie){editable.obj.bind("beforepaste",function(event){that.redirectPaste()})}else{editable.obj.bind("paste",function(event){that.redirectPaste();window.setTimeout(function(){that.getPastedContent()},10)})}});if(jQuery.browser.msie){this.pasteDiv.bind("paste",function(event){window.setTimeout(function(){that.getPastedContent()},10)})}};GENTICS.Aloha.PastePlugin.redirectPaste=function(){this.currentRange=new GENTICS.Utils.RangeObject(true);this.currentEditable=GENTICS.Aloha.activeEditable;this.pasteDiv.text("");if(this.currentEditable){this.currentEditable.blur()}GENTICS.Utils.Dom.setCursorInto(this.pasteDiv.get(0));this.pasteDiv.focus()};GENTICS.Aloha.PastePlugin.getPastedContent=function(){var that=this;for(var i=0;i=0;--i){GENTICS.Utils.Dom.insertIntoDOM(jQuery(pasteDivContents.get(i)),that.currentRange,that.currentEditable.obj,false)}this.currentEditable.activate();this.currentEditable.obj.focus();if(pasteDivContents.length>0){GENTICS.Utils.Dom.setCursorAfter(pasteDivContents.get(pasteDivContents.length-1))}else{this.currentRange.select()}}this.currentRange=false;this.currentEditable=false;this.pasteDiv.text("")};GENTICS.Aloha.PastePlugin.register=function(pasteHandler){this.pasteHandlers.push(pasteHandler)};GENTICS.Aloha.PastePlugin.PasteHandler=function(){GENTICS.Aloha.PastePlugin.register(this)};GENTICS.Aloha.PastePlugin.PasteHandler.prototype.handlePaste=function(jqPasteDiv){};