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