From 1b05bb9afe6642649560cde68f73ef4f73759905 Mon Sep 17 00:00:00 2001
From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com>
Date: Mon, 6 Jan 2025 17:38:24 +0800
Subject: [PATCH] fix(emoji):
https://github.com/siyuan-note/siyuan/issues/13509 (#13585)
* fix(emoji): https://github.com/siyuan-note/siyuan/issues/13509
* fix(emoji): https://github.com/siyuan-note/siyuan/issues/13509
* fix(emoji): https://github.com/siyuan-note/siyuan/issues/13509
* fix(emoji): https://github.com/siyuan-note/siyuan/issues/13509
---
app/src/emoji/index.ts | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts
index df2ac1685..700d75a7f 100644
--- a/app/src/emoji/index.ts
+++ b/app/src/emoji/index.ts
@@ -524,15 +524,28 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi
if (target.classList.contains("emojis__type")) {
const titleElement = emojisContentElement.querySelector(`[data-type="${target.getAttribute("data-type")}"]`) as HTMLElement;
if (titleElement) {
- const index = titleElement.nextElementSibling.getAttribute("data-index");
+ const previousElement = titleElement.previousElementSibling as HTMLElement;
+ const previousIndex = previousElement?.getAttribute("data-index");
+ const nextElement = titleElement.nextElementSibling as HTMLElement;
+ const index = nextElement?.getAttribute("data-index");
+
+ if (previousIndex) {
+ let html = "";
+ window.siyuan.emojis[parseInt(previousIndex)].items.forEach(emoji => {
+ html += ``;
+ });
+ previousElement.innerHTML = html;
+ previousElement.removeAttribute("data-index");
+ previousElement.style.minHeight = "";
+ }
if (index) {
let html = "";
window.siyuan.emojis[parseInt(index)].items.forEach(emoji => {
- html += ``;
+ html += ``;
});
- titleElement.nextElementSibling.innerHTML = html;
- titleElement.nextElementSibling.removeAttribute("data-index");
+ nextElement.innerHTML = html;
+ nextElement.removeAttribute("data-index");
+ nextElement.style.minHeight = "";
}
emojisContentElement.scrollTo({