diff --git a/shared/tinymce/toolbar.js b/shared/tinymce/toolbar.js index 6b4a4c94b92b54..53a9b0f6837b92 100644 --- a/shared/tinymce/toolbar.js +++ b/shared/tinymce/toolbar.js @@ -75,8 +75,7 @@ function onClick( callback ) { return function() { editor.undoManager.transact( function() { - var element = editor.selection.getSelectedBlocks()[ 0 ]; - callback( editor, element ); + callback( editor, window.element ); } ); } } diff --git a/tinymce-single/tinymce/block.js b/tinymce-single/tinymce/block.js index 494dfd3284c73b..713122b6f949b5 100644 --- a/tinymce-single/tinymce/block.js +++ b/tinymce-single/tinymce/block.js @@ -4,8 +4,8 @@ // Set focussed block. Global variable for now. Top-level node for now. - editor.on( 'nodechange', function() { - element = editor.selection.getSelectedBlocks()[ 0 ]; + editor.on( 'nodechange', function( event ) { + element = window.element = event.parents[ event.parents.length - 1 ]; } ); // Global controls