[wp-trac] [WordPress Trac] #29458: No longer able to catch click event of dashicons edit/delete

WordPress Trac noreply at wordpress.org
Mon Sep 1 23:51:35 UTC 2014


#29458: No longer able to catch click event of dashicons edit/delete
-------------------------------------+------------------------------
 Reporter:  programmin               |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Media                    |     Version:  3.9
 Severity:  normal                   |  Resolution:
 Keywords:  reporter-feedback close  |     Focuses:  ui, javascript
-------------------------------------+------------------------------

Comment (by programmin):

 Here's the code affecting it, in wpviews plugin:

 {{{

 editor.on( 'mousedown mouseup click touchend', function( event ) {
                         var view = getView( event.target );

                         firstFocus = false;

                         // Contain clicks inside the view wrapper
                         if ( view ) {
                                 event.stopImmediatePropagation();
                                 event.preventDefault();

                                 if ( ( event.type === 'touchend' ||
 event.type === 'mousedown' ) && ! event.metaKey && ! event.ctrlKey ) {
                                         if ( editor.dom.hasClass(
 event.target, 'edit' ) ) {
                                                 wp.mce.views.edit( view );
                                                 editor.focus();
                                                 return false;
                                         } else if ( editor.dom.hasClass(
 event.target, 'remove' ) ) {
                                                 removeView( view );
                                                 return false;
                                         }
                                 }

                                 if ( event.type === 'touchend' && scrolled
 ) {
                                         scrolled = false;
                                 } else {
                                         select( view );
                                 }

                                 // Returning false stops the ugly bars
 from appearing in IE11 and stops the view being selected as a range in FF.
                                 // Unfortunately, it also inhibits the
 dragging of views to a new location.
                                 return false;
                         } else {
                                 if ( event.type === 'touchend' ||
 event.type === 'mousedown' ) {
                                         deselect();
                                 }
                         }

                         if ( event.type === 'touchend' && scrolled ) {
                                 scrolled = false;
                         }
                 }, true );
 }}}

 Looks like removeView and getView are private here, and there's no obvious
 way to add handler to cancel deletion of certain wp-views or images, for
 example.

 This seems somewhat related to #28169

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


More information about the wp-trac mailing list