Ability to set composer default font (#287)

* Added ability to set Composer font

* Added missing translations and refactoring

* Remove unused methods

* Small fixes
This commit is contained in:
Tiktack
2024-07-18 20:04:11 +02:00
committed by GitHub
parent 76375c9471
commit cf2f0ec936
30 changed files with 424 additions and 316 deletions

View File

@@ -59,7 +59,7 @@ namespace Wino.Views
InitializeComponent();
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,msOverlayScrollbarWinStyle,msOverlayScrollbarWinStyleAnimation");
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,msOverlayScrollbarWinStyle,msOverlayScrollbarWinStyleAnimation,FontAccess");
}
private static async void OnIsComposerDarkModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
@@ -389,6 +389,7 @@ namespace Wino.Views
await DOMLoadedTask.Task;
await UpdateEditorThemeAsync();
await InitializeEditorAsync();
if (string.IsNullOrEmpty(htmlBody))
{
@@ -400,6 +401,16 @@ namespace Wino.Views
}
}
private async Task<string> InitializeEditorAsync()
{
var fonts = ViewModel.FontService.GetFonts();
var composerFont = ViewModel.PreferencesService.ComposerFont;
int composerFontSize = ViewModel.PreferencesService.ComposerFontSize;
var readerFont = ViewModel.PreferencesService.ReaderFont;
int readerFontSize = ViewModel.PreferencesService.ReaderFontSize;
return await ExecuteScriptFunctionAsync("initializeJodit", fonts, composerFont, composerFontSize, readerFont, readerFontSize);
}
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
base.OnNavigatingFrom(e);