(bug 26620) JavaScript error in insertTags() when jQuery is present but currentFocuse...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sat, 8 Jan 2011 16:06:06 +0000 (16:06 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sat, 8 Jan 2011 16:06:06 +0000 (16:06 +0000)
skins/common/edit.js

index fe54350..287fbe3 100644 (file)
@@ -78,7 +78,7 @@ window.mwSetupToolbar = function() {
 // apply tagOpen/tagClose to selection in textarea,
 // use sampleText instead of selection if there is none
 window.insertTags = function( tagOpen, tagClose, sampleText ) {
-       if ( typeof $ != 'undefined' && typeof $.fn.textSelection != 'undefined' &&
+       if ( typeof $ != 'undefined' && typeof $.fn.textSelection != 'undefined' && currentFocused &&
                        ( currentFocused.nodeName.toLowerCase() == 'iframe' || currentFocused.id == 'wpTextbox1' ) ) {
                $( '#wpTextbox1' ).textSelection(
                        'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }