if ( CKEDITOR.env.ie && doc.getById( 'cke_pastebin' ) )\r
return;\r
\r
+ // If the browser supports it, get the data directly\r
+ if (mode == 'text' && evt.data && evt.data.$.clipboardData)\r
+ {\r
+ // evt.data.$.clipboardData.types contains all the flavours in Mac's Safari, but not on windows.\r
+ var plain = evt.data.$.clipboardData.getData( 'text/plain' );\r
+ if (plain)\r
+ {\r
+ evt.data.preventDefault();\r
+ callback( plain );\r
+ return;\r
+ }\r
+ }\r
+\r
var sel = this.getSelection(),\r
range = new CKEDITOR.dom.range( doc );\r
\r
// Register the plugin.\r
CKEDITOR.plugins.add( 'clipboard',\r
{\r
- requires : [ 'htmldataprocessor' ],\r
+ requires : [ 'dialog', 'htmldataprocessor' ],\r
init : function( editor )\r
{\r
// Inserts processed data into the editor at the end of the\r
editor.on( 'contentDom', function()\r
{\r
var body = editor.document.getBody();\r
- body.on( ( mode == 'text' && CKEDITOR.env.ie ) ? 'paste' : 'beforepaste',\r
+ body.on( ( (mode == 'text' && CKEDITOR.env.ie) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste',\r
function( evt )\r
{\r
- if( depressBeforePasteEvent )\r
+ if ( depressBeforePasteEvent )\r
return;\r
\r
getClipboardData.call( editor, evt, mode, function ( data )\r
}\r
});\r
})();\r
+\r
+/**\r
+ * Fired when a clipboard operation is about to be taken into the editor.\r
+ * Listeners can manipulate the data to be pasted before having it effectively\r
+ * inserted into the document.\r
+ * @name CKEDITOR.editor#paste\r
+ * @since 3.1\r
+ * @event\r
+ * @param {String} [data.html] The HTML data to be pasted. If not available, e.data.text will be defined.\r
+ * @param {String} [data.text] The plain text data to be pasted, available when plain text operations are to used. If not available, e.data.html will be defined.\r
+ */\r