🐛 sync tip 转义及支持点击
This commit is contained in:
parent
b2c0f3ea1f
commit
887443c321
4 changed files with 23 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
.tooltip {
|
||||
pointer-events: none;
|
||||
user-select: none; // 同步悬浮需要点击链接,因此不能使用 pointer-events: none;
|
||||
position: fixed;
|
||||
z-index: 1000000;
|
||||
padding: 4px 8px;
|
||||
|
@ -16,6 +16,14 @@
|
|||
animation-fill-mode: both;
|
||||
animation-name: zoomIn;
|
||||
|
||||
a {
|
||||
color: var(--b3-theme-secondary);
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
&--error {
|
||||
background: var(--b3-theme-error);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ export const initBlockPopover = (app: App) => {
|
|||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
} else if (!aElement) {
|
||||
} else if (!aElement && !hasClosestByAttribute(event.target, "id", "tooltip", true)) {
|
||||
hideTooltip();
|
||||
}
|
||||
if (window.siyuan.config.editor.floatWindowMode === 1 || window.siyuan.shiftIsPressed) {
|
||||
|
|
|
@ -26,13 +26,16 @@ export const showTooltip = (message: string, target: Element, error = false) =>
|
|||
messageElement.classList.add("tooltip--memo"); // 为行级备注添加 class https://github.com/siyuan-note/siyuan/issues/6161
|
||||
}
|
||||
let left = targetRect.left;
|
||||
let topSpace = 8
|
||||
const position = target.getAttribute("data-position");
|
||||
if (position === "right") {
|
||||
left = targetRect.right - messageElement.clientWidth;
|
||||
} else if (position === "center") {
|
||||
left = targetRect.left + (targetRect.width - messageElement.clientWidth) / 2;
|
||||
} else if (position === "top") {
|
||||
topSpace = 0;
|
||||
}
|
||||
setPosition(messageElement, left, targetRect.top + targetRect.height + 8, targetRect.height * 2 + 8);
|
||||
setPosition(messageElement, left, targetRect.top + targetRect.height + topSpace, targetRect.height * 2 + 8);
|
||||
};
|
||||
|
||||
export const hideTooltip = () => {
|
||||
|
|
|
@ -41,7 +41,7 @@ export const initBar = (app: App) => {
|
|||
<span class="toolbar__text">${getWorkspaceName()}</span>
|
||||
<svg class="toolbar__svg"><use xlink:href="#iconDown"></use></svg>
|
||||
</div>
|
||||
<div id="barSync" class="toolbar__item b3-tooltips b3-tooltips__se${window.siyuan.config.readonly ? " fn__none" : ""}" aria-label="${window.siyuan.config.sync.stat || (window.siyuan.languages.syncNow + " " + updateHotkeyTip(window.siyuan.config.keymap.general.syncNow.custom))}">
|
||||
<div id="barSync" data-position="top" data-type="a" class="toolbar__item${window.siyuan.config.readonly ? " fn__none" : ""}">
|
||||
<svg><use xlink:href="#iconCloudSucc"></use></svg>
|
||||
</div>
|
||||
<button id="barBack" data-menu="true" class="toolbar__item toolbar__item--disabled b3-tooltips b3-tooltips__se" aria-label="${window.siyuan.languages.goBack} ${updateHotkeyTip(window.siyuan.config.keymap.general.goBack.custom)}">
|
||||
|
@ -240,26 +240,27 @@ export const initBar = (app: App) => {
|
|||
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")) + "\n"
|
||||
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 += "\n"
|
||||
html += window.siyuan.languages.currentKernel + "\n"
|
||||
html += " " + response.data.kernel + "/" + window.siyuan.config.system.kernelVersion + " (" + window.siyuan.config.system.os + "/" + window.siyuan.config.system.name + ")\n"
|
||||
html += window.siyuan.languages.otherOnlineKernels + "\n"
|
||||
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}) \n`
|
||||
html += ` ${item.id}/${item.ver} (${item.os}/${item.hostname}) <br>`
|
||||
})
|
||||
}
|
||||
}
|
||||
barSyncElement.setAttribute("aria-label", escapeAttr(html));
|
||||
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)));
|
||||
};
|
||||
|
||||
export const setZoom = (type: "zoomIn" | "zoomOut" | "restore") => {
|
||||
|
|
Loading…
Add table
Reference in a new issue