--- lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm.orig	2012-05-01 17:29:02.000000000 +0200
+++ lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm	2012-05-01 22:03:12.000000000 +0200
@@ -1408,6 +1408,12 @@
         if ( $text eq $href ) {
             return ( 0, $WC::CHECKw . '[' . $nop . '[' . $href . ']]' );
         }
+	# we must quote square brackets in [[...][...]] notation
+	$text =~ s/[[]/&#91;/g;
+	$text =~ s/[]]/&#93;/g;
+	$href =~ s/[[]/%5B/g;
+	$href =~ s/[]]/%5D/g;
+
         return ( 0,
             $WC::CHECKw . '[' . $nop . '[' . $href . '][' . $text . ']]' );
     }
--- lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm.orig	2012-05-01 17:29:02.000000000 +0200
+++ lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm	2012-05-01 22:09:11.000000000 +0200
@@ -420,6 +420,12 @@
     $text =~ s#%($colourMatch)%(.*?)%ENDCOLOR%#
       _getNamedColour($1, $2)#oge;
 
+    # Handle [[][]] links by letting the WYSIWYG handle them as standard links
+    $text =~ s/\[\[([^]]*)\]\[([^]]*)\]\]/$this->_liftOutGeneral("<a href=\"$1\">", { tag => 'NONE', protect => 0, tmltag => 0 } ).$2.$this->_liftOutGeneral("<\/a>", { tag => 'NONE', protect => 0, tmltag => 0 } )/ge;
+
+    # let WYSIWYG-editable A tags untouched for the editor
+    $text =~ s/(\<a(\s+(href|target|title|class)=("(?:[^"\\]++|\\.)*+"|'(?:[^'\\]++|\\.)*+'|\S+))+\s*\>.*?\<\/a\s*\>)/$this->_liftOutGeneral($1, { tag => 'NONE', protect => 0, tmltag => 0 } )/gei;
+
     # Convert Foswiki tags to spans outside protected text
     $text = $this->_processTags($text);
 
@@ -797,13 +803,10 @@
     $text =~ s(${WC::STARTWW}\=([^\s]+?|[^\s].*?[^\s])\=$WC::ENDWW)
       (CGI::span({class => 'WYSIWYG_TT'}, $1))gem;
 
-    # Handle [[][]] and [[]] links
-
+    # Handle [[]] links
+    $text =~ s/(\[\[[^\]]*\]\])/$this->_liftOut($1, 'LINK')/ge;
     # We do _not_ support [[http://link text]] syntax
 
-    # [[][]]
-    $text =~ s/(\[\[[^\]]*\](\[[^\]]*\])?\])/$this->_liftOut($1, 'LINK')/ge;
-
     $text =~
 s/$WC::STARTWW(($Foswiki::regex{webNameRegex}\.)?$Foswiki::regex{wikiWordRegex}($Foswiki::regex{anchorRegex})?)/$this->_liftOut($1, 'LINK')/geom;
 
