-moved shortcuts handler

-added tooltips for shortcuts
pull/1/head
LianaHus 6 years ago
parent 318a8be11f
commit 5bff0a140c
  1. 13
      src/app.js
  2. 2
      src/app/components/plugin-manager-component.js
  3. 10
      src/app/components/vertical-icons-component.js
  4. 14
      src/framingService.js

@ -454,19 +454,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
} }
}, false) }, false)
window.addEventListener('keypress', (e) => {
if (e.shiftKey && e.ctrlKey) {
if (e.code === 'KeyF') { // Ctrl+Shift+F
verticalIconsApi.select('fileExplorers')
} else if (e.code === 'KeyA') { // Ctrl+Shift+A
verticalIconsApi.select('pluginManager')
} else if (e.code === 'KeyS') { // Ctrl+Shift+S
verticalIconsApi.select('settings')
}
e.preventDefault()
}
})
// Replace early callback with instant response // Replace early callback with instant response
loadFilesCallback = function (files) { loadFilesCallback = function (files) {
self.loadFiles(files) self.loadFiles(files)

@ -40,7 +40,7 @@ const profile = {
methods: [], methods: [],
events: [], events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=',
description: 'start/stop services, modules and plugins', description: 'Start/stop services, modules and plugins',
kind: 'settings', kind: 'settings',
location: 'swapPanel' location: 'swapPanel'
} }

@ -57,9 +57,13 @@ class VerticalIconComponent {
* Add an icon to the map * Add an icon to the map
* @param {ModuleProfile} profile The profile of the module * @param {ModuleProfile} profile The profile of the module
*/ */
addIcon ({kind, name, icon, displayName}) { addIcon ({kind, name, icon, displayName, tooltip}) {
let title = (displayName || name) + " " + tooltip
this.icons[name] = yo` this.icons[name] = yo`
<div class="${css.icon}" onclick="${(e) => { this._iconClick(name) }}" plugin="${name}" title="${displayName}" > <div
class="${css.icon}"
onclick="${(e) => { this._iconClick(name) }}"
plugin="${name}" title="${title}" >
<img class="image" src="${icon}" alt="${name}" /> <img class="image" src="${icon}" alt="${name}" />
</div>` </div>`
this.iconKind[kind || 'other'].appendChild(this.icons[name]) this.iconKind[kind || 'other'].appendChild(this.icons[name])
@ -219,7 +223,7 @@ const css = csjs`
height: 28px; height: 28px;
padding: 4px; padding: 4px;
} }
.icon[title='Settings'] { .icon[title='Settings (Ctrl+Shift+S)'] {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
} }

@ -13,5 +13,19 @@ export default {
verticalIconApi.select('fileExplorers') verticalIconApi.select('fileExplorers')
mainPanelApi.showContent('home') mainPanelApi.showContent('home')
document.addEventListener('keypress', (e) => {
if (e.shiftKey && e.ctrlKey) {
if (e.code === 'KeyF') { // Ctrl+Shift+F
verticalIconApi.select('fileExplorers')
} else if (e.code === 'KeyA') { // Ctrl+Shift+A
verticalIconApi.select('pluginManager')
} else if (e.code === 'KeyS') { // Ctrl+Shift+S
verticalIconApi.select('settings')
}
e.preventDefault()
}
})
} }
} }

Loading…
Cancel
Save