focus the shortcut webview in vscode
This commit is contained in:
@@ -139,7 +139,9 @@
|
||||
// TODO restore focus to previous frame first
|
||||
(_runCommand command inputText)))}
|
||||
{(warningMessage "$key is not mapped to a shortcut in this context")(return)}))))
|
||||
(set shortcutPanel.webview.html (shortcutPanelHtml prefixMap))))
|
||||
(set shortcutPanel.webview.html (shortcutPanelHtml prefixMap))
|
||||
(infoMessage "posting message")
|
||||
(shortcutPanel.webview.postMessage (object command "focus"))))
|
||||
|
||||
(function shortcutPanelHtml [:Map<String,ShortcutKey> prefixMap]
|
||||
(let [shortcutParagraphs
|
||||
@@ -160,6 +162,15 @@
|
||||
$(shortcutParagraphs.join "")
|
||||
<script>
|
||||
const vscode = acquireVsCodeApi();
|
||||
window.addEventListener('message', function(event) {
|
||||
var message = event.data;
|
||||
|
||||
switch (message.command) {
|
||||
case 'focus':
|
||||
window.focus();
|
||||
break;
|
||||
}
|
||||
});
|
||||
window.addEventListener('keydown', function (e) {
|
||||
vscode.postMessage(e.key);
|
||||
});
|
||||
|
Reference in New Issue
Block a user