Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 1 | /* |
| 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 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 31 | import * as Common from '../common/common.js'; |
Paul Lewis | 0fd4371 | 2020-01-08 17:07:36 | [diff] [blame^] | 32 | import * as Host from '../host/host.js'; |
| 33 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 34 | import {KeyboardShortcut, Keys, Modifiers} from './KeyboardShortcut.js'; |
| 35 | import {createDocumentationLink} from './UIUtils.js'; |
| 36 | import {Widget} from './Widget.js'; |
| 37 | |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 38 | /** |
| 39 | * @unrestricted |
| 40 | */ |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 41 | export class ShortcutsScreen { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 42 | constructor() { |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 43 | /** @type {!Object.<string, !ShortcutsSection>} */ |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 44 | this._sections = {}; |
| 45 | } |
| 46 | |
| 47 | static registerShortcuts() { |
| 48 | // Elements panel |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 49 | const elementsSection = UI.shortcutsScreen.section(Common.UIString.UIString('Elements Panel')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 50 | |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 51 | const navigate = ElementsPanelShortcuts.NavigateUp.concat(ElementsPanelShortcuts.NavigateDown); |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 52 | elementsSection.addRelatedKeys(navigate, Common.UIString.UIString('Navigate elements')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 53 | |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 54 | const expandCollapse = ElementsPanelShortcuts.Expand.concat(ElementsPanelShortcuts.Collapse); |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 55 | elementsSection.addRelatedKeys(expandCollapse, Common.UIString.UIString('Expand/collapse')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 56 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 57 | elementsSection.addAlternateKeys(ElementsPanelShortcuts.EditAttribute, Common.UIString.UIString('Edit attribute')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 58 | elementsSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 59 | UI.shortcutRegistry.shortcutDescriptorsForAction('elements.hide-element'), |
| 60 | Common.UIString.UIString('Hide element')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 61 | elementsSection.addAlternateKeys( |
Joel Einbinder | a66e5bf | 2018-05-31 01:26:37 | [diff] [blame] | 62 | UI.shortcutRegistry.shortcutDescriptorsForAction('elements.edit-as-html'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 63 | Common.UIString.UIString('Toggle edit as HTML')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 64 | |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 65 | // Styles pane |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 66 | const stylesPaneSection = UI.shortcutsScreen.section(Common.UIString.UIString('Styles Pane')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 67 | |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 68 | const nextPreviousProperty = ElementsPanelShortcuts.NextProperty.concat(ElementsPanelShortcuts.PreviousProperty); |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 69 | stylesPaneSection.addRelatedKeys(nextPreviousProperty, Common.UIString.UIString('Next/previous property')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 70 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 71 | stylesPaneSection.addRelatedKeys( |
| 72 | ElementsPanelShortcuts.IncrementValue, Common.UIString.UIString('Increment value')); |
| 73 | stylesPaneSection.addRelatedKeys( |
| 74 | ElementsPanelShortcuts.DecrementValue, Common.UIString.UIString('Decrement value')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 75 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 76 | stylesPaneSection.addAlternateKeys( |
| 77 | ElementsPanelShortcuts.IncrementBy10, Common.UIString.UIString('Increment by %f', 10)); |
| 78 | stylesPaneSection.addAlternateKeys( |
| 79 | ElementsPanelShortcuts.DecrementBy10, Common.UIString.UIString('Decrement by %f', 10)); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 80 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 81 | stylesPaneSection.addAlternateKeys( |
| 82 | ElementsPanelShortcuts.IncrementBy100, Common.UIString.UIString('Increment by %f', 100)); |
| 83 | stylesPaneSection.addAlternateKeys( |
| 84 | ElementsPanelShortcuts.DecrementBy100, Common.UIString.UIString('Decrement by %f', 100)); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 85 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 86 | stylesPaneSection.addAlternateKeys( |
| 87 | ElementsPanelShortcuts.IncrementBy01, Common.UIString.UIString('Increment by %f', 0.1)); |
| 88 | stylesPaneSection.addAlternateKeys( |
| 89 | ElementsPanelShortcuts.DecrementBy01, Common.UIString.UIString('Decrement by %f', 0.1)); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 90 | |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 91 | // Console |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 92 | const consoleSection = UI.shortcutsScreen.section(Common.UIString.UIString('Console')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 93 | |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 94 | consoleSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 95 | UI.shortcutRegistry.shortcutDescriptorsForAction('console.clear'), Common.UIString.UIString('Clear console')); |
| 96 | consoleSection.addRelatedKeys( |
| 97 | ConsolePanelShortcuts.AcceptSuggestion, Common.UIString.UIString('Accept suggestion')); |
| 98 | consoleSection.addAlternateKeys( |
| 99 | ConsolePanelShortcuts.ClearConsolePrompt, Common.UIString.UIString('Clear console prompt')); |
| 100 | consoleSection.addRelatedKeys( |
| 101 | ConsolePanelShortcuts.NextPreviousLine, Common.UIString.UIString('Next/previous line')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 102 | |
Paul Lewis | 0fd4371 | 2020-01-08 17:07:36 | [diff] [blame^] | 103 | if (Host.Platform.isMac()) { |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 104 | consoleSection.addRelatedKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 105 | ConsolePanelShortcuts.NextPreviousCommand, Common.UIString.UIString('Next/previous command')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 106 | } |
| 107 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 108 | consoleSection.addKey(ConsolePanelShortcuts.ExecuteCommand, Common.UIString.UIString('Execute command')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 109 | |
| 110 | // Debugger |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 111 | const debuggerSection = UI.shortcutsScreen.section(Common.UIString.UIString('Debugger')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 112 | |
| 113 | debuggerSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 114 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-pause'), |
| 115 | Common.UIString.UIString('Pause/ Continue')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 116 | debuggerSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 117 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.step-over'), Common.UIString.UIString('Step over')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 118 | debuggerSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 119 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.step-into'), Common.UIString.UIString('Step into')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 120 | debuggerSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 121 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.step-out'), Common.UIString.UIString('Step out')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 122 | |
| 123 | const nextAndPrevFrameKeys = |
| 124 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.next-call-frame') |
| 125 | .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.previous-call-frame')); |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 126 | debuggerSection.addRelatedKeys(nextAndPrevFrameKeys, Common.UIString.UIString('Next/previous call frame')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 127 | |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 128 | debuggerSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 129 | SourcesPanelShortcuts.EvaluateSelectionInConsole, Common.UIString.UIString('Evaluate selection in console')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 130 | debuggerSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 131 | SourcesPanelShortcuts.AddSelectionToWatch, Common.UIString.UIString('Add selection to watch')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 132 | debuggerSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 133 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-breakpoint'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 134 | Common.UIString.UIString('Toggle breakpoint')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 135 | debuggerSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 136 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-breakpoint-enabled'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 137 | Common.UIString.UIString('Toggle breakpoint enabled')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 138 | debuggerSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 139 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.toggle-breakpoints-active'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 140 | Common.UIString.UIString('Toggle all breakpoints')); |
Olivia Flynn | 8e746e0 | 2019-06-19 17:06:23 | [diff] [blame] | 141 | debuggerSection.addAlternateKeys( |
| 142 | UI.shortcutRegistry.shortcutDescriptorsForAction('debugger.breakpoint-input-window'), |
| 143 | ls`Open breakpoint editor`); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 144 | |
| 145 | // Editing |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 146 | const editingSection = UI.shortcutsScreen.section(Common.UIString.UIString('Text Editor')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 147 | |
| 148 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 149 | UI.shortcutRegistry.shortcutDescriptorsForAction('sources.go-to-member'), |
| 150 | Common.UIString.UIString('Go to member')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 151 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 152 | SourcesPanelShortcuts.ToggleAutocompletion, Common.UIString.UIString('Autocompletion')); |
| 153 | editingSection.addAlternateKeys( |
| 154 | UI.shortcutRegistry.shortcutDescriptorsForAction('sources.go-to-line'), Common.UIString.UIString('Go to line')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 155 | editingSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 156 | UI.shortcutRegistry.shortcutDescriptorsForAction('sources.jump-to-previous-location'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 157 | Common.UIString.UIString('Jump to previous editing location')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 158 | editingSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 159 | UI.shortcutRegistry.shortcutDescriptorsForAction('sources.jump-to-next-location'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 160 | Common.UIString.UIString('Jump to next editing location')); |
| 161 | editingSection.addAlternateKeys(SourcesPanelShortcuts.ToggleComment, Common.UIString.UIString('Toggle comment')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 162 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 163 | SourcesPanelShortcuts.IncreaseCSSUnitByOne, Common.UIString.UIString('Increment CSS unit by 1')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 164 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 165 | SourcesPanelShortcuts.DecreaseCSSUnitByOne, Common.UIString.UIString('Decrement CSS unit by 1')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 166 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 167 | SourcesPanelShortcuts.IncreaseCSSUnitByTen, Common.UIString.UIString('Increment CSS unit by 10')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 168 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 169 | SourcesPanelShortcuts.DecreaseCSSUnitByTen, Common.UIString.UIString('Decrement CSS unit by 10')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 170 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 171 | SourcesPanelShortcuts.SelectNextOccurrence, Common.UIString.UIString('Select next occurrence')); |
| 172 | editingSection.addAlternateKeys(SourcesPanelShortcuts.SoftUndo, Common.UIString.UIString('Soft undo')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 173 | editingSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 174 | SourcesPanelShortcuts.GotoMatchingBracket, Common.UIString.UIString('Go to matching bracket')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 175 | editingSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 176 | UI.shortcutRegistry.shortcutDescriptorsForAction('sources.close-editor-tab'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 177 | Common.UIString.UIString('Close editor tab')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 178 | editingSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 179 | UI.shortcutRegistry.shortcutDescriptorsForAction('sources.switch-file'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 180 | Common.UIString.UIString('Switch between files with the same name and different extensions.')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 181 | |
| 182 | // Performance panel |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 183 | const performanceSection = UI.shortcutsScreen.section(Common.UIString.UIString('Performance Panel')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 184 | |
| 185 | performanceSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 186 | UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.toggle-recording'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 187 | Common.UIString.UIString('Start/stop recording')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 188 | performanceSection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 189 | UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.record-reload'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 190 | Common.UIString.UIString('Record page reload')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 191 | performanceSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 192 | UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.save-to-file'), |
| 193 | Common.UIString.UIString('Save profile')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 194 | performanceSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 195 | UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.load-from-file'), |
| 196 | Common.UIString.UIString('Load profile')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 197 | performanceSection.addRelatedKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 198 | UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.jump-to-previous-frame') |
| 199 | .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.jump-to-next-frame')), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 200 | Common.UIString.UIString('Jump to previous/next frame')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 201 | performanceSection.addRelatedKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 202 | UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.show-history'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 203 | Common.UIString.UIString('Pick a recording from history')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 204 | performanceSection.addRelatedKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 205 | UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.previous-recording') |
| 206 | .concat(UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.next-recording')), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 207 | Common.UIString.UIString('Show previous/next recording')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 208 | |
| 209 | // Memory panel |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 210 | const memorySection = UI.shortcutsScreen.section(Common.UIString.UIString('Memory Panel')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 211 | |
| 212 | memorySection.addAlternateKeys( |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 213 | UI.shortcutRegistry.shortcutDescriptorsForAction('profiler.heap-toggle-recording'), |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 214 | Common.UIString.UIString('Start/stop recording')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 215 | |
| 216 | // Layers panel |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 217 | const layersSection = UI.shortcutsScreen.section(Common.UIString.UIString('Layers Panel')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 218 | |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 219 | layersSection.addAlternateKeys(LayersPanelShortcuts.ResetView, Common.UIString.UIString('Reset view')); |
| 220 | layersSection.addAlternateKeys(LayersPanelShortcuts.PanMode, Common.UIString.UIString('Switch to pan mode')); |
| 221 | layersSection.addAlternateKeys(LayersPanelShortcuts.RotateMode, Common.UIString.UIString('Switch to rotate mode')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 222 | layersSection.addAlternateKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 223 | LayersPanelShortcuts.TogglePanRotate, |
| 224 | Common.UIString.UIString('Temporarily toggle pan/rotate mode while held')); |
| 225 | layersSection.addAlternateKeys(LayersPanelShortcuts.ZoomIn, Common.UIString.UIString('Zoom in')); |
| 226 | layersSection.addAlternateKeys(LayersPanelShortcuts.ZoomOut, Common.UIString.UIString('Zoom out')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 227 | layersSection.addRelatedKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 228 | LayersPanelShortcuts.Up.concat(LayersPanelShortcuts.Down), Common.UIString.UIString('Pan or rotate up/down')); |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 229 | layersSection.addRelatedKeys( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 230 | LayersPanelShortcuts.Left.concat(LayersPanelShortcuts.Right), |
| 231 | Common.UIString.UIString('Pan or rotate left/right')); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | /** |
| 235 | * @param {string} name |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 236 | * @return {!ShortcutsSection} |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 237 | */ |
| 238 | section(name) { |
| 239 | let section = this._sections[name]; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 240 | if (!section) { |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 241 | this._sections[name] = section = new ShortcutsSection(name); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 242 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 243 | return section; |
| 244 | } |
| 245 | |
| 246 | /** |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 247 | * @return {!Widget} |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 248 | */ |
| 249 | createShortcutsTabView() { |
| 250 | const orderedSections = []; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 251 | for (const section in this._sections) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 252 | orderedSections.push(this._sections[section]); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 253 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 254 | function compareSections(a, b) { |
| 255 | return a.order - b.order; |
| 256 | } |
| 257 | orderedSections.sort(compareSections); |
| 258 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 259 | const widget = new Widget(); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 260 | |
| 261 | widget.element.className = 'settings-tab-container'; // Override |
Chandani Shrestha | 83bd7c9 | 2019-06-11 21:21:59 | [diff] [blame] | 262 | widget.element.createChild('header').createChild('h1').createTextChild(ls`Shortcuts`); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 263 | const scrollPane = widget.element.createChild('div', 'settings-container-wrapper'); |
| 264 | const container = scrollPane.createChild('div'); |
| 265 | container.className = 'settings-content settings-container'; |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 266 | for (let i = 0; i < orderedSections.length; ++i) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 267 | orderedSections[i].renderSection(container); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 268 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 269 | |
| 270 | const note = scrollPane.createChild('p', 'settings-footnote'); |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 271 | note.appendChild(createDocumentationLink( |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 272 | 'iterate/inspect-styles/shortcuts', |
| 273 | Common.UIString.UIString('Full list of DevTools keyboard shortcuts and gestures'))); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 274 | |
| 275 | return widget; |
| 276 | } |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 277 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 278 | |
| 279 | /** |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 280 | * @unrestricted |
| 281 | */ |
Tim van der Lippe | c96ccd9 | 2019-11-29 16:23:54 | [diff] [blame] | 282 | class ShortcutsSection { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 283 | /** |
| 284 | * @param {string} name |
| 285 | */ |
| 286 | constructor(name) { |
| 287 | this.name = name; |
| 288 | this._lines = /** @type {!Array.<!{key: !Node, text: string}>} */ ([]); |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 289 | this.order = ++ShortcutsSection._sequenceNumber; |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | /** |
| 293 | * @param {!UI.KeyboardShortcut.Descriptor} key |
| 294 | * @param {string} description |
| 295 | */ |
| 296 | addKey(key, description) { |
| 297 | this._addLine(this._renderKey(key), description); |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} keys |
| 302 | * @param {string} description |
| 303 | */ |
| 304 | addRelatedKeys(keys, description) { |
| 305 | this._addLine(this._renderSequence(keys, '/'), description); |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} keys |
| 310 | * @param {string} description |
| 311 | */ |
| 312 | addAlternateKeys(keys, description) { |
Paul Lewis | 17e384e | 2020-01-08 15:46:51 | [diff] [blame] | 313 | this._addLine(this._renderSequence(keys, Common.UIString.UIString('or')), description); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | /** |
| 317 | * @param {!Node} keyElement |
| 318 | * @param {string} description |
| 319 | */ |
| 320 | _addLine(keyElement, description) { |
| 321 | this._lines.push({key: keyElement, text: description}); |
| 322 | } |
| 323 | |
| 324 | /** |
| 325 | * @param {!Element} container |
| 326 | */ |
| 327 | renderSection(container) { |
| 328 | const parent = container.createChild('div', 'settings-block'); |
| 329 | |
| 330 | const headLine = parent.createChild('div', 'settings-line'); |
| 331 | headLine.createChild('div', 'settings-key-cell'); |
| 332 | headLine.createChild('div', 'settings-section-title settings-cell').textContent = this.name; |
Amanda Baker | 11630de | 2019-07-12 02:54:33 | [diff] [blame] | 333 | UI.ARIAUtils.markAsHeading(headLine, /* level */ 2); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 334 | |
| 335 | for (let i = 0; i < this._lines.length; ++i) { |
| 336 | const line = parent.createChild('div', 'settings-line'); |
| 337 | const keyCell = line.createChild('div', 'settings-key-cell'); |
| 338 | keyCell.appendChild(this._lines[i].key); |
| 339 | keyCell.appendChild(this._createSpan('settings-key-delimiter', ':')); |
| 340 | line.createChild('div', 'settings-cell').textContent = this._lines[i].text; |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} sequence |
| 346 | * @param {string} delimiter |
| 347 | * @return {!Node} |
| 348 | */ |
| 349 | _renderSequence(sequence, delimiter) { |
| 350 | const delimiterSpan = this._createSpan('settings-key-delimiter', delimiter); |
| 351 | return this._joinNodes(sequence.map(this._renderKey.bind(this)), delimiterSpan); |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * @param {!UI.KeyboardShortcut.Descriptor} key |
| 356 | * @return {!Node} |
| 357 | */ |
| 358 | _renderKey(key) { |
| 359 | const keyName = key.name; |
| 360 | const plus = this._createSpan('settings-combine-keys', '+'); |
| 361 | return this._joinNodes(keyName.split(' + ').map(this._createSpan.bind(this, 'settings-key')), plus); |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * @param {string} className |
| 366 | * @param {string} textContent |
| 367 | * @return {!Element} |
| 368 | */ |
| 369 | _createSpan(className, textContent) { |
| 370 | const node = createElement('span'); |
| 371 | node.className = className; |
| 372 | node.textContent = textContent; |
| 373 | return node; |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * @param {!Array.<!Element>} nodes |
| 378 | * @param {!Element} delimiter |
| 379 | * @return {!Node} |
| 380 | */ |
| 381 | _joinNodes(nodes, delimiter) { |
| 382 | const result = createDocumentFragment(); |
| 383 | for (let i = 0; i < nodes.length; ++i) { |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 384 | if (i > 0) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 385 | result.appendChild(delimiter.cloneNode(true)); |
Tim van der Lippe | 1d6e57a | 2019-09-30 11:55:34 | [diff] [blame] | 386 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 387 | result.appendChild(nodes[i]); |
| 388 | } |
| 389 | return result; |
| 390 | } |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 391 | } |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 392 | |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 393 | ShortcutsSection._sequenceNumber = 0; |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 394 | |
| 395 | |
Tim van der Lippe | c96ccd9 | 2019-11-29 16:23:54 | [diff] [blame] | 396 | const ElementsPanelShortcuts = { |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 397 | NavigateUp: [KeyboardShortcut.makeDescriptor(Keys.Up)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 398 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 399 | NavigateDown: [KeyboardShortcut.makeDescriptor(Keys.Down)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 400 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 401 | Expand: [KeyboardShortcut.makeDescriptor(Keys.Right)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 402 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 403 | Collapse: [KeyboardShortcut.makeDescriptor(Keys.Left)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 404 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 405 | EditAttribute: [KeyboardShortcut.makeDescriptor(Keys.Enter)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 406 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 407 | NextProperty: [KeyboardShortcut.makeDescriptor(Keys.Tab)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 408 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 409 | PreviousProperty: [KeyboardShortcut.makeDescriptor(Keys.Tab, Modifiers.Shift)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 410 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 411 | IncrementValue: [KeyboardShortcut.makeDescriptor(Keys.Up)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 412 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 413 | DecrementValue: [KeyboardShortcut.makeDescriptor(Keys.Down)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 414 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 415 | IncrementBy10: |
| 416 | [KeyboardShortcut.makeDescriptor(Keys.PageUp), KeyboardShortcut.makeDescriptor(Keys.Up, Modifiers.Shift)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 417 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 418 | DecrementBy10: |
| 419 | [KeyboardShortcut.makeDescriptor(Keys.PageDown), KeyboardShortcut.makeDescriptor(Keys.Down, Modifiers.Shift)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 420 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 421 | IncrementBy100: [KeyboardShortcut.makeDescriptor(Keys.PageUp, Modifiers.Shift)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 422 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 423 | DecrementBy100: [KeyboardShortcut.makeDescriptor(Keys.PageDown, Modifiers.Shift)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 424 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 425 | IncrementBy01: [KeyboardShortcut.makeDescriptor(Keys.Up, Modifiers.Alt)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 426 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 427 | DecrementBy01: [KeyboardShortcut.makeDescriptor(Keys.Down, Modifiers.Alt)] |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 428 | }; |
| 429 | |
Tim van der Lippe | c96ccd9 | 2019-11-29 16:23:54 | [diff] [blame] | 430 | const ConsolePanelShortcuts = { |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 431 | AcceptSuggestion: [KeyboardShortcut.makeDescriptor(Keys.Tab), KeyboardShortcut.makeDescriptor(Keys.Right)], |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 432 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 433 | ClearConsolePrompt: [KeyboardShortcut.makeDescriptor('u', Modifiers.Ctrl)], |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 434 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 435 | ExecuteCommand: KeyboardShortcut.makeDescriptor(Keys.Enter), |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 436 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 437 | NextPreviousLine: [KeyboardShortcut.makeDescriptor(Keys.Down), KeyboardShortcut.makeDescriptor(Keys.Up)], |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 438 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 439 | NextPreviousCommand: |
| 440 | [KeyboardShortcut.makeDescriptor('N', Modifiers.Alt), KeyboardShortcut.makeDescriptor('P', Modifiers.Alt)], |
Fabio Rocha | f0d9547 | 2019-05-28 21:35:19 | [diff] [blame] | 441 | }; |
| 442 | |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 443 | export const SourcesPanelShortcuts = { |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 444 | SelectNextOccurrence: [KeyboardShortcut.makeDescriptor('d', Modifiers.CtrlOrMeta)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 445 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 446 | SoftUndo: [KeyboardShortcut.makeDescriptor('u', Modifiers.CtrlOrMeta)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 447 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 448 | GotoMatchingBracket: [KeyboardShortcut.makeDescriptor('m', Modifiers.Ctrl)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 449 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 450 | ToggleAutocompletion: [KeyboardShortcut.makeDescriptor(Keys.Space, Modifiers.Ctrl)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 451 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 452 | IncreaseCSSUnitByOne: [KeyboardShortcut.makeDescriptor(Keys.Up, Modifiers.Alt)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 453 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 454 | DecreaseCSSUnitByOne: [KeyboardShortcut.makeDescriptor(Keys.Down, Modifiers.Alt)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 455 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 456 | IncreaseCSSUnitByTen: [KeyboardShortcut.makeDescriptor(Keys.PageUp, Modifiers.Alt)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 457 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 458 | DecreaseCSSUnitByTen: [KeyboardShortcut.makeDescriptor(Keys.PageDown, Modifiers.Alt)], |
| 459 | EvaluateSelectionInConsole: [KeyboardShortcut.makeDescriptor('e', Modifiers.Shift | Modifiers.Ctrl)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 460 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 461 | AddSelectionToWatch: [KeyboardShortcut.makeDescriptor('a', Modifiers.Shift | Modifiers.Ctrl)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 462 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 463 | ToggleComment: [KeyboardShortcut.makeDescriptor(Keys.Slash, Modifiers.CtrlOrMeta)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 464 | }; |
| 465 | |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 466 | export const LayersPanelShortcuts = { |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 467 | ResetView: [KeyboardShortcut.makeDescriptor('0')], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 468 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 469 | PanMode: [KeyboardShortcut.makeDescriptor('x')], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 470 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 471 | RotateMode: [KeyboardShortcut.makeDescriptor('v')], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 472 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 473 | TogglePanRotate: [KeyboardShortcut.makeDescriptor(Keys.Shift)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 474 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 475 | ZoomIn: |
| 476 | [KeyboardShortcut.makeDescriptor(Keys.Plus, Modifiers.Shift), KeyboardShortcut.makeDescriptor(Keys.NumpadPlus)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 477 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 478 | ZoomOut: |
| 479 | [KeyboardShortcut.makeDescriptor(Keys.Minus, Modifiers.Shift), KeyboardShortcut.makeDescriptor(Keys.NumpadMinus)], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 480 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 481 | Up: [KeyboardShortcut.makeDescriptor(Keys.Up), KeyboardShortcut.makeDescriptor('w')], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 482 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 483 | Down: [KeyboardShortcut.makeDescriptor(Keys.Down), KeyboardShortcut.makeDescriptor('s')], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 484 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 485 | Left: [KeyboardShortcut.makeDescriptor(Keys.Left), KeyboardShortcut.makeDescriptor('a')], |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 486 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 487 | Right: [KeyboardShortcut.makeDescriptor(Keys.Right), KeyboardShortcut.makeDescriptor('d')] |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 488 | }; |