[6779] | 1 | // Plugin for htmlArea to run code through the server's HTML Tidy |
---|
| 2 | // By Adam Wright, for The University of Western Australia |
---|
| 3 | // |
---|
| 4 | // Email: zeno@ucc.gu.uwa.edu.au |
---|
| 5 | // Homepage: http://blog.hipikat.org/ |
---|
| 6 | // |
---|
| 7 | // Distributed under the same terms as HTMLArea itself. |
---|
| 8 | // This notice MUST stay intact for use (see license.txt). |
---|
| 9 | // |
---|
| 10 | // Version: 0.5 |
---|
| 11 | // Released to the outside world: 04/03/04 |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | HtmlTidy is a plugin for the popular cross-browser TTY WYSIWYG editor, |
---|
| 15 | htmlArea (http://www.interactivetools.com/products/htmlarea/). HtmlTidy |
---|
| 16 | basically queries HTML Tidy (http://tidy.sourceforge.net/) on the |
---|
| 17 | server side, getting it to make-html-nice, instead of relying on masses |
---|
| 18 | of javascript, which the client would have to download. |
---|
| 19 | |
---|
| 20 | Hi, this is a quick explanation of how to install HtmlTidy. Much better |
---|
| 21 | documentation is probably required, and you're welcome to write it :) |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | * The HtmlTidy directory you should have found this file in should |
---|
| 25 | include the following: |
---|
| 26 | |
---|
| 27 | - README |
---|
| 28 | This file, providing help installing the plugin. |
---|
| 29 | |
---|
| 30 | - html-tidy-config.cfg |
---|
| 31 | This file contains the configuration options HTML Tidy uses to |
---|
| 32 | clean html, and can be modified to suit your organizations |
---|
| 33 | requirements. |
---|
| 34 | |
---|
| 35 | - html-tidy-logic.php |
---|
| 36 | This is the php script, which is queried with dirty html and is |
---|
| 37 | responsible for invoking HTML Tidy, getting nice new html and |
---|
| 38 | returning it to the client. |
---|
| 39 | |
---|
| 40 | - html-tidy.js |
---|
| 41 | The main htmlArea plugin, providing functionality to tidy html |
---|
| 42 | through the htmlArea interface. |
---|
| 43 | |
---|
| 44 | - htmlarea.js.onmode_event.diff |
---|
| 45 | At the time of publishing, an extra event handler was required |
---|
| 46 | inside the main htmlarea.js file. htmlarea.js may be patched |
---|
| 47 | against this file to make the changes reuquired, but be aware |
---|
| 48 | that the event handler may either now be in the core or |
---|
| 49 | htmlarea.js may have changed enough to invalidate the patch. |
---|
| 50 | |
---|
| 51 | UPDATE: now it exists in the official htmlarea.js; applying |
---|
| 52 | this patch is thus no longer necessary. |
---|
| 53 | |
---|
| 54 | - img/html-tidy.gif |
---|
| 55 | The HtmlTidy icon, for the htmlArea toolbar. Created by Dan |
---|
| 56 | Petty for The University of Western Australia. |
---|
| 57 | |
---|
| 58 | - lang/en.js |
---|
| 59 | English language file. Add your own language files here and |
---|
| 60 | please contribute back into the htmlArea community! |
---|
| 61 | |
---|
| 62 | The HtmlArea directory should be extracted to your htmlarea/plugins/ |
---|
| 63 | directory. |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | * Make sure the onMode event handler mentioned above, regarding |
---|
| 67 | htmlarea.js.onmode_event.diff, exists in your htmlarea.js |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | * html-tidy-logic.php should be executable, and your web server should |
---|
| 71 | be configured to execute php scripts in the directory |
---|
| 72 | html-tidy-logic.php exists in. |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | * HTML Tidy needs to be installed on your server, and 'tidy' should be |
---|
| 76 | an alias to it, lying in the PATH known to the user executing such |
---|
| 77 | web scripts. |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | * In your htmlArea configuration, do something like this: |
---|
| 81 | |
---|
| 82 | HTMLArea.loadPlugin("HtmlTidy"); |
---|
| 83 | |
---|
| 84 | editor = new HTMLArea("doc"); |
---|
| 85 | editor.registerPlugin("HtmlTidy"); |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | * Then, in your htmlArea toolbar configuration, use: |
---|
| 89 | |
---|
| 90 | - "HT-html-tidy" |
---|
| 91 | This will create the 'tidy broom' icon on the toolbar, which |
---|
| 92 | will attempt to tidy html source when clicked, and; |
---|
| 93 | |
---|
| 94 | - "HT-auto-tidy" |
---|
| 95 | This will create an "Auto Tidy" / "Don't Tidy" dropdown, to |
---|
| 96 | select whether the source should be tidied automatically when |
---|
| 97 | entering source view. On by default, if you'd like it otherwise |
---|
| 98 | you can do so programatically after generating the toolbar :) |
---|
| 99 | (Or just hack it to be otherwise...) |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | Thank you. |
---|
| 103 | |
---|
| 104 | Any bugs you find can be emailed to zeno@ucc.gu.uwa.edu.au |
---|