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