mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-14 11:14:21 +01:00
This commit is contained in:
parent
7f21a05d84
commit
0f8e2969ee
4 changed files with 33 additions and 36 deletions
|
|
@ -15,8 +15,8 @@ export const initBlockPopover = (app: App) => {
|
|||
return;
|
||||
}
|
||||
const aElement = hasClosestByAttribute(event.target, "data-type", "a", true) ||
|
||||
hasClosestByAttribute(event.target, "data-type", "url") ||
|
||||
hasClosestByAttribute(event.target, "data-type", "tab-header") ||
|
||||
hasClosestByClassName(event.target, "av__celltext") ||
|
||||
hasClosestByClassName(event.target, "ariaLabel") ||
|
||||
hasClosestByAttribute(event.target, "data-type", "inline-memo");
|
||||
if (aElement) {
|
||||
|
|
@ -25,6 +25,9 @@ export const initBlockPopover = (app: App) => {
|
|||
if (hasClosestByAttribute(event.target, "data-type", "fold", true)) {
|
||||
tip = window.siyuan.languages.fold;
|
||||
}
|
||||
if (aElement.classList.contains("av__celltext") && aElement.scrollWidth > aElement.parentElement.clientWidth - 11) {
|
||||
tip = aElement.textContent;
|
||||
}
|
||||
if (!tip) {
|
||||
tip = aElement.getAttribute("data-href");
|
||||
const title = aElement.getAttribute("data-title");
|
||||
|
|
@ -159,8 +162,9 @@ const getTarget = (event: MouseEvent & { target: HTMLElement }, aElement: false
|
|||
if (!popoverTargetElement) {
|
||||
popoverTargetElement = hasClosestByClassName(event.target, "popover__block") as HTMLElement;
|
||||
}
|
||||
if (!popoverTargetElement && aElement && aElement.getAttribute("data-href")?.startsWith("siyuan://blocks") &&
|
||||
aElement.getAttribute("prevent-popover") !== "true") {
|
||||
if (!popoverTargetElement && aElement && (
|
||||
(aElement.getAttribute("data-href")?.startsWith("siyuan://blocks") && aElement.getAttribute("prevent-popover") !== "true") ||
|
||||
(aElement.classList.contains("av__celltext") && aElement.dataset.type === "url"))) {
|
||||
popoverTargetElement = aElement;
|
||||
}
|
||||
if (!popoverTargetElement || window.siyuan.altIsPressed ||
|
||||
|
|
@ -208,11 +212,12 @@ export const showPopover = async (app: App, showRef = false) => {
|
|||
});
|
||||
ids = postResponse.data;
|
||||
}
|
||||
} else if (
|
||||
popoverTargetElement.getAttribute("data-type")?.split(" ").includes("a") ||
|
||||
popoverTargetElement.getAttribute("data-type")?.split(" ").includes("url")) {
|
||||
} else if (popoverTargetElement.getAttribute("data-type")?.split(" ").includes("a")) {
|
||||
// 以思源协议开头的链接
|
||||
ids = [getIdFromSYProtocol(popoverTargetElement.getAttribute("data-href"))];
|
||||
} else if (popoverTargetElement.dataset.type === "url") {
|
||||
// 在 database 的 url 列中以思源协议开头的链接
|
||||
ids = [getIdFromSYProtocol(popoverTargetElement.textContent.trim())];
|
||||
} else {
|
||||
// pdf
|
||||
let targetId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue