Changeset 1256


Ignore:
Timestamp:
05/10/10 09:22:00 (7 years ago)
Author:
gogo
Message:

Ticket:1485

Add a double-click handler which will bring up the link/image insertion dialogs (or ImageManager/Linker?) when a link or image is double clicked.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XinhaCore.js

    r1248 r1256  
    11711171    killword: [ "Clear MSOffice tags", ["ed_buttons_main.png",4,3], false, function(e) { e.execCommand("killword"); } ] 
    11721172  }; 
     1173   
     1174  /** A hash of double click handlers for the given elements, each element may have one or more double click handlers 
     1175   *  called in sequence.  The element may contain a class selector ( a.somethingSpecial ) 
     1176   *   
     1177   */ 
     1178    
     1179  this.dblclickList =  
     1180  { 
     1181    "a": [function(e, target) {e._createLink(target);}], 
     1182    "img": [function(e, target) {e._insertImage(target);}] 
     1183  }; 
     1184   
    11731185  /** A container for additional icons that may be swapped within one button (like fullscreen) 
    11741186   * @private 
     
    35563568        } 
    35573569      ); 
     3570       
     3571      Xinha._addEvents( 
     3572        doc,  
     3573        ["dblclick"], 
     3574        function (event) 
     3575        { 
     3576          return editor._onDoubleClick(Xinha.is_ie ? editor._iframe.contentWindow.event : event); 
     3577        } 
     3578      ); 
     3579       
    35583580      if(resetting_events_for_opera) return; 
    35593581 
     
    54425464}; 
    54435465 
     5466/** Handle double click events. 
     5467 *  See dblclickList in the config. 
     5468 */ 
     5469  
     5470Xinha.prototype._onDoubleClick = function(ev) 
     5471{ 
     5472  var editor=this; 
     5473  var target = Xinha.is_ie ? ev.srcElement : ev.target; 
     5474  var tag = target.tagName; 
     5475  var className = target.className; 
     5476  if (tag) { 
     5477    tag = tag.toLowerCase(); 
     5478    if (className && (this.config.dblclickList[tag+"."+className] != undefined)) 
     5479      this.config.dblclickList[tag+"."+className][0](editor, target); 
     5480    else if (this.config.dblclickList[tag] != undefined) 
     5481      this.config.dblclickList[tag][0](editor, target); 
     5482  }; 
     5483}; 
     5484 
    54445485/** Handles ctrl + key shortcuts  
    54455486 *  @TODO: make this mor flexible 
Note: See TracChangeset for help on using the changeset viewer.