src/vs/workbench/contrib/webview/browser/webview.contribution.ts/overrideCommandForWebview
function overrideCommandForWebview(command: MultiCommand | undefined, f: (webview: Webview) => void) {
	command?.addImplementation(PRIORITY, 'webview', accessor => {
		const webviewService = accessor.get(IWebviewService);
		const webview = webviewService.activeWebview;
		if (webview?.isFocused) {
			f(webview);
			return true;
		}

		const editorService = accessor.get(IEditorService);
		if (editorService.activeEditor instanceof WebviewInput) {
			f(editorService.activeEditor.webview);
			return true;
		}

		return false;
	});
}