mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
♻️ wnd tab 下拉图标
This commit is contained in:
parent
a7e6164f0e
commit
7acdb158f2
7 changed files with 19 additions and 13 deletions
|
|
@ -35,6 +35,7 @@ import {hideAllElements} from "../protyle/ui/hideElements";
|
|||
import {focusByOffset, getSelectionOffset} from "../protyle/util/selection";
|
||||
import {Custom} from "./dock/Custom";
|
||||
import {App} from "../index";
|
||||
import {unicode2Emoji} from "../emoji";
|
||||
|
||||
export class Wnd {
|
||||
private app: App;
|
||||
|
|
@ -579,10 +580,23 @@ 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
|
||||
if (iconElement) {
|
||||
if (iconElement.firstElementChild?.tagName === "IMG") {
|
||||
// 图标为图片的文档
|
||||
iconHTML = `<img src="${iconElement.firstElementChild.getAttribute("src")}" class="b3-menu__icon">`
|
||||
} else {
|
||||
// 有图标的文档
|
||||
iconHTML = `<span class="b3-menu__icon">${iconElement.innerHTML}</span>`
|
||||
}
|
||||
} else if (!graphicElement) {
|
||||
// 没有图标的文档
|
||||
iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true)
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: escapeHtml(item.querySelector(".item__text").textContent),
|
||||
action: "iconCloseRound",
|
||||
iconHTML: iconElement ? `<span class="b3-menu__icon">${iconElement.innerHTML}</span>` : "",
|
||||
iconHTML,
|
||||
icon: graphicElement ? graphicElement.firstElementChild.getAttribute("xlink:href").substring(1) : "",
|
||||
bind: (element) => {
|
||||
element.addEventListener("click", (itemEvent) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue