Skip to content

Commit c4c1950

Browse files
authored
Revert "Single TinyMCE: Drop window element global"
1 parent faae59a commit c4c1950

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

shared/tinymce/toolbar.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@
7575
function onClick( callback ) {
7676
return function() {
7777
editor.undoManager.transact( function() {
78-
var element = editor.selection.getSelectedBlocks()[ 0 ];
79-
callback( editor, element );
78+
callback( editor, window.element );
8079
} );
8180
}
8281
}

tinymce-single/tinymce/block.js

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

1111
// Global controls

0 commit comments

Comments
 (0)