source: [view]
var ed = this.editor;
var strings = dojo.i18n.getLocalization("dojox.editor.plugins", "PageBreak");
this.button = new dijit.form.Button({
label: strings["pageBreak"],
showLabel: false,
iconClass: this.iconClassPrefix + " " + this.iconClassPrefix + "PageBreak",
tabIndex: "-1",
onClick: dojo.hitch(this, "_insertPageBreak")
});
ed.onLoadDeferred.addCallback(
dojo.hitch(this, function(){
//Register our hotkey to CTRL-SHIFT-ENTER.
ed.addKeyHandler(dojo.keys.ENTER, true, true, dojo.hitch(this, this._insertPageBreak));
if(dojo.isWebKit || dojo.isOpera){
// Webkit and Opera based browsers don't generate keypress events when ctrl and shift are
// held then enter is pressed. Odd, that.
this.connect(this.editor, "onKeyDown", dojo.hitch(this, function(e){
if((e.keyCode === dojo.keys.ENTER) && e.ctrlKey && e.shiftKey){
this._insertPageBreak();
}
}));
}
})
);