Fixes bug when having multiple textareas, which is caused by the fact that dialogs are kept in memory for performance, even when selecting a different textarea.

This commit is contained in:
Jan Paul Posma 2011-02-27 17:14:01 +00:00
parent ef3a3a06f7
commit 9df5838aa5

View file

@ -84,7 +84,12 @@ fn: {
}
}
}
if ( !filtered && $.wikiEditor.isSupported( module ) && $( '#' + module.id ).size() == 0 ) {
// If the dialog already exists, but for another textarea, simply remove it
var $existingDialog = $( '#' + module.id );
if ( $existingDialog.size() > 0 && $existingDialog.data( 'context' ).$textarea != context.$textarea ) {
$existingDialog.remove();
}
if ( !filtered && $.wikiEditor.isSupported( module ) && $existingDialog.size() == 0 ) {
$.wikiEditor.modules.dialogs.modules[mod] = module;
// If this dialog requires the iframe, set it up
if ( typeof context.$iframe == 'undefined' && $.wikiEditor.isRequired( module, 'iframe' ) ) {