Wiki source code of XWiki Keyboard Shortcuts

Last modified by Vincent Massol on 2020/02/05

Show last authors
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 === a) Edit Actions ===
20
21 (% class="keyboard" summary="Keyboard Shortcuts for View Mode in order to activate edit actions" %)
22 | (% class="shortcut" %)
23 (((
24 (% class="key" %)E
25 )))|Edit the page using the default edition mode
26 | (% class="shortcut" %)
27 (((
28 (% class="key" %)K
29 )))|Edit the page in wiki edition mode
30 | (% class="shortcut" %)
31 (((
32 (% class="key" %)G
33 )))|Edit the page using the WYSIWYG editor
34 | (% class="shortcut" %)
35 (((
36 (% class="key" %)F
37 )))|Inline Form
38 | (% class="shortcut" %)
39 (((
40 (% class="key" %)R
41 )))|Edit page access rights
42 | (% class="shortcut" %)
43 (((
44 (% class="key" %)O
45 )))|Edit page objects
46 | (% class="shortcut" %)
47 (((
48 (% class="key" %)S
49 )))|Edit class
50
51 === b) View Actions ===
52
53 (% class="keyboard" summary="Keyboard Shortcuts for View Mode in order to activate view actions" %)
54 | (% class="shortcut" %)
55 (((
56 (% class="key" %)C
57 )))|Go to page comments
58 | (% class="shortcut" %)
59 (((
60 (% class="key" %)A
61 )))|Go to page attachments
62 | (% class="shortcut" %)
63 (((
64 (% class="key" %)H
65 )))|Go to page history
66 | (% class="shortcut" %)
67 (((
68 (% class="key" %)I
69 )))|Go to page information
70 | (% class="shortcut" %)
71 (((
72 (% class="key" %)D
73 )))|View page wiki code
74
75 === c) Other Actions ===
76
77 (% class="keyboard" summary="Keyboard Shortcuts for View Mode in order to activate other actions" %)
78 | (% class="shortcut" %)
79 (((
80 (% class="key" %)F2
81 )))|Rename page
82 | (% class="shortcut" %)
83 (((
84 (% class="key" %)Delete
85 )))|Delete page
86
87 == Edit Wiki & Edit Inline Mode ==
88
89 {{warning}}
90 While in Inline Edit mode and focusing on a WYSIWYG edit area, the keyboard shortcuts listed below won't work since the WYSIWYG editor grabs all the key pressed events.
91 {{/warning}}
92
93 (% class="keyboard" summary="Keyboard Shortcuts for Edit Wiki and Inline Mode" %)
94 | (% class="shortcut" %)
95 (((
96 (% class="key" %)Alt(%%) + (% class="key" %)C
97 )))|Cancel edition
98 | (% class="shortcut" %)
99 (((
100 (% class="key" %)Alt(%%) + (% class="key" %)P
101 )))|Preview the page without saving
102 | (% class="shortcut" %)
103 (((
104 (% class="key" %)Alt(%%) + (% class="key" %)Shift(%%) + (% class="key" %)S
105 )))|Save and continue to edit the page
106 | (% class="shortcut" %)
107 (((
108 (% class="key" %)Alt(%%) + (% class="key" %)S
109 )))|Save and view the page
110
111 == Edit WYSIWYG Mode ==
112
113 {{include document="platform:Features.WysiwygEditorShortcuts"/}}
114
115 == Preview Mode ==
116
117 (% class="keyboard" summary="Keyboard Shortcuts for Preview Mode" %)
118 | (% class="shortcut" %)
119 (((
120 (% class="key" %)Alt(%%) + (% class="key" %)C
121 )))|Cancel edition
122 | (% class="shortcut" %)
123 (((
124 (% class="key" %)Alt(%%) + (% class="key" %)B
125 )))|Back to the edition
126 | (% class="shortcut" %)
127 (((
128 (% class="key" %)Alt(%%) + (% class="key" %)Shift(%%) + (% class="key" %)S
129 )))|Save and continue to edit the page
130 | (% class="shortcut" %)
131 (((
132 (% class="key" %)Alt(%%) + (% class="key" %)S
133 )))|Save and view the page
134
135 == Annotations ==
136
137 (% class="keyboard" summary="Keyboard Shortcuts for Annotations" %)
138 | (% class="shortcut" %)
139 (((
140 (% class="key" %)Ctrl(%%) + (% class="key" %)M(%%) (% class="separator" %)or(%%) (% class="key" %)Meta(%%) + (% class="key" %)M(%%)
141 (% class="key" %)Ctrl(%%) + (% class="key" %)I(%%) (% class="separator" %)or(%%) (% class="key" %)Meta(%%) + (% class="key" %)I
142 )))|Annotate a piece of text
143 | (% class="shortcut" %)
144 (((
145 (% class="key" %)Alt(%%) + (% class="key" %)A
146 )))|Show annotations
147
148 == Navigation ==
149
150 (% class="keyboard" summary="Keyboard Shortcuts for Navigation" %)
151 | (% class="shortcut" %)
152 (((
153 (% class="key" %)Ctrl(%%) + (% class="key" %)G
154 )))(% class="separator" %)or(%%) (% class="shortcut" %)
155 (((
156 (% class="key" %)Meta(%%) + (% class="key" %)G
157 )))|Jump to any page in the wiki
158
159 == Developer shortcuts ==
160
161 {{info}}Since 9.11{{/info}}, the following key sequences can be used to toggle specific actions on the current logged in user:
162
163 (% class="keyboard" summary="Keyboard Shortcuts for developers" %)
164 | (% class="shortcut" %)
165 (((
166 (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)a
167 )))|Toggle advanced user mode for the current user.
168
169 (% class="keyboard" summary="Keyboard Shortcuts for developers" %)
170 | (% class="shortcut" %)
171 (((
172 (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)x(%%) (% class="key" %)h
173 )))|Toggle hidden pages for the current user.
174
175 = Configuring keyboard shortcuts =
176
177 == Modifying keyboard shortcuts ==
178
179 * Create a new page in your wiki, for example ##XWiki.KeyboardShortcuts## and paste the following content inside:(((
180 {{code}}
181 core.shortcuts.view.edit=e
182 core.shortcuts.view.wiki=k
183 core.shortcuts.view.wysiwyg=g
184 core.shortcuts.view.inline=f
185 core.shortcuts.view.rights=r
186 core.shortcuts.view.objects=o
187 core.shortcuts.view.class=s
188 core.shortcuts.view.comments=c
189 core.shortcuts.view.attachments=a
190 core.shortcuts.view.history=h
191 core.shortcuts.view.information=i
192 core.shortcuts.view.code=d
193 core.shortcuts.view.delete=Delete
194 core.shortcuts.view.rename=F2
195 core.shortcuts.edit.cancel=Alt+C
196 core.shortcuts.edit.backtoedit=Alt+B
197 core.shortcuts.edit.preview=Alt+P
198 core.shortcuts.edit.saveandcontinue=Alt+Shift+S
199 core.shortcuts.edit.saveandview=Alt+S
200 {{/code}}
201 )))
202 * Modify entries in this list at your convenience
203 * Save the page
204 * Go to the wiki administration, edit the attached XObject (change the URL to ##/edit/XWiki/XWikiPreferences?editor=object##)
205 * Add ##XWiki.KeyboardShortcuts## to the "Internationalization Document Bundles" field
206
207 == Adding your own shortcuts ==
208
209 You can add your own keyboard shortcuts in a few javascript lines :
210
211 {{code language="html"}}
212 <script type="text/javascript">
213 //<![CDATA[
214 shortcut.add("Ctrl+Alt+n", function() { alert("Hey there! Congratulations on typing this one ;)"); });
215 //]]>
216 </script>
217 {{/code}}
218
219 {{html clean="false"}}
220 <script type="text/javascript">
221 shortcut.add("Ctrl+Alt+n", function() { alert("Hey there! Congratulations on typing this one ;)"); }, {'propagate':false} );
222 </script>
223 {{/html}}
224
225 Try the snippet by pressing (% class="key" %)**Ctrl**(%%) + (% class="key" %)**Alt**(%%) + (% class="key" %)**n**(%%).
226
227 Also check the [[complete documentation>>https://dmauro.github.io/Keypress/]].
228
229 == Removing keyboard shortcuts ==
230
231 To remove a shortcut adapt this snippet to your needs :
232
233 {{code language="html"}}
234 <script type="text/javascript">
235 //<![CDATA[
236 shortcut.remove("Ctrl+Alt+n");
237 //]]>
238 </script>
239 {{/code}}
240
241 {{html clean="false"}}
242 <script type="text/javascript">
243 function removeCtrlAltN() {
244 shortcut.remove("Ctrl+Alt+n");
245 }
246 </script>
247 <a onclick="removeCtrlAltN(); return false;" href="#">Click here to try the snippet, it will remove the Ctrl+Alt+n shortcut</a>.
248 {{/html}}
249
250 == Removing all shortcuts at once ==
251
252 {{code language="html"}}
253 <script type="text/javascript">
254 //<![CDATA[
255 for (binding in shortcut.all_shortcuts()) {
256 shortcut.remove(binding.keys.join(' '));
257 }
258 //]]>
259 </script>
260 {{/code}}
261
262 {{velocity}}
263 #if (!$isGuest && $isAdvancedUser)
264 {{html clean="false"}}
265 <script type="text/javascript">
266 //<![CDATA[
267 function removeAll() {
268 for (binding in shortcut.all_shortcuts()) {
269 shortcut.remove(binding.keys.join(' '));
270 }
271 }
272 //]]>
273 </script>
274 <a onclick="removeAll(); return false;" href="#">Click here to try the snippet, it will disable all keyboard shortcuts</a>.
275 {{/html}}
276 #end
277 {{/velocity}}
278
279 == Credits ==
280
281 XWiki keyboard shortcuts are powered by [[Keypress JS shortcut library>>https://dmauro.github.io/Keypress/]].

Get Connected