mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-30 12:15:16 +01:00
This commit is contained in:
parent
4b873f2091
commit
0cac246415
16 changed files with 70 additions and 15 deletions
18
app/src/protyle/render/htmlRender.ts
Normal file
18
app/src/protyle/render/htmlRender.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
export const htmlRender = (element: Element) => {
|
||||
let htmlElements: Element[] = [];
|
||||
if (element.getAttribute("data-type") === "NodeHTMLBlock") {
|
||||
// 编辑器内代码块编辑渲染
|
||||
htmlElements = [element];
|
||||
} else {
|
||||
htmlElements = Array.from(element.querySelectorAll('[data-type="NodeHTMLBlock"]'));
|
||||
}
|
||||
if (htmlElements.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (htmlElements.length > 0) {
|
||||
htmlElements.forEach((e: HTMLDivElement) => {
|
||||
e.firstElementChild.firstElementChild.setAttribute("aria-label", window.siyuan.languages.edit);
|
||||
e.firstElementChild.lastElementChild.setAttribute("aria-label", window.siyuan.languages.more);
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue