mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +01:00
Refactor code language and ts types (#9300)
* 🎨 Code block language list adds custom languages * Update index.d.ts * 🎨 Improve global variable type definition * 🎨 Improve global variable type definition * 🎨 Add constant `EXTRA_CODE_LANGUAGES`
This commit is contained in:
parent
17d2a16a94
commit
b2a27bb54c
16 changed files with 86 additions and 72 deletions
|
|
@ -2,10 +2,6 @@ import {addScript} from "../util/addScript";
|
|||
import {Constants} from "../../constants";
|
||||
import {genIconHTML} from "./util";
|
||||
|
||||
declare const ABCJS: {
|
||||
renderAbc(element: Element, text: string, options: { responsive: string }): void;
|
||||
};
|
||||
|
||||
export const abcRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
|
||||
let abcElements: Element[] = [];
|
||||
if (element.getAttribute("data-subtype") === "abc") {
|
||||
|
|
@ -30,7 +26,7 @@ export const abcRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {
|
|||
e.lastElementChild.insertAdjacentHTML("beforebegin", `<span style="position: absolute">${Constants.ZWSP}</span>`);
|
||||
}
|
||||
const renderElement = e.firstElementChild.nextElementSibling as HTMLElement;
|
||||
ABCJS.renderAbc(renderElement, Lute.UnEscapeHTMLStr(e.getAttribute("data-content")), {
|
||||
window.ABCJS.renderAbc(renderElement, Lute.UnEscapeHTMLStr(e.getAttribute("data-content")), {
|
||||
responsive: "resize"
|
||||
});
|
||||
renderElement.setAttribute("contenteditable", "false");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue