From 795b2211fbda4dcb23d02b222a2f8fe2787b7f90 Mon Sep 17 00:00:00 2001 From: Ella Iseulde Van Dorpe Date: Thu, 16 Jul 2015 11:10:28 +0000 Subject: [PATCH] TinyMCE: inline toolbar: fix memory leaks Part props ungestaltbar. Fixes #32873. git-svn-id: https://develop.svn.wordpress.org/trunk@33294 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/tinymce/plugins/wordpress/plugin.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index 4f0b229109..f7e7c61ded 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -764,6 +764,10 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { } } ); + editor.on( 'remove', function() { + toolbar.remove(); + } ); + toolbar.reposition = reposition; toolbar.hide().renderTo( document.body ); @@ -830,6 +834,12 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { DOM.bind( window, 'resize scroll', hide ); editor.dom.bind( editor.getWin(), 'resize scroll', hide ); + + editor.on( 'remove', function() { + DOM.unbind( window, 'resize scroll', hide ); + editor.dom.unbind( editor.getWin(), 'resize scroll', hide ); + } ); + editor.on( 'blur hide', hide ); editor.wp = editor.wp || {};