How do I change the keys for keyboard shortcuts?
Purpose
The customizations described on this page are outside the scope of Atlassian support. Please see Atlassian Support Offerings for more information.
For when you experience some problems with keyboard shortcuts that could clash with other operating system or application keyboard shortcuts.
The guide below is a workaround to change the keyboard shortcut for a particular function. The aim here is to change the quote
shortcut in the editor to ctrl+alt+y
:
Resolution
For Confluence 5.0 and above
To change a keyboard shortcut defined by the Keyboard Shortcut plugin
- Unjar
<confluence-install>/confluence/WEB-INF/atlassian-bundled-plugins/confluence-keyboard-shortcuts-X.X.X.jar
- Edit the
atlassian-plugin.xml
Change the shortcut within a keyboard-shortcut block. For example:
<keyboard-shortcut key="tinymce.blockquote" i18n-name="admin.keyboard.shortcut.tinymce.blockquote" name="Blockquote"> <order>30</order> <description key="tinymce.advanced.blockquote"/> <shortcut>[Ctrl+8]</shortcut> <operation type="execute">FormatBlock-blockquote</operation> <context>tinymce.block</context> </keyboard-shortcut>
would be changed to:
<keyboard-shortcut key="tinymce.blockquote" i18n-name="admin.keyboard.shortcut.tinymce.blockquote" name="Blockquote"> <order>30</order> <description key="tinymce.advanced.blockquote"/> <shortcut>[Ctrl+Alt+Y]</shortcut> <operation type="execute">FormatBlock-blockquote</operation> <context>tinymce.block</context> </keyboard-shortcut>
- Save the file
- Jar the file back to
confluence-keyboard-shortcuts-X.X.X.jar
- Restart your Confluence instance. Your changes should be reflected after this. You may need to force refresh your browser.
To change a keyboard shortcut defined by a different plugin
- Unjar the plugin
- Locate either a keyboard-shortcut block in
atlassian-plugin.xml
and change as above, or find a Javascript file containing a call to "addShortcut" and change it as described in For Confluence earlier than 5.0. - Jar the plugin
For Confluence earlier than 5.0
- Unzip the
<confluence-install>/confluence/WEB-INF/classes/com/atlassian/confluence/setup/atlassian-bundled-plugins.zip
. - Unjar the
confluence-tinymce-plugin-X.X.X.X.jar
in theunzipped atlassian-bundled-plugins.zip
. - Edit the
/tinymce3/plugins/keyboardshortcuts/editor_plugins_src.js
. Change the following line in the file from (for example):
ed.addShortcut('ctrl+alt+q', '', ['FormatBlock', false, 'macro_quote']);
to:
ed.addShortcut('ctrl+alt+y', '', ['FormatBlock', false, 'macro_quote']);
- Save the file.
- Jar the file back to
confluence-tinymce-plugin-X.X.X.X.jar
. - Zip the
atlassian-bundled-plugins.zip.
- Restart your Confluence instance. Your changes should be reflected after this. You may need to force refresh your browser.
If you need a guide to help with editing files within JAR archives, you can refer to How to edit files in Confluence JAR files. However, please keep in mind that the Tinymce plugin is a bundled plugin. Therefore it is stored in a certain directory, specifically <confluence-install>/confluence/WEB-INF/classes/com/atlassian/confluence/setup/atlassian-bundled-plugins.zip
. If you are following the guide, please make sure the paths are correct.