Ticket #6020: 6020.patch

File 6020.patch, 1.5 KB (added by Martin, 14 years ago)
  • _source/plugins/clipboard/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    342342
    343343                                var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html';
    344344
     345                                function manageButtonState()
     346                                {
     347                                        var commandCut = editor.getCommand( 'cut' ),
     348                                                commandCopy = editor.getCommand( 'copy' );
     349
     350                                        if( editor.getSelection().getRanges()[0].collapsed )
     351                                        {
     352                                                commandCut.setState( CKEDITOR.TRISTATE_DISABLED );
     353                                                commandCopy.setState( CKEDITOR.TRISTATE_DISABLED );
     354                                        }
     355                                        else
     356                                        {
     357                                                commandCut.setState( CKEDITOR.TRISTATE_OFF );
     358                                                commandCopy.setState( CKEDITOR.TRISTATE_OFF );
     359                                        }
     360                                }
     361
    345362                                // We'll be catching all pasted content in one line, regardless of whether the
    346363                                // it's introduced by a document command execution (e.g. toolbar buttons) or
    347364                                // user paste behaviors. (e.g. Ctrl-V)
     
    368385                                                });
    369386
    370387                                        body.on( 'beforecut', function() { !depressBeforeEvent && fixCut( editor ); } );
     388
     389                                        body.on( 'mouseup', manageButtonState );
     390
     391                                        editor.document.on( 'keyup', manageButtonState );
    371392                                });
    372393
    373394                                // If the "contextmenu" plugin is loaded, register the listeners.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy