Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_handleKeydown(event) {
if (
this.isEditing
&& event.key === 'Escape'
|| (Browser.isMac() && event.key === 'Enter' && event.metaKey)
|| (!Browser.isMac() && event.key === 'Enter' && event.ctrlKey)
) {
// run the select card routine with isEditing=false to exit edit mode
this.selectCard(false);
event.preventDefault();
}
},
_handleKeydown(event) {
if (
this.isEditing
&& event.key === 'Escape'
|| (Browser.isMac() && event.key === 'Enter' && event.metaKey)
|| (!Browser.isMac() && event.key === 'Enter' && event.ctrlKey)
) {
// run the select card routine with isEditing=false to exit edit mode
this.selectCard(false);
event.preventDefault();
}
},
case key.isHorizontalArrowWithoutModifiersOtherThanShift(): {
let newRange;
if (key.isShift()) {
newRange = range.extend(key.direction * 1);
} else {
newRange = range.move(key.direction);
}
editor.selectRange(newRange);
event.preventDefault();
break;
}
case key.isDelete(): {
let { direction } = key;
let unit = 'char';
if (this.modifierKeys.alt && Browser.isMac()) {
unit = 'word';
} else if (this.modifierKeys.ctrl && Browser.isWin()) {
unit = 'word';
}
editor.performDelete({direction, unit});
event.preventDefault();
break;
}
case key.isEnter():
editor.handleNewline(event);
break;
case key.isTab():
// Handle tab here because it does not fire a `keypress` event
event.preventDefault();
this._textInputHandler.handle(key.toString());
break;
run(editor, koenig) {
if (Browser.isMac()) {
return koenig.send('toggleMarkup', 'code');
}
return false;
}
}];
run(editor, koenig) {
if (!Browser.isMac()) {
return koenig.send('toggleMarkup', 'code');
}
return false;
}
}, {