This commit is contained in:
Vanessa 2023-12-05 22:38:28 +08:00
parent 7604a0a930
commit f687828a6b
14 changed files with 50 additions and 32 deletions

View file

@ -445,11 +445,12 @@ ${response.data.replace("%pages", "<span class=totalPages></span>").replace("%pa
</div></div>`);
const pinElement = document.getElementById("pinWindow");
pinElement.addEventListener("click", () => {
pinElement.classList.toggle("toolbar__item--active");
if (pinElement.classList.contains("toolbar__item--active")) {
if (pinElement.getAttribute("aria-label") === window.siyuan.languages.pin) {
pinElement.querySelector("use").setAttribute("xlink:href", "#iconUnpin");
pinElement.setAttribute("aria-label", window.siyuan.languages.unpin);
ipcRenderer.send(Constants.SIYUAN_CMD, "setAlwaysOnTopTrue");
} else {
pinElement.querySelector("use").setAttribute("xlink:href", "#iconPin");
pinElement.setAttribute("aria-label", window.siyuan.languages.pin);
ipcRenderer.send(Constants.SIYUAN_CMD, "setAlwaysOnTopFalse");
}