[wp-trac] [WordPress Trac] #13314: HTML is deleted when switched to visual editor

WordPress Trac wp-trac at lists.automattic.com
Sun Sep 16 01:37:19 UTC 2012


#13314: HTML is deleted when switched to visual editor
--------------------------+-----------------------
 Reporter:  BH8489        |       Owner:  azaozz
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  3.5
Component:  Editor        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+-----------------------

Comment (by azaozz):

 Replying to [comment:25 MarcusPope]:
 > Replying to [comment:13 azaozz]:
 > > ...
 > > As the html is parsed into a DOM and then serialized back to a string,
 keeping the original white space/line breaks is impossible, except in a
 <pre>.
 >
 > As with most of everything related to software, not only is it
 '''possible''', it's also pretty easy to implement:
 http://wordpress.org/extend/plugins/preserved-html-editor-markup/

 That's nor exactly true :) This plugin preserves '''some''' of the html
 code formatting/line breaks, but breaks pretty bad with other. Example:

 {{{
 <p
     class="some"
     id="else"
     style="margin: 1em 0;"
 >
 }}}

 That's besides the point though, the text editor doesn't have preserving
 white space and line breaks as priority (as they don't matter in html).
 The priority there is to keep the paragraphs flowing "naturally" and allow
 use of some html tags. There was a discussion in IRC about making it
 easier for plugins to add Code tab, trying to preserve line breaks and
 white space would be good for there.

 The above plugin also replaces (some?) TinyMCE logic when inserting <br>
 tags. If that works well in all browsers, why not make a patch and submit
 it to them.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13314#comment:28>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list