Ignore:
Timestamp:
12/09/05 13:43:04 (14 years ago)
Author:
gocher
Message:

Changes to CharCounter? Plugin
and updates of extended example to check it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/ext_example-body.html

    r385 r433  
    2121      return false; 
    2222    } 
    23     window.onerror = showError; 
    24     document.onerror = showError; 
    25  
    26     var f = window.parent.menu.document.forms[0]; 
     23    var f = top.frames["menu"].document.forms["fsettings"]; 
    2724    // You must set _editor_url to the URL (including trailing slash) where 
    2825    // where xinha is installed, it's highly recommended to use an absolute URL 
     
    3229    // in this example we do a little regular expression to find the absolute path. 
    3330    _editor_url  = document.location.href.replace(/examples\/ext_example-body\.html.*/, '') 
    34     _editor_lang = f.lang.value; // And the language we need to use in the editor. 
    35     _editor_skin = f.skin.value; // the skin we use in the editor 
     31    _editor_lang = f.lang[f.lang.selectedIndex].value; // the language we need to use in the editor. 
     32    _editor_skin = f.skin[f.skin.selectedIndex].value; // the skin we use in the editor 
    3633  </script> 
    3734 
     
    4643     
    4744    xinha_init = xinha_init ? xinha_init : function() { 
    48       var f = window.parent.menu.document.forms[0]; 
     45      window.onerror = showError; 
     46      document.onerror = showError; 
     47 
     48      var f = top.frames["menu"].document.forms["fsettings"]; 
    4949// What are the plugins you will be using in the editors on this page. 
    5050// List all the plugins you will need, even if not all the editors will use all the plugins. 
     
    8787 
    8888// Create a default configuration to be used by all the editors. 
     89      settings = top.frames["menu"].settings; 
    8990      xinha_config = new HTMLArea.Config(); 
    90       if (f.width) xinha_config.width = f.width.value; 
    91       if (f.height) xinha_config.height = f.height.value; 
    92       if (f.sizeIncludesBars) xinha_config.sizeIncludesBars = f.sizeIncludesBars.value; 
    93       if (f.statusBar) xinha_config.statusBar = f.statusBar.value; 
    94       if (f.mozParaHandler) xinha_config.mozParaHandler = f.mozParaHandler.value; 
    95       if (f.undoSteps) xinha_config.undoSteps = f.undoSteps.value; 
    96       if (f.baseHref) xinha_config.baseHref = f.baseHref.value; 
    97       if (f.stripBaseHref) xinha_config.stripBaseHref = f.stripBaseHref.value; 
    98       if (f.stripSelfNamedAnchors) xinha_config.stripSelfNamedAnchors = f.stripSelfNamedAnchors.value; 
    99       if (f.only7BitPrintablesInURLs) xinha_config.only7BitPrintablesInURLs = f.only7BitPrintablesInURLs.value; 
    100       if (f.sevenBitClean) xinha_config.sevenBitClean = f.sevenBitClean.value; 
    101       if (f.killWordOnPaste) xinha_config.killWordOnPaste = f.killWordOnPaste.value; 
    102       if (f.flowToolbars) xinha_config.flowToolbars = f.flowToolbars.value; 
    103       if ((typeof CharacterMap != 'undefined') && (f.CharacterMapMode)) xinha_config.CharacterMap.mode = f.CharacterMapMode.value; 
    104       if ((typeof ListType != 'undefined') && (f.ListTypeMode)) xinha_config.ListType.mode = f.ListTypeMode.value; 
     91      xinha_config.width = settings.width; 
     92      xinha_config.height = settings.height; 
     93      xinha_config.sizeIncludesBars = settings.sizeIncludesBars; 
     94      xinha_config.statusBar = settings.statusBar; 
     95      xinha_config.mozParaHandler = settings.mozParaHandler; 
     96      xinha_config.undoSteps = settings.undoSteps; 
     97      xinha_config.baseHref = settings.baseHref; 
     98      xinha_config.stripBaseHref = settings.stripBaseHref; 
     99      xinha_config.stripSelfNamedAnchors = settings.stripSelfNamedAnchors; 
     100      xinha_config.only7BitPrintablesInURLs = settings.only7BitPrintablesInURLs; 
     101      xinha_config.sevenBitClean = settings.sevenBitClean; 
     102      xinha_config.killWordOnPaste = settings.killWordOnPaste; 
     103      xinha_config.flowToolbars = settings.flowToolbars; 
     104      xinha_config.showLoading = settings.showLoading; 
     105 
     106      if (typeof CharCounter != 'undefined') { 
     107        xinha_config.CharCounter.showChar = settings.showChar; 
     108        xinha_config.CharCounter.showWord = settings.showWord; 
     109        xinha_config.CharCounter.showHtml = settings.showHtml; 
     110      } 
     111 
     112      if (typeof CharacterMap != 'undefined') xinha_config.CharacterMap.mode = settings.CharacterMapMode; 
     113      if (typeof ListType != 'undefined') xinha_config.ListType.mode = settings.ListTypeMode; 
    105114 
    106115      if(typeof CSS != 'undefined') { 
     
    148157        InsertPicture.PicturePath = '/schmal/pictures/'; 
    149158      } 
    150                          
     159 
    151160      if(typeof Filter != 'undefined') { 
    152161        xinha_config.Filters = ["Word", "Paragraph"]; 
     
    173182    } 
    174183 
     184// javascript submit handler 
     185// this shows how to create a javascript submit button that works with the htmleditor. 
     186    submitHandler = function(formname) { 
     187      var form = document.getElementById(formname); 
     188      // in order for the submit to work both of these methods have to be called. 
     189      form.onsubmit(); 
     190      window.parent.menu.document.getElementById('myTextarea0').value = document.getElementById('myTextarea0').value; 
     191      form.submit(); 
     192      return true; 
     193    } 
     194 
    175195    window.onload = xinha_init; 
     196//    window.onunload = HTMLArea.collectGarbageForIE; 
    176197  </script> 
    177198</head> 
    178199 
    179200<body> 
    180   <form id="to_submit" method="post" action="ext_example-dest.php"> 
    181   <div id="editors_here"></div> 
    182   <button type="submit">Submit</button> 
    183   <textarea id="errors" style="width:100%; height:100px; background:silver;"></textarea><!-- style="display:none;"> --> 
     201  <form id="to_submit" name="to_submit" method="post" action="ext_example-dest.php"> 
     202  <div id="editors_here" name="editors_here"></div> 
     203  <button type="button" onclick="submitHandler('to_submit');">Submit</button> 
     204  <textarea id="errors" name="errors" style="width:100%; height:100px; background:silver;"></textarea><!-- style="display:none;" --> 
    184205  </form> 
    185 <script type="text/javascript"> 
    186     var _oldSubmitHandler = null; 
    187     if (document.forms[0].onsubmit != null) { 
    188       _oldSubmitHandler = document.forms[0].onsubmit; 
    189     } 
    190     function frame_onSubmit(){ 
    191       document.getElementById('myTextarea0').value = document.getElementById('myTextarea0').value.replace(/^[\r\n]+|\s+$/, '') 
    192       window.parent.menu.document.getElementById('myTextarea0').value = document.getElementById('myTextarea0').value; 
    193       if (_oldSubmitHandler != null) { 
    194         _oldSubmitHandler(); 
    195       } 
    196     } 
    197     document.forms[0].onsubmit = frame_onSubmit; 
    198 </script> 
    199206</body> 
    200207</html> 
Note: See TracChangeset for help on using the changeset viewer.