Changeset 1377 for trunk


Ignore:
Timestamp:
02/06/18 10:48:05 (21 months ago)
Author:
gogo
Message:

Improve handling of tab in ListOperations? by default tab anywere in a list will indent/outdent, this works better and more expected, of course it does mean you can't actually insert tabs in them, but I think that's OK.

File:
1 edited

Legend:

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

    r1375 r1377  
    88  
    99 {{{ 
    10    xinha_config.ListOperations.tabToIndent = true; 
     10   xinha_config.ListOperations.tabToIndent = [true | 'atstart' | false]; 
    1111 }}} 
    1212  
    1313 which causes pressig tab ina list to indent (or shift-tab to detent) to  
    14  a new list level. 
     14 a new list level 
    1515  
    1616 Note that the HTML structure of this list may be, for example 
     
    3838} 
    3939 
     40Xinha.Config.prototype.ListOperations =  
     41{  
     42  // One of true, false, 'atstart' 
     43  //  where 'atstart' will indent only at the start of a list item (can be a bit wonky if there is a leading space) 
     44  tabToIndent: true  
     45} 
     46 
    4047function ListOperations(editor) 
    4148{ 
     
    4653{ 
    4754  var editor = this.editor; 
    48     
    49   if( ev.keyCode !== 9 ) { return; } 
     55  
     56  // Not enabled, drop out 
     57  if(!editor.config.ListOperations.tabToIndent) return false; 
     58   
     59  if( ev.keyCode !== 9 ) { return false; } 
    5060 
    5161  var sel = editor.getSelection(), 
     
    5464 
    5565  if( containing_list[0] === null ) { 
    56       return; 
     66      return false; 
    5767  } 
    5868 
     
    6070  containing_list = containing_list[0]; 
    6171 
    62   if( rng.startOffset !== 0 ) { 
    63     return; 
     72  if(!editor.config.ListOperations.tabToIndent == 'atstart') 
     73  { 
     74    if( rng.startOffset !== 0 ) { 
     75      return false; 
     76    } 
    6477  } 
    6578 
Note: See TracChangeset for help on using the changeset viewer.