Wiki source code of XWiki Keyboard Shortcuts
Last modified by Lucas Charpentier (Sereza7) on 2024/06/07
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{velocity}} | ||
2 | $xwiki.ssx.use("Features.KeyboardShortcuts") | ||
3 | {{/velocity}} | ||
4 | |||
5 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
6 | {{toc/}} | ||
7 | {{/box}} | ||
8 | |||
9 | You can use keyboard shortcuts to use some XWiki features. Keyboard shortcuts help you save time since you never have to take your hands off the keyboard to use the mouse. | ||
10 | |||
11 | = Using keyboard shortcuts = | ||
12 | |||
13 | == View Mode == | ||
14 | |||
15 | {{info}} | ||
16 | View keyboard shortcuts are only available to advanced users, preventing simple users to get unexpected behavior when pressing keyboard keys by mistake | ||
17 | {{/info}} | ||
18 | |||
19 | === Edit Actions === | ||
20 | |||
21 | (% class="keyboard" summary="Keyboard Shortcuts for View Mode in order to activate edit actions" %) | ||
22 | |(% class="shortcut" %)((( | ||
23 | (% class="key" %)E | ||
24 | )))|Edit the page using the default edition mode | ||
25 | |(% class="shortcut" %)((( | ||
26 | (% class="key" %)K | ||
27 | )))|Edit the page in wiki edition mode | ||
28 | |(% class="shortcut" %)((( | ||
29 | (% class="key" %)G | ||
30 | )))|Edit the page using the WYSIWYG editor | ||
31 | |(% class="shortcut" %)((( | ||
32 | (% class="key" %)F | ||
33 | )))|Inline Form | ||
34 | |(% class="shortcut" %)((( | ||
35 | (% class="key" %)R | ||
36 | )))|Edit page access rights | ||
37 | |(% class="shortcut" %)((( | ||
38 | (% class="key" %)O | ||
39 | )))|Edit page objects | ||
40 | |(% class="shortcut" %)((( | ||
41 | (% class="key" %)S | ||
42 | )))|Edit class | ||
43 | |||
44 | === View Actions === | ||
45 | |||
46 | (% class="keyboard" summary="Keyboard Shortcuts for View Mode in order to activate view actions" %) | ||
47 | |(% class="shortcut" %)((( | ||
48 | (% class="key" %)C | ||
49 | )))|Go to page comments | ||
50 | |(% class="shortcut" %)((( | ||
51 | (% class="key" %)N | ||
52 | )))|Go to page annotations {{warning}} This shortcut might be used for creating a new page instead. See the evolution of the discussion on [[this forum topic>>https://forum.xwiki.org/t/adding-a-shortcut-for-the-create-action/]]{{/warning}} | ||
53 | |(% class="shortcut" %)((( | ||
54 | (% class="key" %)A | ||
55 | )))|Go to page attachments | ||
56 | |(% class="shortcut" %)((( | ||
57 | (% class="key" %)H | ||
58 | )))|Go to page history | ||
59 | |(% class="shortcut" %)((( | ||
60 | (% class="key" %)I | ||
61 | )))|Go to page information | ||
62 | |(% class="shortcut" %)((( | ||
63 | (% class="key" %)D | ||
64 | )))|View page wiki code | ||
65 | |||
66 | === Other Actions === | ||
67 | |||
68 | (% class="keyboard" summary="Keyboard Shortcuts for View Mode in order to activate other actions" %) | ||
69 | |(% class="shortcut" %)((( | ||
70 | (% class="key" %)F2 | ||
71 | )))|Rename page | ||
72 | |(% class="shortcut" %)((( | ||
73 | (% class="key" %)Delete | ||
74 | )))|Delete page | ||
75 | |||
76 | == Edit Mode == | ||
77 | |||
78 | {{warning}} | ||
79 | In the following shortcuts, macOS users should use the ##Option## or ##⌥## button instead of ##Alt##. | ||
80 | {{/warning}} | ||
81 | |||
82 | (% class="keyboard" summary="Keyboard Shortcuts for Edit Mode" %) | ||
83 | |(% class="shortcut" %)((( | ||
84 | (% class="key" %)Alt(%%) + (% class="key" %)C | ||
85 | )))|Cancel edition | ||
86 | |(% class="shortcut" %)((( | ||
87 | (% class="key" %)Alt(%%) + (% class="key" %)P | ||
88 | )))|Preview the page without saving | ||
89 | |(% class="shortcut" %)((( | ||
90 | (% class="key" %)Alt(%%) + (% class="key" %)Shift(%%) + (% class="key" %)S | ||
91 | )))|Save and continue to edit the page | ||
92 | |(% class="shortcut" %)((( | ||
93 | (% class="key" %)Alt(%%) + (% class="key" %)S | ||
94 | )))|Save and view the page | ||
95 | |||
96 | === WYSIWYG Edit Mode === | ||
97 | |||
98 | See the [[WYSIWYG Editor keyboard shortcuts>>extensions:Extension.CKEditor Integration#HKeyboardShortcuts]]. | ||
99 | |||
100 | == Preview Mode == | ||
101 | |||
102 | {{warning}} | ||
103 | In the following shortcuts, macOS users should use the ##Option## or ##⌥## button instead of ##Alt##. | ||
104 | {{/warning}} | ||
105 | |||
106 | (% class="keyboard" summary="Keyboard Shortcuts for Preview Mode" %) | ||
107 | |(% class="shortcut" %)((( | ||
108 | (% class="key" %)Alt(%%) + (% class="key" %)C | ||
109 | )))|Cancel edition | ||
110 | |(% class="shortcut" %)((( | ||
111 | (% class="key" %)Alt(%%) + (% class="key" %)B | ||
112 | )))|Back to the edition | ||
113 | |(% class="shortcut" %)((( | ||
114 | (% class="key" %)Alt(%%) + (% class="key" %)Shift(%%) + (% class="key" %)S | ||
115 | )))|Save and continue to edit the page | ||
116 | |(% class="shortcut" %)((( | ||
117 | (% class="key" %)Alt(%%) + (% class="key" %)S | ||
118 | )))|Save and view the page | ||
119 | |||
120 | == Annotations == | ||
121 | |||
122 | (% class="keyboard" summary="Keyboard Shortcuts for Annotations" %) | ||
123 | |(% class="shortcut" %)((( | ||
124 | (% class="key" %)Ctrl(%%) + (% class="key" %)M(%%) (% class="separator" %)or(%%) (% class="key" %)Meta(%%) + (% class="key" %)M(%%) | ||
125 | (% class="key" %)Ctrl(%%) + (% class="key" %)I(%%) (% class="separator" %)or(%%) (% class="key" %)Meta(%%) + (% class="key" %)I | ||
126 | )))|Annotate a piece of text | ||
127 | |(% class="shortcut" %)((( | ||
128 | (% class="key" %)Alt(%%) + (% class="key" %)A | ||
129 | )))|Show annotations {{warning}}In this shortcut, macOS users should use the ##Option## or ##⌥## button instead of ##Alt##.{{/warning}} | ||
130 | |||
131 | |||
132 | == Navigation == | ||
133 | |||
134 | (% class="keyboard" summary="Keyboard Shortcuts for Navigation" %) | ||
135 | |(% class="shortcut" %)((( | ||
136 | (% class="key" %)Ctrl(%%) + (% class="key" %)G(%%) (% class="separator" %)or(%%) (% class="key" %)Meta(%%) + (% class="key" %)G(%%) | ||
137 | (% class="key" %)Ctrl(%%) + (% class="key" %)/(%%) (% class="separator" %)or(%%) (% class="key" %)Meta(%%) + (% class="key" %)/(%%) | ||
138 | )))|Jump to any page in the wiki | ||
139 | |||
140 | == Developer shortcuts == | ||
141 | |||
142 | {{info}}Since 9.11{{/info}}, the following key sequences can be used to toggle specific actions on the current logged in user: | ||
143 | |||
144 | (% class="keyboard" summary="Keyboard Shortcuts for developers" %) | ||
145 | |(% class="shortcut" %)((( | ||
146 | (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)a | ||
147 | )))|Toggle advanced user mode for the current user. | ||
148 | |||
149 | (% class="keyboard" summary="Keyboard Shortcuts for developers" %) | ||
150 | |(% class="shortcut" %)((( | ||
151 | (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)h | ||
152 | )))|Toggle hidden pages for the current user. | ||
153 | |||
154 | = Configuring keyboard shortcuts = | ||
155 | |||
156 | == Modifying keyboard shortcuts == | ||
157 | |||
158 | * Create a new page in your wiki, for example ##XWiki.KeyboardShortcuts## and paste the following content inside:((( | ||
159 | {{code language="text"}} | ||
160 | core.shortcuts.view.edit=e | ||
161 | core.shortcuts.view.wiki=k | ||
162 | core.shortcuts.view.wysiwyg=g | ||
163 | core.shortcuts.view.inline=f | ||
164 | core.shortcuts.view.rights=r | ||
165 | core.shortcuts.view.objects=o | ||
166 | core.shortcuts.view.class=s | ||
167 | core.shortcuts.view.comments=c | ||
168 | core.shortcuts.view.attachments=a | ||
169 | core.shortcuts.view.history=h | ||
170 | core.shortcuts.view.information=i | ||
171 | core.shortcuts.view.code=d | ||
172 | core.shortcuts.view.delete=Delete | ||
173 | core.shortcuts.view.rename=F2 | ||
174 | core.shortcuts.edit.cancel=Alt+C | ||
175 | core.shortcuts.edit.backtoedit=Alt+B | ||
176 | core.shortcuts.edit.preview=Alt+P | ||
177 | core.shortcuts.edit.saveandcontinue=Alt+Shift+S | ||
178 | core.shortcuts.edit.saveandview=Alt+S | ||
179 | {{/code}} | ||
180 | ))) | ||
181 | * Modify entries in this list at your convenience | ||
182 | * Save the page | ||
183 | * Edit the page in [[object mode>>Documentation.UserGuide.Features.PageEditing#HObjectseditingmode]] and add an ## XWiki.TranslationDocumentClass## xobject | ||
184 | ** Select the ##wiki## scope for the new translations (i.e. the new keyboard shortcuts) to apply to the whole wiki. {{warning}}You'll need to have Admin permissions for it to work{{/warning}} | ||
185 | |||
186 | == Adding your own shortcuts == | ||
187 | |||
188 | You can add your own keyboard shortcuts in a few javascript lines. You can do that, for example, by adding a [[JavaScript StyleSheet Extension>>Documentation.DevGuide.Tutorials.SkinExtensionsTutorial.WebHome]] and putting the following content: | ||
189 | |||
190 | {{code language="javascript"}} | ||
191 | shortcut.add("Ctrl+Alt+n", function() { alert("Hey there! Congratulations on typing this one ;)"); }); | ||
192 | {{/code}} | ||
193 | |||
194 | Also check the [[complete documentation>>https://dmauro.github.io/Keypress/]]. | ||
195 | |||
196 | == Removing keyboard shortcuts == | ||
197 | |||
198 | To remove a shortcut adapt the following snippet to your needs and use by putting it in a [[JavaScript StyleSheet Extension>>Documentation.DevGuide.Tutorials.SkinExtensionsTutorial.WebHome]]: | ||
199 | |||
200 | {{code language="javascript"}} | ||
201 | shortcut.remove("Ctrl+Alt+n"); | ||
202 | {{/code}} | ||
203 | |||
204 | == Removing all shortcuts at once == | ||
205 | |||
206 | {{code language="javascript"}} | ||
207 | for (binding in shortcut.all_shortcuts()) { | ||
208 | shortcut.remove(binding.keys.join(' ')); | ||
209 | } | ||
210 | {{/code}} | ||
211 | |||
212 | == Credits == | ||
213 | |||
214 | XWiki keyboard shortcuts are powered by [[Keypress JS shortcut library>>https://dmauro.github.io/Keypress/]]. |