Changeset 13273

Show
Ignore:
Timestamp:
04/05/08 12:07:33 (8 months ago)
Author:
liucougar
Message:

fixes #3598: just show a dialog to notify user that he can only paste using keyboard shortcut

Location:
dijit/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/Editor.js

    r12777 r13273  
    146146                                return this[cmd](); 
    147147                        }else{ 
     148                                if(this.customUndo){ 
     149                                        this.endEditing(); 
     150                                        this._beginEditing(); 
     151                                } 
    148152                                try{ 
    149                                         if(this.customUndo){ 
    150                                                 this.endEditing(); 
    151                                                 this._beginEditing(); 
    152                                         } 
    153153                                        var r = this.inherited('execCommand',arguments); 
    154                                         if(this.customUndo){ 
    155                                                 this._endEditing(); 
    156                                         } 
    157                                         return r; 
     154                    if(dojo.isSafari && cmd=='paste' && !r){ //see #4598: safari does not support invoking paste from js 
     155                        var su = dojo.string.substitute, _isM = navigator.userAgent.indexOf("Macintosh") != -1; 
     156                        alert(su(this.commands.pasteShortcutSafari,[su(this.commands[_isM ? 'appleKey' : 'ctrlKey'], ['V'])])); 
     157                    } 
    158158                                }catch(e){ 
    159159                                        if(dojo.isMoz && /copy|cut|paste/.test(cmd)){ 
     
    165165                                                        [this.commands[cmd], sub(this.commands[isMac ? 'appleKey' : 'ctrlKey'], [accel[cmd]])])); 
    166166                                        } 
    167                                         return false; 
    168                                 } 
     167                                        r = false; 
     168                                } 
     169                                if(this.customUndo){ 
     170                                        this._endEditing(); 
     171                                } 
     172                                return r; 
    169173                        } 
    170174                }, 
  • dijit/trunk/_editor/nls/commands.js

    r11886 r13273  
    4141        'systemShortcutFF': 'The "${0}" action is only available in Mozilla Firefox using a keyboard shortcut. Use ${1}.', 
    4242        'ctrlKey':'ctrl+${0}', 
    43         'appleKey':'\u2318${0}' // "command" or open-apple key on Macintosh 
     43        'appleKey':'\u2318${0}', // "command" or open-apple key on Macintosh 
     44        'pasteShortcutSafari':'The "paste" action is only available in Safari using a keyboard shortcut. Use ${0}.' 
    4445}) 
  • dijit/trunk/_editor/plugins/EnterKeyHandling.js

    r13263 r13273  
    146146 
    147147                //text node directly under body, let's wrap them in a node 
    148                 if(!block.blockNode){ 
    149                         this.editor.document.execCommand('formatblock', false, this.blockNodeForEnter); 
     148                if(!block.blockNode || block.blockNode===this.editor.editNode){ 
     149                        dijit._editor.RichText.prototype.execCommand.call(this.editor, 'formatblock',this.blockNodeForEnter); 
    150150                        //get the newly created block node 
    151151                        // FIXME 
  • dijit/trunk/_editor/RichText.js

    r13262 r13273  
    450450                if(!this.iframe){ 
    451451                        var ifr = this.iframe = dojo.doc.createElement("iframe"); 
    452                         ifr.id=this.id; 
     452                        ifr.id=this.id+"_iframe"; 
    453453                        // this.iframe.src = "about:blank"; 
    454454                        // dojo.doc.body.appendChild(this.iframe);