Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

fix(emoji): https://github.com/siyuan-note/siyuan/issues/13509 (#13585)

Jeffrey Chen1b05bb9afe66
diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts
index df2ac16856..700d75a7f1 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 += `<button data-unicode="${emoji.unicode}" class="emojis__item ariaLabel" aria-label="${getEmojiDesc(emoji)}">${unicode2Emoji(emoji.unicode)}</button>`;
+ });
+ previousElement.innerHTML = html;
+ previousElement.removeAttribute("data-index");
+ previousElement.style.minHeight = "";
+ }
if (index) {
let html = "";
window.siyuan.emojis[parseInt(index)].items.forEach(emoji => {
- html += `<button data-unicode="${emoji.unicode}" class="emojis__item ariaLabel" aria-label="${getEmojiDesc(emoji)}">
-${unicode2Emoji(emoji.unicode)}</button>`;
+ html += `<button data-unicode="${emoji.unicode}" class="emojis__item ariaLabel" aria-label="${getEmojiDesc(emoji)}">${unicode2Emoji(emoji.unicode)}</button>`;
});
- titleElement.nextElementSibling.innerHTML = html;
- titleElement.nextElementSibling.removeAttribute("data-index");
+ nextElement.innerHTML = html;
+ nextElement.removeAttribute("data-index");
+ nextElement.style.minHeight = "";
}
emojisContentElement.scrollTo({