mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-11 15:12:33 +01:00
This commit is contained in:
parent
83c44cf25b
commit
e1914469a2
3 changed files with 26 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ import {App} from "../index";
|
|||
import {Constants} from "../constants";
|
||||
import {getCellText} from "../protyle/render/av/cell";
|
||||
import {isTouchDevice} from "../util/functions";
|
||||
import {escapeAriaLabel} from "../util/escape";
|
||||
|
||||
let popoverTargetElement: HTMLElement;
|
||||
let notebookItemElement: HTMLElement | false;
|
||||
|
|
@ -28,7 +29,17 @@ export const initBlockPopover = (app: App) => {
|
|||
let tooltipClass = "";
|
||||
let tip = aElement.getAttribute("aria-label");
|
||||
if (aElement.classList.contains("av__cell")) {
|
||||
if (!aElement.classList.contains("av__cell--header")) {
|
||||
if (aElement.classList.contains("av__cell--header")) {
|
||||
const textElement = aElement.querySelector(".av__celltext");
|
||||
const desc = aElement.getAttribute("data-desc")
|
||||
if (textElement.scrollWidth > textElement.clientWidth + 2 || desc) {
|
||||
if (desc) {
|
||||
tip = `${getCellText(aElement)}<div class='ft__on-surface'>${escapeAriaLabel(desc)}</div>`;
|
||||
} else {
|
||||
tip = getCellText(aElement);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (aElement.firstElementChild?.getAttribute("data-type") === "url") {
|
||||
if (aElement.firstElementChild.textContent.indexOf("...") > -1) {
|
||||
tip = Lute.EscapeHTMLStr(aElement.firstElementChild.getAttribute("data-href"));
|
||||
|
|
@ -43,6 +54,16 @@ export const initBlockPopover = (app: App) => {
|
|||
aElement.style.overflow = "";
|
||||
}
|
||||
}
|
||||
} else if (aElement.parentElement.parentElement.classList.contains("av__views")) {
|
||||
const textElement = aElement.querySelector(".item__text");
|
||||
const desc = aElement.getAttribute("data-desc")
|
||||
if (textElement.scrollWidth > textElement.clientWidth + 2 || desc) {
|
||||
if (desc) {
|
||||
tip = `${textElement.textContent}<div class='ft__on-surface'>${escapeAriaLabel(desc)}</div>`;
|
||||
} else {
|
||||
tip = textElement.textContent;
|
||||
}
|
||||
}
|
||||
} else if (aElement.classList.contains("av__celltext--url")) {
|
||||
tip = tip ? `<span style="word-break: break-all">${tip.substring(0, Constants.SIZE_TITLE)}</span><div class="fn__hr"></div>${aElement.getAttribute("data-name")}` : aElement.getAttribute("data-name");
|
||||
tooltipClass = "href";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue