mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-23 07:24:07 +01:00
This commit is contained in:
parent
a165cac78e
commit
107711469b
3 changed files with 6 additions and 55 deletions
|
|
@ -66,54 +66,3 @@ export const getIconByType = (type: string, sub?: string) => {
|
|||
}
|
||||
return iconName;
|
||||
};
|
||||
|
||||
export const getIconByElement = (blockElement: HTMLElement) => {
|
||||
let iconName = "iconParagraph";
|
||||
let iconTitle = window.siyuan.languages.paragraph;
|
||||
if (blockElement.tagName.indexOf("H") > -1) {
|
||||
iconName = "icon" + blockElement.tagName;
|
||||
iconTitle = window.siyuan.languages.headings;
|
||||
} else if (blockElement.tagName === "BLOCKQUOTE") {
|
||||
iconName = "iconQuote";
|
||||
iconTitle = window.siyuan.languages.quote;
|
||||
} else if (blockElement.tagName === "TABLE") {
|
||||
iconName = "iconTable";
|
||||
iconTitle = window.siyuan.languages.table;
|
||||
} else if (blockElement.tagName === "UL" || blockElement.tagName === "OL") {
|
||||
if (blockElement.firstElementChild.classList.contains("protyle-task")) {
|
||||
iconName = "iconCheck";
|
||||
iconTitle = window.siyuan.languages.check;
|
||||
} else if (blockElement.tagName === "UL") {
|
||||
iconName = "iconList";
|
||||
iconTitle = window.siyuan.languages.list;
|
||||
} else if (blockElement.tagName === "OL") {
|
||||
iconName = "iconOrderedList";
|
||||
iconTitle = window.siyuan.languages["ordered-list"];
|
||||
}
|
||||
} else if (blockElement.tagName === "LI") {
|
||||
iconName = "iconMenu";
|
||||
iconTitle = window.siyuan.languages.listItem;
|
||||
} else {
|
||||
switch (blockElement.getAttribute("data-type")) {
|
||||
case "math-block":
|
||||
iconName = "iconMath";
|
||||
iconTitle = window.siyuan.languages.math;
|
||||
break;
|
||||
case "block-query-embed":
|
||||
iconName = "iconSQL";
|
||||
iconTitle = window.siyuan.languages.blockEmbed;
|
||||
break;
|
||||
case "super-block":
|
||||
iconName = "iconSuper";
|
||||
iconTitle = window.siyuan.languages.superBlock;
|
||||
break;
|
||||
case "html-block":
|
||||
case "code-block":
|
||||
case "yaml-front-matter":
|
||||
iconName = "iconCode";
|
||||
iconTitle = window.siyuan.languages.code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return {iconName, iconTitle};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue