Changeset 1382


Ignore:
Timestamp:
02/07/18 10:46:31 (18 months ago)
Author:
gogo
Message:

Fix for TableOperations? for Safari ContextMenu? issue with cell properties.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/TableOperations/TableOperations.js

    r1380 r1382  
    2020  // (the context menu can perform all the button operations) 
    2121  'tabToNext':   true, // Hit tab in a table cell goes to next (shift for prev) cell 
     22  'dblClickOpenTableProperties': false, // Double click on a cell to open table properties (I don't like this, it's unintuitive when you double-click to select a word, perhaps if it was default only for empty cells - James) 
    2223  'addToolbarLineBreak': true // By default TableOperations adds a 'linebreak' in the toolbar. 
    2324  // Set to false to prevent this and instead just append the buttons without a 'linebreak'. 
     
    7172  } 
    7273 
    73   cfg.dblclickList['td'] = [function() { self.dialogTableProperties() }]; 
    74   cfg.dblclickList['th'] = [function() { self.dialogTableProperties() }]; 
     74  if(cfg.TableOperations.doubleClickOpenTableProperties) 
     75  { 
     76    cfg.dblclickList['td'] = [function() { self.dialogTableProperties() }]; 
     77    cfg.dblclickList['th'] = [function() { self.dialogTableProperties() }]; 
     78  } 
    7579} 
    7680 
     
    113117TableOperations.prototype.getClosestMatch = function(regExpTagName) { 
    114118  var editor = this.editor; 
     119   
     120  var sel = editor.getSelection(); 
     121   
     122  // Safari is really weird, if you right click in a cell with (only?) whitespace 
     123  // it selects the entire contents of the cell and the end of the selection is  
     124  // inside the next cell. We have collapse to start to get this to work!   
     125  sel.collapseToStart(); 
     126  /* 
     127  if(typeof sel.focusNode != 'undefined' && typeof sel.focusNode.tagName != 'undefined' && sel.focusNode.tagName.match(regExpTagName)) 
     128  { 
     129    return sel.focusNode; 
     130  } 
     131  */ 
     132   
     133  var currentElement = editor.activeElement(sel) ? editor.activeElement(sel) : editor.getParentElement(sel); 
     134 
     135  if(typeof currentElement.tagName != 'undefined' && currentElement.tagName.match(regExpTagName)) 
     136  { 
     137    return currentElement; 
     138  } 
     139   
    115140  var ancestors = editor.getAllAncestors(); 
    116141  var ret = null; 
Note: See TracChangeset for help on using the changeset viewer.