Tags:
create new tag
view all tags

Question

I've modded my TinyMCEPlugin to have the color and font buttons shown:

    *  Set TINYMCEPLUGIN_INIT = mode : "textareas", 
      cleanup : false, theme : "advanced", 
      convert_urls : false, 
      relative_urls : false, 
      remove_script_host : false, 
      plugins : "table,searchreplace,emotions,fullscreen,spellchecker", 
      setupcontent_callback : "tinymce_plugin_setUpContent", 
      init_instance_callback : "tinymce_plugin_addWysiwygTagToForm", 
      theme_advanced_toolbar_align : "left", 
      theme_advanced_buttons1 : "fontselect,fontsizeselect,separator,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,bullist,numlist,separator,outdent,indent,separator,strikethrough,sub,sup,separator,emotions,separator,search,replace",
      theme_advanced_buttons2 : "styleselect,formatselect,separator,undo,redo,separator,spellchecker,separator,link,unlink,removeformat,hr,separator,tablecontrols,separator,anchor,image,help,code,charmap,separator,fullscreen",

This allows the insertion of tags with the wysiwyg, but on pressing the 'save' button, all html tags seem to be stripped. This is not true if i add '&nowysiwyg=1' to my URL and inssert the tags manually, but if I open with TinyMCE and save, the color is again stripped.

How do I disable this behavior? I had this working fairly perfectly with the previous version (14547 (14 Aug 2007)), although I had to comment out a line from WysiwygPlugin (TML2HTML.pm:238 # protect some HTML tags.) to make it not escape the tags to ASCII (defeating the point of wysiwyg).

Thanks for the '&nowysiwyg=1' by the way.

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: WysiwygPlugin TinyMCEPlugin
Server OS: Red Hat Enterprise Linux WS release 4 (Nahant Update 3), kernel 2.6.9-34.ELsmp
Web server: Apache/2.0.52 (Red Hat)
Perl version: 5.008008 (linux)
Client OS: same as server
Web Browser: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Categories: Add-Ons

-- BuckGolemon - 08 Sep 2007

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

This script shows the core of the issue:

#!/bin/env perl

use lib "/apps/backed_up/twiki/run/twiki/lib";
use lib "/apps/backed_up/twiki/run/twiki/lib/CPAN/lib";
use TWiki::Plugins::WysiwygPlugin;



$text = '<font color="#339966">hello</font>';
$text = TWiki::Plugins::WysiwygPlugin::TranslateTML2HTML($text);
print "TML2HTML:\n$text\n";
$text = TWiki::Plugins::WysiwygPlugin::TranslateHTML2TML($text);
print "HTML2TML:\n$text\n";

output:

TML2HTML:
<p>
<font color="#339966">hello</font>
</p>
HTML2TML:
hello

On the previous version the TML2HTML section had "&gt;" and such in it, but is OK now, but the HTML2TML is now stripping out tags.

-- BuckGolemon - 08 Sep 2007

I've traced it to this piece of code. I've commented out this section to fix my problem. Is there any way to set WC::VERY_CLEAN from the preferences?

twiki/lib/TWiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm(836):

sub _handleFONT {
    my( $this, $options ) = @_;
    # Ignore font tags
    if( $options & $WC::VERY_CLEAN ) {
        return $this->_flatten( $options );
    }
    return ( 0, undef );
}

-- BuckGolemon - 08 Sep 2007

Answer: There is are options in WysiwygPlugin code, but there doesn't seem to be an interface to the TWiki preferences. Minimal change to get fonts and everything to work:

--- HTML2TML.pm	2007-09-07 11:53:47.000000000 -0700
+++ HTML2TML.pm.bak	2007-09-07 22:41:59.000000000 -0700
@@ -100,6 +100,9 @@
     my $opts = 0;
     $opts = $WC::VERY_CLEAN
       if ( $options->{very_clean} );
+    #buck.golemon 9.7.2007
+    $opts = $WC::KEEP_WS;
+
 
     # SMELL: ought to convert to site charset

-- BuckGolemon - 08 Sep 2007

Change status to:
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2007-09-08 - BuckGolemon
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.