Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] shortcut for ckeditor's edit block menu #1141

Closed
leeyaunlong opened this issue Jun 30, 2020 · 9 comments
Closed

[Feature request] shortcut for ckeditor's edit block menu #1141

leeyaunlong opened this issue Jun 30, 2020 · 9 comments

Comments

@leeyaunlong
Copy link

can you add the shortcut to popup the ckeditor's edit block menu?
because some funcitons in block menu have the shortcut , but I want to quick access others(inline note , etc).

@koutto
Copy link

koutto commented Nov 3, 2020

would indeed be great to have shortcuts/hotkeys for some formatting like "inline code", "block code" and so on. I think it is dependent of Ckeditor, and maybe there is a plugin for that

@zadam
Copy link
Owner

zadam commented Nov 3, 2020

Checkout https://ckeditor.com/docs/ckeditor5/latest/features/autoformat.html

Things like inline/block code can be triggered in markdown fashion via typing `something` and ```

@psybustermk2
Copy link

It's not complete though. The checkbox (to-do list) does not work when doing [ ] or [x].

@zadam
Copy link
Owner

zadam commented Mar 31, 2021

@psybustermk2 these will work in (not yet released) 0.47

@stgolem
Copy link

stgolem commented Jul 24, 2021

There is already 0.47.5 available. How can we trigger "edit block" menu from keyboard?

@abitofevrything
Copy link
Contributor

@zadam was referring to the check box list, not the keyboard shortcuts

@code-ink-space
Copy link

I have been searching through the issues here asking about the keyboard shortcut (earliest I found was #764) and didn't find any solution. I needed this functionality badly so I came up with this JS backend code to trigger the ckeditor toolbar.

api.bindGlobalShortcut("ctrl+shift+p", function(){
    let button_off = document.querySelector('.ck.ck-button.ck-off.ck-block-toolbar-button');
    if (button_off)
        button_off.click();
    else
        document.querySelector('.ck.ck-button.ck-on.ck-block-toolbar-button').click();
});

I added a shortcut too for blockQuote which I use a lot. I don't know if this is the right way of doing it but it works for me. I love Trilium for being this customizable. Thanks @zadam !

api.bindGlobalShortcut("ctrl+shift+q", function(){
    api.getActiveTabTextEditor(function(editor){
        editor.execute('blockQuote');
    });
});

@WACrown
Copy link

WACrown commented Mar 16, 2023

@code-ink-space This is a good idea! However, in version 0.59.1, the multi-tag function will cause the shortcut key to not work. I made some changes:

api.bindGlobalShortcut("alt+q", function(){
    console.log("alt+q");
    let edit_block_buttons = document.querySelectorAll(".ck.ck-button.ck-block-toolbar-button");
        for (let item of edit_block_buttons) {
            console.log(item);
            if(!item.getAttribute("class").includes("ck-hidden")){
                item.click();
                continue;
            }
        }
});

@meichthys
Copy link
Collaborator

meichthys commented May 9, 2024

Trilium has entered maintenance mode. Future enhancements will be addressed in TrilumNext: TriliumNext/Notes#100

@meichthys meichthys closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants