diff --git a/Source/Lib/Luthetus.Ide.ClassLib/Context/ContextFacts.cs b/Source/Lib/Luthetus.Ide.ClassLib/Context/ContextFacts.cs index 3b73a38ec..70d57446e 100644 --- a/Source/Lib/Luthetus.Ide.ClassLib/Context/ContextFacts.cs +++ b/Source/Lib/Luthetus.Ide.ClassLib/Context/ContextFacts.cs @@ -10,6 +10,12 @@ public static class ContextFacts "Global", "global", Keymap.Empty); + + public static readonly ContextRecord ActiveContextsContext = new( + ContextKey.NewContextKey(), + "Active Contexts", + "active-contexts", + Keymap.Empty); public static readonly ContextRecord FolderExplorerContext = new( ContextKey.NewContextKey(), @@ -86,6 +92,7 @@ public static class ContextFacts public static readonly ImmutableArray ContextRecords = new[] { GlobalContext, + ActiveContextsContext, FolderExplorerContext, SolutionExplorerContext, CompilerServiceExplorerContext, diff --git a/Source/Lib/Luthetus.Ide.RazorLib/ContextCase/ActiveContextsDisplay.razor b/Source/Lib/Luthetus.Ide.RazorLib/ContextCase/ActiveContextsDisplay.razor index fb1532283..25f99805c 100644 --- a/Source/Lib/Luthetus.Ide.RazorLib/ContextCase/ActiveContextsDisplay.razor +++ b/Source/Lib/Luthetus.Ide.RazorLib/ContextCase/ActiveContextsDisplay.razor @@ -3,7 +3,7 @@ @inherits FluxorComponent - diff --git a/Source/Lib/Luthetus.Ide.RazorLib/LuthetusIdeInitializer.razor.cs b/Source/Lib/Luthetus.Ide.RazorLib/LuthetusIdeInitializer.razor.cs index 06662c5ee..964c110b2 100644 --- a/Source/Lib/Luthetus.Ide.RazorLib/LuthetusIdeInitializer.razor.cs +++ b/Source/Lib/Luthetus.Ide.RazorLib/LuthetusIdeInitializer.razor.cs @@ -290,7 +290,8 @@ private async Task InitializeCompilerServiceExplorerStateAsync() /// private void InitializeGlobalContext() { - var keymapArgument = new KeymapArgument( + { + var keymapArgument = new KeymapArgument( "KeyZ", null, false, @@ -300,26 +301,59 @@ private void InitializeGlobalContext() false, false); - // The generic type here is because I'm using closure for everything in this specific case. - var command = new Command( - async () => - { - var success = await JsRuntime.InvokeAsync( - "luthetusIde.tryFocusHtmlElementById", - ContextFacts.GlobalContext.ContextElementId); - - if (success) + var command = new Command( + async () => { - // TODO: Add a 'reveal' Func to perhaps set an active panel tab if needed, - // then invoke javascript one last time to try again. - } - }, - "Focus Context Element", - "focus-context-element", + var success = await JsRuntime.InvokeAsync( + "luthetusIde.tryFocusHtmlElementById", + ContextFacts.GlobalContext.ContextElementId); + + if (success) + { + // TODO: Add a 'reveal' Func to perhaps set an active panel tab if needed, + // then invoke javascript one last time to try again. + } + }, + "Focus Context Element", + "focus-context-element", + false); + + ContextFacts.GlobalContext.Keymap.Map.Add( + keymapArgument, + command); + } + + { + var keymapArgument = new KeymapArgument( + "KeyX", + null, + false, + false, + true, + true, + false, false); - ContextFacts.GlobalContext.Keymap.Map.Add( - keymapArgument, - command); + var command = new Command( + async () => + { + var success = await JsRuntime.InvokeAsync( + "luthetusIde.tryFocusHtmlElementById", + ContextFacts.ActiveContextsContext.ContextElementId); + + if (success) + { + // TODO: Add a 'reveal' Func to perhaps set an active panel tab if needed, + // then invoke javascript one last time to try again. + } + }, + "Focus Context Element", + "focus-context-element", + false); + + ContextFacts.GlobalContext.Keymap.Map.Add( + keymapArgument, + command); + } } } \ No newline at end of file