This commit is contained in:
Vanessa 2023-06-01 21:04:58 +08:00
parent 6806392b41
commit 51b4b26426
11 changed files with 7 additions and 43981 deletions

View file

@ -126,14 +126,6 @@ export const appearance = {
<svg><use xlink:href="#iconSettings"></use></svg>${window.siyuan.languages.config}
</button>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.appearance14}
<div class="b3-label__text">${window.siyuan.languages.appearance15}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="nativeEmoji" type="checkbox"${window.siyuan.config.appearance.nativeEmoji ? " checked" : ""}>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.appearance16}
@ -168,7 +160,6 @@ export const appearance = {
icons: window.siyuan.config.appearance.icons,
lang: (appearance.element.querySelector("#lang") as HTMLSelectElement).value,
closeButtonBehavior: (appearance.element.querySelector("#closeButtonBehavior") as HTMLInputElement).checked ? 1 : 0,
nativeEmoji: (appearance.element.querySelector("#nativeEmoji") as HTMLInputElement).checked,
hideStatusBar: (appearance.element.querySelector("#hideStatusBar") as HTMLInputElement).checked,
}, response => {
if (window.siyuan.config.appearance.themeJS) {
@ -242,7 +233,7 @@ export const appearance = {
});
},
onSetappearance(data: IAppearance) {
if (data.lang !== window.siyuan.config.appearance.lang || data.nativeEmoji !== window.siyuan.config.appearance.nativeEmoji) {
if (data.lang !== window.siyuan.config.appearance.lang) {
exportLayout({
reload: true,
onlyData: false,

View file

@ -47,11 +47,9 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
"export23", "export24"]),
// 外观
getLang(["language", "language1", "appearance", "appearance1", "appearance2",
"appearance3", "appearance4",
"appearance5", "appearance6", "appearance8", "appearance9", "appearance10", "appearance11",
"appearance14", "appearance15", "appearance16", "appearance17",
"resetLayout", "reset", "icon", "themeLight", "themeDark", "close", "themeOS", "theme",
getLang(["language", "language1", "appearance", "appearance1", "appearance2", "appearance3", "appearance4",
"appearance5", "appearance6", "appearance8", "appearance9", "appearance10", "appearance11", "appearance16",
"appearance17", "resetLayout", "reset", "icon", "themeLight", "themeDark", "close", "themeOS", "theme",
"theme2", "theme11", "theme12", "customEmoji", "customEmojiTip", "refresh"]),
// 集市

View file

@ -24,7 +24,7 @@ export const unicode2Emoji = (unicode: string, assic = false, className = "", ne
let emoji = "";
if (unicode.indexOf(".") > -1) {
emoji = `<img class="${className}" ${lazy ? "data-" : ""}src="/emojis/${unicode}"/>`;
} else if (isMobile() || window.siyuan.config.appearance.nativeEmoji || assic) {
} else {
try {
unicode.split("-").forEach(item => {
if (item.length < 5) {
@ -40,8 +40,6 @@ export const unicode2Emoji = (unicode: string, assic = false, className = "", ne
// 自定义表情搜索报错 https://github.com/siyuan-note/siyuan/issues/5883
// 这里忽略错误不做处理
}
} else {
emoji = `<svg class="${className || "custom-icon"}"><use xlink:href="#icon-${unicode}"></use></svg>`;
}
return emoji;
};

View file

@ -434,7 +434,6 @@ declare interface IWebSocketData {
declare interface IAppearance {
modeOS: boolean,
hideStatusBar: boolean,
nativeEmoji: boolean,
themeJS: boolean,
mode: number, // 1 暗黑0 明亮
icon: string,

View file

@ -105,7 +105,7 @@ export const loadAssets = (data: IAppearance) => {
while (svgElement.tagName === "svg") {
const currentSvgElement = svgElement;
svgElement = svgElement.nextElementSibling;
if (currentSvgElement.id !== "emojiScriptSvg" && !currentSvgElement.getAttribute("data-name")) {
if (!currentSvgElement.getAttribute("data-name")) {
currentSvgElement.remove();
}
}
@ -116,15 +116,8 @@ export const loadAssets = (data: IAppearance) => {
};
export const initAssets = () => {
const emojiElement = document.getElementById("emojiScript");
const loadingElement = document.getElementById("loading");
if (!emojiElement && !window.siyuan.config.appearance.nativeEmoji && !isMobile()) {
addScript("/appearance/emojis/twitter-emoji.js?v=1.0.1", "emojiScript").then(() => {
if (loadingElement) {
loadingElement.remove();
}
});
} else if (loadingElement) {
if (loadingElement) {
setTimeout(() => {
loadingElement.remove();
}, 160);