feature: Added remove last emoji ability
This commit is contained in:
parent
df2fa8aed8
commit
c010ef24a4
4 changed files with 316 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
16
Assets/Scripts/Messaging/Composer/UndoButton.cs
Normal file
16
Assets/Scripts/Messaging/Composer/UndoButton.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Messaging.Composer {
|
||||
public class UndoButton : MonoBehaviour {
|
||||
private InputField _inputField;
|
||||
|
||||
private void Awake() {
|
||||
_inputField = FindObjectOfType<InputField>();
|
||||
}
|
||||
|
||||
public void UndoClick() {
|
||||
_inputField.RemoveEmoji();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Messaging/Composer/UndoButton.cs.meta
Normal file
11
Assets/Scripts/Messaging/Composer/UndoButton.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 680df1608b0d6b540972873124e33ad1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue