[wp-trac] [WordPress Trac] #52493: Link button in custom wysiwyg textarea not compatible with new jQuery

WordPress Trac noreply at wordpress.org
Wed Feb 10 21:05:32 UTC 2021


#52493: Link button in custom wysiwyg textarea not compatible with new jQuery
--------------------------+-----------------------------
 Reporter:  lgedeon       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In 5.7-beta2 using a custom textarea with the wysiwyg editor, clicking the
 link button causes the following in the console:

     wplink.js?ver=5.7-beta2-50281:172 Uncaught TypeError: Cannot read
 property 'selectionStart' of undefined
     at Object.refresh (wplink.js?ver=5.7-beta2-50281:172)
     at Object.open (wplink.js?ver=5.7-beta2-50281:145)
     at qt.LinkButton.callback (quicktags.js?ver=5.7-beta2-50281:637)
     at HTMLDivElement.onclick (quicktags.js?ver=5.7-beta2-50281:188)

 After the link editor box pops up you are no longer able to select an
 existing post and you are not able to insert a link or close the box.

 I was able to trace this back to wplink.js line 121 which has:
 {{{
 this.textarea = $( '#' + window.wpActiveEditor ).get( 0 );
 }}}

 This can be fixed with vanilla JS by changing it to:
 {{{
 this.textarea = document.getElementById( window.wpActiveEditor );
 }}}

 In tests on my local machine, this worked perfectly.

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


More information about the wp-trac mailing list