mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 20:38:49 +01:00
This commit is contained in:
parent
1a8c519fb3
commit
75ce696bdc
1 changed files with 6 additions and 2 deletions
|
|
@ -73,9 +73,13 @@ export const renderSnippet = () => {
|
|||
"content": string
|
||||
}) => {
|
||||
if (item.type === "css") {
|
||||
document.head.insertAdjacentHTML("beforeend", `<style type="text/css" id="snippet${item.name}">${item.content}</style>`);
|
||||
document.head.insertAdjacentHTML("beforeend", `<style id="snippetCSS${item.name}">${item.content}</style>`);
|
||||
} else if (item.type === "js") {
|
||||
document.head.insertAdjacentHTML("beforeend", `<script type="text/javascript" id="snippet${item.name}">${item.content}</script>`);
|
||||
const scriptElement = document.createElement("script");
|
||||
scriptElement.type = "text/javascript";
|
||||
scriptElement.text = `try{${item.content}}catch(e){console.error(e, 111)}`;
|
||||
scriptElement.id = `snippetJS${item.name}`;
|
||||
document.head.appendChild(scriptElement);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue