This commit is contained in:
Vanessa 2023-06-19 21:04:56 +08:00
parent 887443c321
commit 39f9aaca82
11 changed files with 45 additions and 46 deletions

View file

@ -580,18 +580,18 @@ export class Wnd {
Array.from(this.headersElement.children).forEach((item: HTMLElement) => {
const iconElement = item.querySelector(".item__icon");
const graphicElement = item.querySelector(".item__graphic");
let iconHTML = undefined
let iconHTML = undefined;
if (iconElement) {
if (iconElement.firstElementChild?.tagName === "IMG") {
// 图标为图片的文档
iconHTML = `<img src="${iconElement.firstElementChild.getAttribute("src")}" class="b3-menu__icon">`
iconHTML = `<img src="${iconElement.firstElementChild.getAttribute("src")}" class="b3-menu__icon">`;
} else {
// 有图标的文档
iconHTML = `<span class="b3-menu__icon">${iconElement.innerHTML}</span>`
iconHTML = `<span class="b3-menu__icon">${iconElement.innerHTML}</span>`;
}
} else if (!graphicElement) {
// 没有图标的文档
iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true)
iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true);
}
window.siyuan.menus.menu.append(new MenuItem({
label: escapeHtml(item.querySelector(".item__text").textContent),

View file

@ -106,12 +106,12 @@ export class Outline extends Model {
click: (element: HTMLElement) => {
const id = element.getAttribute("data-node-id");
if (this.isPreview) {
const headElement = document.getElementById(id)
const headElement = document.getElementById(id);
if (headElement) {
const tabElement = hasTopClosestByClassName(headElement, "protyle")
const tabElement = hasTopClosestByClassName(headElement, "protyle");
if (tabElement) {
const tab = getInstanceById(tabElement.getAttribute("data-id")) as Tab
tab.parent.switchTab(tab.headElement)
const tab = getInstanceById(tabElement.getAttribute("data-id")) as Tab;
tab.parent.switchTab(tab.headElement);
}
headElement.scrollIntoView();
} else {
@ -337,7 +337,7 @@ export class Outline extends Model {
if (this.isPreview) {
this.tree.element.querySelectorAll(".popover__block").forEach(item => {
item.classList.remove("popover__block");
})
});
}
if (currentId) {

View file

@ -17,7 +17,6 @@ import {Constants} from "../constants";
import {isBrowser, isWindow} from "../util/functions";
import {Menu} from "../plugin/Menu";
import {fetchPost} from "../util/fetch";
import {escapeAttr} from "../util/escape";
import {needSubscribe} from "../util/needSubscribe";
import * as dayjs from "dayjs";
@ -236,30 +235,30 @@ export const initBar = (app: App) => {
event.stopPropagation();
event.preventDefault();
fetchPost("/api/sync/getSyncInfo", {}, (response) => {
let html = ""
let html = "";
if (!window.siyuan.config.sync.enabled || (0 === window.siyuan.config.sync.provider && needSubscribe(""))) {
html = response.data.stat;
} else {
html = window.siyuan.languages._kernel[82].replace("%s", dayjs(response.data.synced).format("YYYY-MM-DD HH:mm")) + "<br>"
html = window.siyuan.languages._kernel[82].replace("%s", dayjs(response.data.synced).format("YYYY-MM-DD HH:mm")) + "<br>";
html += " " + response.data.stat;
if (response.data.kernels.length > 0) {
html += "<br>"
html += window.siyuan.languages.currentKernel + "<br>"
html += " " + response.data.kernel + "/" + window.siyuan.config.system.kernelVersion + " (" + window.siyuan.config.system.os + "/" + window.siyuan.config.system.name + ")<br>"
html += window.siyuan.languages.otherOnlineKernels + "<br>"
html += "<br>";
html += window.siyuan.languages.currentKernel + "<br>";
html += " " + response.data.kernel + "/" + window.siyuan.config.system.kernelVersion + " (" + window.siyuan.config.system.os + "/" + window.siyuan.config.system.name + ")<br>";
html += window.siyuan.languages.otherOnlineKernels + "<br>";
response.data.kernels.forEach((item: {
os: string;
ver: string;
hostname: string;
id: string;
}) => {
html += ` ${item.id}/${item.ver} (${item.os}/${item.hostname}) <br>`
})
html += ` ${item.id}/${item.ver} (${item.os}/${item.hostname}) <br>`;
});
}
}
barSyncElement.setAttribute("aria-label", html);
})
})
});
});
barSyncElement.setAttribute("aria-label", window.siyuan.config.sync.stat || (window.siyuan.languages.syncNow + " " + updateHotkeyTip(window.siyuan.config.keymap.general.syncNow.custom)));
};