trilium
trilium copied to clipboard
[Feature request] shortcut for ckeditor's edit block menu
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).
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
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 ```
It's not complete though. The checkbox (to-do list) does not work when doing [ ] or [x].
@psybustermk2 these will work in (not yet released) 0.47
There is already 0.47.5 available. How can we trigger "edit block" menu from keyboard?
@zadam was referring to the check box list, not the keyboard shortcuts
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');
});
});
@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;
}
}
});
Trilium has entered maintenance mode. Future enhancements will be addressed in TrilumNext: https://github.com/TriliumNext/Notes/issues/100