From 17fa5d2e496c53bc6b059694607022bae34365eb Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Thu, 18 Jun 2015 14:03:23 +0200
Subject: [PATCH] `mainPasteEvent` should be public to use it in tests.
---
plugins/clipboard/plugin.js | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js
index 178b011cd4e..873d26a93f4 100644
--- a/plugins/clipboard/plugin.js
+++ b/plugins/clipboard/plugin.js
@@ -373,13 +373,7 @@
var clipboard = CKEDITOR.plugins.clipboard,
preventBeforePasteEvent = 0,
preventPasteEvent = 0,
- inReadOnly = 0,
- // Safari doesn't like 'beforepaste' event - it sometimes doesn't
- // properly handles ctrl+c. Probably some race-condition between events.
- // Chrome and Firefox works well with both events, so better to use 'paste'
- // which will handle pasting from e.g. browsers' menu bars.
- // IE7/8 doesn't like 'paste' event for which it's throwing random errors.
- mainPasteEvent = CKEDITOR.env.ie ? 'beforepaste' : 'paste';
+ inReadOnly = 0;
addListeners();
addButtonsCommands();
@@ -547,7 +541,7 @@
// We'll be catching all pasted content in one line, regardless of whether
// it's introduced by a document command execution (e.g. toolbar buttons) or
// user paste behaviors (e.g. CTRL+V).
- editable.on( mainPasteEvent, function( evt ) {
+ editable.on( clipboard.mainPasteEvent, function( evt ) {
if ( CKEDITOR.env.ie && preventBeforePasteEvent )
return;
@@ -983,7 +977,7 @@
var focusManager = editor.focusManager;
focusManager.lock();
- if ( editor.editable().fire( mainPasteEvent ) && !execIECommand( 'paste' ) ) {
+ if ( editor.editable().fire( clipboard.mainPasteEvent ) && !execIECommand( 'paste' ) ) {
focusManager.unlock();
return false;
}
@@ -1493,6 +1487,22 @@
*/
isFileApiSupported: !CKEDITOR.env.ie || CKEDITOR.env.version > 9,
+
+ /**
+ * Main native paste event editable should listen to.
+ *
+ * **Note:** Safari doesn't like 'beforepaste' event - it sometimes doesn't
+ * properly handles ctrl+c. Probably some race-condition between events.
+ * Chrome and Firefox works well with both events, so better to use 'paste'
+ * which will handle pasting from e.g. browsers' menu bars.
+ * IE7/8 doesn't like 'paste' event for which it's throwing random errors.
+ *
+ * @since 4.5
+ * @readonly
+ * @property {String}
+ */
+ mainPasteEvent: CKEDITOR.env.ie ? 'beforepaste' : 'paste',
+
/**
* Returns the element that should be used as the target for the drop event.
*