pub struct KeyboardShortcut {
pub key: String,
pub modifiers: KeyboardEventModifierMask,
pub unshifted_key: Option<String>,
pub command: LexicalCommand<Rc<KeyboardEvent>>,
pub description: Option<String>,
pub disabled: Option<ShortcutDisabledFn>,
pub dispatch: Option<ShortcutDispatchFn>,
pub bubble_from_nested_editors: bool,
}Expand description
KeyboardShortcut (@experimental): a shortcut as data, the key and
modifiers to match and the command to dispatch with the matched event.
@lexical/extension’s KeyboardShortcutsExtension
(keyboard_shortcuts_extension,
the extension feature) dispatches a table of them.
Fields§
§key: String§modifiers: KeyboardEventModifierMask§unshifted_key: Option<String>§command: LexicalCommand<Rc<KeyboardEvent>>command: dispatched with the matched event as its payload.
description: Option<String>description, for menus and help.
disabled: Option<ShortcutDisabledFn>$disabled: skip the shortcut when it returns true.
dispatch: Option<ShortcutDispatchFn>$dispatch: replaces dispatching command; its $next dispatches
it.
bubble_from_nested_editors: boolbubbleFromNestedEditors.
Implementations§
Source§impl KeyboardShortcut
impl KeyboardShortcut
Sourcepub fn new(key: &str, command: LexicalCommand<Rc<KeyboardEvent>>) -> Self
pub fn new(key: &str, command: LexicalCommand<Rc<KeyboardEvent>>) -> Self
A shortcut of key with no modifiers that dispatches command.
Trait Implementations§
Source§impl Clone for KeyboardShortcut
impl Clone for KeyboardShortcut
Source§impl KeyboardShortcutMatch for KeyboardShortcut
impl KeyboardShortcutMatch for KeyboardShortcut
Source§fn modifiers(&self) -> KeyboardEventModifierMask
fn modifiers(&self) -> KeyboardEventModifierMask
modifiers: the expected state of the modifier keys (none pressed
by default).Source§fn unshifted_key(&self) -> Option<&str>
fn unshifted_key(&self) -> Option<&str>
unshiftedKey: the key without Shift, for display.Auto Trait Implementations§
impl !RefUnwindSafe for KeyboardShortcut
impl !Send for KeyboardShortcut
impl !Sync for KeyboardShortcut
impl !UnwindSafe for KeyboardShortcut
impl Forget for KeyboardShortcut
impl Freeze for KeyboardShortcut
impl Move for KeyboardShortcut
impl Unpin for KeyboardShortcut
impl UnsafeUnpin for KeyboardShortcut
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more