[frontend/components] Don't get emojis until opening emoji picker
This commit is contained in:
parent
1c7f2832a1
commit
ac47bafffd
4 changed files with 13 additions and 9 deletions
|
@ -512,9 +512,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
private void ToggleEmojiPicker()
|
||||
private async Task ToggleEmojiPicker()
|
||||
{
|
||||
GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback<EmojiResponse>(this, AddEmoji));
|
||||
await GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback<EmojiResponse>(this, AddEmoji))!;
|
||||
}
|
||||
|
||||
private async Task AddQuote() =>
|
||||
|
|
|
@ -44,10 +44,8 @@
|
|||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
GlobalComponentSvc.EmojiPicker = this;
|
||||
EmojiList = await EmojiService.GetEmojiAsync();
|
||||
_module = (IJSInProcessObjectReference)await Js.InvokeAsync<IJSObjectReference>("import",
|
||||
"./Components/EmojiPicker.razor.js");
|
||||
FilterEmojis();
|
||||
}
|
||||
|
||||
private async Task Select(EmojiResponse emoji)
|
||||
|
@ -61,8 +59,14 @@
|
|||
_module.InvokeVoid("closeDialog", EmojiPickerRef);
|
||||
}
|
||||
|
||||
public void Open(ElementReference root, EventCallback<EmojiResponse> func)
|
||||
public async Task Open(ElementReference root, EventCallback<EmojiResponse> func)
|
||||
{
|
||||
if (EmojiList.Count == 0)
|
||||
{
|
||||
EmojiList = await EmojiService.GetEmojiAsync();
|
||||
FilterEmojis();
|
||||
}
|
||||
|
||||
OnEmojiSelect = func;
|
||||
var pos = _module.Invoke<List<float>>("getPosition", root);
|
||||
_left = pos[0];
|
||||
|
|
|
@ -193,9 +193,9 @@
|
|||
NoteActions.DoQuote(Note);
|
||||
}
|
||||
|
||||
private void ToggleEmojiPicker()
|
||||
private async Task ToggleEmojiPicker()
|
||||
{
|
||||
GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback<EmojiResponse>(this, React));
|
||||
await GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback<EmojiResponse>(this, React))!;
|
||||
}
|
||||
|
||||
private void React(EmojiResponse emoji)
|
||||
|
|
|
@ -312,9 +312,9 @@
|
|||
UserProfile.BannerAlt = "";
|
||||
}
|
||||
|
||||
private void ToggleEmojiPicker()
|
||||
private async Task ToggleEmojiPicker()
|
||||
{
|
||||
GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback<EmojiResponse>(this, AddEmoji));
|
||||
await GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback<EmojiResponse>(this, AddEmoji))!;
|
||||
}
|
||||
|
||||
private async Task AddEmoji(EmojiResponse emoji)
|
||||
|
|
Loading…
Add table
Reference in a new issue