move toolbar-button click handler to separated callback

This commit is contained in:
neSpecc 2016-05-12 14:02:09 +03:00
parent 1984feff8f
commit e132c823fb

View file

@ -218,16 +218,10 @@ cEditor.ui = {
cEditor.callback.redactorInputEvent(event);
}, false );
/** Bind click listeners on toolbar buttons */
for (button in cEditor.nodes.toolbarButtons){
cEditor.nodes.toolbarButtons[button].addEventListener('click', function (event) {
console.log(this.dataset.type);
cEditor.toolbar.current = this.dataset.type;
cEditor.toolbar.toolClicked(event);
cEditor.toolbar.close();
cEditor.callback.toolbarButtonClicked(event, this);
}, false);
}
@ -316,6 +310,19 @@ cEditor.callback = {
},
/**
* Toolbar button click handler
* @param this - cursor to the button
*/
toolbarButtonClicked : function (event, button) {
cEditor.toolbar.current = button.dataset.type;
cEditor.toolbar.toolClicked(event);
cEditor.toolbar.close();
},
redactorInputEvent : function (event) {
/**