Changeset 40 for trunk/plugins


Ignore:
Timestamp:
03/19/05 12:43:54 (15 years ago)
Author:
gogo
Message:

Applying #64

Location:
trunk/plugins/HtmlTidy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/HtmlTidy/html-tidy-logic.php

    r30 r40  
    1818                1 => array("pipe", "w") 
    1919        ); 
    20         $process = proc_open("tidy -config html-tidy-config.cfg", $descriptorspec, $pipes); 
     20        $process = proc_open("tidy -utf8 -config html-tidy-config.cfg", $descriptorspec, $pipes); 
     21 
    2122 
    2223        // Make sure the program started and we got the hooks... 
     
    5960        } 
    6061?> 
    61  
    62  
    63 <html> 
    64   <head> 
    65     <script type="text/javascript"> 
    66  
    67 function setNewHtml() { 
    68         var htRef = window.parent._editorRef.plugins['HtmlTidy']; 
    69         htRef.instance.processTidied(tidyString()); 
    70 } 
    71 function tidyString() { 
    72         var ns = '\n'; 
    73         <?=$jsMakeSrc;?> 
    74         return ns; 
    75 } 
    76  
    77     </script> 
    78   </head> 
    79  
    80   <body id="htiNewBody" onload="setNewHtml()"> 
    81   </body> 
    82 </html> 
     62var ns=""; 
     63<?=$jsMakeSrc?> 
     64editor.setHTML(ns); 
  • trunk/plugins/HtmlTidy/html-tidy.js

    r20 r40  
    7777]; 
    7878 
    79 HtmlTidy.prototype.onGenerateOnce = function() { 
    80         var editor = this.editor; 
    81  
    82         var ifr = document.createElement("iframe"); 
    83         ifr.name = "htiframe_name"; 
    84         var s = ifr.style; 
    85         s.position = "absolute"; 
    86         s.width = s.height = s.border = s.left = s.top = s.padding = s.margin = "0px"; 
    87         document.body.appendChild(ifr); 
    88  
    89         var frm = '<form id="htiform_id" name="htiform_name" method="post" target="htiframe_name" action="'; 
    90         frm += _editor_url + 'plugins/HtmlTidy/html-tidy-logic.php'; 
    91         frm += '"><textarea name="htisource_name" id="htisource_id">'; 
    92         frm += '</textarea></form>'; 
    93  
    94         var newdiv = document.createElement('div'); 
    95         newdiv.style.display = "none"; 
    96         newdiv.innerHTML = frm; 
    97         document.body.appendChild(newdiv); 
    98 }; 
    99  
    10079HtmlTidy.prototype.buttonPress = function(editor, id) { 
    10180        var i18n = HtmlTidy.I18N; 
    10281 
    103         switch (id) { 
    104             case "HT-html-tidy": 
    105  
    106                 var oldhtml = editor.getHTML(); 
    107  
    108                 // Ask the server for some nice new html, based on the old... 
    109                 var myform = document.getElementById('htiform_id'); 
    110                 var txtarea = document.getElementById('htisource_id'); 
    111                 txtarea.value = editor.getHTML(); 
    112  
    113                 // Apply the 'meanwhile' text, e.g. "Tidying HTML, please wait..." 
    114                 editor.setHTML(i18n['tidying']); 
    115  
    116                 // The returning tidying processing script needs to find the editor 
    117                 window._editorRef = editor; 
    118  
    119                 // ...And send our old source off for processing! 
    120                 myform.submit(); 
     82        switch (id) 
     83  { 
     84    case "HT-html-tidy": 
     85    { 
     86      var oldhtml = editor.getHTML(); 
     87      // Ask the server for some nice new html, based on the old... 
     88      HTMLArea._postback(_editor_url + 'plugins/HtmlTidy/html-tidy-logic.php', {'htisource_name' : oldhtml}, 
     89                            function(javascriptResponse) { eval(javascriptResponse) }); 
     90    } 
    12191                break; 
    12292        } 
Note: See TracChangeset for help on using the changeset viewer.