You can use https://www.shortkeys.app/ browser addon. [here on github]
- install the addon in your browser
- go to browser settings -> addons -> shortkeys -> addon settings (···)
- add new: ⠀⠀⠀ shortcut: ctrl+b ⠀⠀⠀ label: bold ⠀⠀⠀ behaviour: Run JavaScript ⠀⠀⠀ (as an example)
- open the "Shortcut settings" with a click on the dropdown icon ˅ (at the start of the shortcuts table row)
- paste the javascript below into the textarea
- turn on the activation settings (on the right)
- save your shortcut
- add more shortcuts as you like ...
var $edit = document.activeElement;
if ($edit.nodeName == "INPUT" || $edit.nodeName == "TEXTAREA") {
var $before = ($edit.value).substring(0, $edit.selectionStart);
var $select = ($edit.value).substring($edit.selectionStart, $edit.selectionEnd);
var $behind = ($edit.value).substring($edit.selectionEnd);
$edit.value = $before + '**' + $select + '**' + $behind;
if ( $select.length == 0 ) {
var $cursor = ($before + $select).length + 2;
} else {
var $cursor = ($before + $select).length + 4;
}
$edit.selectionStart = $cursor;
$edit.selectionEnd = $cursor;
}
Limitations: This is not mapping a custom shortcut onto the original shortcut (which did not work, unfortunately). In fact, this is reengineering the accesskey action of the DokuWiki editor via javascript. So, behaviour can slightly differ from what you are used to from the original shortcut. This is tested and works with DokuWiki in page edit mode in Chrome and Firefox.
(What is cool though, you can set up a whole list of these shortcuts and export them to a file and use this file with the import function of the addon in other browsers and on other devices later on. And you can overrule the original shortcuts (accesskeys) in DokuWiki without changing the code.)
Cheers!