mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-26 18:26:09 +01:00
14 lines
487 B
TypeScript
14 lines
487 B
TypeScript
import {fetchPost} from "../../util/fetch";
|
|
|
|
export const previewTemplate = (pathString: string, element: Element, parentId: string) => {
|
|
if (!pathString) {
|
|
element.innerHTML = "";
|
|
return;
|
|
}
|
|
fetchPost("/api/template/render", {
|
|
id: parentId,
|
|
path: pathString
|
|
}, (response) => {
|
|
element.innerHTML = `<div class="protyle-wysiwyg" style="padding: 8px">${response.data.content.replace(/contenteditable="true"/g, "")}</div>`;
|
|
});
|
|
};
|