Item6068: WYSIWYG removes linebreaks from pre-tag
Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
After editing a topic that contains pre-Tags with wysiwyg all linebreaks are deleted.
e.g. create a topic with raw-edit
<pre>
Test
Test
Test
</pre>
edit and save with wysiwyg:
<pre>test test test</pre>
--
TWiki:Main/CedricWeber - 14 Oct 2008
Closing.
Same as
http://foswiki.com/Tasks/Item6068
--
MartinCleaver - 08 Jan 2009
MMM. Martin you point the bug to itself and closes the bug???
Re-opening
--
KennethLavrsen - 04 Jul 2009
Okay guys, any ideas? Any flash of inspiration what causes this bug?
--
SvenHess - 15 Jul 2009
I believe I solved the problem in my 1.0.6 installation with the patch below.
I would be grateful for a confirmation or a correction to my approach.
diff -ur WysiwygPlugin/TML2HTML.pm WysiwygPlugin-patched/TML2HTML.pm
--- WysiwygPlugin/TML2HTML.pm 2009-06-21 23:22:23.000000000 +0200
+++ WysiwygPlugin-patched/TML2HTML.pm 2009-08-02 16:22:47.000000000 +0200
@@ -493,7 +493,7 @@
}
}
- $this->_putBackBlocks( $text, 'pre' );
+ $this->_putBackBlocks( $text, 'pre', 'pre', \&_protectVerbatimChars );
$this->_putBackBlocks( $text, 'literal', 'div' );
--
FulvioScapin - 02 Aug 2009
@FulvioScapin: I tried your patch and it does honor linefeeds and spaces, but HTML entities are shown as &entity;:
<pre>
<-- at the beginning
two spaces here -->[ ]
</pre>
looks like this in
TinyMCE:
<-- at the beginning
two spaces here -->[ ]
Note the additional linefeed at the beginning. Is this OK?
Plus, the PRE box is rendered 2 lines tall in Firefox 3.5, but that happened before your patch.
--
ArielCornejo - 11 Sep 2009
This works on trunk, except that TMCE itself eats the newline after the
<pre>
tag, so
<pre>
Test
Test
Test
</pre>
becomes
<pre>Test
Test
Test
</pre>
However, the presentation is the same before and after removal of the newline so I do not think that is a problem.
I have added unit tests to ensure that this stays fixed. Changing state to "waiting for release". (If you disagree, please change it back
)
--
MichaelTempest - 13 Jun 2010