diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts
index cb1ebeffb..0d38a05a4 100644
--- a/app/src/emoji/index.ts
+++ b/app/src/emoji/index.ts
@@ -87,7 +87,7 @@ export const lazyLoadEmojiImg = (element: Element) => {
});
};
-export const filterEmoji = (key = "", max?: number) => {
+export const filterEmoji = (key = "", max?: number, hideCustom = false) => {
let html = "";
const recentEmojis: IEmojiItem[] = [];
if (key) {
@@ -97,6 +97,9 @@ export const filterEmoji = (key = "", max?: number) => {
let keyHTML = "";
const customStore: IEmojiItem[] = [];
window.siyuan.emojis.forEach((category, index) => {
+ if (hideCustom && category.id === "custom") {
+ return;
+ }
if (!key) {
html += `
${getEmojiTitle(index)}
1 ? ' data-index="' + index + '"' : ""}>`;
}
@@ -236,7 +239,11 @@ export const openEmojiPanel = (
type: "doc" | "notebook" | "av",
position: IPosition,
callback?: (emoji: string) => void,
- dynamicImgElement?: HTMLElement) => {
+ dynamicImgElement?: HTMLElement,
+ hide?: {
+ dynamic: boolean,
+ custom: boolean
+ }) => {
if (type !== "av") {
window.siyuan.menus.menu.remove();
} else {
@@ -275,7 +282,7 @@ export const openEmojiPanel = (
@@ -292,7 +299,7 @@ export const openEmojiPanel = (
- ${filterEmoji()}
+ ${filterEmoji("", null, hide?.custom)}
${[
["2b50", window.siyuan.languages.recentEmoji],
@@ -305,9 +312,12 @@ export const openEmojiPanel = (
["1f52e", getEmojiTitle(6)],
["267e-fe0f", getEmojiTitle(7)],
["1f6a9", getEmojiTitle(8)],
- ].map(([unicode, title], index) =>
- `
${unicode2Emoji(unicode)}
`
- ).join("")}
+ ].map(([unicode, title], index) => {
+ if (hide?.custom && index === 1) {
+ return "";
+ }
+ return `
${unicode2Emoji(unicode)}
`;
+ }).join("")}
@@ -392,7 +402,7 @@ export const openEmojiPanel = (
const emojiSearchInputElement = dialog.element.querySelector('[data-type="tab-emoji"] .b3-text-field') as HTMLInputElement;
const emojisContentElement = dialog.element.querySelector(".emojis__panel");
emojiSearchInputElement.addEventListener("compositionend", () => {
- emojisContentElement.innerHTML = filterEmoji(emojiSearchInputElement.value);
+ emojisContentElement.innerHTML = filterEmoji(emojiSearchInputElement.value, null, hide?.custom);
if (emojiSearchInputElement.value) {
emojisContentElement.nextElementSibling.classList.add("fn__none");
} else {
@@ -409,7 +419,7 @@ export const openEmojiPanel = (
if (event.isComposing) {
return;
}
- emojisContentElement.innerHTML = filterEmoji(emojiSearchInputElement.value);
+ emojisContentElement.innerHTML = filterEmoji(emojiSearchInputElement.value, null, hide?.custom);
if (emojiSearchInputElement.value) {
emojisContentElement.nextElementSibling.classList.add("fn__none");
} else {
diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.ts
index 6bfa208ab..e3d7b41b1 100644
--- a/app/src/plugin/API.ts
+++ b/app/src/plugin/API.ts
@@ -310,13 +310,15 @@ const openEmoji = (options: {
position: IPosition,
selectedCB?: (emoji: string) => void,
dynamicIconURL?: string
+ hideDynamicIcon?: boolean
+ hideCustomIcon?: boolean
}) => {
let dynamicImgElement: HTMLImageElement;
if (options.dynamicIconURL) {
dynamicImgElement = document.createElement("img");
dynamicImgElement.src = options.dynamicIconURL;
}
- openEmojiPanel("", "av", options.position, options.selectedCB, dynamicImgElement);
+ openEmojiPanel("", "av", options.position, options.selectedCB, dynamicImgElement, {dynamic: options.hideDynamicIcon, custom: options.hideCustomIcon});
};
export const API = {