Skip to content

Commit

Permalink
mainPasteEvent should be public to use it in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun authored and scofalik committed Jul 6, 2015
1 parent 1f594e6 commit 17fa5d2
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions plugins/clipboard/plugin.js
Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 17fa5d2

Please sign in to comment.