blob: 77a534f032c71b8113c55a7e169b3bc52b16c8da [file] [log] [blame]
Blink Reformat4c46d092018-04-07 15:32:371/*
2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/**
32 * @unrestricted
33 */
34UI.ShortcutsScreen = class {
35 constructor() {
36 /** @type {!Object.<string, !UI.ShortcutsSection>} */
37 this._sections = {};
38 }
39
40 static registerShortcuts() {
41 // Elements panel
42 const elementsSection = UI.shortcutsScreen.section(Common.UIString('Elements Panel'));
43
44 const navigate = UI.ShortcutsScreen.ElementsPanelShortcuts.NavigateUp.concat(
45 UI.ShortcutsScreen.ElementsPanelShortcuts.NavigateDown);
46 elementsSection.addRelatedKeys(navigate, Common.UIString('Navigate elements'));
47
48 const expandCollapse =
49 UI.ShortcutsScreen.ElementsPanelShortcuts.Expand.concat(UI.ShortcutsScreen.ElementsPanelShortcuts.Collapse);
50 elementsSection.addRelatedKeys(expandCollapse, Common.UIString('Expand/collapse'));
51
52 elementsSection.addAlternateKeys(
53 UI.ShortcutsScreen.ElementsPanelShortcuts.EditAttribute, Common.UIString('Edit attribute'));
54 elementsSection.addAlternateKeys(
Joel Einbindera66e5bf2018-05-31 01:26:3755 UI.shortcutRegistry.shortcutDescriptorsForAction('elements.hide-element'), Common.UIString('Hide element'));
Blink Reformat4c46d092018-04-07 15:32:3756 elementsSection.addAlternateKeys(
Joel Einbindera66e5bf2018-05-31 01:26:3757 UI.shortcutRegistry.shortcutDescriptorsForAction('elements.edit-as-html'),
58 Common.UIString('Toggle edit as HTML'));
Blink Reformat4c46d092018-04-07 15:32:3759
Fabio Rochaf0d95472019-05-28 21:35:1960 // Styles pane
Blink Reformat4c46d092018-04-07 15:32:3761 const stylesPaneSection = UI.shortcutsScreen.section(Common.UIString('Styles Pane'));
62
63 const nextPreviousProperty = UI.ShortcutsScreen.ElementsPanelShortcuts.NextProperty.concat(
64 UI.ShortcutsScreen.ElementsPanelShortcuts.PreviousProperty);
65 stylesPaneSection.addRelatedKeys(nextPreviousProperty, Common.UIString('Next/previous property'));
66
67 stylesPaneSection.addRelatedKeys(
68 UI.ShortcutsScreen.ElementsPanelShortcuts.IncrementValue, Common.UIString('Increment value'));
69 stylesPaneSection.addRelatedKeys(
70 UI.ShortcutsScreen.ElementsPanelShortcuts.DecrementValue, Common.UIString('Decrement value'));
71
72 stylesPaneSection.addAlternateKeys(
73 UI.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy10, Common.UIString('Increment by %f', 10));
74 stylesPaneSection.addAlternateKeys(
75 UI.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy10, Common.UIString('Decrement by %f', 10));
76
77 stylesPaneSection.addAlternateKeys(
78 UI.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy100, Common.UIString('Increment by %f', 100));
79 stylesPaneSection.addAlternateKeys(
80 UI.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy100, Common.UIString('Decrement by %f', 100));
81
82 stylesPaneSection.addAlternateKeys(
83 UI.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy01, Common.UIString('Increment by %f', 0.1));
84 stylesPaneSection.addAlternateKeys(
85 UI.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy01, Common.UIString('Decrement by %f', 0.1));
86
Fabio Rochaf0d95472019-05-28 21:35:1987 // Console
88 const consoleSection = UI.shortcutsScreen.section(Common.UIString('Console'));
Blink Reformat4c46d092018-04-07 15:32:3789
Fabio Rochaf0d95472019-05-28 21:35:1990 consoleSection.addAlternateKeys(
91 UI.shortcutRegistry.shortcutDescriptorsForAction('console.clear'), Common.UIString('Clear console'));
92 consoleSection.addRelatedKeys(
93 UI.ShortcutsScreen.ConsolePanelShortcuts.AcceptSuggestion, Common.UIString('Accept suggestion'));
94 consoleSection.addAlternateKeys(
95 UI.ShortcutsScreen.ConsolePanelShortcuts.ClearConsolePrompt, Common.UIString('Clear console prompt'));
96 consoleSection.addRelatedKeys(
97 UI.ShortcutsScreen.ConsolePanelShortcuts.NextPreviousLine, Common.UIString('Next/previous line'));
98
99 if (Host.isMac()) {
100 consoleSection.addRelatedKeys(
101 UI.ShortcutsScreen.ConsolePanelShortcuts.NextPreviousCommand, Common.UIString('Next/previous command'));
102 }
103
104 consoleSection.addKey(UI.ShortcutsScreen.ConsolePanelShortcuts.ExecuteCommand, Common.UIString('Execute command'));
105
106 // Debugger
107 const debuggerSection = UI.shortcutsScreen.section(Common.UIString('Debugger'));
108
109 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37110 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-pause'), Common.UIString('Pause/ Continue'));
Fabio Rochaf0d95472019-05-28 21:35:19111 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37112 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.step-over'), Common.UIString('Step over'));
Fabio Rochaf0d95472019-05-28 21:35:19113 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37114 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.step-into'), Common.UIString('Step into'));
Fabio Rochaf0d95472019-05-28 21:35:19115 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37116 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.step-out'), Common.UIString('Step out'));
117
118 const nextAndPrevFrameKeys =
119 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.next-call-frame')
120 .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.previous-call-frame'));
Fabio Rochaf0d95472019-05-28 21:35:19121 debuggerSection.addRelatedKeys(nextAndPrevFrameKeys, Common.UIString('Next/previous call frame'));
Blink Reformat4c46d092018-04-07 15:32:37122
Fabio Rochaf0d95472019-05-28 21:35:19123 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37124 UI.ShortcutsScreen.SourcesPanelShortcuts.EvaluateSelectionInConsole,
125 Common.UIString('Evaluate selection in console'));
Fabio Rochaf0d95472019-05-28 21:35:19126 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37127 UI.ShortcutsScreen.SourcesPanelShortcuts.AddSelectionToWatch, Common.UIString('Add selection to watch'));
Fabio Rochaf0d95472019-05-28 21:35:19128 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37129 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-breakpoint'),
130 Common.UIString('Toggle breakpoint'));
Fabio Rochaf0d95472019-05-28 21:35:19131 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37132 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-breakpoint-enabled'),
133 Common.UIString('Toggle breakpoint enabled'));
Fabio Rochaf0d95472019-05-28 21:35:19134 debuggerSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37135 UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-breakpoints-active'),
136 Common.UIString('Toggle all breakpoints'));
137
138 // Editing
Fabio Rochaf0d95472019-05-28 21:35:19139 const editingSection = UI.shortcutsScreen.section(Common.UIString('Text Editor'));
140
141 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37142 UI.shortcutRegistry.shortcutDescriptorsForAction('sources.go-to-member'), Common.UIString('Go to member'));
Fabio Rochaf0d95472019-05-28 21:35:19143 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37144 UI.ShortcutsScreen.SourcesPanelShortcuts.ToggleAutocompletion, Common.UIString('Autocompletion'));
Fabio Rochaf0d95472019-05-28 21:35:19145 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37146 UI.shortcutRegistry.shortcutDescriptorsForAction('sources.go-to-line'), Common.UIString('Go to line'));
Fabio Rochaf0d95472019-05-28 21:35:19147 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37148 UI.shortcutRegistry.shortcutDescriptorsForAction('sources.jump-to-previous-location'),
149 Common.UIString('Jump to previous editing location'));
Fabio Rochaf0d95472019-05-28 21:35:19150 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37151 UI.shortcutRegistry.shortcutDescriptorsForAction('sources.jump-to-next-location'),
152 Common.UIString('Jump to next editing location'));
Fabio Rochaf0d95472019-05-28 21:35:19153 editingSection.addAlternateKeys(
154 UI.ShortcutsScreen.SourcesPanelShortcuts.ToggleComment, Common.UIString('Toggle comment'));
155 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37156 UI.ShortcutsScreen.SourcesPanelShortcuts.IncreaseCSSUnitByOne, Common.UIString('Increment CSS unit by 1'));
Fabio Rochaf0d95472019-05-28 21:35:19157 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37158 UI.ShortcutsScreen.SourcesPanelShortcuts.DecreaseCSSUnitByOne, Common.UIString('Decrement CSS unit by 1'));
Fabio Rochaf0d95472019-05-28 21:35:19159 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37160 UI.ShortcutsScreen.SourcesPanelShortcuts.IncreaseCSSUnitByTen, Common.UIString('Increment CSS unit by 10'));
Fabio Rochaf0d95472019-05-28 21:35:19161 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37162 UI.ShortcutsScreen.SourcesPanelShortcuts.DecreaseCSSUnitByTen, Common.UIString('Decrement CSS unit by 10'));
Fabio Rochaf0d95472019-05-28 21:35:19163 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37164 UI.ShortcutsScreen.SourcesPanelShortcuts.SelectNextOccurrence, Common.UIString('Select next occurrence'));
Fabio Rochaf0d95472019-05-28 21:35:19165 editingSection.addAlternateKeys(UI.ShortcutsScreen.SourcesPanelShortcuts.SoftUndo, Common.UIString('Soft undo'));
166 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37167 UI.ShortcutsScreen.SourcesPanelShortcuts.GotoMatchingBracket, Common.UIString('Go to matching bracket'));
Fabio Rochaf0d95472019-05-28 21:35:19168 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37169 UI.shortcutRegistry.shortcutDescriptorsForAction('sources.close-editor-tab'),
170 Common.UIString('Close editor tab'));
Fabio Rochaf0d95472019-05-28 21:35:19171 editingSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37172 UI.shortcutRegistry.shortcutDescriptorsForAction('sources.switch-file'),
173 Common.UIString('Switch between files with the same name and different extensions.'));
174
175 // Performance panel
Fabio Rochaf0d95472019-05-28 21:35:19176 const performanceSection = UI.shortcutsScreen.section(Common.UIString('Performance Panel'));
177
178 performanceSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37179 UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.toggle-recording'),
180 Common.UIString('Start/stop recording'));
Fabio Rochaf0d95472019-05-28 21:35:19181 performanceSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37182 UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.record-reload'),
183 Common.UIString('Record page reload'));
Fabio Rochaf0d95472019-05-28 21:35:19184 performanceSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37185 UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.save-to-file'), Common.UIString('Save profile'));
Fabio Rochaf0d95472019-05-28 21:35:19186 performanceSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37187 UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.load-from-file'), Common.UIString('Load profile'));
Fabio Rochaf0d95472019-05-28 21:35:19188 performanceSection.addRelatedKeys(
Blink Reformat4c46d092018-04-07 15:32:37189 UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.jump-to-previous-frame')
190 .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.jump-to-next-frame')),
191 Common.UIString('Jump to previous/next frame'));
Fabio Rochaf0d95472019-05-28 21:35:19192 performanceSection.addRelatedKeys(
Blink Reformat4c46d092018-04-07 15:32:37193 UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.show-history'),
194 Common.UIString('Pick a recording from history'));
Fabio Rochaf0d95472019-05-28 21:35:19195 performanceSection.addRelatedKeys(
Blink Reformat4c46d092018-04-07 15:32:37196 UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.previous-recording')
197 .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.next-recording')),
198 Common.UIString('Show previous/next recording'));
199
200 // Memory panel
Fabio Rochaf0d95472019-05-28 21:35:19201 const memorySection = UI.shortcutsScreen.section(Common.UIString('Memory Panel'));
202
203 memorySection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37204 UI.shortcutRegistry.shortcutDescriptorsForAction('profiler.heap-toggle-recording'),
205 Common.UIString('Start/stop recording'));
206
207 // Layers panel
Fabio Rochaf0d95472019-05-28 21:35:19208 const layersSection = UI.shortcutsScreen.section(Common.UIString('Layers Panel'));
209
210 layersSection.addAlternateKeys(UI.ShortcutsScreen.LayersPanelShortcuts.ResetView, Common.UIString('Reset view'));
211 layersSection.addAlternateKeys(
212 UI.ShortcutsScreen.LayersPanelShortcuts.PanMode, Common.UIString('Switch to pan mode'));
213 layersSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37214 UI.ShortcutsScreen.LayersPanelShortcuts.RotateMode, Common.UIString('Switch to rotate mode'));
Fabio Rochaf0d95472019-05-28 21:35:19215 layersSection.addAlternateKeys(
Blink Reformat4c46d092018-04-07 15:32:37216 UI.ShortcutsScreen.LayersPanelShortcuts.TogglePanRotate,
217 Common.UIString('Temporarily toggle pan/rotate mode while held'));
Fabio Rochaf0d95472019-05-28 21:35:19218 layersSection.addAlternateKeys(UI.ShortcutsScreen.LayersPanelShortcuts.ZoomIn, Common.UIString('Zoom in'));
219 layersSection.addAlternateKeys(UI.ShortcutsScreen.LayersPanelShortcuts.ZoomOut, Common.UIString('Zoom out'));
220 layersSection.addRelatedKeys(
Blink Reformat4c46d092018-04-07 15:32:37221 UI.ShortcutsScreen.LayersPanelShortcuts.Up.concat(UI.ShortcutsScreen.LayersPanelShortcuts.Down),
222 Common.UIString('Pan or rotate up/down'));
Fabio Rochaf0d95472019-05-28 21:35:19223 layersSection.addRelatedKeys(
Blink Reformat4c46d092018-04-07 15:32:37224 UI.ShortcutsScreen.LayersPanelShortcuts.Left.concat(UI.ShortcutsScreen.LayersPanelShortcuts.Right),
225 Common.UIString('Pan or rotate left/right'));
226 }
227
228 /**
229 * @param {string} name
230 * @return {!UI.ShortcutsSection}
231 */
232 section(name) {
233 let section = this._sections[name];
234 if (!section)
235 this._sections[name] = section = new UI.ShortcutsSection(name);
236 return section;
237 }
238
239 /**
240 * @return {!UI.Widget}
241 */
242 createShortcutsTabView() {
243 const orderedSections = [];
244 for (const section in this._sections)
245 orderedSections.push(this._sections[section]);
246 function compareSections(a, b) {
247 return a.order - b.order;
248 }
249 orderedSections.sort(compareSections);
250
251 const widget = new UI.Widget();
252
253 widget.element.className = 'settings-tab-container'; // Override
Chandani Shrestha83bd7c92019-06-11 21:21:59254 widget.element.createChild('header').createChild('h1').createTextChild(ls`Shortcuts`);
Blink Reformat4c46d092018-04-07 15:32:37255 const scrollPane = widget.element.createChild('div', 'settings-container-wrapper');
256 const container = scrollPane.createChild('div');
257 container.className = 'settings-content settings-container';
258 for (let i = 0; i < orderedSections.length; ++i)
259 orderedSections[i].renderSection(container);
260
261 const note = scrollPane.createChild('p', 'settings-footnote');
262 note.appendChild(UI.createDocumentationLink(
263 'iterate/inspect-styles/shortcuts', Common.UIString('Full list of DevTools keyboard shortcuts and gestures')));
264
265 return widget;
266 }
267};
268
269/**
270 * We cannot initialize it here as localized strings are not loaded yet.
271 * @type {!UI.ShortcutsScreen}
272 */
273UI.shortcutsScreen;
274
275/**
276 * @unrestricted
277 */
278UI.ShortcutsSection = class {
279 /**
280 * @param {string} name
281 */
282 constructor(name) {
283 this.name = name;
284 this._lines = /** @type {!Array.<!{key: !Node, text: string}>} */ ([]);
285 this.order = ++UI.ShortcutsSection._sequenceNumber;
286 }
287
288 /**
289 * @param {!UI.KeyboardShortcut.Descriptor} key
290 * @param {string} description
291 */
292 addKey(key, description) {
293 this._addLine(this._renderKey(key), description);
294 }
295
296 /**
297 * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} keys
298 * @param {string} description
299 */
300 addRelatedKeys(keys, description) {
301 this._addLine(this._renderSequence(keys, '/'), description);
302 }
303
304 /**
305 * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} keys
306 * @param {string} description
307 */
308 addAlternateKeys(keys, description) {
309 this._addLine(this._renderSequence(keys, Common.UIString('or')), description);
310 }
311
312 /**
313 * @param {!Node} keyElement
314 * @param {string} description
315 */
316 _addLine(keyElement, description) {
317 this._lines.push({key: keyElement, text: description});
318 }
319
320 /**
321 * @param {!Element} container
322 */
323 renderSection(container) {
324 const parent = container.createChild('div', 'settings-block');
325
326 const headLine = parent.createChild('div', 'settings-line');
327 headLine.createChild('div', 'settings-key-cell');
328 headLine.createChild('div', 'settings-section-title settings-cell').textContent = this.name;
329
330 for (let i = 0; i < this._lines.length; ++i) {
331 const line = parent.createChild('div', 'settings-line');
332 const keyCell = line.createChild('div', 'settings-key-cell');
333 keyCell.appendChild(this._lines[i].key);
334 keyCell.appendChild(this._createSpan('settings-key-delimiter', ':'));
335 line.createChild('div', 'settings-cell').textContent = this._lines[i].text;
336 }
337 }
338
339 /**
340 * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} sequence
341 * @param {string} delimiter
342 * @return {!Node}
343 */
344 _renderSequence(sequence, delimiter) {
345 const delimiterSpan = this._createSpan('settings-key-delimiter', delimiter);
346 return this._joinNodes(sequence.map(this._renderKey.bind(this)), delimiterSpan);
347 }
348
349 /**
350 * @param {!UI.KeyboardShortcut.Descriptor} key
351 * @return {!Node}
352 */
353 _renderKey(key) {
354 const keyName = key.name;
355 const plus = this._createSpan('settings-combine-keys', '+');
356 return this._joinNodes(keyName.split(' + ').map(this._createSpan.bind(this, 'settings-key')), plus);
357 }
358
359 /**
360 * @param {string} className
361 * @param {string} textContent
362 * @return {!Element}
363 */
364 _createSpan(className, textContent) {
365 const node = createElement('span');
366 node.className = className;
367 node.textContent = textContent;
368 return node;
369 }
370
371 /**
372 * @param {!Array.<!Element>} nodes
373 * @param {!Element} delimiter
374 * @return {!Node}
375 */
376 _joinNodes(nodes, delimiter) {
377 const result = createDocumentFragment();
378 for (let i = 0; i < nodes.length; ++i) {
379 if (i > 0)
380 result.appendChild(delimiter.cloneNode(true));
381 result.appendChild(nodes[i]);
382 }
383 return result;
384 }
385};
386
387UI.ShortcutsSection._sequenceNumber = 0;
388
389
390UI.ShortcutsScreen.ElementsPanelShortcuts = {
391 NavigateUp: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Up)],
392
393 NavigateDown: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Down)],
394
395 Expand: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Right)],
396
397 Collapse: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Left)],
398
399 EditAttribute: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Enter)],
400
Blink Reformat4c46d092018-04-07 15:32:37401 NextProperty: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Tab)],
402
403 PreviousProperty:
404 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Tab, UI.KeyboardShortcut.Modifiers.Shift)],
405
406 IncrementValue: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Up)],
407
408 DecrementValue: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Down)],
409
410 IncrementBy10: [
411 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.PageUp),
412 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Up, UI.KeyboardShortcut.Modifiers.Shift)
413 ],
414
415 DecrementBy10: [
416 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.PageDown),
417 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Down, UI.KeyboardShortcut.Modifiers.Shift)
418 ],
419
420 IncrementBy100:
421 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.PageUp, UI.KeyboardShortcut.Modifiers.Shift)],
422
423 DecrementBy100:
424 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.PageDown, UI.KeyboardShortcut.Modifiers.Shift)],
425
426 IncrementBy01: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Up, UI.KeyboardShortcut.Modifiers.Alt)],
427
428 DecrementBy01: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Down, UI.KeyboardShortcut.Modifiers.Alt)]
429};
430
Fabio Rochaf0d95472019-05-28 21:35:19431UI.ShortcutsScreen.ConsolePanelShortcuts = {
432 AcceptSuggestion: [
433 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Tab),
434 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Right)
435 ],
436
437 ClearConsolePrompt: [UI.KeyboardShortcut.makeDescriptor('u', UI.KeyboardShortcut.Modifiers.Ctrl)],
438
439 ExecuteCommand: UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Enter),
440
441 NextPreviousLine: [
442 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Down),
443 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Up)
444 ],
445
446 NextPreviousCommand: [
447 UI.KeyboardShortcut.makeDescriptor('N', UI.KeyboardShortcut.Modifiers.Alt),
448 UI.KeyboardShortcut.makeDescriptor('P', UI.KeyboardShortcut.Modifiers.Alt)
449 ],
450};
451
Blink Reformat4c46d092018-04-07 15:32:37452UI.ShortcutsScreen.SourcesPanelShortcuts = {
453 SelectNextOccurrence: [UI.KeyboardShortcut.makeDescriptor('d', UI.KeyboardShortcut.Modifiers.CtrlOrMeta)],
454
455 SoftUndo: [UI.KeyboardShortcut.makeDescriptor('u', UI.KeyboardShortcut.Modifiers.CtrlOrMeta)],
456
457 GotoMatchingBracket: [UI.KeyboardShortcut.makeDescriptor('m', UI.KeyboardShortcut.Modifiers.Ctrl)],
458
459 ToggleAutocompletion:
460 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Space, UI.KeyboardShortcut.Modifiers.Ctrl)],
461
462 IncreaseCSSUnitByOne:
463 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Up, UI.KeyboardShortcut.Modifiers.Alt)],
464
465 DecreaseCSSUnitByOne:
466 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Down, UI.KeyboardShortcut.Modifiers.Alt)],
467
468 IncreaseCSSUnitByTen:
469 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.PageUp, UI.KeyboardShortcut.Modifiers.Alt)],
470
471 DecreaseCSSUnitByTen:
472 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.PageDown, UI.KeyboardShortcut.Modifiers.Alt)],
473 EvaluateSelectionInConsole: [UI.KeyboardShortcut.makeDescriptor(
474 'e', UI.KeyboardShortcut.Modifiers.Shift | UI.KeyboardShortcut.Modifiers.Ctrl)],
475
476 AddSelectionToWatch: [UI.KeyboardShortcut.makeDescriptor(
477 'a', UI.KeyboardShortcut.Modifiers.Shift | UI.KeyboardShortcut.Modifiers.Ctrl)],
478
479 ToggleComment:
480 [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Slash, UI.KeyboardShortcut.Modifiers.CtrlOrMeta)],
481};
482
483UI.ShortcutsScreen.LayersPanelShortcuts = {
484 ResetView: [UI.KeyboardShortcut.makeDescriptor('0')],
485
486 PanMode: [UI.KeyboardShortcut.makeDescriptor('x')],
487
488 RotateMode: [UI.KeyboardShortcut.makeDescriptor('v')],
489
490 TogglePanRotate: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Shift)],
491
492 ZoomIn: [
493 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Plus, UI.KeyboardShortcut.Modifiers.Shift),
494 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.NumpadPlus)
495 ],
496
497 ZoomOut: [
498 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Minus, UI.KeyboardShortcut.Modifiers.Shift),
499 UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.NumpadMinus)
500 ],
501
502 Up: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Up), UI.KeyboardShortcut.makeDescriptor('w')],
503
504 Down: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Down), UI.KeyboardShortcut.makeDescriptor('s')],
505
506 Left: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Left), UI.KeyboardShortcut.makeDescriptor('a')],
507
508 Right: [UI.KeyboardShortcut.makeDescriptor(UI.KeyboardShortcut.Keys.Right), UI.KeyboardShortcut.makeDescriptor('d')]
509};