What this appears to be accomplishing is finding the toolbar and binding a .click handler to it. From inside the click handler, this is where we handle the the commands associated with the particular toolbar button which has been clicked.
For all cases except the "html button" we extract the command from the button's data-edit attribute using $( this ).data and pass that to execCommand. Following that logic, shouldn't the initial check for an HTML toggle button be:
if ( $( this ).data( options.commandRole ) === "html" )
The way it is now, it is trying to retrieve the data-edit value from the editor element, in this case a div which has no data-edit attribute, so it always fails spectacularly.
So in the
.bindToolbar
function there is a piece of code here:What this appears to be accomplishing is finding the toolbar and binding a
.click
handler to it. From inside the click handler, this is where we handle the the commands associated with the particular toolbar button which has been clicked.For all cases except the "html button" we extract the command from the button's
data-edit
attribute using$( this ).data
and pass that to execCommand. Following that logic, shouldn't the initial check for an HTML toggle button be:if ( $( this ).data( options.commandRole ) === "html" )
The way it is now, it is trying to retrieve the
data-edit
value from the editor element, in this case a div which has nodata-edit
attribute, so it always fails spectacularly.