mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 09:30:48 +08:00
🚨
This commit is contained in:
parent
2b3283f060
commit
a8e239574c
@ -201,7 +201,7 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi
|
|||||||
window.siyuan.menus.menu.removeScrollEvent();
|
window.siyuan.menus.menu.removeScrollEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
const dynamicURL = 'api/icon/getDynamicIcon?'
|
const dynamicURL = "api/icon/getDynamicIcon?";
|
||||||
const dialog = new Dialog({
|
const dialog = new Dialog({
|
||||||
disableAnimation: true,
|
disableAnimation: true,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
@ -555,35 +555,35 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
|
|||||||
} else {
|
} else {
|
||||||
avCB(unicode);
|
avCB(unicode);
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
} else if (target.getAttribute("data-type")?.startsWith("tab-")) {
|
} else if (target.getAttribute("data-type")?.startsWith("tab-")) {
|
||||||
dialogElement.querySelectorAll('.emojis__tabheader [data-type|="tab"]').forEach((item: HTMLElement) => {
|
dialogElement.querySelectorAll('.emojis__tabheader [data-type|="tab"]').forEach((item: HTMLElement) => {
|
||||||
if (item.dataset.type === target.dataset.type) {
|
if (item.dataset.type === target.dataset.type) {
|
||||||
item.classList.add("block__icon--active")
|
item.classList.add("block__icon--active");
|
||||||
} else {
|
} else {
|
||||||
item.classList.remove("block__icon--active")
|
item.classList.remove("block__icon--active");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
dialogElement.querySelectorAll('.emojis__tabbody > div').forEach((item: HTMLElement) => {
|
dialogElement.querySelectorAll(".emojis__tabbody > div").forEach((item: HTMLElement) => {
|
||||||
if (item.dataset.type === target.dataset.type) {
|
if (item.dataset.type === target.dataset.type) {
|
||||||
item.classList.remove("fn__none")
|
item.classList.remove("fn__none");
|
||||||
} else {
|
} else {
|
||||||
item.classList.add("fn__none")
|
item.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
window.siyuan.storage[Constants.LOCAL_EMOJIS].currentTab = target.dataset.type.replace("tab-", "");
|
window.siyuan.storage[Constants.LOCAL_EMOJIS].currentTab = target.dataset.type.replace("tab-", "");
|
||||||
setStorageVal(Constants.LOCAL_EMOJIS, window.siyuan.storage[Constants.LOCAL_EMOJIS]);
|
setStorageVal(Constants.LOCAL_EMOJIS, window.siyuan.storage[Constants.LOCAL_EMOJIS]);
|
||||||
break
|
break;
|
||||||
} else if (target.classList.contains("color__square")) {
|
} else if (target.classList.contains("color__square")) {
|
||||||
dynamicTextElements[0].value = target.getAttribute("style").replace("background-color:", "");
|
dynamicTextElements[0].value = target.getAttribute("style").replace("background-color:", "");
|
||||||
dynamicTextElements[0].style.backgroundColor = dynamicTextElements[0].value;
|
dynamicTextElements[0].style.backgroundColor = dynamicTextElements[0].value;
|
||||||
dynamicTextElements[0].dispatchEvent(new CustomEvent("input"))
|
dynamicTextElements[0].dispatchEvent(new CustomEvent("input"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
target = target.parentElement;
|
target = target.parentElement;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const dynamicLangElements: NodeListOf<HTMLSelectElement> = dialog.element.querySelectorAll('[data-type="tab-dynamic"] .b3-select')
|
const dynamicLangElements: NodeListOf<HTMLSelectElement> = dialog.element.querySelectorAll('[data-type="tab-dynamic"] .b3-select');
|
||||||
dynamicLangElements[0].addEventListener("change", () => {
|
dynamicLangElements[0].addEventListener("change", () => {
|
||||||
dialog.element.querySelectorAll(".fn__flex-wrap .emoji__dynamic-item").forEach(item => {
|
dialog.element.querySelectorAll(".fn__flex-wrap .emoji__dynamic-item").forEach(item => {
|
||||||
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
||||||
@ -593,32 +593,32 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
|
|||||||
url.delete("lang");
|
url.delete("lang");
|
||||||
}
|
}
|
||||||
item.setAttribute("src", dynamicURL + url.toString());
|
item.setAttribute("src", dynamicURL + url.toString());
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
dynamicLangElements[1].addEventListener("change", () => {
|
dynamicLangElements[1].addEventListener("change", () => {
|
||||||
dialog.element.querySelectorAll(".fn__flex-wrap .emoji__dynamic-item").forEach(item => {
|
dialog.element.querySelectorAll(".fn__flex-wrap .emoji__dynamic-item").forEach(item => {
|
||||||
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
||||||
url.set("weekdayType", dynamicLangElements[1].value);
|
url.set("weekdayType", dynamicLangElements[1].value);
|
||||||
item.setAttribute("src", dynamicURL + url.toString());
|
item.setAttribute("src", dynamicURL + url.toString());
|
||||||
})
|
|
||||||
});
|
});
|
||||||
const dynamicDateElement = dialog.element.querySelector('[data-type="tab-dynamic"] [type="date"]') as HTMLInputElement
|
});
|
||||||
|
const dynamicDateElement = dialog.element.querySelector('[data-type="tab-dynamic"] [type="date"]') as HTMLInputElement;
|
||||||
dynamicDateElement.addEventListener("change", () => {
|
dynamicDateElement.addEventListener("change", () => {
|
||||||
dialog.element.querySelectorAll(".fn__flex-wrap .emoji__dynamic-item").forEach(item => {
|
dialog.element.querySelectorAll(".fn__flex-wrap .emoji__dynamic-item").forEach(item => {
|
||||||
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
||||||
url.set("date", dynamicDateElement.value ? dayjs(dynamicDateElement.value).format("YYYY-MM-DD") : "");
|
url.set("date", dynamicDateElement.value ? dayjs(dynamicDateElement.value).format("YYYY-MM-DD") : "");
|
||||||
item.setAttribute("src", dynamicURL + url.toString());
|
item.setAttribute("src", dynamicURL + url.toString());
|
||||||
})
|
|
||||||
});
|
});
|
||||||
const dynamicTextElements: NodeListOf<HTMLInputElement> = dialog.element.querySelectorAll('[data-type="tab-dynamic"] [type="text"]')
|
});
|
||||||
const dynamicTextImgElement = dialog.element.querySelector('.emoji__dynamic-item[data-type="text"]')
|
const dynamicTextElements: NodeListOf<HTMLInputElement> = dialog.element.querySelectorAll('[data-type="tab-dynamic"] [type="text"]');
|
||||||
|
const dynamicTextImgElement = dialog.element.querySelector('.emoji__dynamic-item[data-type="text"]');
|
||||||
dynamicTextElements[0].addEventListener("input", () => {
|
dynamicTextElements[0].addEventListener("input", () => {
|
||||||
dialog.element.querySelectorAll(".emoji__dynamic-item").forEach(item => {
|
dialog.element.querySelectorAll(".emoji__dynamic-item").forEach(item => {
|
||||||
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
const url = new URLSearchParams(item.getAttribute("src").replace(dynamicURL, ""));
|
||||||
url.set("color", dynamicTextElements[0].value);
|
url.set("color", dynamicTextElements[0].value);
|
||||||
item.setAttribute("src", dynamicURL + url.toString());
|
item.setAttribute("src", dynamicURL + url.toString());
|
||||||
dynamicTextElements[0].style.backgroundColor = dynamicTextElements[0].value;
|
dynamicTextElements[0].style.backgroundColor = dynamicTextElements[0].value;
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
dynamicTextElements[1].addEventListener("input", () => {
|
dynamicTextElements[1].addEventListener("input", () => {
|
||||||
const url = new URLSearchParams(dynamicTextImgElement.getAttribute("src").replace(dynamicURL, ""));
|
const url = new URLSearchParams(dynamicTextImgElement.getAttribute("src").replace(dynamicURL, ""));
|
||||||
|
@ -4,7 +4,7 @@ import {Constants} from "../../../constants";
|
|||||||
import {addDragFill, renderCell} from "./cell";
|
import {addDragFill, renderCell} from "./cell";
|
||||||
import {unicode2Emoji} from "../../../emoji";
|
import {unicode2Emoji} from "../../../emoji";
|
||||||
import {focusBlock} from "../../util/selection";
|
import {focusBlock} from "../../util/selection";
|
||||||
import {hasClosestBlock, hasClosestByClassName, isInEmbedBlock} from "../../util/hasClosest";
|
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
|
||||||
import {stickyRow, updateHeader} from "./row";
|
import {stickyRow, updateHeader} from "./row";
|
||||||
import {getCalcValue} from "./calc";
|
import {getCalcValue} from "./calc";
|
||||||
import {renderAVAttribute} from "./blockAttr";
|
import {renderAVAttribute} from "./blockAttr";
|
||||||
|
@ -223,12 +223,12 @@ export const fontEvent = (protyle: IProtyle, nodeElements: Element[], type?: str
|
|||||||
e.style.textShadow = "";
|
e.style.textShadow = "";
|
||||||
e.style.backgroundColor = "";
|
e.style.backgroundColor = "";
|
||||||
e.style.fontSize = "";
|
e.style.fontSize = "";
|
||||||
e.style.removeProperty("--b3-parent-background")
|
e.style.removeProperty("--b3-parent-background");
|
||||||
} else if (type === "style1") {
|
} else if (type === "style1") {
|
||||||
const colorList = color.split(Constants.ZWSP);
|
const colorList = color.split(Constants.ZWSP);
|
||||||
e.style.backgroundColor = colorList[0];
|
e.style.backgroundColor = colorList[0];
|
||||||
e.style.color = colorList[1];
|
e.style.color = colorList[1];
|
||||||
e.style.setProperty('--b3-parent-background', colorList[0]);
|
e.style.setProperty("--b3-parent-background", colorList[0]);
|
||||||
} else if (type === "style2") {
|
} else if (type === "style2") {
|
||||||
e.style.webkitTextStroke = "0.2px var(--b3-theme-on-background)";
|
e.style.webkitTextStroke = "0.2px var(--b3-theme-on-background)";
|
||||||
e.style.webkitTextFillColor = "transparent";
|
e.style.webkitTextFillColor = "transparent";
|
||||||
@ -238,7 +238,7 @@ export const fontEvent = (protyle: IProtyle, nodeElements: Element[], type?: str
|
|||||||
e.style.color = color;
|
e.style.color = color;
|
||||||
} else if (type === "backgroundColor") {
|
} else if (type === "backgroundColor") {
|
||||||
e.style.backgroundColor = color;
|
e.style.backgroundColor = color;
|
||||||
e.style.setProperty('--b3-parent-background', color);
|
e.style.setProperty("--b3-parent-background", color);
|
||||||
} else if (type === "fontSize") {
|
} else if (type === "fontSize") {
|
||||||
e.style.fontSize = color;
|
e.style.fontSize = color;
|
||||||
}
|
}
|
||||||
|
@ -212,4 +212,4 @@ export const toolbarKeyToMenu = (toolbar: Array<string | IMenuItem>) => {
|
|||||||
toolbarResult.push(currentMenuItem);
|
toolbarResult.push(currentMenuItem);
|
||||||
});
|
});
|
||||||
return toolbarResult;
|
return toolbarResult;
|
||||||
}
|
};
|
||||||
|
@ -112,7 +112,7 @@ export const isHuawei = () => {
|
|||||||
|
|
||||||
export const isDisabledFeature = (feature: string): boolean => {
|
export const isDisabledFeature = (feature: string): boolean => {
|
||||||
return window.siyuan.config.system.disabledFeatures.indexOf(feature) > -1;
|
return window.siyuan.config.system.disabledFeatures.indexOf(feature) > -1;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const isIPhone = () => {
|
export const isIPhone = () => {
|
||||||
return navigator.userAgent.indexOf("iPhone") > -1;
|
return navigator.userAgent.indexOf("iPhone") > -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user