From 2bb97c20a044faa9b713e8e587e0da7890c52a6c Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 12 Apr 2019 21:47:57 +0200 Subject: [PATCH] -moved shortcuts handler -added tooltips for shortcuts --- src/app.js | 13 ------------- src/app/components/plugin-manager-component.js | 2 +- src/app/components/vertical-icons-component.js | 10 +++++++--- src/framingService.js | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/app.js b/src/app.js index ec9d30a6dc..e4ef25e021 100644 --- a/src/app.js +++ b/src/app.js @@ -454,19 +454,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org } }, 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 loadFilesCallback = function (files) { self.loadFiles(files) diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 59ddddf18a..2213eceb3b 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -40,7 +40,7 @@ const profile = { methods: [], events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', - description: 'start/stop services, modules and plugins', + description: 'Start/stop services, modules and plugins', kind: 'settings', location: 'swapPanel' } diff --git a/src/app/components/vertical-icons-component.js b/src/app/components/vertical-icons-component.js index 6305dd844a..ed5cffb4f7 100644 --- a/src/app/components/vertical-icons-component.js +++ b/src/app/components/vertical-icons-component.js @@ -57,9 +57,13 @@ class VerticalIconComponent { * Add an icon to the map * @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` -
+
${name}
` this.iconKind[kind || 'other'].appendChild(this.icons[name]) @@ -219,7 +223,7 @@ const css = csjs` height: 28px; padding: 4px; } - .icon[title='Settings'] { + .icon[title='Settings (Ctrl+Shift+S)'] { position: absolute; bottom: 0; } diff --git a/src/framingService.js b/src/framingService.js index 0021b15ae1..48ba58beb3 100644 --- a/src/framingService.js +++ b/src/framingService.js @@ -13,5 +13,19 @@ export default { verticalIconApi.select('fileExplorers') 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() + } + }) } }