Skip to content

Commit

Permalink
Merge pull request #372 from NeoCoderMatrix86/370-shortcuts-work-when…
Browse files Browse the repository at this point in the history
…-in-help

Shortcuts work when in help
  • Loading branch information
NeoCoderMatrix86 authored Jul 1, 2024
2 parents c0c3790 + e0a77ad commit ccf1d0e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
4 changes: 0 additions & 4 deletions AudioCuesheetEditor/AudioCuesheetEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,5 @@
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>

<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>

</Project>
34 changes: 27 additions & 7 deletions AudioCuesheetEditor/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ along with Foobar. If not, see
_traceChangeManager.UndoDone += TraceChangeManager_UndoDone;
_traceChangeManager.RedoDone += TraceChangeManager_RedoDone;
hotKeysContext = _hotKeys.CreateContext()
.Add(ModKey.Ctrl, Key.h, () => _navigationManager.NavigateTo("Help"))
.Add(ModKey.Ctrl, Key.e, OnStrgEKeyDown)
.Add(ModKey.Ctrl, Key.s, OnStrgSKeyDown)
.Add(ModKey.Ctrl, Key.h, OnCtrlHKeyDown)
.Add(ModKey.Ctrl, Key.e, OnCtrlEKeyDown)
.Add(ModKey.Ctrl, Key.s, OnCtrlSKeyDown)
.Add(Key.Enter, OnEnterKeyDown);

applicationOptions = await _localStorageOptionsProvider.GetOptions<ApplicationOptions>();
Expand Down Expand Up @@ -643,14 +643,26 @@ along with Foobar. If not, see
}
}

async ValueTask OnStrgEKeyDown()
ValueTask OnCtrlHKeyDown()
{
await OnDisplayExportProfilesClicked();
if (ShortCutsEnabled)
{
_navigationManager.NavigateTo("Help");
}
return ValueTask.CompletedTask;
}

async ValueTask OnStrgSKeyDown()
async ValueTask OnCtrlEKeyDown()
{
if (modalDownloadProjectfile != null)
if (ShortCutsEnabled)
{
await OnDisplayExportProfilesClicked();
}
}

async ValueTask OnCtrlSKeyDown()
{
if ((ShortCutsEnabled) && (modalDownloadProjectfile != null))
{
await modalDownloadProjectfile.Show();
}
Expand Down Expand Up @@ -885,4 +897,12 @@ along with Foobar. If not, see
}
return Task.CompletedTask;
}

Boolean ShortCutsEnabled
{
get
{
return !(_navigationManager.Uri.EndsWith("/help", StringComparison.InvariantCultureIgnoreCase)) && !(_navigationManager.Uri.EndsWith("/about", StringComparison.InvariantCultureIgnoreCase));
}
}
}

0 comments on commit ccf1d0e

Please sign in to comment.