A directory of browser-based WYSIWYG editors


Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
[Patch] Fix for running javascript through HTMLTidy

The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.



Jan 10, 2005, 2:43 AM

Post #1 of 1 (2679 views)
[Patch] Fix for running javascript through HTMLTidy Can't Post

I'm doing a little debugging in htmlArea and don't think I found a direct reference to this problem but it seems that trying to run any javascript through HTMLTidy kills it. In the most annoying way, too - it loses your content :)

Anywho, attached is a replacement html-tidy-logic.php file which is basically this patch:

*** 13,16 **** 
--- 13,20 ----
$source = stripslashes($source);

+ // Comment out script so it doesn't blow everything up
+ $source = str_replace("<script","<!--<script",$source);
+ $source = str_replace("</script>","</script>-->",$source);
// Open a tidy process - I hope it's installed!
$descriptorspec = array(
*** 68,72 ****
function setNewHtml() {
var htRef = window.parent._editorRef.plugins['HtmlTidy'];
! htRef.instance.processTidied(tidyString());
function tidyString() {
--- 72,79 ----
function setNewHtml() {
var htRef = window.parent._editorRef.plugins['HtmlTidy'];
! var newSrc = tidyString();
! newSrc = newSrc.replace('<\!--<script','<script');
! newSrc = newSrc.replace('<\/script>-->','<\/script>');
! htRef.instance.processTidied(newSrc);
function tidyString() {

(This post was edited by Hipikat on Jan 10, 2005, 2:52 AM)
Attachments: html-tidy-logic.php (2.63 KB)


Search for (options)