Ignore:
Timestamp:
05/01/06 04:51:51 (13 years ago)
Author:
gogo
Message:

Added filter for ticket:709 and also allowed filter config to be an
object rather than just the label, this is to allow for
off-by-default filters (such as the one just added).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/SuperClean/super-clean.js

    r376 r507  
    107107               'remove_sizes': HTMLArea._lc('Remove custom font sizes.', 'SuperClean'), 
    108108               'remove_colors': HTMLArea._lc('Remove custom text colors.', 'SuperClean'), 
    109                'remove_lang': HTMLArea._lc('Remove lang attributes.', 'SuperClean') 
     109               'remove_lang': HTMLArea._lc('Remove lang attributes.', 'SuperClean'), 
     110               'remove_fancy_quotes': {label:HTMLArea._lc('Replace directional quote marks with non-directional quote marks.', 'SuperClean'), checked:false}, 
    110111  //additional custom filters (defined in plugins/SuperClean/filters/word.js) 
    111112               //'paragraph': 'remove paragraphs'}, 
     
    149150  return editor.getInnerHTML(); 
    150151}; 
     152 
     153SuperClean.filterFunctions.remove_fancy_quotes = function(D) 
     154{ 
     155  D = D.replace(new RegExp(String.fromCharCode(8216),"g"),"'"); 
     156  D = D.replace(new RegExp(String.fromCharCode(8217),"g"),"'"); 
     157  D = D.replace(new RegExp(String.fromCharCode(8220),"g"),"\""); 
     158  D = D.replace(new RegExp(String.fromCharCode(8221),"g"),"\""); 
     159  return D; 
     160}; 
     161 
    151162SuperClean.filterFunctions.tidy = function(html, editor) 
    152163{ 
     
    224235  { 
    225236    htmlFilters += "    <div>\n"; 
    226     htmlFilters += "        <input type=\"checkbox\" name=\"["+filter+"]\" id=\"["+filter+"]\" checked />\n"; 
    227     htmlFilters += "        <label for=\"["+filter+"]\">"+this.SuperClean.editor.config.SuperClean.filters[filter]+"</label>\n"; 
     237    var filtDetail = this.SuperClean.editor.config.SuperClean.filters[filter]; 
     238    if(typeof filtDetail.label == 'undefined') 
     239    {     
     240      htmlFilters += "        <input type=\"checkbox\" name=\"["+filter+"]\" id=\"["+filter+"]\" checked />\n"; 
     241      htmlFilters += "        <label for=\"["+filter+"]\">"+this.SuperClean.editor.config.SuperClean.filters[filter]+"</label>\n"; 
     242    } 
     243    else 
     244    { 
     245      htmlFilters += "        <input type=\"checkbox\" name=\"["+filter+"]\" id=\"["+filter+"]\" " + (filtDetail.checked ? "checked" : "") + " />\n"; 
     246      htmlFilters += "        <label for=\"["+filter+"]\">"+filtDetail.label+"</label>\n"; 
     247    } 
    228248    htmlFilters += "    </div>\n"; 
    229249  } 
Note: See TracChangeset for help on using the changeset viewer.