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