Index: CKEditor/branches/features/pasting/_source/core/tools.js
===================================================================
--- CKEditor/branches/features/pasting/_source/core/tools.js	(revision 4308)
+++ CKEditor/branches/features/pasting/_source/core/tools.js	(revision 4309)
@@ -1,3 +1,3 @@
-﻿/*
+/*
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -524,5 +524,20 @@
 		{
 			return new Array( times + 1 ).join( str );
-		}
+		},
+
+		tryThese : function()
+		{
+		    var returnValue;
+		    for ( var i = 0, length = arguments.length; i < length; i++ )
+		    {
+		      var lambda = arguments[i];
+		      try
+		      {
+		        returnValue = lambda();
+		        break;
+		      } catch (e) { }
+		    }
+		    return returnValue;
+		 }
 	};
 })();
Index: CKEditor/branches/features/pasting/_source/plugins/pastetext/plugin.js
===================================================================
--- CKEditor/branches/features/pasting/_source/plugins/pastetext/plugin.js	(revision 4308)
+++ CKEditor/branches/features/pasting/_source/plugins/pastetext/plugin.js	(revision 4309)
@@ -15,12 +15,39 @@
 		exec : function( editor )
 		{
-			var clipboardText = CKEDITOR.getClipboardText( editor );
-			if ( !clipboardText )   // Clipboard access privilege is not granted.  
+			var clipboardText = CKEDITOR.tools.tryThese(
+				function()
+				{
+					var clipboardText = window.clipboardData.getData( 'Text' );
+					if ( !clipboardText )
+						throw 0;
+					return clipboardText;
+				},
+				function()
+				{
+					netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect" );
+
+					var clip = Components.classes[ "@mozilla.org/widget/clipboard;1" ]
+							.getService( Components.interfaces.nsIClipboard );
+					var trans = Components.classes[ "@mozilla.org/widget/transferable;1" ]
+							.createInstance( Components.interfaces.nsITransferable );
+					trans.addDataFlavor( "text/unicode" );
+					clip.getData( trans, clip.kGlobalClipboard );
+
+					var str = {}, strLength = {}, clipboardText;
+					trans.getTransferData( "text/unicode", str, strLength );
+					str = str.value.QueryInterface( Components.interfaces.nsISupportsString );
+					clipboardText = str.data.substring( 0, strLength.value / 2 );
+					return clipboardText;
+				}
+				// Any other approach that's working... 
+				);
+			
+			if ( !clipboardText )   // Clipboard access privilege is not granted.
 			{
-				editor.openDialog('pastetext');
+				editor.openDialog( 'pastetext' );
 				return false;
 			}
 			else
-				editor.fire('paste', { 'text' : clipboardText });
+				editor.fire( 'paste', { 'text' : clipboardText } );
 		}
 	};
@@ -38,5 +65,5 @@
 					label : editor.lang.pasteText.button,
 					command : commandName
-				});
+				} );
 
 			CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/pastetext.js' ) );
@@ -44,76 +71,17 @@
 			if( editor.config.forcePasteAsPlainText )
 			{
-				editor.on( 'pasteDialog', function ( evt )
+				// Intercept the default pasting process.
+				editor.on( 'beforeCommandExec', function ( evt )
 				{
-					editor.execCommand( 'pastetext' );
-					evt.cancel();
+					if ( evt.data.name == 'paste' )
+					{
+						editor.execCommand( 'pastetext' );
+						evt.cancel();
+					}
 				}, null, null, 0 );
-
 			}
-
 		},
 		requires : [ 'clipboard' ]
 	});
-
-	CKEDITOR.getClipboardText =
-		CKEDITOR.env.ie ? function()
-		{
-			var clipboardAccess = window.clipboardData;
-			return clipboardAccess && clipboardAccess.getData( 'Text' );
-		}
-		:
-		CKEDITOR.env.gecko ? function(copytext)
-		{
-			try {
-				if ( netscape.security.PrivilegeManager.enablePrivilege ) {
-					netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect" );
-				}
-				else
-					return;
-			} catch ( ex )
-			{
-				return;
-			}
-
-			var clip = Components.classes[ "@mozilla.org/widget/clipboard;1" ].getService(Components.interfaces.nsIClipboard);
-			if ( !clip ) return false;
-
-			var trans = Components.classes[ "@mozilla.org/widget/transferable;1" ].createInstance( Components.interfaces.nsITransferable );
-			if ( !trans ) return false;
-			trans.addDataFlavor( "text/unicode" );
-			clip.getData( trans, clip.kGlobalClipboard );
-
-			var str = {}, strLength = {}, pastetext;
-			trans.getTransferData("text/unicode", str, strLength);
-			if ( str )
-				str = str.value.QueryInterface( Components.interfaces.nsISupportsString );
-			if ( str )
-				pastetext = str.data.substring( 0, strLength.value / 2 );
-			return pastetext;
-		}
-		// Currently in Safari 'paste' event is only available in response
-		// to the user action, while the codes below may work in the future. 
-//		: CKEDITOR.env.webkit ? function( editor )
-//		{
-//			var doc = editor.document,
-//				clipboardText;
-//			doc.on( 'paste', function( evt )
-//			{
-//			    evt.data.preventDefault( true );
-//				clipboardText = evt.clipboardData.getData( 'text/plain' );
-//			} );
-//			try
-//			{
-//				if ( !doc.$.execCommand( 'Paste', false, null ) )
-//					throw 0;
-//			}
-//			catch ( e )
-//			{
-//				return;
-//			}
-//			return clipboardData;
-//		}
-		// Opera has no support for clipboard access.
-		: function(){};
 })();
 
@@ -137,3 +105,3 @@
  * config.forcePasteAsPlainText = true;
  */
-CKEDITOR.config.forcePasteAsPlainText = false;
+CKEDITOR.config.forcePasteAsPlainText = true;
