#1355: Converting <p> to <pre> may add additional line breaks
----------------------+-----------------------------------------------------
Reporter: fredck | Owner: martinkou
Type: Bug | Status: assigned
Priority: Normal | Milestone: FCKeditor 2.6
Component: General | Version: SVN
Resolution: | Keywords: Review-
----------------------+-----------------------------------------------------
Comment (by fredck):
Replying to [comment:5 martinkou]:
> The regex method does not work <pre> -> regular block because converting
simple spaces to with a regex would destroy the contents inside
tags. Also for cases like
> {{{
> <pre>
> hello world!
> </pre>
> }}}
>
> Converting the space between "hello" and "world" to is not
necessary.
Martin, I still think using innerHTML and Regex is the easier solution. It
would also avoid problems with successive space text nodes.
One idea would be using the <string>.split, to split the text using a
regex that finds tags, like {{{/(<[^\s].*?>)/}}}, capturing the regex
matches, so they are included in the split array. Then, processing each
entry in the array, replacing spaces in those that don't look like tags
(don't start with {{{<[^\s]}}}, basically), and re-joining the array.
To replace the spaces, first replace all tabs with four spaces, then a
simple replace regex with {{{/ {2,}/}}} using a replace function would do
the magic.
--
Ticket URL: <http://dev.fckeditor.net/ticket/1355#comment:6>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac