[wp-trac] [WordPress Trac] #44617: Introduce new 'hasBlock' behavior for TinyMCE 'BeforeSetContent' and 'SaveContent' events

WordPress Trac noreply at wordpress.org
Sat Jul 21 12:51:51 UTC 2018


#44617: Introduce new 'hasBlock' behavior for TinyMCE 'BeforeSetContent' and
'SaveContent' events
------------------------------------+---------------------
 Reporter:  danielbachhuber         |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  4.9.8
Component:  Editor                  |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+---------------------

Comment (by azaozz):

 > TinyMCE applies <p> paragraph tags to all root nodes...

 Right. There is even a setting for that (which tag to use).

 Couple of things:
 1. This is "not supported formatting" in the current (classic) editor:
 {{{
 [column]

 I daresay that Fry has discovered the smelliest object in the known
 universe! For the last time, I don't like lilacs! Your 'first' wife was
 the one who liked lilacs! No argument here. A true inspiration for the
 children.

 [/column]
 }}}

 Frankly I don't see why we should add support for it now. That will also
 most likely introduce several edge cases which will have to be fixed at
 the cost of adding other edge cases, etc. etc.

 2. The current/classic editor is set to remove all line breaks when
 "saving" the content. This is done to facilitate running `pre_wpautop()`
 to remove the `<p>` tags (at that point line breaks become meaningful in
 the content). Don't think we should change that, the amount of back-compat
 and edge cases will be overwhelming.

 We discussed the possible solutions to shortcodes in existing content when
 loading them in Gutenberg blocks:
 - One possibility is that the content will have to be run through
 `wpautop()` and then, if there are any shorcodes in it, the content will
 also have to be run through `shortcodes_unautop()`. That is the exact
 handling on the front-end, and will ensure all shortcodes "arrive" in
 proper formatting to Gutenberg.
 - Another possibility would be to run `shortcodes_unautop()` even on posts
 created with Gutenberg when there are old-style shortcodes in them. (This
 may actually be the better option, needs testing).

 Don't think we need to specifically deal with old-style shortcodes that
 are "improperly formatted" then saved in a Gutenberg post and then edited
 in the classic editor. The only change that might make sense would be to
 check if a post has shortcodes in it, and still run `shortcodes_unautop()`
 even when `wpautop()` is disabled.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44617#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list