[Wikiwyg-dev] wikitext - drops lines with 'start_lines' formatting?



Hi all,

First of all, thanks for all the hard work that's gone into Wikiwyg.
It's good stuff and I'm close to putting it into service on the
modified "UseModWiki" my company uses on its intranet.

The main reason for my mail though - the conversion from HTML to
wikitext seems to drop parts of 'pre' blocks where the dom has objects
inside the block.

This can be reproduced in the standalone demo on the wikiwyg.net website by:
 - type something in a Wysiwyg view
 - mark it as 'pre'
 - put a newline in the middle of the new 'pre' text
 - switch to Wikitext view
... only the 1st 'pre' line will appear.

I guess the newline in the html view becomes a '<br>' in the dom of
the 'pre', so to get both lines I think handle_start_lines() now needs
to walk the children of the pre rather than just acting on the first.

The version below works better for me - not sure it's quite there yet
though. The insert_new_line() to replace what I guess was, in this
case, a <br> seems particularly iffy...

   proto.handle_start_lines = function (element, markup) {
       if (!element) return;
       this.assert_blank_line();
       for (var part = element.firstChild; part; part = part.nextSibling) {
           if (part.nodeType == 1) {
               this.dispatch_formatter(part);
           }
           else if (part.nodeType == 3) {
                   this.appendOutput(part.nodeValue.replace(/^/mg, markup[1]));
                   this.insert_new_line();
           }
       }
       this.assert_blank_line();
   }

Cheers,
Rob.





This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.