Support » Fixing WordPress » New WPLink in modal window

  • Hi!

    I cannot get the new WPLink modal to work in a TinyMCE modal window.
    The plugins seems to work, but the modal doesn’t show.

    Here’s an idea of the code (come has been stripped for reading purposes).

    This is the JS that opens a modal, from a button added to the main editor.

    
    editor.windowManager.open( {
    
      type: 'form',
    
      // HTML Form
      html: this.template_form( { values: values } ),
    
      buttons: [ … ],
      onsubmit: [ … ],
      onpostRender: function() {
    
        var options = $.extend( {}, tinyMCEPreInit.mceInit.content, {
    
          selector: '#description',
          toolbar1: 'styleselect,formatselect,bold,italic,underline,bullist,numlist,hr,link,unlink,removeformat',
          toolbar2: '',
    
        } );
    
        tinyMCE.init( options );
    
      },
    
    } );
    
    

    The loaded form contains the textarea (no special classes on it, should there be some?):

    
    <textarea name="description" id="description" aria-hidden="true">[ … ]</textarea>
    
    

    With that, when the modal opens, the textarea becomes a nice editor, no problem, usable entirely but for the new WPLink.
    When I click on the Link button, the text indeed becomes a link (styled) and the _wp_link_placeholder is added to the content (when looking at the source).

    The WPLinkPreview is actually populated with the content (and a link if needed), but its main container stays in display:none;

    But no modal shows to edit the destination of the link. Anybody got that?

    Thank you!

  • The topic ‘New WPLink in modal window’ is closed to new replies.