I'm having an issue with a function tied to a keystroke.
I have declared in my config.js file the following keystrokes:
Each command has three parameters: the selection, a cell bgcolor, and text to put into the cell.
Here is the function that is ultimately called:
The bgcolor changes fine but I cannot get the HTML portion to work. The cell just remains empty. Any help would be appreciated.
I have declared in my config.js file the following keystrokes:
config.keystrokes = [ /** * Shortcuts for Shifts */ [ 83 /*S*/, 'cellFillStore' ], [ 70 /*F*/, 'cellFillRegister' ], [ 79 /*O*/, 'cellFillOffice' ], [ 84 /*T*/, 'cellFillTechStore' ], [ 90 /*Z*/, 'cellFillEmergency' ], [ 80 /*P*/, 'cellFillPhone' ], [ 87 /*W*/, 'cellFillWhite' ], [ CKEDITOR.CTRL + 79 /*O*/, 'cellFillOrange' ] ];
Each command has three parameters: the selection, a cell bgcolor, and text to put into the cell.
Here is the function that is ultimately called:
function backgroundColor( selectionOrCell, color, code) { if ( selectionOrCell instanceof CKEDITOR.dom.selection ) { var cellsToChange = getSelectedCells( selectionOrCell ); for ( var i = cellsToChange.length - 1 ; i >= 0 ; i-- ) { cellsToChange[i].setAttribute( 'bgColor', color ); cellsToChange[i].innerHTML = code; } } else { selectionOrCell.setAttribute( 'bgColor', color ); selectionOrCell.innerHTML = code; } }
The bgcolor changes fine but I cannot get the HTML portion to work. The cell just remains empty. Any help would be appreciated.
Re: KeyStroke Tied to Function