Ticket #1344: 1344_3.patch

File 1344_3.patch, 4.3 KB (added by Frederico Caldeira Knabben, 16 years ago)
  • _whatsnew.html

     
    146146                        FCKConfig.RemoveAttributes.</li>
    147147                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1596">#1596</a>] On Safari,
    148148                        dialogs have now rigth-to-left layout when it runs a RTL language, like Arabic.</li>
     149                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1344">#1344</a>] Added warning message on
     150                        Copy and Cut operation failure on IE due to paste permission settings.</li>
    149151        </ul>
    150152        <p>
    151153                <a href="_whatsnew_history.html">See previous versions history</a>
  • editor/_source/commandclasses/fck_othercommands.js

     
    396396        }
    397397} ;
    398398
    399 // FCKCopyCommand
    400 var FCKCopyCommand = function()
     399// FCKCutCopyCommand
     400var FCKCutCopyCommand = function( isCut )
    401401{
    402         this.Name = 'Copy' ;
     402        this.Name = isCut ? 'Cut' : 'Copy' ;
    403403}
    404404
    405 FCKCopyCommand.prototype =
     405FCKCutCopyCommand.prototype =
    406406{
    407407        Execute : function()
    408408        {
    409                 FCK.ExecuteNamedCommand( this.Name ) ;
     409                var enabled = false ;
     410               
     411                if ( FCKBrowserInfo.IsIE )
     412                {
     413                        // The following seems to be the only reliable way to detect that
     414                        // cut/copy is enabled in IE. It will fire the oncut/oncopy event
     415                        // only if the security settings enabled the command to execute.
     416
     417                        var onEvent = function()
     418                        {
     419                                enabled = true ;
     420                        } ;
     421
     422                        var eventName = 'on' + this.Name.toLowerCase() ;
     423                       
     424                        FCK.EditorDocument.body.attachEvent( eventName, onEvent ) ;
     425                        FCK.ExecuteNamedCommand( this.Name ) ;
     426                        FCK.EditorDocument.body.detachEvent( eventName, onEvent ) ;
     427                }
     428                else
     429                {
     430                        try                     
     431                        {
     432                                // Other browsers throw an error if the command is disabled.
     433                                FCK.ExecuteNamedCommand( this.Name ) ;
     434                                enabled = true ;
     435                        }
     436                        catch(e){}
     437                }
     438
     439                if ( !enabled )
     440                        alert( FCKLang[ 'PasteError' + this.Name ] ) ;
    410441        },
    411442
    412443        GetState : function()
    413444        {
    414                 if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
    415                         return FCK_TRISTATE_DISABLED ;
    416                 // Strangely, the cut command happens to have the correct states for both Copy and Cut in all browsers.
    417                 return FCK.GetNamedCommandState( 'Cut' ) ;
     445                // Strangely, the Cut command happens to have the correct states for
     446                // both Copy and Cut in all browsers.
     447                return FCK.EditMode != FCK_EDITMODE_WYSIWYG ?
     448                                FCK_TRISTATE_DISABLED :
     449                                FCK.GetNamedCommandState( 'Cut' ) ;
    418450        }
    419451};
    420452
  • editor/_source/internals/fck_gecko.js

     
    301301FCK.RedirectNamedCommands =
    302302{
    303303        Print   : true,
    304         Paste   : true,
    305 
    306         Cut     : true,
    307         Copy    : true
     304        Paste   : true
    308305} ;
    309306
    310307// ExecuteNamedCommand overload for Gecko.
     
    327324                        }
    328325                        catch (e)       { FCKDialog.OpenDialog( 'FCKDialog_Paste', FCKLang.Paste, 'dialog/fck_paste.html', 400, 330, 'Security' ) ; }
    329326                        break ;
    330                 case 'Cut' :
    331                         try                     { FCK.ExecuteNamedCommand( 'Cut', null, true ) ; }
    332                         catch (e)       { alert(FCKLang.PasteErrorCut) ; }
    333                         break ;
    334                 case 'Copy' :
    335                         try                     { FCK.ExecuteNamedCommand( 'Copy', null, true ) ; }
    336                         catch (e)       { alert(FCKLang.PasteErrorCopy) ; }
    337                         break ;
    338327                default :
    339328                        FCK.ExecuteNamedCommand( commandName, commandParameter ) ;
    340329        }
  • editor/_source/internals/fckcommands.js

     
    126126
    127127                case 'Undo'     : oCommand = new FCKUndoCommand() ; break ;
    128128                case 'Redo'     : oCommand = new FCKRedoCommand() ; break ;
    129                 case 'Copy'     : oCommand = new FCKCopyCommand() ; break ;
     129                case 'Copy'     : oCommand = new FCKCutCopyCommand( false ) ; break ;
     130                case 'Cut'      : oCommand = new FCKCutCopyCommand( true ) ; break ;
    130131
    131132                case 'SelectAll'                        : oCommand = new FCKSelectAllCommand() ; break ;
    132133                case 'InsertOrderedList'        : oCommand = new FCKListCommand( 'insertorderedlist', 'ol' ) ; break ;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy