Skip to content

Commit

Permalink
Merge pull request #168 from WordPress/update/single-remove-window-el…
Browse files Browse the repository at this point in the history
…ement

Single TinyMCE: Drop window element global
  • Loading branch information
aduth committed Mar 2, 2017
2 parents b942bb4 + 5ebcd10 commit ca89f74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion shared/tinymce/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
function onClick( callback ) {
return function() {
editor.undoManager.transact( function() {
callback( editor, window.element );
var element = editor.selection.getSelectedBlocks()[ 0 ];
callback( editor, element );
} );
}
}
Expand Down
4 changes: 2 additions & 2 deletions tinymce-single/tinymce/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

// Set focussed block. Global variable for now. Top-level node for now.

editor.on( 'nodechange', function( event ) {
element = window.element = event.parents[ event.parents.length - 1 ];
editor.on( 'nodechange', function() {
element = editor.selection.getSelectedBlocks()[ 0 ];
} );

// Global controls
Expand Down

0 comments on commit ca89f74

Please sign in to comment.