I should note that the code I found to be an issue on lines 234-234 is in the wplink.js file (not the minified one).
I’ll take a look at this, thank you.
I just upgraded to v1.4.5 and realized that the issue I described above is still a problem. It looks like the code is unchanged, but it looks to me like my adjustment is what is needed to fix the problem.
Here is the only place I am seeing the variable ed set is in the open function where it is used to set the editor variable value:
open: function( editorId ) {
var ed;
$( document.body ).addClass( 'modal-open' );
wpLink.range = null;
if ( editorId ) {
window.wpActiveEditor = editorId;
}
if ( ! window.wpActiveEditor ) {
return;
}
this.textarea = $( '#' + window.wpActiveEditor ).get( 0 );
if ( typeof tinymce !== 'undefined' ) {
ed = tinymce.get( wpActiveEditor );
if ( ed && ! ed.isHidden() ) {
editor = ed;
} else {
editor = null;
}
if ( editor && tinymce.isIE ) {
editor.windowManager.bookmark = editor.selection.getBookmark();
}
}
if ( ! wpLink.isMCE() && document.selection ) {
this.textarea.focus();
this.range = document.selection.createRange();
}
inputs.wrap.show();
inputs.backdrop.show();
wpLink.refresh();
$( document ).trigger( 'wplink-open', inputs.wrap );
},
It is not used anywhere else in the code except in the location I have pointed to previously, and the “Open in a New Tab” checkbox directly above the offending line uses editor instead of ed:
mceRefresh: function() {
var text,
selectedNode = editor.selection.getNode(),
linkNode = editor.dom.getParent( selectedNode, 'a[href]' ),
onlyText = this.hasSelectedText( linkNode );
if ( linkNode ) {
text = linkNode.innerText || linkNode.textContent;
inputs.url.val( editor.dom.getAttrib( linkNode, 'href' ) );
inputs.openInNewTab.prop( 'checked', '_blank' === editor.dom.getAttrib( linkNode, 'target' ) );
// Set rel="nofollow" (mod)
inputs.relNofollow.prop('checked', "nofollow" === editor.dom.getAttrib(linkNode, 'rel' ));
inputs.submit.val( wpLinkL10n.update );
} else {
text = editor.selection.getContent({ format: 'text' });
this.setDefaultValues();
}
if ( onlyText ) {
inputs.text.val( text || '' );
inputs.wrap.addClass( 'has-text-field' );
} else {
inputs.text.val( '' );
inputs.wrap.removeClass( 'has-text-field' );
}
},
When I change the code in my local copy everything works as expected. Any chance this can be pushed in to the next release?
Is anyone still updating this plugin?
I’m having the same issue…