question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Shortcut Keys [Hot Keys] for Editor buttons

See original GitHub issue

Hi @volkanceylan @minhhungit

Can you guys please guide me how I can assign a shortcut Key [hotkey] to Editor Button till now I have tried following and it doesn’t work. It is very important to get this functionality for the project I am working on.

// *** Add Select Button to Grid Editor ***
            buttons.push({
                title: "Select Items",
                cssClass: "add-button",
                hotkey: "Alt+K",
                onClick: () => {}
});

Thank you for your support

Regards,

Arvind

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
minhhungitcommented, Sep 7, 2020

@reach2rv ah I see your comment, try this code

put this on your editor.ts

protected createToolbar(buttons: Serenity.ToolButton[]): void {
            var toolbarDiv = $('<div class="grid-toolbar"></div>').appendTo(this.element);
            this.toolbar = new Serenity.Toolbar(toolbarDiv, { buttons: buttons, hotkeyContext: document.getElementsByTagName('body')[0] });
        }

        getButtons() {
            let buttons = super.getButtons();

            buttons.push({
                title: "Test shortkey",
                hotkey: "alt+k",
                //hotkeyContext: document.getElementsByTagName('body')[0],
                onClick: () => {
                    Q.notifyInfo("Hello");
                }
            })

            return buttons;
        }
1reaction
reach2rvcommented, Sep 7, 2020

@minhhungit the above code works. I do get a notification. Thank you!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are some keyboard shortcuts for the Rich-Text Editor?
Use standard formatting shortcut keys. ; Bold - Ctrl + B (in Windows) or Command + B (on a Mac) ; Italics -...
Read more >
Customize keyboard shortcuts
You can customize keyboard shortcuts (or shortcut keys) by assigning them to a command, macro, font, style, or frequently used symbol.
Read more >
Keyboard shortcuts in Windows
Copy, paste, and other general keyboard shortcuts ; Ctrl + Spacebar. Turn the Chinese input method editor (IME) on or off. ; Shift...
Read more >
Use keyboard shortcuts (Classic Editor)
Editor Shortcuts · Ctrl + key · Alt + Shift + key · Formatting Shortcuts.
Read more >
Windows Basics: Keyboard Shortcuts in Windows
You'll use the Ctrl (Control) or Alt key to perform most keyboard shortcuts. You'll find these keys near the bottom-left corner of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found