Files
tbd-station-14/Content.Client/FlavorText/FlavorText.xaml.cs
dffdff2423 9f1d95e335 Fix Flavor Text editor not saving correctly (#28122)
* Check for flavor text equality in profile.

* Fix some characters being deleted from flavor text

Sometimes the last few characters of the flavor text would get deleted. This fixes this issue.
2024-05-19 02:23:44 +02:00

29 lines
864 B
C#

using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
namespace Content.Client.FlavorText
{
[GenerateTypedNameReferences]
public sealed partial class FlavorText : Control
{
public Action<string>? OnFlavorTextChanged;
public FlavorText()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
var loc = IoCManager.Resolve<ILocalizationManager>();
CFlavorTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder"));
CFlavorTextInput.OnTextChanged += _ => FlavorTextChanged();
}
public void FlavorTextChanged()
{
OnFlavorTextChanged?.Invoke(Rope.Collapse(CFlavorTextInput.TextRope).Trim());
}
}
}