2023-03-27 09:48:11 +08:00
|
|
|
export const openModel = (obj: {
|
|
|
|
|
html: string,
|
|
|
|
|
icon: string,
|
|
|
|
|
title: string,
|
|
|
|
|
bindEvent: (element: HTMLElement) => void
|
|
|
|
|
}) => {
|
2023-03-27 09:48:53 +08:00
|
|
|
const modelElement = document.getElementById("model");
|
2023-04-07 09:06:30 +08:00
|
|
|
modelElement.style.transform = "translateY(0px)";
|
2024-04-18 10:44:46 +08:00
|
|
|
modelElement.style.zIndex = (++window.siyuan.zIndex).toString();
|
2023-03-27 09:48:11 +08:00
|
|
|
modelElement.querySelector(".toolbar__icon use").setAttribute("xlink:href", "#" + obj.icon);
|
2023-03-27 09:48:53 +08:00
|
|
|
modelElement.querySelector(".toolbar__text").innerHTML = obj.title;
|
2023-03-27 09:48:11 +08:00
|
|
|
const modelMainElement = modelElement.querySelector("#modelMain") as HTMLElement;
|
|
|
|
|
modelMainElement.innerHTML = obj.html;
|
|
|
|
|
obj.bindEvent(modelMainElement);
|
2023-03-27 09:48:53 +08:00
|
|
|
};
|