Skip to content

Commit

Permalink
修复评论详情溢出文本未更新的问题 (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richasy authored Sep 19, 2024
1 parent f233324 commit 3cf7c5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
Visibility="Collapsed">
<ic:SymbolIcon FontSize="12" Symbol="MoreHorizontal" />
<Button.Flyout>
<Flyout>
<Flyout Opened="OnOverflowFlyoutOpened">
<RichTextBlock
x:Name="FlyoutRichBlock"
MaxWidth="360"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedE
{
instance.InitializeContent();
}

instance.FlyoutRichBlock?.Blocks?.Clear();
}

private void InitializeContent()
Expand Down Expand Up @@ -150,26 +152,6 @@ private void OnTextTrimChanged(RichTextBlock sender, IsTextTrimmedChangedEventAr
private void CheckTextTrim()
{
OverflowButton.Visibility = RichBlock.IsTextTrimmed ? Visibility.Visible : Visibility.Collapsed;
if (RichBlock.IsTextTrimmed)
{
if (FlyoutRichBlock.Blocks.Count > 0)
{
return;
}

var para = ParseText();
if (para != null)
{
FlyoutRichBlock.Blocks.Add(para);
}
}
else
{
if (FlyoutRichBlock.Blocks.Count > 0)
{
FlyoutRichBlock.Blocks.Clear();
}
}
}

private void OnImageTapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e)
Expand All @@ -180,4 +162,18 @@ private void OnImageTapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEv
new GalleryWindow(image, [.. Text.Pictures]).Activate();
}
}

private void OnOverflowFlyoutOpened(object sender, object e)
{
if (FlyoutRichBlock.Blocks.Count > 0)
{
return;
}

var para = ParseText();
if (para != null)
{
FlyoutRichBlock.Blocks.Add(para);
}
}
}

0 comments on commit 3cf7c5b

Please sign in to comment.