I am trying to build a small plugin for CKeditor. I want to add a function that when I press one the the generated buttons that in the addcommand function the Lable for that button gets printed to the editor
example : if List array contains "Name", "State", "country" so this plugin code below will add 3 button to the menu called "Name", "State" and "country" if I click anyone of these buttons they will activate insertMM command , I want that command to do a inserthtml with the string "you pressed [Label]" so if I pressed "Name" button it would print "you pressed Name" in the Editor window
CKEDITOR.plugins.add( 'MM', {
init: function( editor ) {
editor.addCommand( 'insertMM', {
exec: function( editor) {
editor.insertHtml( "you pressed "+ {{ADD LABEL STRING HERE}} );
}
});
for (i = 0; i < List.length; i++) {
editor.ui.addButton( List[i], {
label: List[i],
command: 'insertMM',
toolbar: 'insert'
});
}
}
});
so the question is, is there some way of knowing which button is pressed and getting its details when running the addcommand or is there a way of passing a know value to the addcommmand when the button is pushed