feature: Added remove last emoji ability

This commit is contained in:
Gerard Gascón 2024-01-27 00:26:33 +01:00
parent df2fa8aed8
commit c010ef24a4
4 changed files with 316 additions and 0 deletions

View file

@ -1,3 +1,4 @@
using System.Text.RegularExpressions;
using TMPro;
using UnityEngine;
@ -12,5 +13,12 @@ namespace Messaging.Composer {
public void WriteEmoji(string emoji) {
fieldText.text += emoji;
}
private readonly Regex _removeRegex = new(@"<([a-z]+)(?![^>]*\/>)[^>]*>(?!.*<([a-z]+)(?![^>]*\/>)[^>]*>)");
public void RemoveEmoji() {
string newText = _removeRegex.Replace(fieldText.text, "");
fieldText.SetText(newText);
}
}
}