devexpress-richedit
Version:
DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.
25 lines (24 loc) • 760 B
JavaScript
import { CommandBase, CommandOptions } from '../command-base';
import { SimpleCommandState } from '../command-states';
export class AssignShortcutCommandOptions extends CommandOptions {
constructor(control, keyCode, callback) {
super(control);
this.keyCode = keyCode;
this.callback = callback;
}
}
export class AssignShortcutCommand extends CommandBase {
isEnabled() {
return super.isEnabled();
}
getState() {
return new SimpleCommandState(this.isEnabled());
}
isEnabledInReadOnlyMode() {
return true;
}
executeCore(_state, options) {
this.control.shortcutManager.assignShortcut(options.keyCode, options.callback);
return true;
}
}