Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js |
— | — | @@ -86,10 +86,12 @@ |
87 | 87 | } |
88 | 88 | // If the dialog already exists, but for another textarea, simply remove it |
89 | 89 | var $existingDialog = $( '#' + module.id ); |
90 | | - if ( $existingDialog.size() > 0 && $existingDialog.data( 'context' ).$textarea != context.$textarea ) { |
| 90 | + if ( $existingDialog.length > 0 && $existingDialog.data( 'context' ).$textarea != context.$textarea ) { |
91 | 91 | $existingDialog.remove(); |
92 | 92 | } |
93 | | - if ( !filtered && $.wikiEditor.isSupported( module ) && $existingDialog.size() == 0 ) { |
| 93 | + // Re-select from the DOM, we might have removed the dialog just now |
| 94 | + $existingDialog = $( '#' + module.id ); |
| 95 | + if ( !filtered && $.wikiEditor.isSupported( module ) && $existingDialog.size() === 0 ) { |
94 | 96 | $.wikiEditor.modules.dialogs.modules[mod] = module; |
95 | 97 | // If this dialog requires the iframe, set it up |
96 | 98 | if ( typeof context.$iframe == 'undefined' && $.wikiEditor.isRequired( module, 'iframe' ) ) { |