admin管理员组

文章数量:1356032

I need to override key shortcut for out of the box ckeditor5 commands like 'underline', 'numberedList' etc. I am able to do so using the following code:

editor.keystrokes.set("Ctrl+" + "Shift+" + "U", "underline");

editor.keystrokes.set("Ctrl+" + "Shift+" + "N", "numberedList");

This ensures that the command is executed on the respective shortcuts. But, these keystrokes are not appearing on the toolbar button tooltip. They continue to show the default key shortcut (if any).

I have checked that explicitly setting the keystroke attribute of buttonView element and calling editor.ui.update() shows the tooltip. But I am not able to figure which button maps to which command, so that I can appropriately set the keystroke property. Most of the suggestions are to use button.label to determine the command, but this would not work on non English locales.

Am I on right track or there is a simpler way to ensure that the custom key shortcuts appear in the tooltip?

本文标签: