fixed some app bar buttons
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:accounts="using:Wino.Core.Domain.Models.Accounts"
|
||||
xmlns:controls="using:Wino.Controls"
|
||||
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -52,45 +54,67 @@
|
||||
DefaultLabelPosition="Collapsed"
|
||||
IsOpen="False">
|
||||
<AppBarButton
|
||||
Width="48"
|
||||
Click="InvertComposerThemeClicked"
|
||||
LabelPosition="Collapsed"
|
||||
Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay}">
|
||||
<AppBarButton.Icon>
|
||||
<controls:WinoFontIcon Icon="DarkEditor" />
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
|
||||
<AppBarButton
|
||||
Width="48"
|
||||
Click="InvertComposerThemeClicked"
|
||||
LabelPosition="Collapsed"
|
||||
Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay, Converter={StaticResource ReverseBooleanToVisibilityConverter}}">
|
||||
<AppBarButton.Icon>
|
||||
<controls:WinoFontIcon Icon="LightEditor" />
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
|
||||
<AppBarSeparator />
|
||||
|
||||
<AppBarToggleButton
|
||||
x:Name="BoldButton"
|
||||
Width="48"
|
||||
Click="BoldButtonClicked"
|
||||
Label="Bold"
|
||||
ToolTipService.ToolTip="Bold">
|
||||
<AppBarButton.Icon>
|
||||
<AppBarToggleButton.Icon>
|
||||
<PathIcon Data="{StaticResource BoldPathIcon}" />
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
<AppBarButton
|
||||
</AppBarToggleButton.Icon>
|
||||
</AppBarToggleButton>
|
||||
<AppBarToggleButton
|
||||
x:Name="ItalicButton"
|
||||
Width="48"
|
||||
Click="ItalicButtonClicked"
|
||||
Label="Italic"
|
||||
ToolTipService.ToolTip="Italic">
|
||||
<AppBarButton.Icon>
|
||||
<AppBarToggleButton.Icon>
|
||||
<PathIcon Data="{StaticResource ItalicPathIcon}" />
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
<AppBarButton
|
||||
</AppBarToggleButton.Icon>
|
||||
</AppBarToggleButton>
|
||||
<AppBarToggleButton
|
||||
x:Name="UnderlineButton"
|
||||
Width="48"
|
||||
Click="UnderlineButtonClicked"
|
||||
Label="Underline"
|
||||
ToolTipService.ToolTip="Underline">
|
||||
<AppBarButton.Icon>
|
||||
<AppBarToggleButton.Icon>
|
||||
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
<AppBarButton
|
||||
</AppBarToggleButton.Icon>
|
||||
</AppBarToggleButton>
|
||||
<AppBarToggleButton
|
||||
x:Name="StrokeButton"
|
||||
Width="48"
|
||||
Click="StrokeButtonClicked"
|
||||
Label="Stroke"
|
||||
ToolTipService.ToolTip="Stroke">
|
||||
<AppBarButton.Icon>
|
||||
<AppBarToggleButton.Icon>
|
||||
<PathIcon Data="{StaticResource StrikePathIcon}" />
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
</AppBarToggleButton.Icon>
|
||||
</AppBarToggleButton>
|
||||
<AppBarSeparator />
|
||||
<AppBarToggleButton
|
||||
x:Name="BulletListButton"
|
||||
@@ -187,7 +211,7 @@
|
||||
x:Name="AddImageButton"
|
||||
Width="48"
|
||||
Click="AddImageClicked"
|
||||
ToolTipService.ToolTip="Add Image">
|
||||
ToolTipService.ToolTip="{x:Bind domain:Translator.Photos}">
|
||||
<AppBarButton.Icon>
|
||||
<PathIcon Data="{StaticResource AddPhotoPathIcon}" />
|
||||
</AppBarButton.Icon>
|
||||
@@ -204,15 +228,7 @@
|
||||
x:Name="EmojiButton"
|
||||
Width="48"
|
||||
Click="EmojiButtonClicked"
|
||||
ToolTipService.ToolTip="Add Emoji">
|
||||
<AppBarButton.Content>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Viewbox Width="16" VerticalAlignment="Center">
|
||||
<PathIcon Data="{StaticResource EmojiPathIcon}" />
|
||||
</Viewbox>
|
||||
<TextBlock Text="{x:Bind domain:Translator.Emoji}" />
|
||||
</StackPanel>
|
||||
</AppBarButton.Content>
|
||||
ToolTipService.ToolTip="{x:Bind domain:Translator.Emoji}">
|
||||
<AppBarButton.Icon>
|
||||
<PathIcon Data="{StaticResource EmojiPathIcon}" />
|
||||
</AppBarButton.Icon>
|
||||
@@ -222,7 +238,7 @@
|
||||
Width="48"
|
||||
Click="HyperlinkAddClicked"
|
||||
Label="Add Link"
|
||||
ToolTipService.ToolTip="Add Link">
|
||||
ToolTipService.ToolTip="{x:Bind domain:Translator.AddHyperlink}">
|
||||
<AppBarButton.Flyout>
|
||||
<Flyout x:Name="HyperlinkFlyout">
|
||||
<StackPanel Width="250" Spacing="6">
|
||||
@@ -240,26 +256,18 @@
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</AppBarButton.Flyout>
|
||||
<AppBarButton.Content>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Viewbox Width="16" VerticalAlignment="Center">
|
||||
<PathIcon Data="{StaticResource AddLinkPathIcon}" />
|
||||
</Viewbox>
|
||||
<TextBlock Text="Link" />
|
||||
</StackPanel>
|
||||
</AppBarButton.Content>
|
||||
<AppBarButton.Icon>
|
||||
<PathIcon Data="{StaticResource AddLinkPathIcon}" />
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
</CommandBar>
|
||||
<Grid Grid.Row="1" CornerRadius="10">
|
||||
<muxc:WebView2
|
||||
x:Name="Chromium"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="1" />
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Margin="0,6,0,0"
|
||||
CornerRadius="3">
|
||||
<Grid Background="White" Visibility="{x:Bind IsComposerDarkMode, Converter={StaticResource ReverseBooleanToVisibilityConverter}, Mode=OneWay}" />
|
||||
|
||||
<muxc:WebView2 x:Name="Chromium" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Wino.Dialogs
|
||||
InitializeComponent();
|
||||
|
||||
SignatureNameHeader = Translator.SignatureEditorDialog_SignatureName_TitleNew;
|
||||
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
|
||||
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,OverlayScrollbarWinStyle,OverlayScrollbarWinStyleAnimation");
|
||||
|
||||
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
|
||||
@@ -56,6 +57,7 @@ namespace Wino.Dialogs
|
||||
HtmlBody = signatureModel.HtmlBody
|
||||
};
|
||||
|
||||
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
|
||||
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,OverlayScrollbarWinStyle,OverlayScrollbarWinStyleAnimation");
|
||||
|
||||
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
|
||||
@@ -90,7 +92,7 @@ namespace Wino.Dialogs
|
||||
if (Chromium.CoreWebView2 != null)
|
||||
{
|
||||
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
|
||||
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageRecieved;
|
||||
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageReceived;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,32 +305,32 @@ namespace Wino.Dialogs
|
||||
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
|
||||
Chromium.CoreWebView2.DOMContentLoaded += DOMLoaded;
|
||||
|
||||
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageRecieved;
|
||||
Chromium.CoreWebView2.WebMessageReceived += ScriptMessageRecieved;
|
||||
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageReceived;
|
||||
Chromium.CoreWebView2.WebMessageReceived += ScriptMessageReceived;
|
||||
}
|
||||
|
||||
private static async void OnIsComposerDarkModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
//if (obj is ComposePage page)
|
||||
//{
|
||||
// await page.UpdateEditorThemeAsync();
|
||||
//}
|
||||
if (obj is SignatureEditorDialog dialog)
|
||||
{
|
||||
await dialog.UpdateEditorThemeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private void ScriptMessageRecieved(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args)
|
||||
private void ScriptMessageReceived(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args)
|
||||
{
|
||||
var change = JsonConvert.DeserializeObject<string>(args.WebMessageAsJson);
|
||||
|
||||
bool isEnabled = change.EndsWith("ql-active");
|
||||
|
||||
if (change.StartsWith("ql-bold"))
|
||||
BoldButton.IsFocusEngaged = isEnabled;
|
||||
BoldButton.IsChecked = isEnabled;
|
||||
else if (change.StartsWith("ql-italic"))
|
||||
ItalicButton.IsEnabled = isEnabled;
|
||||
ItalicButton.IsChecked = isEnabled;
|
||||
else if (change.StartsWith("ql-underline"))
|
||||
UnderlineButton.IsEnabled = isEnabled;
|
||||
UnderlineButton.IsChecked = isEnabled;
|
||||
else if (change.StartsWith("ql-strike"))
|
||||
StrokeButton.IsEnabled = isEnabled;
|
||||
StrokeButton.IsChecked = isEnabled;
|
||||
else if (change.StartsWith("orderedListButton"))
|
||||
OrderedListButton.IsChecked = isEnabled;
|
||||
else if (change.StartsWith("bulletListButton"))
|
||||
@@ -369,5 +371,10 @@ namespace Wino.Dialogs
|
||||
}
|
||||
|
||||
private void SignatureNameTextBoxTextChanged(object sender, TextChangedEventArgs e) => IsPrimaryButtonEnabled = !string.IsNullOrWhiteSpace(SignatureNameTextBox.Text);
|
||||
|
||||
private void InvertComposerThemeClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IsComposerDarkMode = !IsComposerDarkMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user