Changeset 1448


Ignore:
Timestamp:
05/23/18 23:42:12 (3 months ago)
Author:
gogo
Message:

Add UseStrongEm? plugin and preserveI, preserveB core configuration options.

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/XinhaCore.js

    r1442 r1448  
    604604  PSLocal:              { url: _editor_url+'unsupported_plugins/PSLocal/PSLocal.js' }, 
    605605  PSServer:             { url: _editor_url+'unsupported_plugins/PSServer/PSServer.js' }, 
     606  QuickSnippet:         { url: _editor_url+'plugins/QuickSnippet/QuickSnippet.js' }, 
    606607  QuickTag:             { url: _editor_url+'plugins/QuickTag/QuickTag.js' }, 
    607608  SaveOnBlur:           { url: _editor_url+'plugins/SaveOnBlur/SaveOnBlur.js' }, 
     
    983984   */ 
    984985  this.htmlRemoveTags = null; 
     986 
     987 /** If the HTML fed into Xinha includes <i> tags, preserve these, otherwise convert them into <em> 
     988  *  
     989  *  The default null will not preserve UNLESS you load the UseStrongEm plugin in which case it will,  
     990  *  that means that if you use the italic button with UseStrongEm that it will insert an <em> 
     991  *  but you can also include <i> as is common to do with young designers who think it means "icon" 
     992  *  instead of "italic" :-) 
     993  *  
     994  *  Set to true or false if you want to explicitly handle this. 
     995  */ 
     996  
     997  this.preserveI     = null; 
     998 
     999 /** If the HTML fed into Xinha includes <b> tags, preserve these, otherwise convert them into <strong> 
     1000  *  
     1001  *  The default null will not preserve UNLESS you load the UseStrongEm plugin in which case it will,  
     1002  *  that means that if you use the bold button with UseStrongEm that it will insert an <strong> 
     1003  *  but you can also include <b>. 
     1004  *  
     1005  *  Set to true or false if you want to explicitly handle this. 
     1006  */ 
     1007  
     1008  this.preserveB     = null; 
    9851009 
    9861010 /** Turning this on will turn all "linebreak" and "separator" items in your toolbar into soft-breaks, 
     
    55255549        { 
    55265550          case 'b': 
    5527             txt = 'strong'; 
     5551            if(!this.config.preserveB) txt = 'strong'; 
    55285552          break; 
    55295553          case 'i': 
    5530             txt = 'em'; 
     5554            if(!this.config.preserveI) txt = 'em'; 
    55315555          break; 
    55325556          case 'strike': 
     
    66526676  } 
    66536677   
    6654   html = html.replace(/<(\/?)b(\s|>|\/)/ig, "<$1strong$2"); 
    6655   html = html.replace(/<(\/?)i(\s|>|\/)/ig, "<$1em$2"); 
     6678  if(!this.config.preserveB) 
     6679  { 
     6680    html = html.replace(/<(\/?)b(\s|>|\/)/ig, "<$1strong$2"); 
     6681  } 
     6682   
     6683  if(!this.config.preserveI) 
     6684  { 
     6685    html = html.replace(/<(\/?)i(\s|>|\/)/ig, "<$1em$2"); 
     6686  } 
     6687 
    66566688  html = html.replace(/<(\/?)strike(\s|>|\/)/ig, "<$1del$2"); 
    66576689   
  • trunk/modules/Gecko/Gecko.js

    r1402 r1448  
    361361   // Midas uses b and i internally instead of strong and em 
    362362   // Xinha will use strong and em externally (see Xinha.prototype.outwardHtml)    
    363    html = html.replace(/<(\/?)strong(\s|>|\/)/ig, "<$1b$2"); 
    364    html = html.replace(/<(\/?)em(\s|>|\/)/ig, "<$1i$2");     
     363   if(!this.editor.config.preserveB) 
     364   { 
     365     html = html.replace(/<(\/?)strong(\s|>|\/)/ig, "<$1b$2"); 
     366   } 
     367    
     368   if(!this.editor.config.preserveI) 
     369   { 
     370     html = html.replace(/<(\/?)em(\s|>|\/)/ig, "<$1i$2");     
     371   } 
    365372    
    366373   // Both IE and Gecko use strike internally instead of del (#523) 
Note: See TracChangeset for help on using the changeset viewer.