Skip to content

Commit faae59a

Browse files
authored
Merge pull request #168 from WordPress/update/single-remove-window-element
Single TinyMCE: Drop window element global
2 parents af50087 + 910c1b7 commit faae59a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

shared/tinymce/toolbar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
function onClick( callback ) {
7676
return function() {
7777
editor.undoManager.transact( function() {
78-
callback( editor, window.element );
78+
var element = editor.selection.getSelectedBlocks()[ 0 ];
79+
callback( editor, element );
7980
} );
8081
}
8182
}

tinymce-single/tinymce/block.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

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

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

1111
// Global controls

0 commit comments

Comments
 (0)