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