🎨 新增 data-tooltipclass 属性用于自定义 tooltip 的额外类名
This commit is contained in:
parent
2ff40bd339
commit
337a5bf430
2 changed files with 6 additions and 8 deletions
|
@ -21,19 +21,16 @@ export const initBlockPopover = (app: App) => {
|
|||
}
|
||||
const aElement = hasClosestByAttribute(event.target, "data-type", "a", true) ||
|
||||
hasClosestByClassName(event.target, "ariaLabel") ||
|
||||
hasClosestByAttribute(event.target, "data-type", "tab-header") ||
|
||||
hasClosestByAttribute(event.target, "data-type", "inline-memo") ||
|
||||
hasClosestByClassName(event.target, "av__calc--ashow") ||
|
||||
hasClosestByClassName(event.target, "av__cell");
|
||||
if (aElement) {
|
||||
const tooltipClasses: string[] = [];
|
||||
let tip = aElement.getAttribute("aria-label");
|
||||
if (aElement.classList.contains("has-tooltip--warning")) {
|
||||
tooltipClasses.push("error");
|
||||
let tip = aElement.getAttribute("aria-label") || "";
|
||||
if (aElement.hasAttribute("data-tooltipclass")) {
|
||||
tooltipClasses.push(...aElement.getAttribute("data-tooltipclass").split(" "));
|
||||
}
|
||||
if (aElement.getAttribute("data-type") === "tab-header") {
|
||||
tooltipClasses.push("tab_header");
|
||||
} else if (aElement.classList.contains("av__cell")) {
|
||||
if (aElement.classList.contains("av__cell")) {
|
||||
if (aElement.classList.contains("av__cell--header")) {
|
||||
const textElement = aElement.querySelector(".av__celltext");
|
||||
const desc = aElement.getAttribute("data-desc");
|
||||
|
|
|
@ -36,7 +36,8 @@ export class Tab {
|
|||
this.headElement.setAttribute("data-type", "tab-header");
|
||||
this.headElement.setAttribute("draggable", "true");
|
||||
this.headElement.setAttribute("data-id", this.id);
|
||||
this.headElement.classList.add("item", "item--focus");
|
||||
this.headElement.setAttribute("data-tooltipclass", "tab_header");
|
||||
this.headElement.classList.add("item", "item--focus", "ariaLabel");
|
||||
let iconHTML = "";
|
||||
if (options.icon) {
|
||||
iconHTML = `<svg class="item__graphic"><use xlink:href="#${options.icon}"></use></svg>`;
|
||||
|
|
Loading…
Add table
Reference in a new issue