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