[wp-trac] [WordPress Trac] #33335: embedURL wp-view not detecting in div, only p tag.

WordPress Trac noreply at wordpress.org
Tue Aug 11 07:02:55 UTC 2015


#33335: embedURL wp-view not detecting in div, only p tag.
--------------------------------------------+-----------------------------
 Reporter:  programmin                      |      Owner:
     Type:  defect (bug)                    |     Status:  new
 Priority:  normal                          |  Milestone:  Awaiting Review
Component:  Editor                          |    Version:  trunk
 Severity:  normal                          |   Keywords:
  Focuses:  ui, javascript, administration  |
--------------------------------------------+-----------------------------
 As described here, there's a cool link-edit-popup in 4.3:
 https://make.wordpress.org/core/2015/08/01/editor-enhancements-
 in-4-3-%e2%9c%a8/

 Unfortunately if the post has divs instead of paragraphs, for example if
 you have MCE set to forced_root_block = 'div', you never see these. In wp-
 views.js you see it's matching paragraphs:



 {{{
         views.register( 'embedURL', _.extend( {}, embed, {
                 match: function( content ) {
                         var re =
 /(^|<p>)(https?:\/\/[^\s"]+?)(<\/p>\s*|$)/gi,
                                 match = re.exec( content );

                         if ( match ) {
                                 return {
                                         index: match.index +
 match[1].length,
                                         content: match[2],
                                         options: {
                                                 url: true
                                         }
                                 };
                         }
                 }
         } ) );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33335>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list