Support event unbinding for legacy redactor plugins
authorAlexander Ebert <ebert@woltlab.com>
Fri, 16 Aug 2019 13:45:50 +0000 (15:45 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 16 Aug 2019 13:45:50 +0000 (15:45 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/redactor.js

index 6482b3f7d557fe1b976e64d451c8662b625b1421..7f23936a8697de9dbdc39b8427a72982815d1ffd 100644 (file)
                                        }
                                        
                                        itemContainer.innerHTML = '<a href="#" class="redactor-dropdown-' + btnName + '" role="button"><span>' + btnObject.title + '</span></a>';
-                                       itemContainer.children[0].addEventListener('mousedown', (function(event) {
+                                       // Use a jQuery event here to support the unbinding of the event listener in
+                                       // existing "3rdParty" code.
+                                       $(itemContainer.children[0]).on('mousedown', (function(event) {
                                                event.preventDefault();
                                                
                                                this.dropdown.buildClick(event, btnName, btnObject);