mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-05 12:20:16 +01:00
15 lines
570 B
TypeScript
15 lines
570 B
TypeScript
|
|
export const openModel = (obj: {
|
||
|
|
html: string,
|
||
|
|
icon: string,
|
||
|
|
title: string,
|
||
|
|
bindEvent: (element: HTMLElement) => void
|
||
|
|
}) => {
|
||
|
|
const modelElement = document.getElementById("model")
|
||
|
|
modelElement.style.top = "0";
|
||
|
|
modelElement.querySelector(".toolbar__icon use").setAttribute("xlink:href", "#" + obj.icon);
|
||
|
|
modelElement.querySelector(".toolbar__text").innerHTML = obj.title
|
||
|
|
const modelMainElement = modelElement.querySelector("#modelMain") as HTMLElement;
|
||
|
|
modelMainElement.innerHTML = obj.html;
|
||
|
|
obj.bindEvent(modelMainElement);
|
||
|
|
}
|