[wp-trac] [WordPress Trac] #40907: Introduce widget dedicated for HTML code

WordPress Trac noreply at wordpress.org
Fri Jun 2 04:00:59 UTC 2017


#40907: Introduce widget dedicated for HTML code
-----------------------------+--------------------
 Reporter:  westonruter      |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  4.8.1
Component:  Widgets          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+--------------------
Description changed by westonruter:

Old description:

> As summarized in [https://make.wordpress.org/core/2017/06/01/dev-chat-
> summary-may-31st-4-8-week-5/ Dev Chat Summary: May 31st (4.8 week 5)],
> the Text widget as of 4.8 uses the same TinyMCE editor as the edit post
> screen. Like the WP editor, it has a Visual tab and a Text tab, where a
> user can supply raw HTML in the latter. What is removed from the Text
> widget is the “auto add paragraphs” checkbox which allowed a user to
> control whether or not `wpautop` was applied to the text. This was
> removed to align the widget's behavior with the post editor, where
> `wpautop` is always applied. As noted in the
> [https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-
> text-widget/#remove-extraneous-line-breaks TinyMCE Text Widget post], the
> behavioral changes to the Text widget means that users who have
> previously pasted 3rd party HTML into the Text widget may encounter extra
> line breaks if the HTML copied includes extra line breaks for readability
> (as normally line breaks in HTML are not significant). This extra line
> break issue is more problematic when pasted 3rd-party HTML includes
> JavaScript, `wpautop` can currently (erroneously) add `p` tags inside of
> `script` elements (see #2833).
>
> So, in order to facilitate users being able to paste in arbitrary HTML, a
> new “HTML Code Widget” can be introduced.
>
> At a minimum, the widget could look the same as the old Text widget
> except (again) without the checkbox to `wpautop`, where in this case it
> does ''not'' get applied.
>
> It would also be ideal for the HTML code widget to make use of CodeMirror
> to provide syntax highlighting and checking, however this depends on
> #12423, which is currently blocked due to CodeMirror not being fully
> accessible.
>
> When the user does not have the `unfiltered_html` capability, the HTML
> code widget should also indicate the HTML tags that are allowed and
> anything not allowed will be stripped. It seems logical that the HTML
> code widget should allow the same tags that are allowed in post content.

New description:

 As summarized in [https://make.wordpress.org/core/2017/06/01/dev-chat-
 summary-may-31st-4-8-week-5/ Dev Chat Summary: May 31st (4.8 week 5)], the
 Text widget as of 4.8 uses the same TinyMCE editor as the edit post
 screen. Like the WP editor, it has a Visual tab and a Text tab, where a
 user can supply raw HTML in the latter. What is removed from the Text
 widget is the “auto add paragraphs” checkbox which allowed a user to
 control whether or not `wpautop` was applied to the text. This was removed
 to align the widget's behavior with the post editor, where `wpautop` is
 always applied. As noted in the
 [https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-
 text-widget/#remove-extraneous-line-breaks TinyMCE Text Widget post], the
 behavioral changes to the Text widget means that users who have previously
 pasted 3rd party HTML into the Text widget may encounter extra line breaks
 if the HTML copied includes extra line breaks for readability (as normally
 line breaks in HTML are not significant). This extra line break issue is
 more problematic when pasted 3rd-party HTML includes JavaScript, `wpautop`
 can currently (erroneously) add `p` tags inside of `script` elements (see
 #2833).

 So, in order to facilitate users being able to paste in arbitrary HTML, a
 new “HTML Code Widget” can be introduced.

 At a minimum, the widget could look the same as the old Text widget except
 (again) without the checkbox to `wpautop`, where in this case it does
 ''not'' get applied.

 It would also be ideal for the HTML code widget to make use of CodeMirror
 to provide syntax highlighting and checking, however this depends on
 #12423, which is currently blocked due to CodeMirror not being fully
 accessible. Use of CodeMirror has also been proposed for as well as
 Additional CSS in the Customizer and the Text tab in the post editor.

 When the user does not have the `unfiltered_html` capability, the HTML
 code widget should also indicate the HTML tags that are allowed and
 anything not allowed will be stripped. It seems logical that the HTML code
 widget should allow the same tags that are allowed in post content.

--

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


More information about the wp-trac mailing list